Protocol: game, part 2 of 2#
The game commands a program sends to a running game, as the engine describes them: what each takes, what it answers and what it does. Back to all commands.
game.try#
game.try {from?: integer, inputs: [record], read?: [record], until?: record, keep?: value} -> {step: integer, checksum: text, reached: value, reads: [record], id: integer} · write
Plays a stretch of input from a snapshot and answers what came of it, in one call: the game is put back to the snapshot, stepped through the inputs (to the goal, when one is given), read, and kept as a new snapshot when asked. The game is left where the try ended, with the last step's input held. For a search: one call a branch.
| Parameters | Type | Meaning |
|---|---|---|
from? | integer | The snapshot to start from, as game.snapshot or an earlier try gave it. Left out: the game as it stands. |
inputs | [record] | The input to play, as a project's recording is written: one {steps, ACTION: value, ..., player} per stretch, each action from -1 to 1 and at rest when not named; player left out is player 0. A player's stretches follow one another, and two players' run side by side. At most 36000 steps. An empty list plays nothing. |
read? | [record] | What to read where the try ends: one {command, params} per read, each a read-only command of this protocol with its parameters. Left out: nothing. |
until? | record | A goal to stop at, looked at after each step: {scene: NAME} (the game is in that scene), {event: NAME} (the step sent that event), {field: "Component.field", op, value, entity} (an entity's field compares so; entity left out: any entity's) or {state: "key", op, value, script} (a key of a script's state compares so, with dots for keys inside tables; script left out: any script's). op is one of = != < <= > >= and may be left out for =. Left out: every step is run. |
keep? | value | true to keep the game where the try ends as a snapshot. Left out: false. |
| Result | Type | Meaning |
|---|---|---|
step | integer | How many fixed steps have run. |
checksum | text | The world's checksum at this step, 16 hex digits: what frost run prints as world checksum. Equal checksums mean equal worlds, on any machine. A project's replay holds another number, the checksum of a whole run (run checksum), which sums the world at every step. |
reached | value | true when the goal of until was met: the stepping stopped there, and step is the step that met it. false when the steps ran out first, or no goal was given. |
reads | [record] | One {command, result} per read, in the order asked. |
id | integer | The snapshot kept of the end, for keep; 0 when none was asked for. |
Generated from Coldwave 0.0.1 r289, 2026-11-30 by the binary itself: do not edit by hand.