Quick start
The Suity runtime has three layers:
| Layer | Package | Responsibility |
|---|---|---|
| Runtime Core | @suity/runtime (inlined into the engine package) | Scene graph, Prefab expansion, references, lifecycle, signals |
| Engine | @suity/engine-pixi | Maps scene documents to Pixi display objects; provides the component catalog and rendering |
| Modules | @suity/module-* | Actor, Tilemap and other extensions that register component handlers and renderers |
pixi.js is a peer dependency, so the app installs it itself. That guarantees the app and the scene loader share one Pixi instance.
bash
npm install pixi.js@^8.22.0 @suity/engine-pixiLoad a scene
loadSceneInstance(source, context?) accepts a scene document, an Addressable Key/uid or a URL, and returns a queryable SceneInstance:
ts
import { Application } from "pixi.js";
import { loadSceneInstance } from "@suity/engine-pixi";
const app = new Application();
await app.init({ background: "#0a0a0a", resizeTo: window });
document.body.appendChild(app.canvas);
const scene = await loadSceneInstance("scenes/main", { mutable: true });
app.stage.addChild(scene.root);
const player = scene.get("Player");
player?.container().position.set(100, 50);
app.ticker.add((ticker) => scene.update(ticker.deltaMS / 1000));Key points:
mutable: trueis required to instantiate Prefabs or remove runtime nodes; read-only scenes still support queries,updateanddestroy.- Without
context.assetsthe globalSuityAssetsSDK is used.context.catalogdefaults to the engine catalog; when modules are installed, pass the merged catalog. scene.get(ref)queries by node ref,getByUid(uid)by uid;getAll()includes expanded Prefab children.
Instantiate a Prefab at runtime
ts
const enemy = await scene.instantiatePrefab({
asset: "prefabs/enemy",
parentRef: "Enemies",
name: "Enemy1",
transform: { x: 100, y: 50 },
});Runtime instances are not written back to the scene document. For persistent edits use the editor transaction API.
Deployment builds
Dedicated builds generate suity.app.json, an asset manifest and the script bundle. The entry point is @suity/engine-pixi/app:
ts
import { createRuntimeApp } from "@suity/engine-pixi/app";
const handle = await createRuntimeApp({
mount: document.getElementById("app")!,
appConfigUrl: "/suity.app.json",
assetsManifestUrl: "/assets.manifest.json",
scripts: {
enabled: true,
manifestUrl: "/scripts/manifest.json",
bundleUrl: "/scripts/bundle.js",
},
});
// Optional runtime scene switch
handle.loadScene?.("scenes/level-2");createRuntimeApp creates the Pixi Application, resolves the boot config, initializes the audio mixer and recomputes the viewport on resize. See the App Entry API.
Next steps
- Understand scenes, nodes and components
- Write scripts
- Decouple logic with node signals
- Browse the Runtime API
