Repository navigation
API Interface WorldHandle
Defined in: src/engine/core/worlds.ts:140
A handle on a World: the only cross-World API. It controls the World's lifetime and setup but never exposes its nodes, so Worlds stay isolated (ADR 0032).
readonly alive: boolean;Defined in: src/engine/core/worlds.ts:144
False from unload() (or destroy()) on. Methods on an unloaded handle throw.
readonly holdPending: boolean;Defined in: src/engine/core/worlds.ts:155
The next replacing load will hold: WorldConfig.start: "held", or a hold load still preparing.
readonly loading: boolean;Defined in: src/engine/core/worlds.ts:151
A load is in flight, from its first asset to its readiness (additive loads into a playing World included).
readonly loadProgress: LoadProgress | null;Defined in: src/engine/core/worlds.ts:157
How far the current load has come (ADR 0616): the newest replacing load's while one is in flight, else the newest additive load's; null while nothing is loading.
readonly name: string;Defined in: src/engine/core/worlds.ts:141
readonly paused: boolean;Defined in: src/engine/core/worlds.ts:159
Use state === "paused".
readonly ready: boolean;Defined in: src/engine/core/worlds.ts:153
No load is in flight and the latest reached readiness (ADR 0616). True before any load.
readonly state: "playing" | "held" | "activating" | "paused" | "unloading" | "destroyed";Defined in: src/engine/core/worlds.ts:149
What the World does (ADR 0615): only playing steps its systems, scripts and physics; held waits for
activate(), activating runs its deferred start() calls hidden, paused is stopped and silent.
readonly tags: readonly WorldTag[];Defined in: src/engine/core/worlds.ts:142
activate(): Promise<void>;Defined in: src/engine/core/worlds.ts:178
Release a held World (ADR 0615): activating runs its deferred start() calls hidden, a few milliseconds a frame,
then it plays. Resolves once it's playing.
Promise<void>
addresses(): readonly string[];Defined in: src/engine/core/worlds.ts:196
Where this World listens (ADR 0067). Empty if it doesn't.
readonly string[]
addSystem(name): void;Defined in: src/engine/core/worlds.ts:180
Add a catalog system by name. Throws for unknown names.
string
void
connect(
server,
transport,
options?
): void;Defined in: src/engine/core/worlds.ts:188
Join this World (client side) to server over a transport (ADR 0033): a World of this page,
or the address of a server elsewhere, such as a dedicated server's "ws://host:7777" (ADR 0036).
string | WorldHandle
string
Record<string, unknown>
void
destroy(): void;Defined in: src/engine/core/worlds.ts:212
void
Use unload(). Tears down at once, without the audio fade.
hasTag(tag): boolean;Defined in: src/engine/core/worlds.ts:160
boolean
listen(transport, options?): Promise<string>;Defined in: src/engine/core/worlds.ts:194
Make this World a server and listen over a transport (ADR 0067). Resolves with the address
clients connect to; rejects with a reason. Options: port, host, path, address,
maxConnections and timeouts. Throws if the World is a client.
string
Record<string, unknown>
Promise<string>
load(path, options?): Promise<void>;Defined in: src/engine/core/worlds.ts:166
Load a scene into the World (ADR 0615). Resolves at the swap, at the end of a frame. Rejects with an AbortError
when signal aborts or a later replacing load replaces it, and with a WorldUnloadedError when the World is
unloaded first. hold (replacing loads only) enters held at the swap instead of going on playing.
string
Promise<void>
loadScene(path, options?): Promise<void>;Defined in: src/engine/core/worlds.ts:168
string
boolean
Promise<void>
Use load(path, options).
onChange(listener): () => void;Defined in: src/engine/core/worlds.ts:218
Called after each change of state, loading, ready or holdPending. A state change is reported at the end of the
World's frame (at once between frames); the loading flags when a load begins or settles. A change asked for inside a
listener waits until the listeners have run. Returns the unsubscribe; listeners go when the World does.
(change) => void
() => void
pause(options?): void;Defined in: src/engine/core/worlds.ts:203
Pausing a World stops its input and UI too: for a pause menu, set Time.timeScale = 0 instead. pause() is for a
World nobody is looking at (the menu behind a match): it stops stepping, its sounds pause (faded over
audioFadeMs, default a few milliseconds), and its network stays connected (ADR 0615). Server Worlds can't pause,
and an activating World throws (await activate() first). A held World paused resumes held.
number
void
removeSystem(name): void;Defined in: src/engine/core/worlds.ts:181
string
void
resume(): void;Defined in: src/engine/core/worlds.ts:205
Undo pause(): back to playing, or to held if it was held.
void
systems(): readonly string[];Defined in: src/engine/core/worlds.ts:183
The World's systems by name, in execution order per phase.
readonly string[]
unload(): Promise<void>;Defined in: src/engine/core/worlds.ts:210
Tear the World down (ADR 0615): alive is false at once, pending loads reject, its sounds fade out; resolves once
it's destroyed. The Engine's last World can't be unloaded (dispose the Engine instead).
Promise<void>
whenReady(): Promise<void>;Defined in: src/engine/core/worlds.ts:173
Resolves when no load is pending and the latest is ready; at once if nothing is loading. Rejects if the latest load failed, or the newest replacing load did (even when a later additive load succeeded).
Promise<void>
This wiki is generated from docs/wiki/ and the myco module's source on every push to master. Change pages there in a pull request: edits made here are not kept.
Basics
Gameplay
Rendering
Audio
- Playing sound
- Why is there no sound?
- Playlists
- Interactive music
- Sound generators
- Spatial audio
- Audio mixer
- Live mixing
- Loudness
- Audio profiler
- Audio takes
Reference