project#
Part of the scripting reference, written by the engine so it matches your frost. Start with your first game if you are new.
Use when editing game.toml or scene files, declaring custom components, loading assets or sharing scene content.
| In a script | Does |
|---|---|
stream.loaded(x, z) | Whether the cell at this world position is fully resident; false without streaming. In 2D use x/y. Finite coordinates required (E0577) |
stream.hold(x, z, on?) | Hold the cell at a world position at the next step boundary; false releases, omitted means true. Holds are booleans, not counted; unknown cell is E0579. See project streaming |
The project file#
game.toml is everything about a game that is not a scene or a script. Every key, with what it means:
# Paths are relative to the folder the project file is in.
scene = "demo.toml" # required: the scene to load
space = "2d" # or "3d" for a 3D game (see 3D). Left out: "2d"
scripts = ["demo.luau"] # Luau scripts, stepped in this order
# A saved test (a copy of a project file with its own recording) says which game it tests:
# `frost test --write` writes it. It plays nothing differently. Left out: the folder's game.toml.
# test_of = "game.toml"
# Optional: more scenes, which a script starts with scene.load("level2.toml"). `scene`
# itself can be loaded the same way, to start it again.
scenes = ["level2.toml"]
# What the game's saves are kept under on a player's machine: 1 to 64 of a to z, digits,
# `-`, `_` and `.`. Changing it orphans players' saves. Left out: an export warns
# and uses the folder's name.
id = "com.example.demo"
# A scene file may begin with `include = ["common.toml"]`: it starts with those
# scenes' entities (paths from this folder), then adds its own. A name written in
# both is an error (E0106), and an included scene includes nothing itself (E0426).
# Optional: Luau files the scripts share. A script takes one in by the path written
# here: local kit = library("lib/kit.luau").
libraries = ["lib/kit.luau"]
# Optional: TOML files of values the scripts read, a level or a list of waves, each as
# a new plain table: local level = data("levels/one.toml"). Read when the game loads;
# a change starts the game again. A date, or an integer past 2^53, is E0408.
data = ["levels/one.toml"]
title = "Held Note" # optional: the game's name, on its window, tab and exported program
seed = 0 # where `math.random` starts: 0 to 4294967295. Left out: 0
# Pictures (PNG files) to load besides those the scene's sprites name: the ones only
# a script puts in a `Sprite.image`. A sprite can show loaded pictures only.
images = ["art/coin.png"]
# Models (.glb, .gltf) only a script puts in a `Mesh.file`, loaded with the game.
models = ["kit/drum.glb"]# Optional: the sounds scripts play, each a WAV or Ogg Vorbis file named by its path
# from this file. A script names a sound by the same path: sound.play("sfx/hit.wav").
# With [web], a sound over 3 minutes is a warning (W0437): a browser holds it whole,
# 21 MB a stereo minute.
sounds = ["sfx/hit.wav", "music/theme.ogg"]# Optional: the numbers the game is tuned by. A script reads `tuning.jump`; a name the
# project does not have is an error in a script, not nil, and a script cannot write one.
# An entry is a number, or a table with `value` and any of `min` and `max` (a value set
# outside them is E0435) and `step` (how far apart the values worth trying are).
# `frost run --set tuning.jump=300` and the protocol's `tuning.set` change one without
# touching a file. A value set stays set through a reset and a seek, which load the game
# with it in place, so a script that copies it as it loads (`local JUMP = tuning.jump`)
# reads the one set; set while the game runs, it reaches such a copy at the next load.
# The values are not in the checksum; `input.history` lists every one set, with its step.
[tuning]
jump = { value = 280, min = 100, max = 500, step = 20 }
gravity = 900# The game's own components: a name and its fields with their defaults. The default
# fixes the field's type, as in a scene: 0.0 is a number, 0 a whole number, true or
# false a boolean, "" a string. For f64/u32 see Numbers; wrappers also fit `value`. `{ color = 0xRRGGBB }` is a whole number that an
# editor shows as a colour. `{ entity = "" }` is a string that names an entity: an editor picks one, and `frost check` warns of a scene where it names none (W0436). `{ value = 0.5, min = 0, max = 1, step = 0.1 }` is a number with the
# range it is meant to stay in (`step` is optional): an editor makes it a slider and
# `frost check` warns of a scene that leaves it (W0427); a script may write any value. The engine declares its own (`Transform`, `Sprite` and the rest of this page).
# An editor shows the `#` lines above a component, or a field under
# `[components.Player]`; nothing checks them.
[components]
Player = { vy = 0.0, grounded = false, glow = { color = 0xffec27 }, health = { value = 3, min = 0, max = 5 } }
Note = {}# Optional: levels of detail and the far cut, the picture's alone (no checksum moves). A
# model `x.glb` with `x.lod1.glb` and `x.lod2.glb` beside it (either may be left out: the
# nearest present is drawn) is drawn at level 1 below the first of `sizes` (parts of the
# picture's height, by its box at rest) and level 2 below the second (left out: 0.25 and
# 0.08). Nothing pops: within `band` either way of a size (a part of it; left out 0.10;
# 0 changes level at once) both levels are drawn, each through a screen door that keeps
# its share of the pixels; shadows and ambient occlusion draw both whole. Nothing farther than `far` metres from the eye is drawn, nor its shadow, nor what
# it holds (0, or left out: no cut), each faded out through the door over the last tenth.
# A rigged level must have its model's joints (E0491); `frost check` says (W0462) of a level
# painted with other materials than its model. `fixtures/lods` is its game.
[lods]
sizes = [0.25, 0.08]
far = 120
band = 0.10A file whose top-level scene key is not a table is a project. Any other file is a bare scene: it is loaded with no scripts, no input actions and no components of its own.
Every game has parts of the engine's own besides those above: what a thing is under, what turns at a steady rate, and in a 3D game what follows another (a third-person camera), and how its model is posed.
| Component | Field | Type | Default | Meaning |
|---|---|---|---|---|
Parent | of | text | "" | The name of the entity it is under. Under one with a Transform its own Transform is local to that one's; under a group (a named entity with no Transform) or nothing, in the world. Despawning that entity despawns this one. The tree shows siblings in the order the scene writes them; scripts walk things in the order they were made, and what is drawn over what is layer's to say, never the tree's. Where it is in the world is drawn, picked, looked from (a Camera under a parent), heard (sound.play at it) and read by placed and world.entities; get reads its own fields. Under a parent flipped by a negative scale its turn is mirrored too. A Collider with no Body is held there too, moved and turned with its parents each step (its size is not scaled). A Body, Mover or UI Node under a thing with a Transform is refused, by the scene and at the next step after a script or an edit puts it there |
Tags | list | text | "" | The words, apart by commas or spaces: "pushable, heavy". A tag is one whole word of it |
Streaming cells#
A project may add one grid, active in every scene:
[stream]
folder = "cells"
cells = ["0_0.toml", "1_0.toml"] # explicit finite manifest; missing files are errors
size = 64 # world units, positive
load = 1 # square radius in cells, default 1
drop = 2 # hysteresis radius, >= load, default 2
followers = ["hero"] # union; omitted/empty: lowest placed Camera
budget = 256 # things entered per step, default 256Each cell is an ordinary scene with globally unique thing names and world coordinates. X_Z.toml names its signed grid coordinate (X_Y in 2D); floor(position/size) selects it, including negative positions. Only listed cells exist; gaps are empty world. Cell files cannot include scenes. Each cell's things must fit the budget; split a larger cell or raise it. Connected things (Parent, Joint, Node) belong in the base scene in this version. Cell assets follow the existing scene cook; cell text and assets are read at game load, including on the web. This version bounds live things and bodies, not asset memory or I/O.
After input, before physics, cells enter in coordinate order, static things before bodies, names sorted within each group. A whole cell enters or waits for the next step's budget. Physics waits while any requested cell is pending; scripts still run and may gate travel on stream.loaded. An initial scene has no cells until step 1. Followers are read at the start of the step, so script movement affects the next boundary. Missing followers fail (E0577); keep them in the base scene. A teleport may show queued cells for several steps.
Changes and deletions of owned things are kept when their cell drops, including Body velocities. Dormant bodies do not simulate; re-entry rebuilds their physics from those fields (solver contacts and sleeping timers start fresh). A thing crossing its cell's boundary becomes world-owned permanently, never duplicated on re-entry. Its current cell and immediate neighbours stay required, even off camera. Script-spawned things are always world-owned. Crossing the finite manifest's edge has no ground guarantee. Ground geometry must cover the cell and bodies must fit the loaded margin; choose radii for their speed.
cell.enter and cell.leave are ordinary events with the string "X,Z" as value, no entity, visible to scripts in that step. Enter means all rows exist; leave means they have been saved and removed. Use find again after re-entry: old entity handles are dead. stream.loaded(x,z) queries residency; stream.hold(x,z,on?) keeps/releases a cell. C#: Scene.Loaded, Scene.Hold, and Events.Count/Events.At read the same events. Holds, ownership and deltas are in world state: replay, snapshots and moments preserve them. scene.load resets them with the world. stream.read reports that state; the stream profiler span times the boundary, stream.cells and stream.entered count work.
Errors: E0576 invalid grid/cell content (fix the named file); E0577 absent/unplaced follower or nonfinite/out-of-range position (keep followers placed inside the grid); E0578 a name collision at entry (use unique spawned names); E0579 holding an undeclared cell (add it to the manifest). Ordinary scene/type/file errors retain their existing codes.
Generated from Coldwave 0.0.1 r289, 2026-11-30 by the binary itself: do not edit by hand.