Skip to content

Debug a Desync

A desync means two machines running the same match computed different states. It is always a bug in your game or in content, and it is easier to fix the sooner you see it. This guide turns the checks up to their strictest, reads what they report, and narrows the cause down. Read Networking and Lockstep first for how the check works.

In Project Settings > Plugins > SeinARTS, category Network:

Setting Debugging value
Determinism Checks Enabled On
Determinism Check Interval Turns 1. Every machine checksums its state every turn, so the report names the exact turn. This costs a state capture per turn, so use it only while hunting.
Desync Policy Abort the Match with a Report. A repair would hide the cause.
Fixed Session Seed (0 = random), under Network / Debug Any non-zero number, so each run uses the same random seed and repeats. Put it back to 0 when you finish.

Every machine in the match needs the same settings. The host compares only checks for turns that are a multiple of its own interval.

Play the match on two machines, or two editor windows with Number of Players set to 2, until the desync appears. Use the same build on every machine. The match fails at start, instead of later, when machines differ in build, simulation settings or map.

If it does not appear, confirm that detection works. Type Sein.Net.SimulateDesync in the console of a client (Development builds only). It changes that machine’s random stream, so its next checksum differs. Within one interval the host must report a mismatch. If it does not, checks are off or you are not in a network match: type Sein.Net.Status and read the phase.

The host writes the report to its log in category LogSeinNet. Development builds also show it in red on screen for 15 seconds.

Message Meaning
“Desync: player 2’s state differs from the host’s at turn 130.” Player 2’s checksum for turn 130 differs from the host’s. With the Resync policy the log adds “Sending the host’s state.” and player 2 receives a full state. With Abort, every machine stops with this reason.
“Player 2 runs a different build, settings or map (build …, map …)” The match refused to start. Compare the build lines in Sein.Net.Status on both machines.
“Player 2 built a different tick zero.” The machines are on the same build but built different starting states. Look for differences in content, level data or settings.
“Player 2 could not build the match; see its log.” The build failed on that client. Read that client’s log.
“Replay checksum differs from the recording at turn N.” A replay disagrees with its recording. See Record and Play Replays.

Because the check at interval 1 matched on turn 129 and failed on turn 130, the states first differed during the three ticks between those checks, ticks 388 to 390 at the default rates. That is a small window to search.

An aborted match still saves the host’s replay.

Set Sein.Net.LogChecksumParts to 1 on every machine before the match, either in the console or with -ExecCmds="Sein.Net.LogChecksumParts 1" on the command line. At every check, each machine then writes one line per part of its state:

LogSeinNet: Checksum part [turn 130] 3F9A...C21 Random
LogSeinNet: Checksum part [turn 130] 8B04...E77 HeatPayload

The checksum comes first, then the part’s name. The parts are the root fields of the world state (Tick, Random, EntityPool, EntityTags and others), each module’s state block, and each component type’s storage.

Compare the lines for the failing turn between the host’s log and the client’s. Any part whose checksum differs is where the states diverged. One way to do it:

Terminal window
Select-String -Path host.log -Pattern 'Checksum part \[turn 130\]' | ForEach-Object { $_.Line -replace '^.*\] ', '' } | Sort-Object > host.txt

Do the same for the client’s log, then compare the two files with any diff tool.

Set Sein.Net.LogChecksumParts to 2 to go deeper. It adds one line per entity component, such as HeatPayload with the entity’s handle, and one per simulation object, such as an ability instance, with its class name. A differing line names the entity or object.

To look at one machine by hand, run Sein.Net.DumpState 1 or 2. It prints the tick, entity count, seed and checksum, then the same parts. Sein.Sim.Checksum prints the checksum alone.

Part that differs Look for
Random Code that draws a random number on one machine and not another, or a different number of times. Use only World.GetSimRandom() or the Random Library nodes in simulation code. Check code that runs only on the host or in presentation callbacks.
A component of yours The ability, effect or system that writes it. Look for float, FVector, unordered iteration over a TMap or TSet, the frame time, or a read of an actor or widget.
EntityPool, PendingDestroy or EntityTags Spawn, destroy or tag order. Spawning from presentation callbacks, or in a branch only some machines run, such as a Has Authority check, changes the pool.
PendingCommands A command reached one machine and not the other. Check custom command handlers and any code that submits commands.
A module block, such as navigation, movement or fog Different content or settings. Check that Async Pathfinding and other simulation settings are the same everywhere.
Many parts at once Usually one root cause upstream, such as Random. Fix the first difference and rerun.
  1. Try the reference path. Set Sein.Sim.Parallel 0 on every machine (or turn off Parallel Simulation in Simulation settings). Parallel passes are built to match the serial ones. If the desync goes away, a parallel pass differs, which is a framework bug or a data race in your own parallel code. Report a framework case.
  2. Remove features. Disable your systems, abilities and AI one at a time until the differing part stops differing.
  3. Check the reproduction window. At interval 1, the cause is inside one turn. Log the commands for that turn with the command log. See Debug Views and Profiling.
  4. Replay it. Play the host’s saved replay on the host. If it reports a differing checksum, the simulation depends on something outside its state and commands, on one machine alone. See Record and Play Replays.

Fix the cause, then:

  1. Rerun with checks at interval 1 for at least ten minutes of busy play, with orders, production and combat.
  2. Return Determinism Check Interval Turns to 10, Desync Policy to your shipping choice, and Fixed Session Seed to 0.
  3. Play a long match with Resync and confirm the host log has no “Desync:” lines.
  4. Save and load mid-match. The state must load without error. See Save and Load a Match.
  5. Play a replay of the long match. The log must report no differing checksums.
Symptom Cause
No checks run Determinism Checks Enabled is off, Networking Enabled is off, or you are not in a network match.
The report appears but no state differs when you compare You compared the wrong turn. Use the turn in the report. Both logs need the checksum parts enabled before the match starts.
The match fails to start with a build mismatch The machines run different packages. Compare the Build= lines from Sein.Net.Status. See Package Your Game.
Desyncs only after a player returns The returning player loads the host’s state. Compare the first Desync line’s turn with the load, and check what the state omits: data held outside the world state, such as a variable on a non-simulation object.
Repeating “Sending the host’s state.” lines The cause is still active and Resync is only repairing it. Switch to Abort and find it.
Sein.Net.SimulateDesync refuses It works in Development builds only, and only while a network match is running.