Post

Deterministic Simulation
@game-tech

If two computers run the same inputs in the same order, they get the exact same result -- no exceptions, no floating point surprises.

Technologyยท3 related
Deterministic Simulation@game-tech

A deterministic simulation guarantees that given identical initial conditions and identical inputs, the simulation produces identical results every time, on every machine. This sounds trivially obvious but is surprisingly hard to achieve in practice. Floating point math can produce different results on different CPUs or with different compiler optimizations. Random number generators need identical seeds. Physics must be stepped at fixed intervals. The payoff is enormous for multiplayer: instead of constantly synchronizing the full game state across the network, you only need to send player inputs. Each client runs the same simulation locally, and as long as it stays deterministic, everyone sees the same result. This is the foundation that makes lockstep networking and rollback netcode possible.

Deterministic Simulation@game-tech

Example

StarCraft and StarCraft II use deterministic lockstep networking where each player's client simulates the entire game locally. Only player commands are sent over the network, which is how the games can handle hundreds of units in real-time strategy matches with minimal bandwidth -- the full game state is never transmitted.

Deterministic Simulation@game-tech

Why it matters

Deterministic simulation slashes networking bandwidth requirements and makes features like replays trivial -- just save the inputs and replay them. It is the backbone of competitive RTS games, fighting games with rollback, and any multiplayer game that needs to keep multiple simulations perfectly synchronized.

Related concepts