The engine

An engine written as documents.

Press Start is a game engine written in Rust, with an AI agent as its first user. Every system is a document plus a plugin, checked before the app exists, and every feature can fail a test.

How it works

How a game is made here.

  1. 01Write the scene as data.A scene is a base plus patches. A field is set by name, never by a click.
  2. 02Check it before it runs.Every document is validated before the app exists. A refusal names the value and the fix.
  3. 03Run it on a fixed tick.A tick is the same tick on every run, driven by a recorded input tape.
  4. 04Look with numbers, then pixels.Ask for the state and its checksum, capture the frame, compare it with its golden.
use press_start_test_app::{advance, fixed_step_app};

#[derive(Resource, Default)]
struct TickCount(u64);

fn count_ticks(mut count: ResMut<TickCount>) {
    count.0 += 1;
}

#[test]
fn three_fixed_steps_a_frame_are_thirty_after_ten_frames() {
    let mut app = fixed_step_app(3);
    app.init_resource::<TickCount>();
    app.add_systems(FixedUpdate, count_ticks);

    app.update(); // priming: Startup runs, zero fixed steps
    assert_eq!(app.world().resource::<TickCount>().0, 0);

    advance(&mut app, 10);
    assert_eq!(app.world().resource::<TickCount>().0, 30);
}
from the engine · imports trimmedOne of the engine's own tests, from its guide to a test app, imports trimmed.docs/00-build-a-game/test-app.md · 35-55 · 45aeffd

Five strengths

Five things it does differently.

In the box

What a game needs, in the box.

89 engine crates, in families. Each system is a document plus a plugin: the document holds the data and its rules, the plugin puts it in the app.

  • Scenesdocuments, prefabs, patches
  • Assetsmeshes, textures, materials, glTF
  • Renderingshaders, sprites, terrain
  • Physicsbodies, colliders, materials
  • Characterscontrollers, animation, rigs
  • Camerarigs and shake
  • Inputactions, bindings, one input funnel
  • Interfacelayouts, menus, localisation
  • Audioevents and buses
  • Effectsparticles
  • Navigation and AInavmesh, crowds, behaviour trees
  • Save and networksave slots, networking as a document

The engine in numbers

  • 89engine crates
  • 103features built, of 404
  • 71reference tools
  • 189accepted goldens

synced from the engine at commit c998685