Coming from Defold#
Defold is the closest starting point: small games, Lua scripts and messages between objects. Coldwave's scripts are Luau, a descendant of Lua, so most of your code reads the same. The calls into the engine change, state moves out of self, and every run replays exactly. There is no importer for Defold projects yet: you rebuild collections by hand or with an AI agent, and much of your Lua carries over line by line.
What maps to what#
| Defold | Coldwave |
|---|---|
| Collection | A scene: a TOML file of named things and their components (scenes) |
| Game object | A thing: a number with an optional name, made of components (things) |
| Sprite, collision object | Components: Sprite, Body, Collider |
go.property | Your own component under [components] in game.toml, or [tuning] numbers |
update(self, dt) and fixed_update | One step(dt), called 60 times a second at a fixed step |
init(self) | on_scene(name), called when a scene has started |
msg.post and on_message | send("hit", thing, 1) in one script, events("hit") in another |
self | Components on the thing, or the script's state table |
go.get_position(), go.set_position() | get(thing, "Transform", "x"), set(thing, "Transform", "x", value) |
| Factory | spawn(...) with the components the new thing starts with |
| Collection proxy | scene.load("level2.toml") |
Movement#
A thing that slides right at its own speed. In Defold:
Luau
go.property("speed", 90)
function update(self, dt)
local p = go.get_position()
p.x = p.x + self.speed * dt
go.set_position(p)
endIn Coldwave, with Slider = { speed = 90.0 } under [components]:
Luau
function step(dt)
for _, thing in ipairs(each("Slider", "Transform")) do
local x = get(thing, "Transform", "x")
set(thing, "Transform", "x", x + get(thing, "Slider", "speed") * dt)
end
endMessages become events#
In Defold:
Luau
msg.post("/score", "picked", { value = 5 })In Coldwave, the event is read in the same step by any script:
Luau
send("picked", coin, 5)
for _, picked in ipairs(events("picked")) do
state.score += picked.value
endWhat carries over#
- Your Lua. Tables, functions, loops and most helpers work as they are. Luau adds optional types and a few conveniences such as
+=. - Messages. Events play the same role, and they are part of the replay.
- Your art. PNG pictures, glTF models with their clips, WAV sounds and OGG music. JPEG is not read yet, so convert those to PNG.
What changes#
selfis not memory. Keep what the game must remember in components or instate.- One script walks many things. Scripts run once a step and find their things with
each. - Positions are fields.
Transformhasx,yand, in 3D,z, read and written one at a time.
Next#
Your first game takes about ten minutes. Steps and determinism explains why every run replays.