Coldwave Read the docs

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#

DefoldColdwave
CollectionA scene: a TOML file of named things and their components (scenes)
Game objectA thing: a number with an optional name, made of components (things)
Sprite, collision objectComponents: Sprite, Body, Collider
go.propertyYour own component under [components] in game.toml, or [tuning] numbers
update(self, dt) and fixed_updateOne 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_messagesend("hit", thing, 1) in one script, events("hit") in another
selfComponents on the thing, or the script's state table
go.get_position(), go.set_position()get(thing, "Transform", "x"), set(thing, "Transform", "x", value)
Factoryspawn(...) with the components the new thing starts with
Collection proxyscene.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)
end

In 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
end

Messages 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
end

What 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#

  • self is not memory. Keep what the game must remember in components or in state.
  • One script walks many things. Scripts run once a step and find their things with each.
  • Positions are fields. Transform has x, y and, 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.