If I have a group of game objects that are being updated each frame, and some of them query each others data like position and such, is it common practice to not care that a game object might get another game object's old state or new state depending on what got updated first? I could see that working out alright as long as the time delta between frames is small. Or is it typical to handle this either via saving one frame of old state or perhaps sorting the updates in some way?

What do well known game engines do?

Also if sorting / saving state is done, are NPCs given the new or the old state of other NPCs and the player's character?


In many cases it won't matter, but if it does you will have to do your processing in two passes.

For example, imagine you are doing a physics simulation that calculates the attraction between a group of bodies. You would first process the entire group, and calculate the final force acting on each individual body. Then you would update the positions of the objects in a second pass. Effectively the first pass happens "simultaneously", without any change happening until the second pass. There may be a small loss of performance by doing a second loop, but in this case the simulation could fail without it.

If your game shows no unusual behaviour with a single pass approach, then it may not matter, but if you are concerned about it you may want to do it in two passes to be safe.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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