Networking · function

combineSnapshotters

Several snapshotters as one, saving and restoring in the order given.

Explained in Networking and rollback.

function combineSnapshotters(parts: readonly Snapshotter<never>[]): Snapshotter<readonly unknown[]>
import { combineSnapshotters } from '@driftengine/network';

Parameters

ParameterTypeDescription
partsreadonly Snapshotter<never>[]

In depth

The slot is an array of the parts' slots, so nothing is allocated per save once the ring is built. Restore runs in the same order as save, which matters for a consumer whose parts are not independent: state derived from the world has to be restored after it.