← Lessons

quiz vs the machine

Platinum1860

System Design

Rollback Netcode

Predicting remote inputs and rewinding to correct them in fighting games.

6 min read · advanced · beat Platinum to climb

Why fighting games are different

Fighting games need frame perfect timing and run a deterministic lockstep simulation on both peers. Classic lockstep waits for the remote input each frame, so any latency stalls both players. Rollback netcode removes the wait.

Predict, then rollback

  • Each frame the client runs the simulation immediately, predicting the remote input, usually by repeating their last input.
  • When the real remote input arrives and it differs from the prediction, the client rolls back to the last confirmed frame.
  • It then re simulates forward to the present using the corrected inputs, all within one frame.

Because most inputs repeat, predictions are usually right and no visible correction happens. When wrong, the world snaps slightly, but play never stalls waiting on the network.

Requirements

Rollback needs a fully deterministic simulation and the ability to save and restore game state cheaply, since it rewinds and replays many times per second. This is why rollback engines obsess over compact state and fast serialization.

Key idea

Rollback netcode predicts remote inputs to avoid stalls, then rolls back and re simulates when a prediction was wrong, demanding determinism and fast state save and restore.

Check yourself

Answer to earn rating on the learn ladder.

1. How does rollback netcode avoid stalling on remote input?

2. What happens when a predicted remote input was wrong?

3. Why do rollback engines need fast state save and restore?