Skip to content

five-on-it / packages/protocol/src/snapshot-v2 / SnapshotEncoder

Class: SnapshotEncoder ​

Defined in: packages/protocol/src/snapshot-v2.ts:301

One client's side of the delta snapshots on the server: what it holds, and the next frame.

Constructors ​

Constructor ​

new SnapshotEncoder(): SnapshotEncoder

Returns ​

SnapshotEncoder

Accessors ​

holding ​

Get Signature ​

get holding(): number

Defined in: packages/protocol/src/snapshot-v2.ts:317

How many entities the client holds.

Returns ​

number

Methods ​

encode() ​

encode(arena, frame): Uint8Array

Defined in: packages/protocol/src/snapshot-v2.ts:327

The next frame for the client, onto what it holds; what it holds is then that frame's.

Parameters ​

arena ​

EntityArena

frame ​

DeltaFrame

Returns ​

Uint8Array


has() ​

has(eid): boolean

Defined in: packages/protocol/src/snapshot-v2.ts:322

Whether the client holds an entity (it was sent and not removed since).

Parameters ​

eid ​

number

Returns ​

boolean


reset() ​

reset(): void

Defined in: packages/protocol/src/snapshot-v2.ts:310

Forgets what the client holds: the next frame is a keyframe (a new client, a resync).

Returns ​

void