Lesson 2 of 9 · 26m
State Sync, Input Sync, and Rollback Are Different Bets
Compare state replication, deterministic input synchronization, and rollback so the architecture matches the game instead of the fashion.
Teams say "we need rollback netcode" the way insecure teams say "we need microservices" — as a slogan rather than an engineering decision. The three major synchronization models are bets about what is cheapest to send, reproduce, and repair. Pick the bet after you understand the game, not before.
State synchronization sends outcomes
In state sync, the server simulates the world and sends state snapshots or deltas: positions, velocities, health, animation state, and events. Clients render those outcomes, often with prediction for the local player. Most shooters, action games, MMOs, and physics-heavy games use some version of this because full deterministic replication is either impossible or too brittle.
server tick 120:
player 7 pos=(12.4, 1.0, 3.9) vel=(4.0, 0, 0) hp=82
player 9 pos=(18.1, 1.0, 2.8) hp=100
projectile 553 pos=(...) ttl=0.4The wire cost scales with changing world state. You buy flexibility: physics need not be deterministic, and late joiners can receive a snapshot.
Input synchronization sends decisions
In deterministic lockstep, every participant runs the same simulation and receives the same inputs. If the model is truly deterministic, identical input produces identical state. RTS games historically loved this model because thousands of units would be expensive to replicate as full state.
tick 3180:
player 1: move unit_group 18 -> (44, 71)
player 2: train unit archer at building 9The catch is brutal: determinism is a compiler, platform, floating-point, ordering, random-seed, and serialization discipline. One differing bit becomes a desync. You need deterministic math or fixed-point arithmetic, locked update ordering, seeded randomness, and checksums.
Rollback predicts inputs and repairs the past
Rollback networking, common in fighting games, predicts remote inputs when they have not arrived, simulates forward, then rewinds and resimulates when the real input arrives. It is input sync plus the admission that waiting for every packet feels terrible.
frame 90: opponent input unknown -> predict neutral
frame 93: packet says opponent pressed attack on frame 90
restore frame 90, apply attack, resimulate 91..93This works beautifully when state is small, frames are discrete, and resimulation is cheap. It works poorly when a frame involves hundreds of interacting physics bodies or expensive systemic simulation.
Choose by constraints
model strengths worst weakness
state sync flexible, scales with gameplay bandwidth and correction complexity
lockstep tiny bandwidth for many entities one nondeterminism desyncs everyone
rollback responsive peer fighting feel costly rewind/resimulationA real game can mix them. Fighting-game characters may use rollback while spectators receive state sync. An RTS may use lockstep for simulation and state snapshots for reconnects. Hybrid does not mean indecision; it means different subsystems have different consistency requirements.
Design questions before implementation
Ask what happens when a packet is late, when a player joins mid-match, when state diverges, and when a client lies. Ask how large the rewindable state is. Ask whether gameplay depends on continuous time or discrete frames. These answers choose the model more honestly than engine marketing does.
Field notes
- Deterministic lockstep does not remove the need for authority; a host or server still validates participation, matchmaking, saves, and moderation.
- Floating-point determinism across architectures is not a default property of your physics engine.
- Rollback needs copyable game state. If restoring one frame touches half the heap, resimulation will miss frame budgets.
- "Just send everything" becomes expensive fast; measure bytes per player per second before promising 64 players and dense physics.
Was this lesson helpful?