Rollback and net rewind

Run a deterministic rollback session where only inputs travel, catch desyncs with checksums, and record replicated frames for the rewind debugger.

Last updated Oct 26, 2026Edit this pageVersion 1.0.0

The default network model is host-authoritative: the host simulates, clients interpolate and predict. Some games need every player to see the same frame instead: fighting games, physics brawlers, anything where interpolation feels late. For those, Mowo has rollback netcode: every machine runs the whole simulation and only inputs travel. This page also covers the net rewind recorder, which captures replicated frames on every peer so you can find where a client and the host stopped agreeing.

How a rollback session works

FRollbackSession FRollbackSession drives any IRollbackGame over any IRollbackTransport:

  1. Local input is delayed and sent
    Each frame, the local input is filed inputDelay frames ahead and sent. Every message carries all input the peer has not acknowledged yet, so a lost message costs nothing once the next one arrives.
  2. Missing input is predicted
    A peer's input that has not arrived is predicted (its last known input repeated) and the frame is simulated at once.
  3. Wrong predictions roll back
    When the real input for an already simulated frame differs from the prediction, the session restores the state saved before that frame and resimulates every frame since.
  4. Far-behind peers stall the simulation
    A peer more than maxPrediction frames behind stalls the local simulation instead of letting it predict further.
  5. Checksums catch desyncs
    Once every player's input up to a frame is known, that frame is final. Every checksumInterval frames each peer sends the final state's checksum; a mismatch reports the frame where the machines stopped agreeing.

Each message names its sender's player index, and the session drops a message whose index is not the player the transport received it from.

Turn it on for a play session

Rollback is off by default. Turn it on in Project Settings › Engine › Networking › Rollback Netcode, or with the cvars:

CvarDefaultMeaning
net.Rollback0Rollback netcode for the play session.
net.Rollback.TickRate60Rollback simulation frames per second.
net.Rollback.InputDelay2Frames a local input waits before it is simulated.
net.Rollback.MaxPrediction8Frames the simulation may run ahead of a peer's last input before it stalls.
net.Rollback.ChecksumInterval10Frames between desync checks.
net.Rollback.OnDesync00 logs a desync and plays on; 1 logs it and ends the rollback session on every machine.

With it on, FRollbackSystem FRollbackSystem makes every player of the online session a rollback player in player-id order and runs the scene's ECS world at the fixed rate. Its messages ride session event 0xFE40, and the host relays them between clients. Offline, a one-player session runs the same fixed-step loop, so a game behaves the same alone and online. A change of roster restarts the session.

Mowo Editor Project Settings window on Engine › Networking › Rollback Netcode, showing the ROLLBACK section with Enable rollback netcode, Input delay, maximum prediction, checksum interval and On desync rows
Rollback settings in Project Settings.

Write deterministic gameplay

Every machine must step to the same bits. Put the gameplay that rolls back into steps and keep its state in components:

  1. Add a RollbackPlayer component (Add Component › Networking) to the entity each player drives, and set its playerIndex. Every simulated frame the session writes that player's buttons, axisX and axisY into it RollbackPlayerComponent.
  2. Register a step with FRollbackSystem::RegisterStep(name, step). Steps run in name order on every frame and again on every resimulation.
  3. Register a checksum for each gameplay component with FRollbackWorld::RegisterChecksum, feeding the fields that matter. The engine registers Transform and RollbackPlayer.
FighterRollback.cpp
#include "ECS/World.h"
#include "Game/Components/RollbackPlayerComponent.h"
#include "Rollback/DeterministicMath.h"
#include "Rollback/RollbackSystem.h"
#include "Rollback/RollbackWorld.h"

#include <cstdint>

struct FFighterState {
	int32_t Health = 100;
	Mowo::FFixed X;
};

static void StepFighters(Mowo::World& world, const Mowo::FRollbackInput* inputs, uint32_t playerCount, float fixedDt) {
	world.ForEach<Mowo::RollbackPlayerComponent>([&](Mowo::Entity entity, Mowo::RollbackPlayerComponent& player) {
		FFighterState* fighter = world.GetComponent<FFighterState>(entity.GetID());
		if (!fighter) {
			return;
		}

		fighter->X += Mowo::FFixed::FromInt(player.axisX);
	});
}

static void HashFighter(const FFighterState& fighter, Mowo::FRollbackHasher& hasher) {
	hasher.I32(fighter.Health);
	hasher.I32(fighter.X.raw);
}

static void RegisterFighterRollback() {
	Mowo::FRollbackSystem::RegisterStep("MyGame.Fighters", &StepFighters);
	Mowo::FRollbackWorld::RegisterChecksum<FFighterState>("MyGame.Fighter", &HashFighter);
}

The deterministic toolkit:

  • FFixed FFixed: Q16.16 fixed point for state that must match across builds and platforms (a replay, a server on another OS). Within one binary, the engine's strict float mode is already deterministic.
  • FDeterministicRandom FDeterministicRandom: a PCG32 generator. One seed is one sequence everywhere. Keep it in a component so rollback saves and restores it.
  • PhysicsWorld::SaveState and RestoreState PhysicsWorld::SaveState: the full Jolt state, including the contact cache, so a restored world steps to the same bits. A restore needs the same set of bodies.
Warning

The scene's own physics is not part of the scene rollback: PhysicsSystem steps on wall-clock time and owns its bodies. Physics that must roll back belongs in a physics world your step advances and hands to an FRollbackWorld FRollbackWorld.

From Visual Scripting, MRollbackStatics MRollbackStatics offers SetRollbackInput(buttons, x, y) each frame, IsRollbackActive, GetRollbackFrame, GetRollbackLocalPlayer, GetRollbackCount and GetRollbackDesyncCount.

Transports

Outside a play session you can drive FRollbackSession yourself. FRollbackNetTransport FRollbackNetTransport runs over any network transport (ENet or Steam, unreliable channel). FRollbackLoopbackNetwork FRollbackLoopbackNetwork connects peers in one process with simulated latency, jitter and loss, which is useful for tuning input delay against a target ping.

Record replicated frames

The net rewind recorder answers "what did each peer see at that moment?" for ordinary host-authoritative sessions. With net.rewind.record on, every replication manager in the process keeps a ring of the last net.rewind.frames frames (1800, a minute at 30 Hz) and writes it when its session ends to:

Text
<project>/Saved/NetRecordings/<yyyyMMdd-HHmmss>_<server|client>_<pid>_<n>.mdfb

Each frame holds every replicated entity (network id, owner, netState, dormancy, position and rotation), the bytes sent and received per peer during that frame, every RPC that arrived, the number of prediction corrections, and the server and client ticks. Recording costs nothing while the cvar is off.

A multiplayer Play in Editor session passes the setting to every child process and collects their recordings when it stops. The Rewind tab of the Network Debug panel loads a server and client recording, aligns them on the server tick, marks desyncs and corrections on a timeline, and can apply a recorded frame to the paused play world. See Play in Editor for the panel.

From code:

RewindCompare.cpp
#include "Networking/Debug/NetRewindRecording.h"

#include <string>
#include <vector>

Mowo::FNetRewindRecorder::SetRecording(true);

Mowo::FNetRewindRecording server;
Mowo::FNetRewindRecording client;
Mowo::FNetRewindRecording::Load(std::string("Saved/NetRecordings/server.mdfb"), server);
Mowo::FNetRewindRecording::Load(std::string("Saved/NetRecordings/client.mdfb"), client);

std::vector<Mowo::FNetRewindDivergence> rows;
for (const Mowo::FNetRewindFrame& frame : server.Frames()) {
	if (const Mowo::FNetRewindFrame* other = client.FindByServerTick(frame.ServerTick)) {
		Mowo::FNetRewindRecording::Compare(frame, *other, rows);
	}
}

Not recorded: component property changes beyond pose and netState.

Engine sources

This page describes behavior implemented in these files of the engine repository, checked against commit 5922e6e5e.

  • Engine/Source/Runtime/Game/Public/Rollback/RollbackSession.h
  • Engine/Source/Runtime/Game/Public/Rollback/RollbackWorld.h
  • Engine/Source/Runtime/Game/Public/Rollback/RollbackSystem.h
  • Engine/Source/Runtime/Game/Public/Rollback/RollbackTransports.h
  • Engine/Source/Runtime/Game/Public/Rollback/DeterministicMath.h
  • Engine/Source/Runtime/Game/Public/Game/Components/RollbackPlayerComponent.h
  • Engine/Source/Runtime/Game/Public/Game/MRollbackStatics.h
  • Engine/Source/Runtime/Physics/Public/Physics/PhysicsWorld.h
  • Engine/Source/Runtime/Networking/Public/Networking/Debug/NetRewindRecording.h

Page feedback

Was this page helpful?