Coldwave Read the docs

Coming from Unity#

You can keep writing C#. What changes is where the game lives: in text files you can read and diff, run at a fixed step so every run replays exactly. There is no importer for Unity projects yet: you rebuild scenes and scripts by hand or with an AI agent, and your art comes across as files. Scrap Riot, a game first made in Unity, was ported this way, and its recorded play-throughs replay exactly.

What maps to what#

UnityColdwave
GameObjectA thing: a number with an optional name, made of components (things)
Transform, SpriteRenderer, Rigidbody2DComponents: Transform, Sprite, Body, Collider
Your MonoBehaviour's fieldsYour own component, declared under [components] in game.toml
Update and FixedUpdateOne Step(dt), called 60 times a second at a fixed step
Start and AwakeOnScene, called when a scene has started
Scene (.unity)A scene: a TOML file of named things and their components (scenes)
PrefabNo prefab asset yet. Spawn the thing from a script, or keep the group in a scene
ScriptableObjectA data file a script reads (data("levels/one.toml")), or [tuning] numbers
Inspector values in Play mode[tuning] numbers, changed while the game runs
Input System actions[input] actions and [input.keys] in game.toml, read with Input.Get
Play mode testsA recorded run that frost test replays to a checksum (recorded runs)

Movement#

A hero that walks left and right. In Unity:

C#
public class Hero : MonoBehaviour
{
    public float speed = 90f;

    void Update()
    {
        transform.position += Vector3.right * Input.GetAxis("Horizontal") * speed * Time.deltaTime;
    }
}

In Coldwave, with a move_x action in game.toml and a thing named hero in the scene:

C#
using Ven;

[State]
public struct Game
{
    public Thing Hero;
}

public static class Main
{
    public static void OnScene(string scene, ref Game game)
    {
        game.Hero = World.Find("hero");
    }

    public static void Step(float dt, TransformColumns transform, ref Game game)
    {
        int row = transform.Row(game.Hero);
        if (row >= 0) transform.X[row] += Input.Get(0, "move_x") * 90 * dt;
    }
}

The [State] struct is what the script remembers between steps. It is saved with the game and restored when a run replays, so the hero is found once in OnScene and kept.

Instantiate becomes spawn#

In Unity:

C#
Instantiate(coinPrefab, new Vector3(40, 90, 0), Quaternion.identity);

In Coldwave, the components are named and their fields set:

C#
Thing coin = World.Spawn("Transform", "Sprite", "Coin");
World.Set(coin, "Transform", "x", 40);
World.Set(coin, "Transform", "y", 90);
World.Set(coin, "Sprite", "image", "art/coin.png");

What carries over#

  • C#. Scripts ending in .cs get the same engine calls as Luau and reload while the game runs (gameplay in C#).
  • Your art. PNG pictures, glTF models with their clips, WAV sounds and OGG music. JPEG is not read yet, so convert those to PNG.
  • Thinking in components. A thing is what its components make it.

What changes#

  • Unity's API. MonoBehaviour, transform.position and Time.deltaTime do not exist. Components reach Step as columns; the rest are calls such as World.Find and Input.Get.
  • The frame rate does not change the game. Every step is 1/60 s of game time. Do not read the clock to decide anything.
  • C# runs on the desktop today. Phones are in progress, the web runs a subset through Fusion, and a multiplayer game must be written in Luau (what works today).

Next#

Your first game takes about ten minutes. C# or Luau helps you choose.