# Changelog, part 7

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

- **`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.
- **`Mover.step` is new**: the highest ledge a mover walks up onto, 0 when left out, so
  a game that does not write it plays as before; the checksum of a game with a mover
  moves once, the field being new in each. The numbers on softness and swing moved
  from the scripting reference to `docs/physics.md`.
- **`Collider.surface` is new**: a belt's speed. A game that does not write it plays as
  before; the checksum of a game with colliders moves once, the field being new in each.
- **A game has the physics' components only when it has the physics, and `Font` only
  with a `[fonts]` table or a `Font` in a scene.** A game has the physics when its project file has a
  `[physics]` table or one of its scenes gives an entity a `Body`, `Collider`,
  `TileCollider`, `Mover` or `Joint`. Scripts are not read to decide it: **a game whose
  scripts make colliders in scenes that have none must add `[physics]`** (an empty
  table will do) to `game.toml`; without it the script's first use stops with the
  unknown-component error, which says so. No recorded game's checksum moves and none
  of the test games or templates needed the table. `world.components` lists fewer for a
  game without them, and a client naming one there is refused (E0415) with the same
  advice. `frost export` links the physics by the same rule.
- **A field can say that its text names an entity, and `frost check` warns when it names
  none (`W0436`).** A game marks its own in the project file as `{ entity = "" }`; the
  engine's are marked: `Node.parent`, `Node.up`, `Node.down`, `Node.left`, `Node.right`,
  `Slider.fill`, `Slider.label`, `Choice.label`, `Toggle.mark`, `Bar.fill`, `Joint.from`
  and `Joint.to`. `world.components` reports `"role": "entity"` for such a field. The
  warning is new for games that already had a focus neighbour that is not there, or, in
  a scene the game does not start in, a parent, a part or a joined body that is not
  there. It reads the scene as its files say: an entity a script spawns later is not
  seen. No value and no checksum changed.
- **`profile.steps` says what each step took**: the time of each of the last 3,600
  steps, and the slowest of a range with where their time went (each stage, each
  script, the picture drawn of the step). It is kept in `frost dev`, `frost serve` and
  `frost mcp` whether or not anybody asks, at about a tenth of a microsecond a step; an
  exported game keeps nothing. No checksum and no frame changes.
- **A hit of `frame.at`, `frame.in` and `blame.pixel` has its `box`**: `{x, y, w, h}`
  in the frame's pixels, around everything the entity draws with that component, so a
  tool can outline a sprite drawn at its picture's own size. Nothing else changed.
- **A failing shot in `frost test` says where the game changed.** When the run holds and a
  picture does not, and the folder has changes git has not committed, the line leads
  with the first step and value that differ from the committed game, as a failed
  checksum does; when the world is the same at every step it says so and names the
  files that changed.
- **`frost check` warns of a script variable a snapshot does not hold (`W0309`)**: a
  `local` declared outside a script's or a library's functions that a function writes,
  or writes a field of, with the line of the first write. Such a game goes wrong after
  `game.restore` and `game.try`, which `frost test --restore` finds by running it; move
  the variable into `state`. The game loads and runs as before. The platformer and
  the brick breaker templates kept their tilemap that way; they now read it once a
  step into `state.land` and take it out when the step ends, on the same checksums.
- **A failing `frost test` says the step, the value and the line.** When the game's folder
  is in a git repository and has changes that are not committed, the failure is:
  "FAILED: at step 131 ball.Transform.x is 131.5 and was 131.0; last written by script
  go.luau:5 in step. That is the first step that differs from the game as committed (git
  HEAD a1b2c3d)." The two checksums are not printed then.
  The committed files are played in memory beside those on disk; nothing is stored, and
  a game that passes is not played twice. Without git, or with nothing changed since the
  commit, the message is the one it was.
- **`frost test` fails a game that cannot be put back to a snapshot.** It plays one
  stretch of the recording twice (from the checkpoint nearest the middle to the next,
  put back from a snapshot in between) and both times have to come to the same worlds.
  A game that kept part of what it is in a script's own variable (a `local` outside its
  functions) passed before and fails now, with the step and what to do: move it into
  `state`. `frost test --restore` does the same at every checkpoint.
- **`frame.at` and `frame.in` say what is drawn at a pixel and inside a box of the
  frame**, the one in front first, with no blame on and no picture taken: what an
  editor asks to pick the thing under the pointer. `blame.pixel` answers the same
  hits with who made and placed each, so its hits have four fields more (`tile`,
  `node`, `coverage`, `fills`); nothing it answered is gone.
- **A node with a `Text` and no `w` or `h` has the size of its words**, where before
  it was a point. One anchored by its middle is where it was; one anchored by an edge
  (`Anchor = { y = 1, dy = -14 }`) now has that edge of its words there, not their
  middle: move `dx` and `dy` by half the text's size. In a stack it takes its room,
  and a press on it is the interface's (`Node = { pointer = false }` lets it through).
- **A `Stack` or `Grid` with no `w` or `h` is as big as what is shown in it**: before,
  it was a point and its nodes hung from that. Write the size for the old layout.
- **`Anchor.stretch_x` and `stretch_y` are read in a stack and a grid**: a node
  stretched across its stack fills it, those stretched along it share what is left,
  and one in a grid fills its cell. Before, both were ignored there.
- **A fill node with an `Anchor.dx` keeps that much clear at both ends** of its slider
  or bar: before, only at its left, and a full bar ran past the right end by `dx`.
- **A tween of the `Transform` of a node the interface places is an error** (`E1306`):
  before, it did nothing. Tween `Anchor.dx` or `dy`, `Scale` or `Opacity`.
- **The pointer uses a button, a choice or a toggle when it lets go on it**, not when
  it presses: sliding off first cancels. A recording made with the pointer sends its
  events as many steps later as the press was held, and one that pressed here and let
  go there no longer uses anything. Keys and a gamepad are as they were.
- **The focus is remembered.** A screen that is hidden and shown again has the focus
  where it was left, and when a modal node closes the focus is back on the node that
  had it; before, both went to `[ui] start`. A modal node still opens on `start`.
  For the old behaviour call `ui.focus(find("play"))` when showing the screen.
