@vgai/engine 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -11
- package/package.json +10 -6
- package/schemas/engine-api.json +1 -68
- package/schemas/engine-api.md +1 -32
- package/schemas/engine-capabilities.json +30 -42
- package/schemas/{vgai-game.schema.json → vgai-project.schema.json} +52 -34
- package/src/adapter/adapter-surface.ts +5 -5
- package/src/adapter/authoring.ts +168 -226
- package/src/adapter/colyseus-networking-adapter.ts +44 -5
- package/src/adapter/first-party-systems.ts +156 -42
- package/src/adapter/host-context.ts +177 -46
- package/src/adapter/index.ts +47 -51
- package/src/adapter/ingest/game-contract.ts +2 -2
- package/src/adapter/ingest/scene-capture.ts +18 -19
- package/src/adapter/ingest/structural-ids.ts +127 -0
- package/src/adapter/ingest/upstream-pin.ts +9 -12
- package/src/adapter/loop-gate-report.ts +11 -11
- package/src/adapter/rapier-physics-adapter.ts +27 -9
- package/src/adapter/root-adapter.ts +217 -0
- package/src/adapter/{vgai-scene-game-adapter.ts → setup-three-root-adapter.ts} +173 -351
- package/src/adapter/system-adapter.ts +80 -63
- package/src/ai/navigation.ts +1 -1
- package/src/animation/animation-clock.ts +1 -1
- package/src/animation/camera-ownership.ts +1 -2
- package/src/animation/cubic-spline-interpolant.ts +132 -0
- package/src/animation/theatre-clock-binding.ts +2 -2
- package/src/animation/theatre-object-binding.ts +4 -4
- package/src/animation/xstate-animation-binding.ts +75 -5
- package/src/{scene/schema → asset-formats}/camera.ts +2 -5
- package/src/{scene/schema → asset-formats}/collider.ts +2 -5
- package/src/asset-formats/index.ts +54 -0
- package/src/{scene/schema → asset-formats}/instances.ts +10 -6
- package/src/{scene/schema → asset-formats}/light.ts +3 -6
- package/src/{scene/schema → asset-formats}/material.ts +4 -7
- package/src/{scene/schema → asset-formats}/mesh.ts +4 -7
- package/src/asset-formats/parse.ts +39 -0
- package/src/{scene/schema → asset-formats}/particles.ts +3 -6
- package/src/{scene/schema/environment.ts → asset-formats/render-env.ts} +23 -86
- package/src/{scene/schema → asset-formats}/tuples.ts +1 -1
- package/src/{scene/asset-loaders.ts → asset-loaders.ts} +8 -9
- package/src/asset-parse-error.ts +33 -0
- package/src/{scene/asset-registry.ts → asset-registry.ts} +1 -1
- package/src/assets.ts +1 -1
- package/src/audio/wav-encode.ts +9 -9
- package/src/canvas-react/engine-bridge.ts +59 -0
- package/src/canvas-react/index.ts +50 -0
- package/src/canvas-react/pixi-primitive.tsx +202 -0
- package/src/canvas-react/pixi-react-adapter.tsx +290 -0
- package/src/canvas-react/pixi-react-root-factory.tsx +88 -0
- package/src/canvas-react/world-context.ts +328 -0
- package/src/core/frame-pacing.ts +100 -0
- package/src/core/game-loop.ts +50 -28
- package/src/core/seeded-random.ts +7 -7
- package/src/core/sim-clock.ts +388 -0
- package/src/core/system-runner.ts +17 -63
- package/src/core/types.ts +34 -15
- package/src/data/data-asset.ts +3 -3
- package/src/data/data-check-core.ts +6 -7
- package/src/data/data-ref.ts +11 -11
- package/src/data/vite-plugin-data.ts +10 -10
- package/src/{scene/defaults.ts → defaults.ts} +18 -40
- package/src/dev/render-debug-adapter.ts +1 -1
- package/src/dev/webgl-frame-capture.ts +1 -1
- package/src/ecs/scene-index.ts +439 -0
- package/src/ecs/scene-query.ts +43 -0
- package/src/{scene → ecs}/user-data.ts +17 -36
- package/src/index.ts +7 -9
- package/src/input/input-manager.ts +29 -32
- package/src/input/input-types.ts +2 -2
- package/src/input/schema.ts +5 -5
- package/src/loader.ts +57 -0
- package/src/manifest/editor-port.ts +69 -0
- package/src/manifest/filename.ts +49 -0
- package/src/manifest/index.ts +8 -2
- package/src/manifest/load-file.ts +11 -0
- package/src/manifest/load.ts +65 -77
- package/src/manifest/locate.ts +55 -0
- package/src/manifest/schema.ts +400 -233
- package/src/{scene → physics}/collider-dimensions.ts +3 -3
- package/src/physics/physics-registry.ts +1 -1
- package/src/{world2d/authoring-2d.ts → pixi/authoring.ts} +24 -11
- package/src/pixi/index.ts +43 -0
- package/src/{world2d/ingest-iframe-2d.ts → pixi/ingest-iframe.ts} +9 -9
- package/src/{world2d/ingest2d.ts → pixi/ingest.ts} +28 -28
- package/src/{world2d/physics2d-registry.ts → pixi/physics-registry.ts} +1 -1
- package/src/{world2d/scene-capture-2d.ts → pixi/scene-capture.ts} +3 -3
- package/src/{world2d/system-adapters-2d.ts → pixi/system-adapters.ts} +2 -2
- package/src/react/unmanaged-root-detector.ts +26 -1
- package/src/react/use-data.ts +5 -5
- package/src/react/use-selection.tsx +15 -42
- package/src/react/{game-state.tsx → world-state.tsx} +44 -46
- package/src/render/auto-batcher.ts +1 -2
- package/src/{scene → render}/instance-mesh.ts +1 -1
- package/src/{scene → render}/light-camera-factory.ts +14 -13
- package/src/render/lod.ts +17 -0
- package/src/{scene → render}/material-factory.ts +8 -7
- package/src/{scene → render}/particles-factory.ts +62 -12
- package/src/render/render-batch-system.ts +14 -41
- package/src/render/render-features.ts +1 -1
- package/src/render/render-settings.ts +1 -2
- package/src/render/spark-renderer-lifecycle.ts +1 -1
- package/src/runtime/create-runtime.ts +352 -463
- package/src/runtime/debug-bridge.ts +148 -93
- package/src/runtime/debug-registry.ts +79 -54
- package/src/runtime/dev-layers.ts +40 -0
- package/src/runtime/frame-selector-cache.ts +4 -4
- package/src/runtime/game.ts +618 -369
- package/src/runtime/gameplay-rng-trap.ts +6 -7
- package/src/runtime/input-router.ts +11 -11
- package/src/runtime/mount-game.ts +54 -55
- package/src/runtime/mount-manifest.ts +154 -150
- package/src/runtime/presentation.ts +141 -0
- package/src/runtime/render-audio-control.ts +64 -53
- package/src/runtime/render-control.ts +45 -51
- package/src/runtime/render-seed.ts +3 -4
- package/src/runtime/state-bridge.ts +17 -18
- package/src/runtime/types.ts +94 -61
- package/src/setup/setup-renderer.ts +11 -6
- package/src/world3d-react/engine-bridge.ts +46 -33
- package/src/world3d-react/index.ts +31 -26
- package/src/world3d-react/r3f-adapter.tsx +211 -96
- package/src/world3d-react/r3f-root-factory.tsx +91 -0
- package/src/world3d-react/renderer-config.ts +137 -0
- package/src/world3d-react/world-context.ts +141 -111
- package/schemas/entity2d.schema.json +0 -468
- package/schemas/prefab.schema.json +0 -9992
- package/schemas/scn2d.schema.json +0 -494
- package/schemas/vscn.schema.json +0 -10851
- package/src/adapter/game-adapter.ts +0 -164
- package/src/adapter/ingest/overlay-applier.ts +0 -207
- package/src/adapter/ingest/overlay-apply.ts +0 -168
- package/src/adapter/ingest/overlay-file.ts +0 -126
- package/src/adapter/ingest/overlay-report.ts +0 -176
- package/src/animation/gsap-registration.ts +0 -184
- package/src/audio/audio-introspection.ts +0 -290
- package/src/audio/index.ts +0 -39
- package/src/audio/tone-clock-binding.ts +0 -98
- package/src/audio/tone-context.ts +0 -175
- package/src/audio/tone-offline-render.ts +0 -167
- package/src/ecs/component-manager.ts +0 -814
- package/src/ecs/game-component.ts +0 -260
- package/src/ecs/hmr-swap-report.ts +0 -65
- package/src/physics/trigger-dispatch.ts +0 -97
- package/src/react/root-adapter.tsx +0 -49
- package/src/scene/asset-paths.ts +0 -121
- package/src/scene/asset-ref-check.ts +0 -248
- package/src/scene/component-registry.ts +0 -51
- package/src/scene/parse.ts +0 -204
- package/src/scene/scene-apply.ts +0 -407
- package/src/scene/scene-diff-schema.ts +0 -115
- package/src/scene/scene-diff-types.ts +0 -29
- package/src/scene/scene-loader.ts +0 -1526
- package/src/scene/scene-query.ts +0 -63
- package/src/scene/scene-types.ts +0 -33
- package/src/scene/scene-version.ts +0 -40
- package/src/scene/schema/animation.ts +0 -46
- package/src/scene/schema/audio.ts +0 -25
- package/src/scene/schema/entity-ref.ts +0 -78
- package/src/scene/schema/entity.ts +0 -189
- package/src/scene/schema/index.ts +0 -51
- package/src/scene/schema/joint.ts +0 -26
- package/src/scene/schema/physics.ts +0 -49
- package/src/scene/schema/scene-file.ts +0 -292
- package/src/scene/schema/shadow.ts +0 -24
- package/src/scene/schema/spline.ts +0 -21
- package/src/world2d/asset-paths2d.ts +0 -44
- package/src/world2d/capture-to-scene2d.ts +0 -52
- package/src/world2d/collision-2d.ts +0 -99
- package/src/world2d/entity2d-asset.ts +0 -22
- package/src/world2d/index.ts +0 -91
- package/src/world2d/physics2d-transform.ts +0 -173
- package/src/world2d/physics2d-units.ts +0 -10
- package/src/world2d/pixi-game-adapter.ts +0 -439
- package/src/world2d/pixi-surface.ts +0 -78
- package/src/world2d/scene2d-identity.ts +0 -49
- package/src/world2d/scene2d-loader.ts +0 -433
- package/src/world2d/schema/entity2d.ts +0 -163
- package/src/world2d/schema/physics2d.ts +0 -64
- package/src/world2d/schema/sprite.ts +0 -99
- package/src/world2d/schema/tilemap.ts +0 -39
- package/src/world2d/schema/tuples2d.ts +0 -25
- package/src/world2d/transform-writer-2d.ts +0 -42
- package/src/world2d/types.ts +0 -74
- package/src/world3d-react/behavior.tsx +0 -146
- /package/src/{scene → render}/mesh-shadow.ts +0 -0
package/src/manifest/schema.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
// T3.1 slice 1 — the game manifest schema (`vgai.
|
|
1
|
+
// T3.1 slice 1 — the game manifest schema (`vgai.project.json`).
|
|
2
2
|
//
|
|
3
|
-
// This is the serialized form of the Game's root list
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
// `scripts/generate-schema.ts` and the T4.1 schema-walk coverage test).
|
|
3
|
+
// This is the serialized form of the Game's root list for the adjudicated
|
|
4
|
+
// field list this file implements exactly. `load.ts` is this schema's runtime
|
|
5
|
+
// reader (T4.1 policy): it parses via this schema, then layers the
|
|
6
|
+
// cross-field checks and default resolution §3/§5 describe. Every field below
|
|
7
|
+
// has a `.describe()` (repo policy — powers `scripts/generate-schema.ts` and
|
|
8
|
+
// the T4.1 schema-walk coverage test).
|
|
10
9
|
//
|
|
11
10
|
// Naming: this file follows the repo's `XxxSchema` (Zod schema) / `Xxx`
|
|
12
11
|
// (inferred type) convention used throughout `scene/schema/` — the design
|
|
@@ -18,19 +17,19 @@
|
|
|
18
17
|
// inferred types, matching every other schema file in the repo.
|
|
19
18
|
//
|
|
20
19
|
// Adapter surface values mirror `AdapterSurface` in
|
|
21
|
-
// `packages/engine/src/runtime/game.ts` (`'
|
|
20
|
+
// `packages/engine/src/runtime/game.ts` (`'three' | 'canvas' | 'dom'`)
|
|
22
21
|
// by value, not by import. The adapter remains the sole root discriminator.
|
|
23
22
|
|
|
24
23
|
import { z } from 'zod';
|
|
25
24
|
|
|
26
25
|
/**
|
|
27
|
-
* Current on-disk `vgai.
|
|
26
|
+
* Current on-disk `vgai.project.json` format. Exported so editor/server
|
|
28
27
|
* compatibility checks do not duplicate the schema's literal value.
|
|
29
28
|
*/
|
|
30
29
|
export const GAME_MANIFEST_VERSION = 2 as const;
|
|
31
30
|
|
|
32
31
|
// ---------------------------------------------------------------------------
|
|
33
|
-
// Ingest capture strategy (
|
|
32
|
+
// Ingest capture strategy (the general vocabulary D6/§4 names)
|
|
34
33
|
// ---------------------------------------------------------------------------
|
|
35
34
|
|
|
36
35
|
export const IngestStrategySchema = z.enum([
|
|
@@ -60,191 +59,279 @@ export type Tier = z.infer<typeof TierSchema>;
|
|
|
60
59
|
// repeats its rendering substrate in a sibling `kind` field. Module and ingest
|
|
61
60
|
// adapters carry the surface their adapter contract exposes because the host
|
|
62
61
|
// must allocate a layer before the module has mounted.
|
|
62
|
+
//
|
|
63
|
+
// The surface vocabulary is `three | canvas | dom` — what the HOST HANDS the
|
|
64
|
+
// root, not which library it uses. `canvas` and `dom` are platform primitives:
|
|
65
|
+
// a canvas root may be Pixi, Phaser, Babylon, raw WebGL/WebGPU or a 2D context,
|
|
66
|
+
// and a dom root may be React, Vue, Svelte or plain HTML, all through the
|
|
67
|
+
// identical host. The former `canvas`/`react` named two libraries in a seam
|
|
68
|
+
// that has nothing to do with either, which foreclosed the rest by
|
|
69
|
+
// construction.
|
|
70
|
+
//
|
|
71
|
+
// All three surfaces are legal as a BARE adapter string: each names a root the
|
|
72
|
+
// engine itself mounts from an `entry` module — `three` through the R3F lane
|
|
73
|
+
// (`@engine/world3d-react`), `canvas` through the Pixi lane
|
|
74
|
+
// (`@engine/canvas-react`), `dom` through the React lane. In every case the
|
|
75
|
+
// entry's document is its own TSX source. A root the engine does NOT mount
|
|
76
|
+
// arrives as an `{ ingest }` root or a `{ module }` adapter the project
|
|
77
|
+
// supplies, both of which name their `surface` explicitly.
|
|
78
|
+
//
|
|
79
|
+
// `three` earns a kind of its own because the host must provide something the
|
|
80
|
+
// platform cannot: the ONE shared `three` instance (identity matters — ingest
|
|
81
|
+
// games bring their own, and r3f depends on dedupe). React needs no equivalent,
|
|
82
|
+
// which is exactly why react is a `dom` root rather than its own kind.
|
|
83
|
+
//
|
|
84
|
+
// The pre-rename spellings `threejs`/`pixijs`/`react` are REMOVED, not
|
|
85
|
+
// normalized (WO-LR1 item 2, the legacy-removal doctrine at
|
|
86
|
+
// ARCHITECTURE-CORE §Vocabulary). Normalization was a second way to say the
|
|
87
|
+
// same thing: two spellings both parsed, so both kept being written, and
|
|
88
|
+
// SECOND readers grew (the dev server's surface probe, the hosted-editor
|
|
89
|
+
// bundler's alias sets) each re-implementing the same map. A manifest naming
|
|
90
|
+
// an old spelling now fails to parse with an issue that names the canonical
|
|
91
|
+
// value and the exact one-line edit.
|
|
63
92
|
// ---------------------------------------------------------------------------
|
|
64
93
|
|
|
94
|
+
/** Removed spellings → the canonical value each one must be rewritten to. */
|
|
95
|
+
const REMOVED_SURFACE_SPELLING: Readonly<Record<string, 'three' | 'canvas' | 'dom'>> = {
|
|
96
|
+
threejs: 'three',
|
|
97
|
+
pixijs: 'canvas',
|
|
98
|
+
react: 'dom',
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/** Removed spellings legal as a BARE adapter (a root the engine itself mounts). */
|
|
102
|
+
const REMOVED_BARE_ADAPTER_SPELLING: Readonly<Record<string, 'three' | 'canvas' | 'dom'>> = {
|
|
103
|
+
threejs: 'three',
|
|
104
|
+
pixijs: 'canvas',
|
|
105
|
+
react: 'dom',
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
function removedSpellingMessage(bad: string, where: 'adapter' | 'adapter.surface'): string {
|
|
109
|
+
const canonical =
|
|
110
|
+
where === 'adapter' ? REMOVED_BARE_ADAPTER_SPELLING[bad] : REMOVED_SURFACE_SPELLING[bad];
|
|
111
|
+
return (
|
|
112
|
+
`Game manifest: \`${where}\`: "${bad}" — that spelling was REMOVED (WO-LR1; ` +
|
|
113
|
+
'ARCHITECTURE-CORE §Vocabulary). The surface vocabulary is ' +
|
|
114
|
+
"'three' | 'canvas' | 'dom' — what the HOST HANDS the root, never which " +
|
|
115
|
+
`library it uses.\nFix: change \`${where}\` to "${canonical}".`
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** Reject a removed surface spelling wherever one may appear — the bare
|
|
120
|
+
* shorthand, or the `surface` field of a module/ingest adapter — with an issue
|
|
121
|
+
* naming the canonical value. Runs as a Zod preprocess so the message wins
|
|
122
|
+
* over the union's generic discriminant error. */
|
|
123
|
+
function rejectRemovedRootAdapterSpelling(value: unknown, ctx: z.core.$RefinementCtx): unknown {
|
|
124
|
+
if (typeof value === 'string' && REMOVED_BARE_ADAPTER_SPELLING[value]) {
|
|
125
|
+
ctx.addIssue({ code: 'custom', message: removedSpellingMessage(value, 'adapter') });
|
|
126
|
+
return z.NEVER;
|
|
127
|
+
}
|
|
128
|
+
if (value && typeof value === 'object' && 'surface' in value) {
|
|
129
|
+
const surface = (value as { surface?: unknown }).surface;
|
|
130
|
+
if (typeof surface === 'string' && REMOVED_SURFACE_SPELLING[surface]) {
|
|
131
|
+
ctx.addIssue({
|
|
132
|
+
code: 'custom',
|
|
133
|
+
message: removedSpellingMessage(surface, 'adapter.surface'),
|
|
134
|
+
});
|
|
135
|
+
return z.NEVER;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return value;
|
|
139
|
+
}
|
|
140
|
+
|
|
65
141
|
export const RootAdapterSchema = z
|
|
66
|
-
.
|
|
67
|
-
|
|
68
|
-
z
|
|
69
|
-
.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
.string()
|
|
90
|
-
.optional()
|
|
91
|
-
.describe(
|
|
92
|
-
'Entry HTML path, project-relative. WIRED for opaque-embed (D-W2, ' +
|
|
93
|
-
'docs/WAVE4-FTUE-HARDENING-DESIGN.md): the file`s bytes are read verbatim through ' +
|
|
94
|
-
'the project-static route and hosted in a sandboxed iframe (embed-only, no scene ' +
|
|
95
|
-
'introspection), for both pixijs and threejs roots. Legal but NOT wired to a ' +
|
|
96
|
-
'mount for iframe-reachable (a named error at resolve names this — use `bundleUrl` ' +
|
|
97
|
-
'instead, the wired reachable route).',
|
|
142
|
+
.preprocess(
|
|
143
|
+
rejectRemovedRootAdapterSpelling,
|
|
144
|
+
z.union([
|
|
145
|
+
z.enum(['three', 'canvas', 'dom']),
|
|
146
|
+
z
|
|
147
|
+
.object({
|
|
148
|
+
module: z
|
|
149
|
+
.string()
|
|
150
|
+
.describe('Game-folder-relative path to a custom adapter module (trust boundary)'),
|
|
151
|
+
surface: z
|
|
152
|
+
.enum(['three', 'canvas', 'dom'])
|
|
153
|
+
.describe('Native surface exposed by this custom adapter contract'),
|
|
154
|
+
})
|
|
155
|
+
.strict(),
|
|
156
|
+
z
|
|
157
|
+
.object({
|
|
158
|
+
surface: z
|
|
159
|
+
.enum(['three', 'canvas', 'dom'])
|
|
160
|
+
.describe('Native surface captured from the unmodified game'),
|
|
161
|
+
ingest: z
|
|
162
|
+
.object({
|
|
163
|
+
strategy: IngestStrategySchema.describe(
|
|
164
|
+
'Capture mechanics rung this ingested root uses (§4) — also the root`s natural local capability tier',
|
|
98
165
|
),
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
'
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
"
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
'
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
166
|
+
entryHtml: z
|
|
167
|
+
.string()
|
|
168
|
+
.optional()
|
|
169
|
+
.describe(
|
|
170
|
+
'Entry HTML path, project-relative. WIRED for opaque-embed (D-W2): ' +
|
|
171
|
+
'the file`s bytes are read verbatim through ' +
|
|
172
|
+
'the project-static route and hosted in a sandboxed iframe (embed-only, no scene ' +
|
|
173
|
+
'introspection), for both canvas and three roots. Legal but NOT wired to a ' +
|
|
174
|
+
'mount for iframe-reachable (a named error at resolve names this — use `bundleUrl` ' +
|
|
175
|
+
'instead, the wired reachable route).',
|
|
176
|
+
),
|
|
177
|
+
assets: z
|
|
178
|
+
.record(z.string(), z.string())
|
|
179
|
+
.optional()
|
|
180
|
+
.describe(
|
|
181
|
+
'Path-substring -> served-URL rewrites for this ingested game (IngestGame.assets today)',
|
|
182
|
+
),
|
|
183
|
+
domStubs: z
|
|
184
|
+
.array(z.string())
|
|
185
|
+
.optional()
|
|
186
|
+
.describe(
|
|
187
|
+
'DOM API stub ids this ingested game requires to run headlessly/in-realm',
|
|
188
|
+
),
|
|
189
|
+
captureTimeoutMs: z
|
|
190
|
+
.number()
|
|
191
|
+
.optional()
|
|
192
|
+
.describe(
|
|
193
|
+
'How long to wait for capture before REPORTING the degrade loudly — not how ' +
|
|
194
|
+
'long to keep listening. On the self-hosted-three route the devtools ' +
|
|
195
|
+
'subscription is permanent, so a renderer appearing later still upgrades a ' +
|
|
196
|
+
'reported-embed-only mount in place; the host clamps this value so a long ' +
|
|
197
|
+
'one cannot block the editor on a question the upgrade path answers anyway.',
|
|
198
|
+
),
|
|
199
|
+
// The six iframe-reachable-multi mount fields
|
|
200
|
+
// (`ingest-iframe-2d.ts`'s `IframeReachableMultiOpts`), legal
|
|
201
|
+
// ONLY when `strategy` is 'iframe-reachable' (enforced by the
|
|
202
|
+
// `.superRefine` below).
|
|
203
|
+
bundleUrl: z
|
|
204
|
+
.string()
|
|
205
|
+
.optional()
|
|
206
|
+
.describe(
|
|
207
|
+
'Absolute URL of the externalized built game bundle — the WIRED iframe-reachable ' +
|
|
208
|
+
'mount route (iframe-reachable only), for BOTH canvas (Track P, ' +
|
|
209
|
+
"ingest-iframe-2d.ts's mountIngestGame2DIframeReachableMulti) and three (D-W1, " +
|
|
210
|
+
"ingest-iframe-reachable-adapter.ts's mountIngestGameIframeReachableBundle). " +
|
|
211
|
+
'PRECONDITION: the bundle must externalize its root`s own runtime as a bare, ' +
|
|
212
|
+
'un-rewritten import (`pixi.js` for canvas, `three` for three — `vgai bundle` ' +
|
|
213
|
+
'does this for you) so it resolves through the iframe importmap to the HOST ' +
|
|
214
|
+
'instance the capture trap is installed on; a bundle with an inlined runtime is ' +
|
|
215
|
+
'unreachable and degrades to the embed-only floor. Exactly one of bundleUrl/' +
|
|
216
|
+
'entryHtml is required when strategy is iframe-reachable.',
|
|
217
|
+
),
|
|
218
|
+
baseHref: z
|
|
219
|
+
.string()
|
|
220
|
+
.optional()
|
|
221
|
+
.describe(
|
|
222
|
+
"Iframe <base href> so the game's relative asset URLs resolve (iframe-reachable only).",
|
|
223
|
+
),
|
|
224
|
+
assetBaseUrl: z
|
|
225
|
+
.string()
|
|
226
|
+
.optional()
|
|
227
|
+
.describe(
|
|
228
|
+
"Host-side basePath forced onto the trapped runtime's own asset resolution — " +
|
|
229
|
+
"pixi's `Assets.init` for a canvas root, three's " +
|
|
230
|
+
'`DefaultLoadingManager.setURLModifier` for a three root (D-W1) — absolute, or ' +
|
|
231
|
+
"root-relative (resolved against the editor page's own origin at mount time, " +
|
|
232
|
+
'ingest-mode.ts, so a static manifest never has to know the dev-server port) ' +
|
|
233
|
+
'(iframe-reachable only — a document.write iframe keeps the parent window.location).',
|
|
234
|
+
),
|
|
235
|
+
extraDeps: z
|
|
236
|
+
.array(z.string())
|
|
237
|
+
.optional()
|
|
238
|
+
.describe(
|
|
239
|
+
"Bare specifiers of this root's externalized deps beyond its own runtime " +
|
|
240
|
+
"(pixi.js/three — e.g. '@pixi/sound', 'gsap'). Resolved by the editor's " +
|
|
241
|
+
'host-namespace registry into module namespaces when known (D-P1 — the manifest ' +
|
|
242
|
+
'carries data, not code); an unregistered specifier falls back to the open ' +
|
|
243
|
+
"project's own node_modules (D-Z3), served " +
|
|
244
|
+
'as a verbatim iframe importmap URL. Throws a named error if neither resolves it ' +
|
|
245
|
+
'(iframe-reachable only).',
|
|
246
|
+
),
|
|
247
|
+
pixiModuleUrl: z
|
|
248
|
+
.string()
|
|
249
|
+
.optional()
|
|
250
|
+
.describe(
|
|
251
|
+
'PIXI-ONLY: standalone matching-major pixi ESM URL to trap instead of the host ' +
|
|
252
|
+
"pixi, for version-skewed games (e.g. a v6 game on a v8 host); this field's " +
|
|
253
|
+
'PRESENCE is how the skew is expressed (D-P2 — no separate strategy/tier for ' +
|
|
254
|
+
'version skew) (iframe-reachable only). Declaring this on a `kind: "three"` ' +
|
|
255
|
+
'root is schema-legal (this field is kind-agnostic here) but throws a NAMED ' +
|
|
256
|
+
'not-supported error at resolve — three has no version-skew mount this wave ' +
|
|
257
|
+
'(D-W7: a hypothetical `threeModuleUrl` is explicitly parked, no consumer ' +
|
|
258
|
+
'exists).',
|
|
259
|
+
),
|
|
260
|
+
bodyHtml: z
|
|
261
|
+
.string()
|
|
262
|
+
.optional()
|
|
263
|
+
.describe(
|
|
264
|
+
'HTML injected into the iframe body before the game script boots (e.g. a ' +
|
|
265
|
+
'`<div id="game-root">` the game expects to find) (iframe-reachable only).',
|
|
266
|
+
),
|
|
267
|
+
})
|
|
268
|
+
.describe(
|
|
269
|
+
'Ingest adapter configuration for an unmodified game (a repo-vendored game or your ' +
|
|
270
|
+
'own external folder)',
|
|
271
|
+
)
|
|
272
|
+
.superRefine((ingest, ctx) => {
|
|
273
|
+
// The six iframe-reachable-multi fields only make sense for the
|
|
274
|
+
// iframe-reachable-multi mount — reject them under any other
|
|
275
|
+
// strategy (mirrors ui.ts's dead-field-under-wrong-variant pattern).
|
|
276
|
+
const iframeOnlyFields: ReadonlyArray<
|
|
277
|
+
readonly [
|
|
278
|
+
key:
|
|
279
|
+
| 'bundleUrl'
|
|
280
|
+
| 'baseHref'
|
|
281
|
+
| 'assetBaseUrl'
|
|
282
|
+
| 'extraDeps'
|
|
283
|
+
| 'pixiModuleUrl'
|
|
284
|
+
| 'bodyHtml',
|
|
285
|
+
present: boolean,
|
|
286
|
+
]
|
|
287
|
+
> = [
|
|
288
|
+
['bundleUrl', ingest.bundleUrl !== undefined],
|
|
289
|
+
['baseHref', ingest.baseHref !== undefined],
|
|
290
|
+
['assetBaseUrl', ingest.assetBaseUrl !== undefined],
|
|
291
|
+
['extraDeps', ingest.extraDeps !== undefined],
|
|
292
|
+
['pixiModuleUrl', ingest.pixiModuleUrl !== undefined],
|
|
293
|
+
['bodyHtml', ingest.bodyHtml !== undefined],
|
|
294
|
+
];
|
|
295
|
+
if (ingest.strategy !== 'iframe-reachable') {
|
|
296
|
+
for (const [key, present] of iframeOnlyFields) {
|
|
297
|
+
if (present) {
|
|
298
|
+
ctx.addIssue({
|
|
299
|
+
code: z.ZodIssueCode.custom,
|
|
300
|
+
message:
|
|
301
|
+
`\`${key}\` is only legal when strategy is 'iframe-reachable' (got ` +
|
|
302
|
+
`"${ingest.strategy}") — bundleUrl/baseHref/assetBaseUrl/extraDeps/` +
|
|
303
|
+
"pixiModuleUrl/bodyHtml are the iframe-reachable-multi mount's options " +
|
|
304
|
+
'(canvas: ingest-iframe-2d.ts IframeReachableMultiOpts; three, D-W1: ' +
|
|
305
|
+
'ingest-iframe-reachable-adapter.ts IframeReachableBundleOpts) and have no ' +
|
|
306
|
+
'meaning under any other strategy.',
|
|
307
|
+
path: [key],
|
|
308
|
+
});
|
|
309
|
+
}
|
|
225
310
|
}
|
|
311
|
+
return;
|
|
226
312
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
])
|
|
313
|
+
const hasBundleUrl = ingest.bundleUrl !== undefined;
|
|
314
|
+
const hasEntryHtml = ingest.entryHtml !== undefined;
|
|
315
|
+
if (hasBundleUrl === hasEntryHtml) {
|
|
316
|
+
ctx.addIssue({
|
|
317
|
+
code: z.ZodIssueCode.custom,
|
|
318
|
+
message:
|
|
319
|
+
"strategy 'iframe-reachable' requires EXACTLY ONE of `bundleUrl` (externalized " +
|
|
320
|
+
'multi-file bundle, the iframe-reachable-multi mount) or `entryHtml` (single-' +
|
|
321
|
+
`file/legacy iframe entry) — ${hasBundleUrl ? 'both are present' : 'neither is present'}.`,
|
|
322
|
+
path: hasBundleUrl ? ['bundleUrl'] : ['entryHtml'],
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
}),
|
|
326
|
+
})
|
|
327
|
+
.strict(),
|
|
328
|
+
]),
|
|
329
|
+
)
|
|
245
330
|
.describe(
|
|
246
|
-
"Root adapter identity: built-in '
|
|
247
|
-
|
|
331
|
+
"Root adapter identity: built-in 'three'/'canvas'/'dom' (what the host hands " +
|
|
332
|
+
"the root — 'canvas' covers Pixi/Phaser/Babylon/raw WebGL, 'dom' covers " +
|
|
333
|
+
'React/Vue/plain HTML), a custom { module, surface } adapter, or an ' +
|
|
334
|
+
'{ ingest, surface } adapter for an unmodified game.',
|
|
248
335
|
);
|
|
249
336
|
export type RootAdapter = z.infer<typeof RootAdapterSchema>;
|
|
250
337
|
|
|
@@ -269,27 +356,35 @@ export const AdapterRootSchema = z
|
|
|
269
356
|
adapter: RootAdapterSchema.describe(
|
|
270
357
|
"This root's adapter and sole rendering/lifecycle discriminator",
|
|
271
358
|
),
|
|
272
|
-
scene: z
|
|
273
|
-
.string()
|
|
274
|
-
.optional()
|
|
275
|
-
.describe(
|
|
276
|
-
'.vscn.json / .scn2d.json scene path (default adapters only — ingest adapters keep their own formats)',
|
|
277
|
-
),
|
|
278
359
|
entry: z
|
|
279
360
|
.string()
|
|
280
361
|
.optional()
|
|
281
362
|
.describe(
|
|
282
|
-
|
|
363
|
+
'Module exporting a world root — a TSX/R3F component or a setup()/adapter (three), or a ' +
|
|
364
|
+
'React component (dom). Required for every built-in adapter root.',
|
|
283
365
|
),
|
|
284
366
|
zOrder: z
|
|
285
367
|
.number()
|
|
286
368
|
.int()
|
|
287
369
|
.default(0)
|
|
288
|
-
.describe('Canvas stacking order
|
|
370
|
+
.describe('Canvas stacking order; ties broken by array order'),
|
|
289
371
|
pausable: z
|
|
290
372
|
.boolean()
|
|
291
373
|
.default(true)
|
|
292
374
|
.describe('Whether play-mode pause/step applies to this root'),
|
|
375
|
+
dev: z
|
|
376
|
+
.boolean()
|
|
377
|
+
.default(false)
|
|
378
|
+
.describe(
|
|
379
|
+
"Marks this root as a DEV LAYER: the game's own dev GUI, not shipped game content. " +
|
|
380
|
+
'Four readers act on it. `mountManifestRoots` mounts it only when dev layers are ' +
|
|
381
|
+
'enabled (`devLayersEnabled`, runtime/dev-layers.ts), so a production build carries ' +
|
|
382
|
+
'no dev GUI; the host stacks every dev root ABOVE every non-dev root (a dev layer ' +
|
|
383
|
+
'sits topmost, and as a DOM layer it steals no input from the game while closed); ' +
|
|
384
|
+
'the play compositor EXCLUDES dev layers from a capture unless the capture asks for ' +
|
|
385
|
+
'them; and the editor mounts a dev root as edit-time CHROME rather than authorable ' +
|
|
386
|
+
'content (no hierarchy entry, no OID stamping, no JSX write-back, not selectable).',
|
|
387
|
+
),
|
|
293
388
|
loop: z
|
|
294
389
|
.enum(['gated', 'self-driven'])
|
|
295
390
|
.default('gated')
|
|
@@ -315,8 +410,20 @@ export const AdapterRootSchema = z
|
|
|
315
410
|
.strict();
|
|
316
411
|
export type AdapterRoot = z.infer<typeof AdapterRootSchema>;
|
|
317
412
|
|
|
413
|
+
/**
|
|
414
|
+
* The MEDIUM a root occupies — its surface, i.e. what the host hands it. A
|
|
415
|
+
* bare adapter string names its own surface; `{ module, surface }` and
|
|
416
|
+
* `{ ingest, surface }` name it explicitly. Bucketing by surface is what makes
|
|
417
|
+
* a first-party `@pixi/react` world, an ingested canvas game and a custom
|
|
418
|
+
* canvas module ONE medium: they all compete for the same canvas surface, and
|
|
419
|
+
* which library draws on it is not what the rule below is about.
|
|
420
|
+
*/
|
|
421
|
+
function rootMedium(root: AdapterRoot): 'three' | 'canvas' | 'dom' {
|
|
422
|
+
return typeof root.adapter === 'string' ? root.adapter : root.adapter.surface;
|
|
423
|
+
}
|
|
424
|
+
|
|
318
425
|
// ---------------------------------------------------------------------------
|
|
319
|
-
// Learn metadata (FT-5
|
|
426
|
+
// Learn metadata (FT-5)
|
|
320
427
|
// ---------------------------------------------------------------------------
|
|
321
428
|
|
|
322
429
|
export const LearnKindSchema = z
|
|
@@ -367,14 +474,14 @@ export const LearnMetadataSchema = z
|
|
|
367
474
|
})
|
|
368
475
|
.strict()
|
|
369
476
|
.describe(
|
|
370
|
-
'Learner-facing metadata (FT-5
|
|
477
|
+
'Learner-facing metadata (FT-5) — powers the example ' +
|
|
371
478
|
'gallery, New Project wizard, and Learn-site catalog. Registries are generated from this ' +
|
|
372
479
|
'block; there is no parallel hand-edited catalog.',
|
|
373
480
|
);
|
|
374
481
|
export type LearnMetadata = z.infer<typeof LearnMetadataSchema>;
|
|
375
482
|
|
|
376
483
|
// ---------------------------------------------------------------------------
|
|
377
|
-
// Game manifest (vgai.
|
|
484
|
+
// Game manifest (vgai.project.json)
|
|
378
485
|
// ---------------------------------------------------------------------------
|
|
379
486
|
|
|
380
487
|
export const GameManifestSchema = z
|
|
@@ -391,13 +498,6 @@ export const GameManifestSchema = z
|
|
|
391
498
|
.string()
|
|
392
499
|
.optional()
|
|
393
500
|
.describe('Stable reverse-domain application id used by packaged targets'),
|
|
394
|
-
editorPort: z
|
|
395
|
-
.number()
|
|
396
|
-
.int()
|
|
397
|
-
.min(1024)
|
|
398
|
-
.max(65535)
|
|
399
|
-
.optional()
|
|
400
|
-
.describe('Stable preferred local editor port; launchers may fall forward when occupied'),
|
|
401
501
|
version: z.string().describe("The game's own version (used for orphan detection)"),
|
|
402
502
|
engine: z
|
|
403
503
|
.object({
|
|
@@ -413,31 +513,74 @@ export const GameManifestSchema = z
|
|
|
413
513
|
.array(AdapterRootSchema)
|
|
414
514
|
.min(1)
|
|
415
515
|
.superRefine((roots, ctx) => {
|
|
416
|
-
// D-V6 (
|
|
417
|
-
//
|
|
418
|
-
//
|
|
419
|
-
//
|
|
420
|
-
//
|
|
421
|
-
//
|
|
422
|
-
//
|
|
423
|
-
//
|
|
424
|
-
// silently-permitted duplicate would have two roots silently share
|
|
425
|
-
// one overlay.
|
|
516
|
+
// D-V6 (debt): root ids are described as unique above but that was
|
|
517
|
+
// describe-only at the SCHEMA level — only load.ts's loader-level
|
|
518
|
+
// cross-field check caught a collision, so any OTHER consumer of this
|
|
519
|
+
// schema (the generated JSON Schema, editor tooling) saw duplicate
|
|
520
|
+
// ids as legal. Enforced HERE instead, naming every colliding id (not
|
|
521
|
+
// just the first found) — a root id is the key every per-world editor
|
|
522
|
+
// surface is addressed by, so a silently-permitted duplicate would
|
|
523
|
+
// have two roots silently collide.
|
|
426
524
|
const counts = new Map<string, number>();
|
|
427
525
|
for (const root of roots) counts.set(root.id, (counts.get(root.id) ?? 0) + 1);
|
|
428
526
|
const duplicates = [...counts.entries()].filter(([, n]) => n > 1).map(([id]) => id);
|
|
429
|
-
if (duplicates.length
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
527
|
+
if (duplicates.length > 0) {
|
|
528
|
+
const idsText = duplicates.map((id) => `"${id}"`).join(', ');
|
|
529
|
+
ctx.addIssue({
|
|
530
|
+
code: z.ZodIssueCode.custom,
|
|
531
|
+
message:
|
|
532
|
+
duplicates.length === 1
|
|
533
|
+
? `Game manifest: duplicate root id ${idsText} — root ids must be unique across the manifest (enforced-unique).`
|
|
534
|
+
: `Game manifest: duplicate root ids: ${idsText} — root ids must be unique across the manifest (enforced-unique).`,
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
// A project has at most ONE world root per MEDIUM (owner-ratified).
|
|
539
|
+
// The medium is the surface (see `rootMedium`), so `three`, `dom` and
|
|
540
|
+
// the canvas surface are the three buckets — a first-party canvas
|
|
541
|
+
// world, a canvas ingest and a canvas module are the SAME medium.
|
|
542
|
+
//
|
|
543
|
+
// Enforced here rather than left to the reader because the editor
|
|
544
|
+
// mounts exactly one root per medium (`resolveFocusedThreejsRootId`
|
|
545
|
+
// is a `find`, and the design-time layer stack hosts the one dom
|
|
546
|
+
// root): a second root of the same medium parsed cleanly and was then
|
|
547
|
+
// silently never mounted, which is the failure mode this rejects.
|
|
548
|
+
//
|
|
549
|
+
// DEV LAYERS ARE COUNTED SEPARATELY. A `dev: true` root is not content
|
|
550
|
+
// competing for the medium — it is the game's dev GUI stacked above
|
|
551
|
+
// everything (`create-runtime.ts`'s stacking pass), and the editor
|
|
552
|
+
// mounts it as chrome, not as the one dom document. Counting it with
|
|
553
|
+
// the content roots would make the ratified shape — a game with a HUD
|
|
554
|
+
// and a dev panel, both `dom` — unrepresentable. The one-per-medium
|
|
555
|
+
// rule still applies WITHIN the dev band, for the same
|
|
556
|
+
// silently-never-mounted reason.
|
|
557
|
+
const idsByMedium = new Map<string, string[]>();
|
|
558
|
+
for (const root of roots) {
|
|
559
|
+
const medium = `${root.dev ? 'dev ' : ''}${rootMedium(root)}`;
|
|
560
|
+
const ids = idsByMedium.get(medium);
|
|
561
|
+
if (ids) ids.push(root.id);
|
|
562
|
+
else idsByMedium.set(medium, [root.id]);
|
|
563
|
+
}
|
|
564
|
+
for (const [medium, ids] of idsByMedium) {
|
|
565
|
+
if (ids.length < 2) continue;
|
|
566
|
+
ctx.addIssue({
|
|
567
|
+
code: z.ZodIssueCode.custom,
|
|
568
|
+
message:
|
|
569
|
+
`Game manifest: a project has at most one ${medium} world root — ` +
|
|
570
|
+
`${ids.map((id) => `"${id}"`).join(', ')} all occupy the ${medium} surface. ` +
|
|
571
|
+
'Keep one and remove the rest, or move a root to a different medium ' +
|
|
572
|
+
"(three / canvas / dom); only one root per medium is ever mounted, so a second one's " +
|
|
573
|
+
'content would never appear.',
|
|
574
|
+
});
|
|
575
|
+
}
|
|
438
576
|
})
|
|
439
577
|
.describe(
|
|
440
|
-
"The Game's explicit, non-empty adapter-root composition. There is no implicit root."
|
|
578
|
+
"The Game's explicit, non-empty adapter-root composition. There is no implicit root. " +
|
|
579
|
+
'Root ids are unique, and a project declares at most ONE world root per medium — ' +
|
|
580
|
+
'one `three`, one `dom`, one canvas-surface root (first-party canvas, canvas ingest ' +
|
|
581
|
+
'and canvas module are the same medium). A `dev: true` root is counted in its own ' +
|
|
582
|
+
'band: a dev layer is chrome stacked above the game, not content competing for the ' +
|
|
583
|
+
'medium, so a game may declare a `dom` HUD and a `dom` dev layer — but not two of either.',
|
|
441
584
|
),
|
|
442
585
|
authoring: z
|
|
443
586
|
.object({
|
|
@@ -475,6 +618,30 @@ export const GameManifestSchema = z
|
|
|
475
618
|
.describe(
|
|
476
619
|
'Module path for the Colyseus room bootstrap; defaults to the scaffolded server bootstrap',
|
|
477
620
|
),
|
|
621
|
+
relay: z
|
|
622
|
+
.object({
|
|
623
|
+
signalingUrl: z
|
|
624
|
+
.string()
|
|
625
|
+
.optional()
|
|
626
|
+
.describe(
|
|
627
|
+
'Managed relay signaling URL to prefer over the client default; omitted when the deploy did not pin one',
|
|
628
|
+
),
|
|
629
|
+
accessToken: z
|
|
630
|
+
.string()
|
|
631
|
+
.describe(
|
|
632
|
+
'Room-scoped managed-relay access token minted at `vgai deploy` and read by the standalone client (main.ts)',
|
|
633
|
+
),
|
|
634
|
+
expiresAt: z
|
|
635
|
+
.number()
|
|
636
|
+
.describe(
|
|
637
|
+
'Token expiry as epoch milliseconds; the client falls back to a tokenless join once elapsed',
|
|
638
|
+
),
|
|
639
|
+
})
|
|
640
|
+
.strict()
|
|
641
|
+
.optional()
|
|
642
|
+
.describe(
|
|
643
|
+
'Deploy-baked managed-relay credentials. NEVER hand-authored in source — written only into the staged manifest by `vgai deploy` and fetched at runtime by the standalone client',
|
|
644
|
+
),
|
|
478
645
|
})
|
|
479
646
|
.optional()
|
|
480
647
|
.describe('Multiplayer server config (Colyseus), if this game registers a room'),
|
|
@@ -506,7 +673,7 @@ export const GameManifestSchema = z
|
|
|
506
673
|
.boolean()
|
|
507
674
|
.describe(
|
|
508
675
|
'Declares that ALL gameplay RNG in this project flows through ctx.random (the ' +
|
|
509
|
-
'named-stream seeded PRNG
|
|
676
|
+
'named-stream seeded PRNG) rather than raw ' +
|
|
510
677
|
'Math.random/Date.now/performance.now. Three runtime enforcers key off this flag: ' +
|
|
511
678
|
'the boot-time seeding reader (mount-manifest.ts seeds ctx.random from ' +
|
|
512
679
|
'defaultSeed/?vgai-seed=/explicit config, in that precedence, only when true), the ' +
|
|
@@ -514,7 +681,7 @@ export const GameManifestSchema = z
|
|
|
514
681
|
"project's src/ for raw RNG/wall-clock calls), and the dev-mode Math.random phase " +
|
|
515
682
|
'trap (runtime/gameplay-rng-trap.ts — warns once per call site during a gameplay ' +
|
|
516
683
|
'frame, never throws). Default false: an undeclared project gets no determinism ' +
|
|
517
|
-
'contract at all (that IS the opt-out — no dead field
|
|
684
|
+
'contract at all (that IS the opt-out — no dead field).',
|
|
518
685
|
),
|
|
519
686
|
defaultSeed: z
|
|
520
687
|
.number()
|
|
@@ -529,7 +696,7 @@ export const GameManifestSchema = z
|
|
|
529
696
|
})
|
|
530
697
|
.optional()
|
|
531
698
|
.describe(
|
|
532
|
-
'Seeded-RNG determinism contract (D15
|
|
699
|
+
'Seeded-RNG determinism contract (D15) — governs ' +
|
|
533
700
|
'whether ctx.random is boot-seeded from a reproducible seed and whether the ' +
|
|
534
701
|
'gameplay-rng-ban scan / dev-mode Math.random phase trap are active for this project.',
|
|
535
702
|
),
|
|
@@ -561,7 +728,7 @@ export const GameManifestSchema = z
|
|
|
561
728
|
.optional()
|
|
562
729
|
.describe(
|
|
563
730
|
'Maximum allowed entity-tagged scene-graph nodes (nodes carrying ' +
|
|
564
|
-
"userData.entityId) summed across the game's
|
|
731
|
+
"userData.entityId) summed across the game's three/canvas worlds at the end " +
|
|
565
732
|
'of a `vgai perf` run. Exact and deterministic under a seed — no tolerance band.',
|
|
566
733
|
),
|
|
567
734
|
maxDrawCalls: z
|
|
@@ -589,7 +756,7 @@ export const GameManifestSchema = z
|
|
|
589
756
|
message:
|
|
590
757
|
'Game manifest: `budget` must set at least one metric (frameCpuMsP95, physicsMsP95, ' +
|
|
591
758
|
'maxEntities, maxDrawCalls, maxTriangles) — an empty budget block gates nothing ' +
|
|
592
|
-
'(
|
|
759
|
+
'(the no-dead-fields policy).',
|
|
593
760
|
})
|
|
594
761
|
.optional()
|
|
595
762
|
.describe(
|
|
@@ -604,6 +771,6 @@ export const GameManifestSchema = z
|
|
|
604
771
|
),
|
|
605
772
|
})
|
|
606
773
|
.strict()
|
|
607
|
-
.describe('Game manifest (vgai.
|
|
774
|
+
.describe('Game manifest (vgai.project.json) — the complete v2 project configuration');
|
|
608
775
|
|
|
609
776
|
export type GameManifest = z.infer<typeof GameManifestSchema>;
|