Systems
Networking
87 symbols, imported from @driftengine/network.
Explained in Networking and rollback.
Classes
AuthorityHost- The machine whose world is the truth.
Fingerprint- An FNV-1a pair, fed bytes and numbers, answering sixteen hex characters.
InputLogLockstepSessionLoopbackNetwork- A set of endpoints that can reach each other, holding the clock they share.
LoopbackTransportPredictingClient- A machine that predicts its own player and corrects toward the authority.
RewindLoopScriptSessionStateInterpolator- Two authoritative states and where between them to draw.
WebRtcTransportWebSocketTransport
Interfaces
AuthorityOptionsClientOptionsDataChannelLike- What an
RTCDataChannelsatisfies. Declared rather than imported; seewebsocket.ts. DecodedMessage- What a decoded message turned out to be.
kind0 means it did not decode. DesyncFixtureMath- The trigonometry, supplied rather than imported.
FixtureResultImpairmentInputLogOptionsLockstepOptionsLoopbackOptionsPeerConnectionLike- The part of
RTCPeerConnectionunreliableChannelneeds. Replicator- What a consumer packs and unpacks.
RewindOptionsSavablePosition- A seeded generator's position.
ScriptSessionOptionsSessionStatus- What a driver tells the façade about itself. Both session classes satisfy the parts they have.
Snapshotter- Somewhere state can be put and taken back.
SocketLike- What a browser
WebSocketand a Nodewsboth satisfy. Named here so neither is imported. TransportWebRtcTransportOptionsWebSocketTransportOptions
Functions
combineSnapshotters- Several snapshotters as one, saving and restoring in the order given.
createDecodedcreateFixture- The pair of arms, sharing one sine table and one starting state.
decode- Read a message's header into
out.falsewhen the bytes are not a message this version knows. encodeAckencodeFingerprintencodeInput- Write an input frame into
into, answering how many bytes it used, or -1 when it does not fit. encodeJoinencodeStateencodeWelcomefingerprintSnapshot- A world snapshot's fingerprint.
randomSnapshotter- A generator, as one number.
simAbssimAddsimCompare- -1, 0 or 1. Present so a caller compares through this file rather than by hand.
simDiv- Divide. Deterministic rather than exact; see §3 of the header. Division by zero saturates.
simFrom- From an ordinary number. Truncates toward negative infinity, as everything here does.
simFromInt- From an integer, exactly, with no rounding to think about.
simMaxsimMinsimMul- Multiply. Exact wherever the result is representable; see §2 of the header.
simNegsimSqrt- Square root, by Newton's method on integers.
simSubsimTo- Back to an ordinary number. Exact: a division by a power of two.
unreliableChannel- A channel configured the way a simulation wants one.
worldSnapshotter- A world, through the identity-preserving snapshot
@driftengine/entitiesowns.
Types
InputPredictor- How a missing input is guessed.
previousis that participant's last confirmed input. LockstepStatusMessageSink- Where a drained message goes.
PeerId- Which participant a message is for or from. Small integers, assigned by the host.
SessionRole- What a role means is in this file's header, not in these names.
Sim- A fixed-point value: an integer, scaled by
SIM_ONE, carried in a double. SimStep- One fixed step. The signature
LoopHooks.simulatehas, so a consumer passes theirs straight in. TransportState
Constants
BROADCAST- Send to everyone the transport can reach.
FINGERPRINT_BYTES- A fingerprint message is fixed: kind, participant, tick, and eight bytes of digest.
FIXTURE_BODIESINPUT_HEADER_BYTES- Header bytes before an input run's payloads: kind, participant, first tick, count, stride.
MESSAGE_ACKMESSAGE_FINGERPRINTMESSAGE_INPUTMESSAGE_JOINMESSAGE_PINGMESSAGE_STATEMESSAGE_WELCOMEPROTOCOL_VERSION- The framing, which is small on purpose.
repeatLastInput- Repeat the last input seen from that participant. See the header for when this is wrong.
SIM_FRACTION_BITS- Fractional bits. The whole format is this number.
SIM_MAX- The largest and smallest representable raws, which is a double's exact integer range.
SIM_MINSIM_ONE- One, as a raw value.
STATE_HEADER_BYTES- Header bytes before a state payload: kind, tick, length.