Expand description
Server-side building blocks for real-time netcode, the counterpart to
plaza_client_utils.
The client crate holds prediction, interpolation and smoothing. This one holds what an authoritative server needs:
HistoricalStateBuffer: the rewind of past entity states that lag compensation uses.relevance: deciding what each client needs to see, so a world larger than one screen with more entities than fit on the wire still scales. Z-order (Morton) keys, a spatial grid and a fast visibility diff.subscription: who a client has chosen to follow wherever they are, which a distance query cannot answer. Indexed both ways round so a departure knows who to tell.aggregate: a middle option between sending everything and sending nothing, for the entities a client must compute with rather than only draw. A Barnes-Hut tree that keeps a distant crowd’s contribution at lower resolution.delta: which of a subscriber’s deltas actually landed and how to recover a mirror that has drifted from the state it acknowledges.seats: handing a bounded number of seats to whoever connects and reporting when a seat’s accumulated state belongs to somebody else.meter: turning running totals into rates, so bandwidth can be shown as a measured number.oneshot: repeating an unacknowledged one-shot op (aWelcome, aRefused) on a link that can lose one, until the peer’s own traffic shows it arrived.
Like the client crate it is pure logic with no async runtime, so a server
simulation can run in wasm (the interactive netcode_playground example does
this). It shares the client’s Interpolatable and ToF32 traits so one
state type serves both sides.
Re-exports§
pub use aggregate::AggregateTree;pub use aggregate::Summary;pub use aggregate::WeightedPoint;pub use delta::DeltaBaseline;pub use delta::DeltaPlan;pub use delta::RecoveryPolicy;pub use history::HistoricalStateBuffer;pub use history::TimedState;pub use input_schedule::InputSchedule;pub use input_schedule::InputWindow;pub use input_schedule::Submission;pub use told::Told;pub use priority::PriorityAccumulator;pub use relevance::CellSpace;pub use relevance::CellTable;pub use relevance::Clearable;pub use relevance::GridQuantizer;pub use relevance::SpatialGrid;pub use relevance::TierBoundary;pub use relevance::VisibilitySet;pub use render_error::RenderError;pub use render_error::render_error_at;pub use rest::RestDetector;pub use subscription::Audience;pub use subscription::Because;pub use subscription::Subscriptions;pub use seats::Admission;pub use seats::Crew;pub use seats::Departure;pub use seats::RankedQueue;pub use seats::Roster;pub use seats::SeatSlots;pub use seats::SeatState;pub use seats::SeatTable;pub use seats::Seating;pub use seats::Shuffle;pub use seats::Turnaway;
Modules§
- aggregate
- Hierarchical aggregation: replacing a distant crowd with a single summary and sending full detail only for what is close.
- delta
- Per-subscriber bookkeeping for a set that is streamed as differences.
- field
- Three ways to answer “who can see whom” in a volume, so the cost of the third axis can be measured.
- history
- A server-side rewind buffer for lag compensation.
- input_
schedule - Tick-addressed input buffering: the server side of “two players who pressed together execute together, whatever their ping”.
- meter
- Counting what crosses the wire, so bandwidth can be shown as a measured number.
- oneshot
- Repeating a one-shot op until the other end shows it arrived.
- priority
- Choosing what fits in the packet and remembering what did not.
- relevance
- Relevance: deciding what each client needs to see.
- render_
error - How wrong a client’s screen was, asked at the instant it was drawing.
- rest
- Which entities have stopped, so the packet can stop paying for them.
- seats
- Handing out a fixed number of seats to whoever connects.
- subscription
- Subscription: the entities a client follows by choice rather than by distance.
- told
- What each viewer has been told, so nothing is re-sent for a world that is not changing.
Structs§
- Delta
Mirror - The client’s mirror of a streamed entity set.
- Divergence
- Which way a mirror diverged, given the server’s own key set.
- Rate
Meter - A running total, its sample count, and the clock it accrued over.
- SetDigest
- An order-independent digest of a set of keys, maintainable incrementally.
- Slot
Allocator - Hands out
SlotKeys over a dense index space, recycling freed slots and bumping a generation so stale handles stay detectable. - SlotKey
- A storage slot and the generation of its current occupant.
Enums§
- Agreement
- Whether the mirror matches what the server says it should be.
- Reuse
Policy - The order freed slots are handed out again in.
Traits§
- Interpolatable
- Trait for types whose state can be interpolated between two instances.
- ToF32
- Helper trait to abstract numeric conversion of timestamp values (or their differences)
to
f32for calculating the interpolation factort. The application’sTimestamptype (and the result ofTimestamp - Timestamp) would need to implement this.