Skip to content

API Class Engine

github-actions[bot] edited this page Nov 29, 2026 · 7 revisions

Class: Engine

Defined in: src/engine/boot/Engine.ts:94

Owns the Worlds and drives them frame by frame (ADR 0011, 0032). A bootstrap creates the start-up Worlds; game code creates more at runtime through handles. engine.world is the default World: the first one the bootstrap made.

const engine = await Engine.create({ container, project, assets });
await SceneManager.load("scenes/main.scene.json");
engine.start();

Implements

Properties

settings

readonly settings: ProjectSettings;

Defined in: src/engine/boot/Engine.ts:95

Implementation of

BootstrapEngine.settings

Accessors

isRunning

Get Signature

get isRunning(): boolean;

Defined in: src/engine/boot/Engine.ts:411

True while the requestAnimationFrame loop is running.

Returns

boolean


world

Get Signature

get world(): World;

Defined in: src/engine/boot/Engine.ts:192

The default World: the first one the bootstrap created (the next one, if that's destroyed).

Returns

World

Methods

createWorld()

createWorld(config): WorldHandle;

Defined in: src/engine/boot/Engine.ts:220

Create a World in this Engine. See Engine.createWorld. Its scenes load in the background (Engine.create waits for the start-up Worlds'), and it steps from the next frame on.

Parameters

config

string | WorldConfig

Returns

WorldHandle

Implementation of

BootstrapEngine.createWorld


dispose()

dispose(): void;

Defined in: src/engine/boot/Engine.ts:516

Stop the loop, destroy every World's nodes (scripts get onDestroy, audio stops), release GPU resources, then release the project context (ADR 0319): the asset sources it was given go, and storage goes back to the backend of the Engine created before it that's still alive (the editor's, after Play), or the one in use before.

Returns

void


findWorld()

findWorld(name): WorldHandle | null;

Defined in: src/engine/boot/Engine.ts:292

A handle on one of this Engine's Worlds, by name, or null.

Parameters

name

string

Returns

WorldHandle | null

Implementation of

BootstrapEngine.findWorld


start()

start(): void;

Defined in: src/engine/boot/Engine.ts:416

Start the requestAnimationFrame loop.

Returns

void


step()

step(dt): void;

Defined in: src/engine/boot/Engine.ts:441

Advance one frame by dt real seconds. Used by the loop; call it directly in tests. As in Unity's player loop, every unpaused World steps once, in creation order, each on its own clock (ADR 0032). Afterwards the default World is current again.

Parameters

dt

number

Returns

void


stop()

stop(): void;

Defined in: src/engine/boot/Engine.ts:430

Returns

void


worlds()

worlds(): readonly WorldHandle[];

Defined in: src/engine/boot/Engine.ts:303

Handles on every World, in creation (and step) order. For the editor and bootstraps, not game scripts.

Returns

readonly WorldHandle[]

Implementation of

WorldOwner.worlds


create()

static create(options?): Promise<Engine>;

Defined in: src/engine/boot/Engine.ts:155

Parameters

options?

EngineOptions = {}

Returns

Promise<Engine>


createWorld()

static createWorld(config): WorldHandle;

Defined in: src/engine/boot/Engine.ts:201

Create a World in the Engine that's running the current World (ADR 0032), e.g. from a menu's "Host" button. config is a WorldConfig or the name of a bootstrap template.

Parameters

config

string | WorldConfig

Returns

WorldHandle


findWorld()

static findWorld(name): WorldHandle | null;

Defined in: src/engine/boot/Engine.ts:206

A handle on a World of the current World's Engine, by name, or null.

Parameters

name

string

Returns

WorldHandle | null

Clone this wiki locally