Tag Info

New answers tagged


You can't reliably control the FPS with functions like SDL_Delay, they call the operating sleep function, which tells the operating system "Please don't give me any CPU time for at least N miliseconds", the operating system is then free to decide: At what granularity (i.e., as you said you specify 1ms and it waits for 15ms, it has a granularity of 15ms) ...


A mistake that I made this week doing this : while (!quit){ startTime = SDL_GetTicks(); Process Input(); Update Game(); Render(); endTime = SDL_GetTicks(); DeltaTime = endTime - startTime; } I do not know exactly Why, But this did not work at all. the solution @Tordin gave is the best one, and I have seen it in many many many references and ...


Typically, a frame is drawn every time through the game loop. Thus, the FPS tells you how fast the game is looping. That said, more sophisticated rendering architectures often decouple the rendering from the main game loop. In that case, the two are only vaguely related.


Time delays are usually not a good idea because you can't go below zero. Also keep in mind that differently powerful systems will take shorter or longer to execute your actual game-loop without the artificial delay. When you want the game experience to be independent from the power of the users hardware, get a time measurement at the beginning of your ...

Top 50 recent answers are included