Skip to content

Make Your First Game ​

Build, play, and export a complete (if tiny) game - a ground plane, a player object you can drive with the keyboard, a light, and a one-file game.html you can share - in a single sitting, without leaving the browser.

This is the foundational tutorial. It walks the whole Awaken loop end-to-end: create objects, edit them in the Inspector, script a behaviour, Play to test, and export a shippable file. Every other tutorial assumes you have done this one, because it teaches the create → edit → Play → ship rhythm the rest of the manual is organised around.

What you will build ​

A small playable scene: a floor, a cube "player" that slides around under WASD control, and a sun so the scene is lit. You will press ▶ Play to drive it, then export it to a single game.html a friend can double-click.

Before you start ​

Steps ​

  1. Start an empty scene. On the Welcome page pick the Empty scene template (or use File ▾ → New Scene). You get a 12 × 12 m Ground slab, a Sun (a directional light) and a Main Camera looking at the middle of the slab. That is your floor and your light; see PBR & Lighting for how the sun and the ambient sky combine.

    The Welcome page: Start from a template, with Empty scene first.

  2. Add the player. In the Hierarchy, open + → Create → Cube. The cube appears at the origin, sitting on the ground, already selected. Right-click its row, choose Rename (or press F2), and call it Player.

    The Hierarchy's + menu open on Create, with the new Cube selected at the origin.

  3. Write a move script. Open the Code tab (Code panel), press + New Game Script, name it Move, and replace its body with:

    ts
    export default class implements ScriptBehavior {
      speed = 5; // m/s, 0..20 - a `min..max` in the comment turns this into an Inspector slider
    
      onUpdate(api: ScriptApi, dt: number) {
        let x = 0, z = 0;
        // Keys are KeyboardEvent.key, lower-cased: "a"/"d"/"w"/"s", not "KeyA".
        if (api.input.isDown("a")) x -= 1;
        if (api.input.isDown("d")) x += 1;
        if (api.input.isDown("w")) z -= 1;
        if (api.input.isDown("s")) z += 1;
        api.translate(x * this.speed * dt, 0, z * this.speed * dt);
      }
    }

    Press Compile. The public speed field becomes an Inspector control: a plain number is a drag-to-scrub box, and the 0..20 range in its comment upgrades it to a slider. See Inspector Parameters and the ScriptApi Reference.

    The Code tab with the Move script pasted in and Compiled ✓ beside the Compile button.

  4. Attach it. Select Player, press + Add Component… in the Inspector, type Script and pick it, then choose Move in the Script component's picker. The speed slider appears under it.

    The Script component on the cube: Move picked, and its speed field as a 0 to 20 slider.

  5. Play. Press ▶ Play in the Toolbar. The Game tab comes forward; click it to give it the keyboard, and drive the cube with WASD. Press ■ Stop: the scene snaps back to where you left it, because Play runs on a snapshot (see Core Concepts).

    The editor in Play with the Game view in front: the cube on the Ground slab, lit by the Sun, Pause and Stop in the toolbar.

  6. Export. Open File ▾ → Export Game (game.html)…. The Export game dialog asks how much to protect your scripts (leave No obfuscation), then Export… asks where to save. Awaken writes one self-contained file: double-click it, or send it to a friend. It runs the same runtime you just played. See Export game.html.

    The Export game dialog: Script protection, the debug overlay option, and Export….

Where to go next ​

See also ​

Awaken: browser-native WebGPU game engine.