Hacker News new | ask | show | jobs
by rorrr 4925 days ago
So what happens when the OS doesn't return to your process in dt time?

The whole point of dt is to deal with variable framerate.

2 comments

When your game does regain control, it can run the simulation for N steps (however many it usually does for the given dt), then finally render the scene using the latest state. (so the game will appear to pause, then skip ahead). Or it can try to play catch-up, it does 1 tick and render at a time, but with a reduced delay between frames until it's "caught up". (so the game will pause, then appear fast-forwarded for a bit).

Either way Tlark is right, you really don't want the game logic to be affected by framerate.

Then the game runs in slow motion. There's not much you can do on a slow system.

Or if you mean that you may be forced to draw at (for instance) 55fps, then the solution is to precalculate the next physics frame and linearly interpolate between the previous and next frame when drawing.