Frames recorded so far.
Inputs recorded so far.
Whether a session is open (between begin and end).
Periodic snapshots captured so far (excluding the initial one).
Simulation steps recorded so far — the sum of every
ReplayRecorder.recordFrame's stepCount.
Also the index of the next step to run, which is the step index an input recorded "now, for the step about to happen" belongs to.
Abandons an open session without producing a document, returning the recorder to its idle state.
Idempotent, and safe to call from a finally: it never touches the target.
ReplayRecorder.end finishes with the same reset, so the counters
above describe the open session and read zero between sessions.
Opens a session and captures the initial snapshot — §34's "initial scene state", plus the adapter name and version the whole document is keyed on and, since 2026-08-06 (PH-6), the world configuration it was captured under, taken from ReplaySnapshot.configuration.
the simulation to record; must be able to snapshot
fixed step (seconds), seed, snapshot cadence, metadata
Closes the session and returns the §34 document.
The final checksum is read from the target here, at the end of the last recorded frame: a replay that reproduces the run must land on this exact uint32 (§33, §92).
the canonical, deep-frozen recording
Records one frame of the §10 fixed-step loop, and captures a periodic snapshot if one is due.
Call this after the frame's fixed steps have run, with the numbers
TimeState reports: how many fixed steps executed and how much time the
maximumSubSteps clamp dropped.
The recorder only ever sees the target between frames, so it cannot capture
state at an exact multiple of snapshotIntervalSteps in the middle of a
frame that ran several steps. It therefore captures at most one snapshot
per frame, at the first frame boundary at or after each due multiple, and
records the step index the snapshot actually corresponds to. The recorded
step is always exact — the state after that many steps — while the
cadence is approximate whenever frames run more than one step. Missed
multiples are skipped rather than queued, so a long frame produces one
snapshot, not five.
fixed steps executed this frame; a non-negative integer
dropped simulation time this frame, in seconds; >= 0
Records one external input against the simulation step it applies to (§34).
The payload is validated as JSON and deep-copied, so a caller may hand over the same mutable object every frame without the recording collapsing to N copies of its final state. Inputs are kept in insertion order (plan §1, §33) — several inputs may share a step, and they replay in the order they were recorded.
the simulation step the input applies to; a non-negative integer, not before the previously recorded input's step
any JSON value
Records a live session into a §34 replay document.
A recorder is a small state machine — idle → recording → idle — and is reusable: ReplayRecorder.end returns it to idle, ready for another ReplayRecorder.begin.
Example