Members - Reputation: 430
Posted 23 August 2012 - 06:39 PM
I know for FPS games, having separate past/present (or, more likely, current/next) states is useful, because things happen so fast and you want to allow multiple things to happen at once rather than sequentially. For example, two players shoot each other at the exact same time. If you have only one game state, player 2's shot could get ignored, since it gets processed after player 1's shot, by which time player 2 is marked as dead. If you have separate current/next game states, the shots fired are read from the "current" state but the players are marked as dead in the "next" state, which doesn't go into effect until the next cycle.
However, for other games such as RTS games, things happen at a much slower pace, and I can think of situations where separate game states might be weird. For example, two units are gathering a resource. If you have separate states, and both units happen to arrive at the resource at the same time, they will both get it, since there is no immediate knowledge if the resource being removed. Whereas with a single game state, one of the units would grab it and the other would find it missing and need to look for another.
I always assumed separate game states would be necessary, no matter what, to maintain the integrity of the simulation, but now I'm not so sure if that is true. Thoughts?
GDNet+ - Reputation: 13940
Posted 23 August 2012 - 07:06 PM
For example, most projectiles in most FPS games today aren't instantaneous (meaning, they travel and are affected by drop, and aren't just a simple ray-test) so they should be entities in their own right, and continue to exist even if the player that fired them has died. That's an example of de-coupling.
throw table_exception("(ノ ゜Д゜)ノ ︵ ┻━┻");