Networking · interface
LockstepOptions
Explained in Networking and rollback.
interface LockstepOptions<S>import type { LockstepOptions } from '@driftengine/network';Properties
| Name | Type | Description |
|---|---|---|
transportreadonly | Transport | |
loopreadonly | RewindLoop<S> | |
inputsreadonly | InputLog | |
selfreadonly | PeerId | This peer's id, and the index its inputs occupy in the log. |
participantsreadonly | number | |
inputDelayreadonlyoptional | number | How many ticks ahead a local input is published. Two is 33 ms at 60 Hz.MoreSee the header: inside this budget the session is exact rather than convergent. |
fingerprintEveryreadonlyoptional | number | How often a fingerprint is published, in ticks. Every tick is wasteful and every hundred is slow to notice; the default is every eight, which at 60 Hz is seven a second. |
compareStatesreadonlyoptional | boolean | Publish fingerprints at all. Off needs no digest from the snapshotter. |
redundancyreadonlyoptional | number | How many recent inputs ride along in every packet. Four by default.MoreThis is what makes lockstep survive loss, and one is not enough. An input is only useful for the tick it names, so asking for a lost one and waiting a round trip delivers it after that tick has gone — the peer's world is then permanently different and nothing local repairs it. Sending the last few in every packet covers a run of drops before anybody notices, for a handful of bytes on a message that already has a header. Four covers three consecutive losses. A link losing four in a row at 60 Hz has stopped being a link. It may reach further back than the rewind window without any arrangement between the two.
The session forgets inputs below the oldest tick a rewind can reach, so past that depth every
packet's oldest words name ticks the log can no longer say anything about. Those are skipped on
the strength of what this world already applied, not on what the log still holds — see the
watermark in |