Networking · function
encodeInput
Write an input frame into into, answering how many bytes it used, or -1 when it does not fit.
Explained in Networking and rollback.
function encodeInput(into: Uint8Array, participant: number, firstTick: number, payloads: Uint8Array, stride?: number, count?: number): numberimport { encodeInput } from '@driftengine/network';Parameters
| Parameter | Type | Description |
|---|---|---|
into | Uint8Array | |
participant | number | |
firstTick | number | |
payloads | Uint8Array | |
stride? | number | |
count? | number |
In depth
-1 rather than a throw, because the caller is a frame loop and AGENTS.md forbids throwing
in one. A buffer too small is a caller's sizing bug and the honest report is a value they can
branch on at the send site.