Skip to main content

Module recording

Module recording 

Source
Expand description

Recording, replay, and world snapshots.

Port of recording.c / recording.h / recording_replay.c / world_snapshot.c.

SPDX-FileCopyrightText: 2026 Erin Catto SPDX-License-Identifier: MIT

Re-exports§

pub use ops::RecOp;
pub use player::validate_replay;
pub use player::RecPlayer;
pub use snapshot::clone_world_via_snapshot;
pub use snapshot::compute_layout_hash;
pub use snapshot::deserialize_into_shell;
pub use snapshot::serialize_world;
pub use snapshot::SNAP_FLAG_DOUBLE_PRECISION;
pub use snapshot::SNAP_FLAG_VALIDATION;
pub use snapshot::SNAP_LAYOUT_VERSION;
pub use snapshot::SNAP_MAGIC;
pub use snapshot::SNAP_VERSION;

Modules§

dispatch
Op-stream dispatcher for recording replay.
ops
Recording op table generated from recording_ops.inl. Opcode constants; the framed write helpers live in write_ops/.
player
Recording player and validate-replay. Port of recording_replay.c player API.
query_replay
Spatial-query replay helpers. Port of recording_replay.c query dispatch.
snapshot
World snapshot serialize/deserialize. Port of world_snapshot.c — field-by-field for Vec-backed Rust pools.

Structs§

GeometryEntry
One entry per unique geometry blob. (b3GeometryEntry)
GeometryRegistry
Growable array of geometry entries with content-hash dedup. (b3GeometryRegistry)
RecBuffer
Growable append-only byte buffer. Doubles on demand. count_only tallies size without allocating. (b3RecBuffer)
RecHeader
Fixed 48-byte recording header. (b3RecHeader)
RecTag
Interned query tag. (b3RecTag)
Recording
User-owned recording buffer. (b3Recording)
RegistrySlot
Resolved geometry slot for deserialization. (b3RegistrySlot)
SnapReader
Bounds-checked read cursor for snapshot images. (b3SnapReader)

Enums§

GeometryKind
Geometry kinds for the trailing registry section. (b3GeometryKind)

Constants§

REC_MAGIC
Magic ‘B3RC’ little-endian. (B3_REC_MAGIC)
REC_VERSION_MAJOR
Major recording version. (B3_REC_VERSION_MAJOR)
REC_VERSION_MINOR
Minor recording version. (B3_REC_VERSION_MINOR)
SNAP_FNV_INIT
FNV-1a 64-bit constants. (B3_SNAP_FNV_*)
SNAP_FNV_PRIME

Functions§

fnv_mix_position
Mix a world position at full width. (b3FnvMixPosition)
hash64_blob
Content hash for geometry blobs. (b3Hash64Blob)
hash_world_state
Hash live body transforms and awake velocities. (b3HashWorldState)
record_op
Record a void mutator if a session is active.
start_recording
Start recording into a user-owned buffer. (b3StartRecordingIntoBuffer / b3World_StartRecording)
stop_recording
Stop recording and finalize the buffer. (b3StopRecordingInternal / b3World_StopRecording)
with_recording
Invoke f on the active recording, if any.
world_public_id
Public world id matching C’s { worldId+1, generation }.