Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm currently coding a realtime game. I'm doing alot of technical operations with the physics world (resimulations of old world states etc.) to prevent game lag. I save the world state every physics update, so I can re simulate it later if needed.

Of course this consumes alot of memory, so I'm trying to decide after what period will I remove old world states. For example, if a world state is 250 milliseconds old, remove it from memory. Then, if any player movements are received from players, that occurred more than 250 milliseconds old, discard them.

This would theoretically discontinue any physics movements of players with a latency of 250+. This is to improve the performance/experience for other players, and to maintain low memory usage.

My question is, what is a fair latency to cut off players at (for the good of other players)?

share|improve this question
That sounds like a bad idea. Have you read this? – Tetrad Dec 16 '11 at 8:47
I have read it, Why does it sound like a bad idea to you? – liamzebedee Dec 16 '11 at 8:55
up vote 2 down vote accepted

It depends on how fast things happen in your game, and what typical latency you expect from your players.

My gut feeling is that 0.25 seconds is too little. World of Tides, a game I worked on that used this approach, stored several seconds worth of history.

Added Also, you most probably do not need to save a snapshot of a whole world for every frame. Save only some key values and interpolate between them - this would save you a lot of memory.

share|improve this answer

You don't need to save the entire world state, only the things that are relevant to the players. Particles, static actors, shaders etc. is irrelevant. Maybe even animations depending on your game. If only relevant information is stored, it shouldn't take that much memory.

I would recommend saving like a full second of gameplay. Remember to clear old data when you recieve a correction from the server. All data stored before the correction timestamp (not the current time) can be cleared. If it was more than a second the game would be unplayable anyway with the correction happening sooner than the recieved package.

share|improve this answer
By saving the world state, I meant the physics world state, which is incredibly small. – liamzebedee Dec 16 '11 at 22:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.