Expand description
The replication frame: what one subscriber receives per tick.
Integers are LEB128 varints (crate::varint); signed values are
zigzag varints. Positions travel quantized: round(value / precision).
u8 version (1)
u8 flags: bit 0 FULL: the client clears its table first
f32 LE precision
varint despawn count, then ids: the first absolute, each next as the
difference from the previous (ids ascend)
varint spawn count, then per entity (ids ascend, delta-coded):
id, x, y, z (zigzag, absolute quantized), components
varint update count, then per entity (ids ascend, delta-coded):
id, u8 mask (1 x, 2 y, 4 z, 8 components),
the changed axes (zigzag, quantized difference from the value
last sent), components when bit 8 is set
components: varint count, then per component:
u8 id, varint (length + 1), bytes; length field 0 = removedA spawn carries every present component. An update carries the ones that changed or were removed since that subscriber was last updated.
Modules§
- mask
- Bits of an update’s mask byte.
Structs§
- Decode
Error - Why a frame did not decode or apply.
- Frame
Builder - Builds one frame. Add despawns in any order; add spawns and updates in ascending id order.
- Frame
Summary - What one frame did.
- Replica
Entity - An entity as a client sees it.
- Replica
Table - A client’s table of the entities it has been told about.
Constants§
Functions§
- encode_
update_ body - Encode an update body (everything after the id): the mask, the changed axes, and the component changes. Returns the body.
- encode_
update_ body_ into encode_update_body, appended tobody.- quantize
value / precision, rounded. Non-finite values quantize to 0.- quantize3
Type Aliases§
- Component
Change - A component change inside an update: new bytes, or removed.