//#region src/core/json.d.ts /** JSON-safe value types — the only types allowed in scene files and node props. */ type JsonValue = string | number | boolean | null | JsonValue[] | JsonObject; interface JsonObject { [key: string]: JsonValue; } type JsonKind = "string" | "number" | "boolean" | "null" | "array" | "object"; declare function jsonKind(value: JsonValue): JsonKind; /** Deep structural equality over JSON values (used for delta-only serialization). */ declare function jsonEquals(a: JsonValue, b: JsonValue): boolean; /** * Deep clone of JSON-safe data (defaults must never be shared between * instances). The value must contain only JSON types. */ declare function jsonClone(value: T): T; //#endregion //#region src/core/scene/schema.d.ts /** Current scene file format version. Defaults are frozen per format version. */ declare const SCENE_FORMAT: 1; interface SceneJson { format: typeof SCENE_FORMAT; type: "scene"; name: string; dimension?: "2d" | "3d"; /** Asset declarations, keyed by stable human-readable keys referenced as `$key`. */ assets?: Record; /** * Named, reusable typed values, keyed by stable name (e.g. `{ "UI": 1000 }`). * A node prop may reference one as `{"@const": "NAME"}`; the loader replaces it * with the literal value at load (see scene/constants.ts). */ constants?: Record; /** * Translations, keyed by locale then by string key: * `{"en": {"hud.score": "Score"}, "ko": {"hud.score": "점수"}}`. * * A text prop references one as `"@t:hud.score"`. `en` is the base: a key a * locale does not declare falls back to English SILENTLY, which is the * intended outcome whenever the English is the more precise term or the * translation would not fit (see core/localization.ts). */ strings?: Record>; /** * Extra draw-order bands, as `name → base offset`, layered over the six built * in (`background -2000` … `overlay 3000`). A node's effective order is * `base(orderGroup) + renderOrder`, so a band is a NUMBER — declaring a bare * name would sort exactly like `default` and mean nothing. * * `{"orderGroups": {"ui-back": 2500}}` then `"orderGroup": "ui-back"`. * Re-declaring a built-in name re-bases it for this scene. */ orderGroups?: Record; /** Declarative input action map (loaded into Engine.input). */ input?: JsonObject; /** Physics config — `{gravity: [x,y]}` (2D px/s²) or `{gravity: [x,y,z]}` (3D m/s²). */ physics?: JsonObject; /** * This scene is a PIECE of another one — a spawner's prefab, an instanced * sub-scene — and is never rendered on its own. * * It exists because no tool can tell a prefab from a broken first level by * looking at the file: both are a small tree with no camera and no light. The * audit used to guess ("no camera means fragment") and so went silent on the * commonest beginner mistake there is. One key, written by the author who * knows, is the honest version. It changes nothing at runtime. */ fragment?: boolean; /** Multiplayer config (interpreted in M6; preserved verbatim until then). */ multiplayer?: JsonObject; /** Scene-level rendering environment (ambient light, background — interpreted by renderers). */ environment?: JsonObject; /** * Design-resolution viewport: `{design: [w, h], fit: 'expand'|'letterbox'|'integer'}`. * Author the world in fixed design px; the renderer maps them onto any canvas size. */ viewport?: JsonObject; root: NodeJson; connections?: ConnectionJson[]; } interface NodeJson { name: string; /** Optional scene-wide-unique stable id (addressable via getNodeByUid). */ uid?: string; /** Registered node type. Mutually exclusive with `instance`. */ type?: string; /** Sub-scene reference (resolved via `LoadSceneOptions.resolveScene`). */ instance?: string; /** Deep-merged onto the instanced scene root's props. Only valid with `instance`. */ overrides?: JsonObject; groups?: string[]; tags?: JsonObject; /** Delta-only: values equal to the type's schema defaults are omitted. */ props?: JsonObject; /** Behavior attachment (resolved in M5; preserved verbatim until then). */ script?: JsonObject; /** Replication config (resolved in M6; preserved verbatim until then). */ network?: JsonObject; children?: NodeJson[]; } interface ConnectionJson { signal: string; /** NodePath relative to the scene root ('.' = the root itself). */ from: string; to: string; /** Method name on the target node (or its behavior, once M5 lands). */ handler: string; once?: boolean; /** Only fire when the first emitted arg is a Node matching the filter. */ filter?: { group?: string; tag?: JsonObject; }; /** * Arguments to call the handler with, INSTEAD of whatever the signal emitted * — `Function.bind` for a wire. `phase2 → Banner.show` with * `["ENRAGED", { "color": "#ff5c5c" }]` is a line in the scene file rather * than a two-line behaviour whose whole job is one constant. */ args?: JsonValue[]; } //#endregion //#region src/core/rng.d.ts /** * Deterministic seeded PRNG (mulberry32). Game logic should draw randomness * from `engine.rng` (or `this.rng` in a Behavior) instead of `Math.random()` — * a seeded engine then replays identically, which is what makes scripted * headless verification and multiplayer-adjacent determinism possible. */ declare class Rng { private state; /** * Where this stream has got to. * * A save that cannot carry this replays the seeded sequence from the top, so * every "random" event after a load is the one the run opened with. Measured: * * ``` * continue WITHOUT save/load: rolls 10-13 = 0.2967 0.0860 0.7333 0.0400 * continue AFTER save/load : rolls 10-13 = 0.5628 0.3253 0.4690 0.8367 * ``` * * and 0.5628 is not merely different — it is the FIRST roll a fresh run of * that game makes. The state was private, so a game could not fix it either: * `serialize()` had nothing to carry. */ get position(): number; set position(value: number); constructor(seed: number); /** Next float in [0, 1). */ next(): number; /** Float in [min, max). */ range(min: number, max: number): number; /** Integer in [min, max] — inclusive of BOTH bounds. */ int(min: number, max: number): number; /** A uniformly random element. Empty arrays are a hard error. */ pick(items: readonly T[]): T; } //#endregion export { SceneJson as a, JsonValue as c, jsonKind as d, SCENE_FORMAT as i, jsonClone as l, ConnectionJson as n, JsonKind as o, NodeJson as r, JsonObject as s, Rng as t, jsonEquals as u };