Worker-safe. The canonical replay artifact and the tools to load and scrub it.Documentation Index
Fetch the complete documentation index at: https://openturn.io/docs/llms.txt
Use this file to discover all available pages before exploring further.
Install
Envelopes
SavedReplayEnvelope<TPlayers, TMatchData>
Serializable JSON artifact produced by a completed or in-progress match.
SavedReplayVersion
Currently 1. Bumps when the envelope format changes in an incompatible way.
SavedReplayMetadata
Arbitrary JSON attached to an envelope.
Creating envelopes
createSavedReplayEnvelope(options)
Build an envelope from explicit parts.
createSavedReplayFromSession(options)
Build an envelope from a LocalGameSession (or anything exposing getReplayData):
Serialization
serializeSavedReplay(envelope)— produce a JSON string.parseSavedReplay(text)— parse a string back into an envelope, validating the version and shape.parseSavedReplayValue(value)— parse a JSON value without going through text.
Timelines
ReplayTimeline<TGame>
In-memory replay, suitable for an inspector.
ReplayFrame<TGame>
ReplayBranch
A branching timeline created with addReplayBranch.
materializeReplay(game, options)
Replay an explicit action list against a fresh session:
materializeSavedReplay(game, envelope)
Shortcut: take an envelope, return a timeline.
ReplayMaterializeOptions<TGame>
addReplayBranch after materialization — it is not an option on the materialize call.
Playback
createReplayCursor(timeline)
Cursor-based navigation.
ReplayCursorState<TGame> is { branch, currentFrame, isPlaying, speed }.
addReplayBranch(timeline, actionID, branchID, parentBranchID?)
Fork a new branch at a given action. Returns a new timeline.
See also
- How-to: capture replays is the recipe.
- Tutorial: tic-tac-toe replay uses these APIs end to end.
- Reference: inspector and reference: inspector-ui for building UIs on top.