Naia Sync Engine Config (sync/config.rs)

naia · shared/src/world/sync/config.rs · rust · Apache-2.0
realtime, infra, lang:rust, tag:sync, tag:performance, tag:config

Defines compile-time numeric parameters for the Naia sync engine's sliding window protocol. Use this to tune network reliability and packet ordering constraints for real-time applications.

// Source: https://github.com/naia-lib/naia | License: Apache-2.0
// Provided via justclaw.it.com; keep this notice with the code.
//! # `EngineConfig` – compile‑time tuning knobs
//!
//! This tiny struct distills the **numeric parameters** that govern
//! how the sync engine manages its *sliding window* of reliable, unordered
//! `MessageIndex` values.  They are set **once at compile time** and cloned
//! into every `Engine` instance; no run‑time mutation is allowed, keeping the
//! hot path branch‑free.
//!
//! ### Why this formula?
//! Because `max_in_flight` is the maximum contiguous block that may be
//! outstanding.  By flushing when we are `max_in_flight` counts away from the
//! wrap, we ensure the next batch of IDs will never collide with IDs still
//! referenced by the receiver, 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key