of engines, loops and learning.

I won’t going to open new exoplanet here, since this topic was covered more than enough in the respective sources.

Still anyone who’d want to make a game will need to know at least basics.

Engine is the core of the game. The gameloop is its heart, and the fps is the heartbeat.  Gameloop, ideally, runs fps times per second from the start of the game till you press the exit key. Every tick the game will update its logic, simulate physics, evaluate AI behavior, and, finally, render the graphics.

That’s everything you want to know if you’re working with the baked framework, like the XNA, or SDL, or many, many more. Their engines already set up, and you only need to add your functionality in the right places. But i’ve decided to make my own engine, for the sake of knowledge, flexibility, and for the pure challenge.

As i said, this topic is fully covered, so you won’t have problems finding related info. There are several things i can recommend though:

Last one has made a great clean-up in my head, especially after i finally remembered integration basics. I’ve also learned that what i was using was called the Euler integrator, and that it was… improper to use, so tomorrow i will be implementing RK4. And today, after brief confrontation with the IDE about how the float variables must behave, i’ve got my own working game heart, with alright-for-now accuracy margin of 1 ms (not accumulating), with the compensation systems able to dish out stable fps in far from ideal conditions. At least it looks so.

I’ve also decided to use thread.sleep due to the nature of my engine. There is some controversy about it, but since the visual renderer is in another thread, it’s important to have as much free CPU time and as low simultaneously working threads as possible. When there will be enough workload to test, the case will be researched once again.