Expand description
Lock-free double-buffered compact replication layout.
This module implements the “Shared World” logic which allows the Game Worker to write authoritative updates while the Render Worker reads a stable snapshot without blocking, satisfying the zero-cost synchronization requirement of M360.
Structs§
- SabHeader
- The header for the
SharedArrayBuffer. - SabSlot
- A single replicated entity state in the compact shared buffer (48 bytes). Optimized for Void Rush (2D gameplay with 3D elevation).
- Shared
World - A lock-free double buffer for compact entity replication.
This points into a
SharedArrayBufferallocated by the Main Thread.
Constants§
- MAX_
ENTITIES - Maximum number of entities supported in the compact shared buffer. Total slots = 16,384 (8,192 per buffer).
- SHARED_
MEMORY_ SIZE - Total size in bytes required for the compact replication layout. 32 bytes (Header) + 384 KiB (Buffer A) + 384 KiB (Buffer B) = 768 KiB + 32 bytes. Note: Rounded to 768 KiB in documentation, exact size is 786,464 bytes.