Expand description
Engine-independent server-sequenced deterministic sessions.
Implement Game and Simulation, then use host, dedicated_server,
connect or replay. Transport channels and replay envelopes are private.
Re-exports§
pub use codec::Wire;pub use hashing::StableHash;pub use hashing::StateHasher;pub use hashing::stable_hash;
Modules§
- codec
- Bounded game payloads. Implement
Wirewith the same field order in all three operations. Validation must traverse the full shape without allocating. - hashing
- Stable state fingerprints for a known game schema, independent of the wire codec.
Structs§
- Client
Config - Command
Sender - Input
- Replay
Outcome - Server
Config - Fixed-duration sessions only. Queue capacity is local; the duration is saved and adopted by clients and resumed sessions.
- Session
Control - Presentation status never enters deterministic simulation state.
- Session
Handle - Owns worker shutdown. Explicit
shutdown/joinreturns the retained terminal result;Dropalso cancels and joins, logging otherwise unobserved failures. - Tick
Enums§
- Desync
Policy - Loading
Phase - Participant
Id - Session-local origin, not an authenticated account. Remote IDs come from the connection, never from the command payload. Host cannot be impersonated by selecting a remote numeric ID.
- Session
Error - Session
Status - Submit
Error
Traits§
- Game
- Supply only game rules, initialization, commands and state fingerprinting.
The factory runs on the worker thread; the simulation need not be
Send. - Simulation
- Deterministic state, owned exclusively by the session worker.
Functions§
- connect
- Connect a replica. The server’s validated header supplies initialization and timing.
- dedicated_
server - Start an authority without a local participant. Its command handle stays disabled.
- host
- Start an authority with a local participant and optional remote participants.
- replay
- Replay synchronously on the calling thread. Pass a control to support signals.
Type Aliases§
Derive Macros§
- Stable
Hash - Hash fields in declaration order, with explicit byte tags for enums.
- Wire
- Generate bounded codec passes for structs and explicitly tagged enums.