Rollback netcode

On this page 7

Rollback netcode is a networking model for online games in which each client runs the game immediately with local inputs, predicts the remote player’s inputs, and, when the real inputs arrive and differ, rewinds the simulation and replays it with corrected data. In gaming performance terms, it keeps input lag constant and low regardless of connection distance, trading occasional visual corrections for consistent responsiveness.

The technique is most closely associated with fighting games, where single-frame timing decides outcomes, and it is often referred to by the name of the GGPO middleware that popularized it. It is also used in platform fighters, sports titles and other peer-to-peer games with small player counts.

How rollback netcode works

Rollback netcode treats the game as a deterministic simulation: given the same starting state and the same inputs, every machine computes exactly the same next frame. Clients therefore exchange only controller inputs, not positions or health values, which keeps bandwidth very low.

Each frame, the client applies its own input at once and predicts the opponent’s input, usually by assuming the last known input continues. It also saves a snapshot of the game state. When the remote input for an earlier frame arrives, the client compares it with the prediction. If they match, nothing happens; if they differ, the client restores the snapshot and re-simulates every frame since then within a single displayed frame.

StepWhat happensWhy it matters
Local inputApplied on the current frameControls feel immediate
PredictionRemote input guessed from historyGame continues without waiting
Save stateSnapshot stored each frameEnables a later rewind
ConfirmationReal remote input arrivesReveals any misprediction
Rollback and resimulationRestore snapshot, replay framesCorrects the shared timeline
Steps in one rollback cycle

Most implementations combine rollback with a small fixed input delay, often one to three frames, so that remote inputs usually arrive before they are needed and fewer rollbacks occur.

Rollback compared with delay-based netcode

The traditional alternative is delay-based netcode, in which neither client advances a frame until it has received the other player’s input for that frame. To hide latency, the game adds input delay equal to the network delay, so controls grow sluggish as the connection worsens, and any spike causes visible slowdown or freezing.

PropertyDelay-basedRollback
Input delayGrows with latencySmall and fixed
Reaction to spikesSlowdown or stutterBrief visual corrections
Muscle memoryChanges per connectionStays close to offline
CPU costLowHigher, frames re-simulated
Implementation effortSimplerRequires determinism and fast state saving
Delay-based and rollback netcode compared

The main advantage of rollback is that timing learned offline still works online. A player who practices a combo with strict timing can perform it in a match across a country, which delay-based systems rarely allow once latency exceeds a few frames.

Latency, frames and visible artifacts

Rollback cannot remove latency; it moves the cost from input feel to visual accuracy. The further the remote player is, the more frames the client must predict, and the larger a correction becomes when the prediction is wrong.

At 60 frames per second one frame lasts about 16.7 milliseconds. The table below gives an approximate picture of how round-trip time translates into frames of uncertainty; actual behavior depends on input delay settings, jitter and the game’s tolerance.

Round-trip timeOne-way delay in framesTypical experience
Under 40 msAbout 1Near-offline feel, rare corrections
40 to 100 msAbout 1 to 3Smooth, occasional small teleports
100 to 160 msAbout 3 to 5Noticeable animation skips
Over 200 ms6 or moreFrequent corrections, hard to react
Approximate experience by connection quality

The typical artifact is a teleport or skipped animation startup: a move appears already several frames in progress because its beginning was predicted incorrectly. Developers reduce this with visual smoothing and generous move startups, but the effect cannot be eliminated entirely on long distances.

Engineering requirements and limitations

Rollback places strict demands on game architecture. The simulation must be fully deterministic across machines, which rules out unsynchronized random numbers and floating-point behavior that varies between platforms, and the full game state must be saved and restored within a fraction of a frame.

The client must also be able to simulate several frames within one frame budget. A game that barely holds 60 frames per second has no headroom for a rollback of seven frames, so performance optimization is part of netcode quality. Audio and visual effects need careful handling so that rewound events do not play twice.

  • Player count: rollback scales best with few players, because every extra participant multiplies prediction errors.
  • Retrofitting difficulty: adding rollback to an engine not designed for determinism is costly and sometimes impractical.
  • Desync risk: any nondeterminism causes the clients’ states to diverge permanently, ending the match.
  • Cheating surface: peer-to-peer rollback exposes inputs and IP addresses unless relayed through servers.

Rollback is one form of netcode, the general term for how a game synchronizes players. Large shooters usually rely on client-side prediction with server reconciliation and lag compensation, a related idea in which only the local player’s own movement is predicted and the server remains authoritative.

Rollback also differs from rubber banding, which describes a player being pulled back after a server correction. Rollback corrections are similar in appearance, but they occur on a symmetrical, input-based timeline rather than through an authoritative server’s position updates, and the tick rate concept is replaced by a fixed per-frame simulation step.

The simple explanation

When two people play online, messages between them take time to travel. Rollback netcode does not wait for those messages. Your game reacts to your button instantly and makes a sensible guess about what the other player is doing.

Most of the time the guess is right. When it is wrong, the game quietly rewinds a fraction of a second, fixes the mistake and catches up, like an editor correcting a live caption a moment later.

How it is used in practice

Two players in different cities, about 600 kilometers apart, play a ranked fighting game match with a round-trip time of roughly 50 milliseconds. The game uses rollback with two frames of input delay, so one player’s anti-air attack comes out exactly when expected, as it would offline.

During the match the opponent suddenly switches from walking forward to jumping. For a moment, the predicted input is wrong, and the jump appears a few frames late, with the character seeming to skip the start of the animation. The correction lasts under a tenth of a second. The match remains playable and fair, and the players’ practiced timing works throughout, which is why tournament organizers now accept online qualifiers for rollback titles.