simnet_pipeline selects snapshot data, transforms it, produces encoded updates, and decodes them
into SnapshotUpdate values.
PipelineDefinitiondescribes the enabled techniques and their settings.ClientReplicationStateholds per-client sequence and incremental cursor state.PipelineScratchowns reusable encode-side selection, preparation, and byte buffers.validate_pipeline_definitionrejects unsupported technique combinations and invalid settings.should_emit_snapshotprovides the pure cadence preflight used before baseline resolution.encode_snapshotproduces an encoded update or a skipped result. Emitted output includes the exact complete logical Client snapshot represented by its canonical encoded values.- Optional representation quality accounting compares only produced source upserts with their already prepared canonical records. Position error uses world units. Heading angular error uses degrees. Disabled collection adds no per-record quality math.
decode_updatevalidates encoded update bytes and returns a state update or an error report.pipeline_decode_signatureidentifies the receiver-side representation.
Each concurrent encoder needs its own ClientReplicationState and PipelineScratch. Each
concurrent decoder needs its own ClientReplicationState.
SendInterval uses the authoritative snapshot tick. Interval 1 emits every tick. Interval N > 1
emits only when tick % N == 0. Other ticks return Skipped without changing sequence, selection,
scratch, or baseline state.
Incremental without Delta schedules candidate upserts with a fair round-robin scan. Its first
emission is a complete FullReplace and does not advance the cursor. Later incremental Patches carry
the exact replica sequence and include every entity removed from that replica.
DistanceBands operates on the AOI-retained population and keeps complete entity records. Near
entities are due every tick, while Medium and Far work is distributed across configured
deterministic intervals. Due work remains latched until a successful update commit. Distance bands
produce explicit-baseline Patches with or without Incremental and Delta.
The Incremental cap limits only ordinary pending work. Player self and delivery-recovery upserts bypass the cap. Deletes bypass temporal scheduling.
Delta filters scheduled candidates against an explicit retained baseline and preserves every
baseline-only delete. Applications use the latest submitted replica for reliable ordered delivery
and the latest ACK-proven replica for loss recovery. Without a baseline, Delta emits a complete
FullReplace and does not advance the incremental cursor. Delivery-recovery upserts are merged
after temporal scheduling and therefore bypass LOD and the ordinary Incremental cap.
Raw records preserve the source values. Quantization encodes positions within configured bounds.
OctHeading requires quantization and encodes a heading as two octahedral components. BitPacking
requires both techniques and produces a 128-bit record. Byte-aligned octahedral and bit-packed
records are both 16 bytes and have identical canonical precision.
Each representation report identifies its complete-record layout and width. Optional quality collection reports Euclidean position error in world units and normalized heading angular error in degrees for produced upserts only. Delta-suppressed candidates and deletes are not samples. Raw records report exact zero error.
| Order | Stage | Current control | Compatibility and ownership |
|---|---|---|---|
| 1 | Cadence control | SendInterval |
Composes with every active technique. A skipped call changes no sequence or selection state. |
| 2 | Relevancy selection | AreaOfInterestSettings |
None passes the complete source. Radius uses inclusive 3D distance. FOV adds an inclusive 3D cone test. The application supplies sorted coarse source indices without exposing its spatial implementation. |
| 3 | Temporal LOD | LevelOfDetailSettings |
Distance bands classify AOI-retained entities with inclusive squared-distance boundaries. Persistent due state is bounded by the retained population. |
| 4 | Update scheduling | Incremental |
Optionally caps ordinary pending LOD work with a fair cyclic scan. It advances by serviced candidates, including candidates later removed by delta selection. |
| 5 | Delivery recovery merge | Application-provided canonical IDs | Recovery upserts bypass temporal LOD and the ordinary Incremental cap. |
| 6 | Delta selection | Delta plus an exact retained baseline |
Filters scheduled or complete upsert candidates. Baseline-only deletes remain truthful and are included. Without a baseline this stage is inactive. |
| 7 | Representation encoding | Quantization, OctHeading |
Octahedral headings require quantization. Delta candidates are compared using canonical encoded values so representation changes remain consistent with transmitted state. |
| 8 | Record layout | BitPacking |
Bitpacking requires quantization and octahedral headings. It does not change decoded precision. |
| 9 | Whole-update compression | simnet_compression |
Outside the pipeline. It transforms the complete encoded update as opaque bytes. |
| 10 | Application packetization | simnet_packetization |
Outside the pipeline. It owns the hard payload budget and consumes opaque pipeline bytes. |
| 11 | Per-packet compression | simnet_compression |
Outside packetization. It independently transforms complete serialized application packets. |
| 12 | Delivery | Application and transport configuration | Outside the pipeline. Transport carries opaque application bytes. |
Unsupported stages fail validation. All active techniques otherwise compose when their listed prerequisites are met.
- Sequence zero is reserved. Encoding fails if allocation would wrap to zero.
- The encoded update size target is used only for reporting. Transport owns actual send limits.
PipelineScratchshould be reused across calls to avoid recurring allocations.- With retained population
N, Incremental capK, and cadenceS, persistent ordinary due work is serviced within at mostceil(N / K)committed emissions. A conservative scheduling-age bound is the band interval plusceil(N / K) * Sticks. Network delivery delay is separate.
- Active AOI requires a finite authoritative interest source. A missing source returns a skipped result and never falls back to the complete population.
- Radius and conical FOV boundaries are inclusive. The FOV setting is a full angle in degrees. Zero-distance entities are retained and entities behind the source are rejected.
- For offset
d, radius acceptsdot(d, d) <= radius^2. FOV also requiresdot(forward, d) >= 0anddot(forward, d)^2 >= dot(d, d) * cos(fov_degrees / 2)^2. - Distance LOD uses Near when
distance_squared <= near_distance^2, Medium through the inclusive medium boundary, and Far for the remainder of the AOI. Player self is always Near. - Boundary oscillation can increase transmitted work. No hysteresis is applied, and oscillation cannot clear pending work or change canonical convergence.
- The private wire header carries a magic value, protocol and schema versions, and a decode signature. Schema versions 5 and 6 require every Patch to carry an explicit nonzero baseline sequence. Decode rejects identity mismatches and stale sequences.
- Patch decoding reports the declared baseline sequence. Client storage must retain and resolve that exact reconstructed snapshot before applying the Patch.
The reference layout is a complete, baseline-independent FullReplace with baseline sequence zero.
All fields are fixed-width and written in network byte order. Float values are converted to their
standard 32-bit IEEE 754 bit patterns and written in network byte order. The codec never writes a
native C++ struct directly, so compiler padding and host byte order cannot alter the wire format.
| Field | Width | Order |
|---|---|---|
| Header | 45 bytes | magic u32, protocol u16, schema u16, decode signature u64, kind u8, tick u64, sequence u32, baseline sequence u32, upsert count u32, delete count u32, payload bytes u32 |
| Reference entity | 30 bytes | id u32, classification u8, position x/y/z f32, heading x/y/z f32, hue u8 |
FullReplace records are encoded in the snapshot's strictly ascending entity-ID order. The decoder
checks the complete declared payload before advancing its accepted sequence, then delegates entity
ID ordering and snapshot semantics to simnet_snapshot.