FlxReplay
Manages deterministic input recording, playback, and checksum verification.
export declare class FlxReplayConstructors
constructor()Constructs a new instance of the FlxReplay class
Properties
| Property | Modifiers | Type | Description |
|---|---|---|---|
diverged | - | boolean | - |
divergenceFrame | - | number | null | - |
divergenceInfo | - | string | null | - |
finished | - | boolean | - |
frame | - | number | - |
frameCount | - | number | - |
frames | - | FrameRecord[] | - |
seed | - | number | - |
Methods
create()
create(seed: number): voidInitializes a clean replay container for recording starting with the specified RNG seed.
Parameters:
| Parameter | Type | Description |
|---|---|---|
seed | number | - |
Returns: void
destroy()
destroy(): voidClears all stored frames and resets status flags.
Returns: void
flagDivergence()
flagDivergence(frameIndex: number, expected: string, actual: string): voidFlags a divergence error when current engine checksum fails to match replay checksum.
Parameters:
| Parameter | Type | Description |
|---|---|---|
frameIndex | number | - |
expected | string | - |
actual | string | - |
Returns: void
load()
load(data: string | ReplayFileFormat): voidLoads a replay from a JSON string or plain replay object.
Parameters:
| Parameter | Type | Description |
|---|---|---|
data | string | ReplayFileFormat | - |
Returns: void
playNextFrame()
playNextFrame(): FrameRecord | nullRetrieves the next FrameRecord for playback and advances the frame counter.
Returns: FrameRecord | null
recordFrame()
recordFrame(frameIndex: number, keys?: CodePair[], mouse?: MouseRecord | null, checksum?: string | null, gamepads?: FlxGamepadFrameRecord[], touches?: FlxTouchFrameRecord[]): voidRecords a single frame's input and optional state checksum.
Parameters:
| Parameter | Type | Description |
|---|---|---|
frameIndex | number | - |
keys | CodePair[] | - |
mouse | MouseRecord | null | - |
checksum | string | null | - |
gamepads | FlxGamepadFrameRecord[] | - |
touches | FlxTouchFrameRecord[] | - |
Returns: void
rewind()
rewind(): voidRewinds playback to the first frame.
Returns: void
save()
save(): stringSerializes the replay into a versioned JSON string.
Returns: string