Sign in to follow this  

Keeping physics consistent under varying processor load: what's this called?

This topic is 1928 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have what is undoubtedly a common problem, but I don't know what it's called, and thus am having trouble finding solutions.

Suppose in a game, holding down the right arrow makes the player's avatar move 2 pixels to the right.

If the game loop runs 100 times per second, then the avatar moves 200 pixels per second.

But of course, we cannot rely on the game loop running the same amount of times every second.

If the game loop runs 10 times the next second, the avatar will only move 20 pixels.

I know that in the vocabulary of graphics programming, the solution to this is called "frame locking", but I'm not just talking about animation updates; this affects the physics of gameplay itself. The game I'm currently writing is also networked using a client/server approach, so it affects multiplayer balance as well.

What is this problem called? Where can I start finding some basic solutions? So far it seems like I'll need to keep track of physics updates the same way an FPS-lock keeps track of frame draws, and lock them similarly. It would be great to see some discussion of the topic, though.

I don't mind if the best articles only cover the non-networked case; if I know how to solve it for an offline single-player context, I can probably figure it out from there using my meager existing knowledge about latency handling and client-side prediction.

Share this post


Link to post
Share on other sites
You should read [url="http://gafferongames.com/game-physics/fix-your-timestep/"]Fix Your Timestep[/url]. I think that should answer your questions.

Share this post


Link to post
Share on other sites
Sign in to follow this