Jump to content

  • Log In with Google      Sign In   
  • Create Account

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


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 bombeater   Members   -  Reputation: 106

Like
0Likes
Like

Posted 07 October 2012 - 11:42 AM

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.

Sponsor:

#2 Álvaro   Crossbones+   -  Reputation: 13907

Like
1Likes
Like

Posted 07 October 2012 - 12:19 PM

You should read Fix Your Timestep. I think that should answer your questions.

#3 bombeater   Members   -  Reputation: 106

Like
0Likes
Like

Posted 07 October 2012 - 01:40 PM

This is perfect. Thank you so much. I could hug you right now.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS