Skip to main content

Module diff_pool

Module diff_pool 

Source
Expand description

WavDiff + DiffPool + RollbackBuffer — 18-byte diff protocol with pre-allocated ring buffers for deterministic rollback.

All world mutations flow through WavDiff. The DiffPool is a 1.1MB pre-allocated ring buffer that never grows. The RollbackBuffer stores exactly 120 frames (1.0 second at 120Hz) of FrameSnapshot metadata for prediction/correction rollback.

Zero heap allocation. Integer-only. Bitwise deterministic.

Structs§

DiffPool
Pre-allocated 1.1MB ring buffer of WavDiff entries.
FrameDiffIter
Forward iterator over a frame’s diffs in the DiffPool.
FrameDiffReverseIter
Reverse iterator over a frame’s diffs in the DiffPool.
FrameRangeIter
Forward iterator over frames in a tick range.
FrameRangeReverseIter
Reverse iterator over frames in a tick range.
FrameSnapshot
Metadata snapshot for a single simulation frame.
RollbackBuffer
120-frame ring buffer for prediction/correction rollback.
WavDiff
18-byte diff record for a single state mutation.

Constants§

POOL_CAPACITY
Pre-allocated DiffPool capacity. 18 bytes × 64000 ≈ 1.125 MB — fits the 1.1MB budget with margin.
ROLLBACK_FRAMES
Rollback window: exactly 120 frames = 1.0 second at 120Hz. Architecturally locked — do not change.

Functions§

compute_tick_checksum
Compute a Blake3 checksum of a frame’s diffs in the DiffPool.
replay
Replay diffs forward (old→new) to restore state after rewind.
rewind
Rewind state by applying diffs in reverse (new→old).