# Changelog, part 5

Part 5 of 7: [newer](4.md) · [older](6.md).

- **`frost cook GAME.toml` cooks a game's pictures into a cache**: each PNG the game loads
  becomes a texture kept under the SHA-256 of the file, the importer and its version and
  the profile (`--profile desktop|web`), in `--cache DIR`, `FROST_CACHE` or the system's
  folder for caches (`E0525`, new, when there is none). A second cook of unchanged files
  cooks nothing; `--check` cooks again in an empty cache and requires the same bytes.
  The game itself still reads its files as written. Nothing else changed.
- **`session.writes {hand?, since?}` lists every change of the hands**: oldest first,
  each `{n, hand, what, name, line, step, at_ms}` as `session.hands` says a last
  change, with `next` to ask from next time; the latest 4,096 are kept, and `missed`
  says about how many an ask from before them lost. Nothing else changed.
- **Blame says the text of the line that wrote**: a script writer in `blame.value`,
  `blame.entity` and `blame.pixel`, and each of its callers, has `text`: the line as the
  code read when it ran (a reload since does not change it), trimmed, at most 200 bytes;
  null for code older than the newest 32 versions of its file.
  The function's name is read from that code too. Nothing else changed.
- **`game.seek` says where it played from and what that cost, and where the keyframes
  are**: it answers `from`, `started` ("here", "keyframe" or "load"), `replayed` and
  `ms`, and `keyframes.steps` lists the keyframes' steps. `world.series` buckets give
  `min_step`, `max_step` and `last_step` beside their values. Nothing else changed.
- **Every command answers `--help`**: `frost COMMAND --help`, `frost COMMAND -h` and `frost
  help COMMAND` print what the command takes and exit 0 (they were refused with E0501 by
  most commands), and exit 2 for one that is not built, so a tool can ask an engine
  whether it has a command. Nothing else changed.
- **The checksum covers a scene asked for and not started yet** (a `scene.load` in
  `on_scene` waits for the end of the next step): two games of equal checksums go on
  the same way. A game with nothing pending has the checksum it had; no test game's or
  stress game's recorded checksum moved.
- **A game put back before a scene that `on_scene` asked for goes to it.** A
  `scene.load` asked for in `on_scene` waits for the end of the next step, and a
  snapshot taken before that step now holds that it was asked for: `game.restore`,
  `game.try` and `frost test --restore` went on in the old scene (and blamed a `local`).
  No checksum changed.
- **A failed `frost test` names the files that changed since the game it is told against**:
  the one sentence now reads "... That is the first step that differs from the game as
  accepted (by `frost test --write`); changed since then: go.luau, speed.toml. If the change
  is meant, ...": from the accepted game's manifest (a file gone is named "(gone)"), or
  from git when told against the game as committed. Five names at most, then how many
  more. `.frost/` is not a file of the game. Nothing else changed.
- **`project.remove` and `frost remove scene|script NAME` take back a `project.add`**: the
  name leaves `scenes` or `scripts` (its line, when the list was only it), every other
  comment and line as written, and the file is deleted, only while it is still exactly
  the engine's stub and no scene, script or library names it; otherwise `E0446`
  ("nothing was removed: ..."), with nothing changed. An add and its remove leave the
  folder byte for byte as it was: an editor's undo of "add". Nothing else changed.
- **`world.series {against: "accepted"}` reads the accepted game**: the values of the
  game as `frost test --write` last kept it, played from those files on the recorded
  input, for a timeline's accepted lane beside the one now; the answer says `against`.
  Nothing else changed.
- **`frost test --write` keeps the game as accepted, and a failing test is told against
  it**: `.frost/accepted/NAME/` beside the project file holds every file the game loaded
  (its text files whole, pictures and sounds by hash). A failure then says the first
  step, the value and the line that differ from what was accepted, with or without git,
  before it falls back to git HEAD and then to the checkpoints; `--against DIR` reads
  what someone kept elsewhere. The line of a `--write` ends ", kept as accepted in ...".
  A folder `.frost/` beside a game is new: it is yours to commit or not, and committed, a
  teammate without the history gets the same answer.
- **A step says how much work its scripts did, as a count**: `profile.steps` and
  `profile.frame` count `script_work`, the calls and loop turns the Luau machine made, and
  `script_work NAME` for each script: the same on every machine and every run, unlike a
  time. Not in any checksum; a game that keeps no profile counts nothing. Nothing else
  changed.
- **`world.apply {writes: [...]}` makes several writes as one**: `spawn`, `insert`, `set`,
  `remove` and `despawn`, each with its own command's parameters, in order and all or
  none. A refused write puts the world back to before the first, checksum and all; its
  error keeps the write's code and names it (`writes[2]`). `"$N"` names the entity of an
  earlier write, so a thing spawned can be given a part in the same call. One answer,
  one entry in `session.hands`. Nothing else changed.
- **Data files: `data = ["levels/one.toml"]` and `data(name)`**: a TOML file the project
  lists is read when the game loads and handed to a script as a new plain table each
  call (tables, lists from 1, text, numbers, true and false), by its path or from the
  calling file's folder with `./` and `../`. A date or an integer past 2^53 is `E0408`
  with its line. A changed data file starts the game again, as a library does. A game
  that lists none is as before; no checksum changed.
- **`library("./name.luau")` and `library("../name.luau")` are from the folder of the
  file that calls `library`**: a set of libraries that take each other in works from a
  project in any folder that lists them (`libraries = ["../shared/kit.luau", ...]`). A
  name without `./` or `../` is found as before, by the path the project file writes.
- **Physics can step on more than one thread**: `FROST_PHYSICS_WORKERS=N` (1 to 16) makes
  every game `frost` plays step Box2D on N threads. The results are the same bits on any
  number, so no checksum moves; left out it is one thread, as before, and an exported
  player and a web page always use one. A number outside 1 to 16 is refused (`E0524`).
- **A script may define `on_restore()`**, called once before it next runs after the game
  was put back to another moment (`game.restore`, `game.try`, a seek, a rollback) or a
  failed reload put `state` back: the place to empty what a `local` caches. `frost check`
  no longer warns (W0309) of a `local` that `on_restore` empties. A script without it
  runs as before.
- **`project.add` and `frost add scene|script NAME` add a scene or a script to a game**:
  the file is written from the engine's stub and named in the project file's `scenes` or
  `scripts`, the project file edited in place with its comments kept. `E0446` (new) when
  the name is taken, is not a plain path, or is outside the project. It is the one
  command that writes a project's files, in the trusted class. Nothing a game does
  changed.
- **A number kept in `state` that is not finite reads as `"Infinity"`, `"-Infinity"` or
  `"NaN"`** in `script.state`, `save.list` and `frost run --state`, where all three were
  `null`. Nothing a game does changed.
- **`frost run --set` loads the game once**, with the values in place, where it loaded it,
  set the values and loaded it again: the top of each script runs once (one `print`
  where there were two), and what a script saves as it loads is saved once. The run
  itself, and its checksum, are as before.
- **`bit32.mul(a, b)` and `math.roundeven(x)`**, for code ported from C, C# or
  JavaScript: the product of two 32-bit words wrapped as C wraps it (where `a * b`
  passes 2^53 and drops low bits), and rounding with halves to the even whole number
  (`math.round` takes them away from zero). Nothing a game does changed.
- **`session.hands` says what each hand last ran, and where its code changed**:
  `last_run {to_step, checksum, matches_replay, n}` for a run to the end of the
  recording (`matches_replay` true or false only where nothing but the recording moved
  the game, else null), `line` on a script.reload's `last_change`, and `tag`, the
  editor's own name for a hand's task (`session.hello {tag}`, `frost mcp --join --tag`
  or `FROST_HAND_TAG`). A joined `frost mcp` that sees its session end exits with status
  2, as every error of `frost` does. Nothing else changed.
- **`frost test --says PART[@STEP]... [--against REV] [--json]`** holds a change to what
  it said: the game on disk may differ from the game at REV (HEAD) only in the parts
  said, as `world.checksum` names them, each from its step on, and a changed shot only
  where a said part differs. Without a repository, a change or a `replay` it says so
  (`E0523`). Nothing else changed.
- **An agent can act on the game the editor shows**: `frost mcp --join 127.0.0.1:PORT
  --token-file PATH [--who NAME]` serves the same MCP tools for a session that runs
  already (`frost serve --port 0 --stdio`, `frost dev`) in place of a game of its own. It
  says `E0521` when it cannot join and `E0522`, and exits, when the session ends.
- **A connection says who it is, and blame names it**: `session.hello {who, kind,
  model?}` makes the connection a hand (an MCP client's `initialize` does it by
  itself), and `session.hands` lists them with what each last did and who moved the
  game's step last (`clock`). Blame answers a client writer with `hand`, `who` and
  `agent` beside `trust`: hand 0, "a client", for a connection that never said. No
  checksum moves.
- **`[export] credits = "full"` ships the source notes with the game**: each
  `.from.toml` note and `.terms.txt` file goes beside its file under `game/`, as well as
  `credits.txt`. Left out, or `"file"`, only `credits.txt` is written, as before. They
  are no part of what the web page downloads. `[export]` is a new table of the project
  file; any other value of `credits` is `E0408`, with its line.
- **Source notes: `assets.from`, `assets.sources`, `credits.txt` and `W1410`.** A file of
  the game can have a note beside it, `NAME.EXT.from.toml`, saying which service made it,
  with which words and under which licence, and the service's terms as
  `NAME.EXT.terms.txt`; the editor writes them, the engine only reads them.
  `assets.from {path}` answers the note, the file's SHA-256 (`sha256:…`) and `changed`
  when the file is no longer what the note's `came` recorded; `assets.sources` lists every
  file the game loads and the `unlicensed` ones. `frost export` writes `credits.txt` beside
  the game when any file has a note, and warns `W1410` (new) of a file a service made or
  a person brought with neither a licence named nor terms saved, as `frost check` and
  `game.check` do; they also warn `W1411` (new) of a note whose file is gone. The
  notes are not copied into the exported game. Nothing changed for a game with no notes.
- **`frost check --costs` and `frost export` say what a game's files cost a download**: the
  bytes as exported and with gzip, by kind (pictures, sounds, fonts, scripts, scenes),
  the five largest, and where a saving is known, one line: a picture `frost` would write
  smaller with the same pixels (exact), or a WAV sound of ten seconds or more as Ogg
  Vorbis for `music.play` (an estimate, with the web player's decoder counted). Nothing is
  re-encoded. `frost check --costs --json` adds the object as `costs` to the line it prints:
  `{bytes, gzip, kinds, files, largest}`. Nothing else changed.
- **Pictures `frost` writes are smaller, with the same pixels.** A frame of at most 256
  colours (`frost run --shot` and `--frames`, `frost check --shots --write-shots`,
  `frame.capture`) is written as a palette PNG (colour type 3, with `tRNS` when a colour
  is see-through) instead of eight bits a channel: the test games' 61 shots went from
  648,555 bytes to 466,920, and those kept in the examples' `shots` folders were written again from
  their own pixels. A frame of more colours is the same file as before. A tool that
  reads these files with a PNG library that does not expand palettes must ask it to
  (the `png` crate: `Transformations::EXPAND | Transformations::ALPHA`); browsers,
  image viewers and `frost check --shots` read both.
- **`profile.steps {totals: true}` adds up a stretch of the game**: every span of the
  steps whose spans are kept, each place in the tree once, ms and count summed, with the
  first and last step added and how many. Nothing else changed.
- **`profile.steps` says where a step's time went, down to the line of a script**: each
  span of a step's record has `parent`, the index of the span it ran inside, and `at`,
  where in a script it is. Inside `script NAME` are its `step()` and `on_scene()`, and
  inside those each engine call they made whose cost depends on the world (`find`,
  `each`, `spawn`, `despawn`, `events`, `tween`, `library`, `physics.ray`,
  `physics.cast`, `physics.overlap` and `save`'s), added together per line that called
  it. `profile.frame` and `profile.frames` add the places of one name together, so they
  list `step()` and those calls by name too. Timing a call costs a tool about 55 ns (a
  game made to call `tween` 2,000 times a step steps about 5 % slower under `frost dev`,
  `frost serve`, `frost run` and `frost bench`); an exported game times nothing. No checksum
  changed.
- **`game.restore` says what it does not undo**: `edits_after`, the steps of a client's
  changes made after the snapshot (a write to the world, `scene.load`, `saves.set`,
  `debug.evaluate`), which playing on with the same input does not make again, and
  `code_changed`, the scripts reloaded since, which run as they are now. `input.history`
  lists the changes on the game's line of time as `edits`. Nothing a game does changed.
- **`world.series` reads a field's value over a stretch of the recording**: `{entity,
  component, field, from?, to?, buckets?}` answers `values`, one `{step, value}` a step
  (at most 3,600), or with `buckets: N` the `{from, to, min, max, last}` of N stretches,
  and `played_from`. It plays the stretch again aside and changes nothing of the game.
- **`game.seek` goes back by keyframes.** A seek to a step behind the game used to load
  the files and play from step 0; it now puts back a moment the session kept on an
  earlier seek (one every 300 steps) and plays on from there, where that makes the same
  game, and loads as before where it might not (a changed file, a `script.reload`,
  `tuning.set` or `blame.on` since the load, a debugger attached). What a client sees
  differently: the session's snapshots survive such a seek (a load forgot them),
  `events.since` starts at the keyframe and not at step 0 (`from` says where), and a
  game that keeps state in a script's `local` gets warning `W0445` once and is loaded
  as before. `game.seek` answers `keyframes`: `{every, kept, bytes, most_bytes}`.
- **`frost play DIR` plays a folder `frost export web` wrote**: it serves the folder as it
  is on 127.0.0.1 and prints `serving http://127.0.0.1:PORT/`, with the media types and
  refusals of `frost dev --web`, and no protocol, no reload and nothing written. A folder
  without the page, both players and `game/` is refused (`E0520`, new). Nothing else
  changed.
- **`frost new --list` names the templates for a program**: one a line, the name, a tab
  and the `about` line of its `template.toml`, in the order of their names. A downloaded
  `frost` with no templates beside it says where they belong in one sentence (`E0519`,
  where it said `E0515` with "no templates were found", and no longer looks in a
  `templates` folder of the current folder), and `--list` then prints nothing and exits
  with status 2. `frost new --help` says the same.
- **`frame.capture` says which part of the world its picture shows**: `view`,
  `{left, bottom, right, top}` in world units, as `frame.view` gives it. Nothing else
  changed.
- **`world.insert` and `world.remove` put a component on an entity of the running game
  and take one off, and the entity keeps its id**: what an editor's "Add a part" and
  "Remove" send. An insert is held to what `world.spawn` is held to. A remove takes the
  tweens of the component's fields with it, and is refused with the code that says why
  when something else needs the component: a joint that holds the entity by its
  `Collider` (`E1111`), a `TileCollider` beside its `Tilemap` (`E1107`), a node in it
  (`E1301`). A script then sees the entity as any that lacks the component: `has` is
  false and `get` of it stops the step with `E0003`. Neither writes a file.
- **Each of the engine's components says what it is, in a sentence**: `world.components`
  gives it as the component's `about`, where it was null, and `frost reference --types` as
  the comment above its type. It is a row of its own above the component's fields in
  each crate's reference table, with the field cell empty, as `Screen`'s was; the page
  `frost reference` prints leaves those rows off, but for `Screen`'s, to stay within its
  budget. Nothing a game does changed.
- **A `Tween` that would stop every step is refused before the first**: one whose
  `component` or `field` is empty (`E1004`, new), whose field holds no number (`E1003`)
  or whose easing is not one (`E1002`). A scene file with one fails to load and
  `frost check` says which, and `world.spawn` makes no entity; before, the game loaded
  and stopped at a step. A tween a script makes with `tween()` is as it was.
- **`profile.steps` keeps an hour of step times, and a replay hides nothing played.**
  Each step is kept by its number: where its time went for the last minute, its time
  for the last hour (an older step is told with `spans: null`). A step the engine plays
  again to reach another (`game.seek`, `blame.on`) no longer writes over the same step
  as it was played, though it gives an older step's spans back, and a `game.try` from a
  kept moment keeps nothing. `steps` rows say `replayed`, a list is of the last minute
  unless `from` says otherwise, a `to` past the game's step tells the steps still kept
  there, and `kept` is now a record of what is held (`{spans, steps, bytes,
  bytes_per_span, bytes_per_hour}`), where it was a number.
  `buckets: N` cuts a range of any length into N stretches with the slowest step of each.
- **A turned thing's hit has its outline, and `frame.view` says what the frame shows.**
  A hit of `frame.at`, `frame.in` and `blame.pixel` has `turned` beside `box`:
  `{x, y, w, h, angle}`, the box along the thing's own sides in the frame's pixels and
  its turn in degrees, or null for what is not turned. `frame.view` answers the frame's
  size and the part of the world it shows, `{left, bottom, right, top}` in world units,
  as the camera looks. Nothing else changed.
