replay
Tool
tools/verify/replay.py(program, Verify). Check a port against a recording of the original that was read from outside, sample by sample.
Run it with ./gameframe run replay ARGS or python3 tools/verify/replay.py. Source on GitHub.
Its own help
This is the help text in the tool itself, as ./gameframe tool replay prints it.
text
Check a port against a recording of the original that was read from outside, sample by sample.
Usage: replay.py RECORDING PORT_TRACE --clock NAME [--fields A,B,...] [--block A,B ...]
[--require NAME=RATE ...] [--show N] [--json]
RECORDING JSON Lines, one sample a line: {"t": ..., "n": ..., NAME: value or [values]}, as
tools/live/memrec.py record writes
PORT_TRACE JSON Lines from the port: one line for every state it passes through (after each
frame or step), with the same NAMEs, the clock among them
--clock the value that orders both: the game's own clock or frame counter, read by the
recorder and kept by the port
--fields the values to compare (default: every name in the recording the trace also has,
except the clock, t and n)
--block values the recorder reads together, compared as one: a sample passes only when
one port state holds all of them (repeat for several blocks)
--require the share of samples a value must pass, 0 to 1 (default 1: every sample). Give a
lower rate only for a value the port cannot reproduce from the recording's input
--show how many failures to print for each value (default 3)
Why: a recorder outside the game reads one value after another while the game runs, and sees
only some frames. One sample can hold the clock of one frame and positions from the next
(docs/knowhow/replay-sample-straddles-frames.md). Comparing each sample with the port's state
at the sample's clock then fails where the port is right. Here a value passes when any state
the port passed through in the sample's window holds it: from the sample's clock up to the
next sample's clock, plus the frame after that. A value that is wrong in the port fails in
every window it reaches.
Output: for each value (or block), the samples that passed, and the first failures with the
recorded value and what the port held in the window. Exit status 1 when a value falls below
its rate, or when a sample's window holds no port state (the trace does not cover the run).
It does not drive the port: the port replays the recording's input itself and writes its
trace. Standard library only.Named by
Skills: re-observe.