Coldwave Read the docs

Making a game with Coldwave#

Read this once; fetch a page or one call when needed. No engine source is needed. frost reference PAGE opens a page below; frost reference CALL opens its entry; frost reference --search words finds ranked entries with page names. frost reference --all is the whole legacy reference. frost reference --types game.toml writes Luau definitions. In an editor use reference.read {name: "PAGE or CALL"}, reference.search {words: "words"}, or reference.read {all: true}; with no parameters reference.read returns this core and index.

Make, play, check#

  1. frost new my-game --template pong copies a finished game; blank starts with a square. Run frost new --list to choose. Work inside the game's folder.
  2. Edit game.toml, scenes and scripts. frost dev game.toml plays and reloads saves. frost check game.toml checks loading and reports file, line and suggested fixes.
  3. Play a recording: frost run --headless --steps 600 --state game.toml. Add --shot 600=shot.png to see it; inspect the picture, not just the checksum.
  4. frost test game.toml checks the recorded run and kept shots. For a new recording, write replay = { steps = 600, checksum = "0000000000000000" } in the project and use frost test --write game.toml to accept its checksum and checkpoints. Never overwrite an existing golden picture without its owner's approval. frost check --shots game.toml compares shots. frost test --restore game.toml checks that putting the game back restores its behaviour.

Three kinds of file#

game.toml names the starting scene, scripts, seed, assets, input actions and custom [components]. Paths are relative to its folder. A scene names things and sets their components. A script defines step(dt); time is fixed, normally 60 steps a second. on_scene(name) builds a scene before its first picture, including at load.

TOML
# game.toml
scene = "scene.toml"
scripts = ["main.luau"]
seed = 1
[input]
actions = ["move"]
[input.keys]
move = { negative = "A", positive = "D" }
TOML
# scene.toml
[hero]
Transform = { x = 80, y = 90 }
Rect = { w = 16, h = 16, color = 0xffffff }
Luau
-- main.luau
state.distance = state.distance or 0
function step(dt)
    local hero = find("hero")
    if hero then
        local dx = input.get(0, "move") * 100 * dt
        set(hero, "Transform", "x", get(hero, "Transform", "x") + dx)
        state.distance += math.abs(dx)
    end
end

Everyday calls#

  • find("hero"): named entity or nil; has(e, "Rect"): component present.
  • get(e, "Transform", "x") reads; set(e, "Transform", "x", 40) writes a field.
  • each("Transform", "Rect"): entities with both components; iterate with ipairs.
  • spawn({ name = "spark", Transform = { x = 40, y = 20 }, Rect = { w = 2, h = 2 } }) creates a thing; despawn(e) removes it and its children.
  • input.get(0, "move") reads an action; input.held(0, "jump") reads a button.
  • send("hit", e, 1) sends; events("hit") reads queued events.
  • scene.load("next.toml") changes scene at the step's end.

Rules that save a run#

Keep gameplay in components or plain state tables. A script's outer local is a cache: reload, seek and rollback do not preserve it. Rebuild caches in on_scene and empty them in on_restore. state holds numbers, strings, booleans and plain tables only. Declare entity handles kept there with keeps_things({"hero"}). After a scene change old entity handles are dead; find them again in on_scene. Use world calls inside step or on_scene, not while loading the script.

2D: origin bottom-left, x right, y up; a rectangle's Transform is its centre. Layers draw low to high. Rotation and Scale are components, not Sprite fields. Keep drawn edges on whole frame pixels for matching pictures across backends. 3D: write space = "3d"; open 3d before placing models or cameras.

A field default 0.0 declares a float; 0 declares a whole number. Use the right kind in set. find may return nil. A script-only picture/model must be listed in images/models; list sounds in sounds. Script-only colliders need [physics]; script-only UI needs [ui]. Shared scene content belongs in include, not copies.

Read actions, not devices. Keep long recordings in recording = "run.toml" under [input]. Random comes from seeded math.random; use math.pow for nonliteral powers. Sound is output, never game state. Animation events reach scripts next step. A successful load is not a successful game: play it and look at its shots.

Pages#

  • scripts: Use when writing Luau gameplay, spawning or finding entities, reading or changing fields, sharing libraries, loading data or switching scenes. Calls: bit32.mul, data, despawn, each, find, get, has, library, math.pow, math.random, math.roundeven, on_scene, print, scene.load, scene.name, set, spawn, step, tuning.
  • drawing: Use when drawing 2D sprites, rectangles or tilemaps, moving a camera, changing colour, layers, rotation or scale. Calls: frame.size, placed.
  • 3d: Use when building a 3D scene, placing meshes, adding a point light or sun, setting sky, ground or a following camera. Calls: ground.at, place, quat.look, quat.mul, quat.rotate, quat.slerp, quat.turn, screen.project, screen.ray.
  • physics: Use when making a player jump, move or collide, adding bodies or sensors, casting rays or pushing objects in 2D or 3D. Calls: physics.cast, physics.force, physics.ground, physics.impulse, physics.mass, physics.overlap, physics.pause, physics.paused, physics.ray.
  • joints: Use when connecting bodies with joints, building wheels, vehicles, ropes, hinges or 3D constraints. Calls: physics.wheels.
  • animation: Use when animating sprites or models, playing clips and poses, tweening fields, emitting particles or handling animation events. Calls: bone, emit, tween.
  • sound: Use when playing a sound on hit, adding sound effects or music, adjusting volume, fading or positioning audio. Calls: music.pause, music.play, music.resume, music.stop, music.volume, sound.effects, sound.play, sound.volume.
  • input: Use when binding keyboard, mouse, touch or gamepad controls, reading player actions or setting up multiplayer input. Calls: input.get, input.held, input.keys, net.cancel, net.host, net.join, net.player, net.state.
  • ui: Use when building menus, buttons, sliders or HUD layout, changing focus, displaying text or loading fonts. Calls: ui.focus, ui.measure.
  • state: Use when saving progress, keeping script state, recording a playthrough, restoring snapshots or checking replay determinism. Calls: keeps_things, on_restore, save.delete, save.get, save.set, save.slots, state.
  • event-flow: Use when sending or reading gameplay events, handling contacts, sensors or the order events reach scripts. Calls: events, send.
  • project: Use when editing game.toml or scene files, declaring custom components, loading assets or sharing scene content. Calls: stream.hold, stream.loaded.
  • render: Use when configuring bloom, materials, frame graphs or effects, or diagnosing rendering such as why a pixel is dark.
  • csharp: Use when writing gameplay in C#, checking Luau API parity or preparing the .NET tools and platform build.
  • export: Use when shipping a game to desktop or browser, choosing export settings or customising the web loader.
  • protocol: Use when inspecting or driving a running game through MCP or JSON-RPC, debugging a dark pixel, profiling, or testing agent edits.

Generated from Coldwave 0.0.1 r289, 2026-11-30 by the binary itself: do not edit by hand.