Coldwave Read the docs

Recorded runs and checkpoints#

Note. The command is ven in today's builds and becomes frost at launch, and so do the names built from it.

Play your game once, keep the recording, and you have a test: frost test plays it again and tells you whether the game still goes the same way. It works because a game is the same at every step for the same input. Your project file holds the recording: what was pressed, step by step, and what the whole run came to.

A recording#

[input] recording is a list of stretches, each held for its steps; an action left out is at rest. The basics sample waits half a second, moves right for two seconds and left for half a second:

TOML
# docs/examples/basics/game.toml
# The concepts pages' game: things with components, a scene, a script that steps them,
# an event, and a recorded run that `frost test` holds to one checksum.
#
#   frost dev game.toml
#   frost test game.toml
scene = "scene.toml"
scripts = ["main.luau"]
seed = 1
replay = { steps = 180, checksum = "4dc3795c2a4e1351", engine = "0.0.1 r280" }
# The run's checksum on the way there, written by `frost test --write`: a test that
# fails says between which two of these steps the game first went another way.
checkpoints = []

[window]
size = [320, 180]
background = 0x15171c

# The game's own components: a name and its fields with their defaults.
[components]
Spinner = { speed = 90.0 }
Coin = { value = 1 }

[input]
actions = ["move_x"]
# The run `frost test` plays: rest, then right for two seconds, then left.
recording = [
    { steps = 30 },
    { steps = 120, move_x = 1 },
    { steps = 30, move_x = -1 },
]

[input.keys]
move_x = { negative = "A", positive = "D" }

A long recording goes in a file of its own (recording = "run.toml"), which players never read and exports leave out. Record one by playing: the protocol's input.history returns a played session in exactly this form, which is how a bot or an agent writes one.

The replay and its checkpoints#

replay = { steps, checksum } says what the recorded run comes to: the run checksum, every world from the start to steps summed. Write zeros the first time and let the engine fill it in:

Shell
frost test --write game.toml    # plays the run, writes replay and checkpoints
frost test game.toml            # plays it again and requires them

--write also writes checkpoints: the run's checksum at every 256th step and at each step a scene started. A test that fails then says between which two checkpoints the game first went another way, and plays the stretch beside the accepted copy of the game to name the first step, the first value that differs and the script line that last wrote it. Changing the coin's value in the sample from 5 to 6 and testing again says:

Text
game.toml: FAILED: at step 0 coin.Coin.value is 6 and was 5; last written by scene
scene.toml:12. That is the first step that differs from the game as accepted (by `frost
test --write`); changed since then: scene.toml. If the change is meant, `frost test
--write` writes the new checksums.

frost test --write keeps the game as accepted in .ven/accepted/ beside the project file, so that comparison needs no git; with uncommitted changes it compares against git HEAD too. frost test --unaccept takes one acceptance back.

Shots#

shots = [{ name = "walk", step = 140 }] names frames the game is judged by: the picture after that step of the recorded run, kept as shots/NAME.png. frost test takes each again and compares; frost check --shots says which changed, the most changed first. A machine with no graphics adapter skips shots and says so.

Asking more of the same recording#

CommandAsks
frost testDoes the run still come to its checksum, and do its shots still match?
frost test --restorePut back at each checkpoint, does the game go on the same? (It finds a local that should be state)
frost test --says PART@STEPDid my change alter only the parts I said (as world.checksum names them), from the step I said? Needs git
frost benchHow long does each step of the run take? See profiling
frost blame GAME.toml hero.Transform.x --step 300Who wrote this value at that step? See debugging

A saved test is a copy of a project file with its own recording under tests/; frost test FOLDER runs every game and every saved test in a folder. A game with no replay has no recorded run: frost test says no recorded run and counts it apart, never as a pass.

When a change is meant#

A change that alters how a run goes fails its test, as it should. Play the game, look at its shots, and when the new behaviour is right accept it with frost test --write, which writes the new checksum and checkpoints. A shot that already has a picture is compared, never replaced: frost check --shots --write-shots keeps new pictures, once you have looked at them.