Expand description
Entity replication for Pylon realtime shards.
A simulation keeps its replicated state in a Replicated store:
entities with stable u64 ids, a 3D position, and components (bytes in
the game’s own encoding, keyed by a u8 id). Every change bumps the
store’s change counter, so the server can tell what changed since it
last wrote to a given subscriber without diffing snapshots.
The server sends each subscriber replication frames (frame): spawn
(full state) for entities that came into view, update (only changed
axes and components) for entities in view, and despawn for entities
that left view. A client applies them to a ReplicaTable.
A WebAssembly shard module records its store’s changes
(Replicated::record_changes) and hands them to the host each tick;
the host applies them to its copy (Replicated::apply_changes).
This crate has no dependencies, so guests build it for wasm32-unknown-unknown.
Re-exports§
pub use frame::DecodeError;pub use frame::FrameSummary;pub use frame::ReplicaEntity;pub use frame::ReplicaTable;
Modules§
- frame
- The replication frame: what one subscriber receives per tick.
- varint
- LEB128 varints and zigzag signed integers.
Structs§
- Change
Error - Why a change log did not apply.
- Component
- Entity
- One replicated entity.
- Replicated
- The replicated state of a simulation.
Type Aliases§
- Component
Id - A component id: the game decides what each one holds.
- Entity
Id - A stable entity id, chosen by the simulation.