Compares the checksum peers compute for each tick. The first checksum seen for a tick is taken
as the reference; a later observation of the same tick that disagrees marks the run divergent and
is remembered as the first such tick, so a game can report exactly where the two peers parted.
constguard = newSyncGuard(); guard.observe(12, stateChecksum(localState)); // true guard.observe(12, stateChecksum(remoteState)); // false if the two peers disagree if (guard.divergent) console.log('desync at tick', guard.atTick);
Compares the checksum peers compute for each tick. The first checksum seen for a tick is taken as the reference; a later observation of the same tick that disagrees marks the run divergent and is remembered as the first such tick, so a game can report exactly where the two peers parted.
Example