Networking · function

fingerprintSnapshot

A world snapshot's fingerprint.

Explained in Networking and rollback.

function fingerprintSnapshot(slot: WorldSnapshot, into?: Fingerprint): string
import { fingerprintSnapshot } from '@driftengine/network';

Parameters

ParameterTypeDescription
slotWorldSnapshot
into?Fingerprint

In depth

The stores are walked in id order rather than in map order. A Map iterates in insertion order, and two peers create their stores in whatever order their code first asked for them — which is a property of the load path, not of the world. Sorting makes the hash a function of the state instead of a function of the state and the startup sequence.

The allocator goes in first, and highWater with it: two worlds holding identical components on identical handles but differing in how many slots have ever been used are genuinely different, because the next spawn differs.