@vgai/engine 0.2.0 → 0.4.0-canary.20260715.0

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.
Files changed (123) hide show
  1. package/README.md +3 -1
  2. package/package.json +24 -4
  3. package/schemas/engine-api.json +124 -0
  4. package/schemas/engine-api.md +53 -0
  5. package/schemas/engine-capabilities.json +124 -0
  6. package/schemas/inputmap.schema.json +314 -0
  7. package/schemas/mat.schema.json +286 -0
  8. package/schemas/prefab.schema.json +10148 -0
  9. package/schemas/scn2d.schema.json +475 -0
  10. package/schemas/vgai-game.schema.json +383 -0
  11. package/schemas/vscn.schema.json +11007 -0
  12. package/src/adapter/{world-kind.ts → adapter-surface.ts} +6 -6
  13. package/src/adapter/authoring.ts +77 -0
  14. package/src/adapter/first-party-systems.ts +23 -34
  15. package/src/adapter/game-adapter.ts +8 -8
  16. package/src/adapter/host-context.ts +2 -4
  17. package/src/adapter/index.ts +4 -4
  18. package/src/adapter/system-adapter.ts +88 -22
  19. package/src/adapter/vgai-scene-game-adapter.ts +244 -194
  20. package/src/animation/anim-graph-types.ts +12 -43
  21. package/src/animation/animation-clock.ts +479 -0
  22. package/src/animation/camera-ownership.ts +467 -0
  23. package/src/animation/cinematic-cues.ts +451 -0
  24. package/src/animation/clip-map.ts +41 -0
  25. package/src/animation/gsap-registration.ts +184 -0
  26. package/src/animation/theatre-clock-binding.ts +111 -0
  27. package/src/animation/theatre-director.ts +347 -0
  28. package/src/animation/theatre-object-binding.ts +661 -0
  29. package/src/animation/xstate-animation-binding.ts +436 -0
  30. package/src/animation/xstate-animation-meta.ts +319 -0
  31. package/src/audio/index.ts +39 -7
  32. package/src/audio/tone-clock-binding.ts +98 -0
  33. package/src/audio/tone-context.ts +129 -0
  34. package/src/audio/tone-offline-render.ts +167 -0
  35. package/src/audio/wav-encode.ts +119 -0
  36. package/src/character/cloth-sim.ts +533 -0
  37. package/src/character/spring-chain.ts +307 -0
  38. package/src/core/game-loop.ts +57 -2
  39. package/src/core/seeded-random.ts +161 -0
  40. package/src/core/system-runner.ts +20 -3
  41. package/src/core/types.ts +50 -0
  42. package/src/data/data-asset.ts +167 -0
  43. package/src/data/data-check-core.ts +242 -0
  44. package/src/data/data-ref.ts +145 -0
  45. package/src/data/vite-plugin-data.ts +290 -0
  46. package/src/dev/performance-profiler.ts +213 -0
  47. package/src/dev/webgl-gpu-timer.ts +53 -0
  48. package/src/ecs/component-manager.ts +45 -12
  49. package/src/ecs/game-component.ts +95 -11
  50. package/src/humanoid/bake.operation.ts +326 -0
  51. package/src/humanoid/body.ts +663 -0
  52. package/src/humanoid/clips.ts +149 -0
  53. package/src/humanoid/compose.ts +209 -0
  54. package/src/humanoid/generate.ts +189 -0
  55. package/src/humanoid/index.ts +36 -0
  56. package/src/humanoid/schema.ts +108 -0
  57. package/src/humanoid/skeleton.ts +345 -0
  58. package/src/index.ts +48 -0
  59. package/src/input/input-manager.ts +1886 -33
  60. package/src/input/input-types.ts +158 -3
  61. package/src/input/prompt-labels.ts +122 -0
  62. package/src/input/rebind-controller.ts +105 -0
  63. package/src/input/schema.ts +206 -52
  64. package/src/manifest/index.ts +5 -5
  65. package/src/manifest/load.ts +125 -72
  66. package/src/manifest/schema.ts +362 -255
  67. package/src/react/game-state.tsx +135 -32
  68. package/src/react/root-adapter.tsx +49 -0
  69. package/src/react/unmanaged-root-detector.ts +66 -0
  70. package/src/react/use-data.ts +124 -0
  71. package/src/react/use-selection.tsx +135 -0
  72. package/src/runtime/create-runtime.ts +112 -273
  73. package/src/runtime/debug-bridge.ts +483 -0
  74. package/src/runtime/debug-registry.ts +856 -0
  75. package/src/runtime/game.ts +342 -93
  76. package/src/runtime/gameplay-rng-trap.ts +134 -0
  77. package/src/runtime/input-router.ts +7 -7
  78. package/src/runtime/mount-game.ts +40 -38
  79. package/src/runtime/mount-manifest.ts +169 -37
  80. package/src/runtime/render-audio-control.ts +168 -0
  81. package/src/runtime/render-control.ts +522 -0
  82. package/src/runtime/render-seed.ts +79 -0
  83. package/src/runtime/state-bridge.ts +24 -10
  84. package/src/runtime/types.ts +110 -33
  85. package/src/scene/asset-loaders.ts +10 -36
  86. package/src/scene/asset-paths.ts +0 -2
  87. package/src/scene/asset-ref-check.ts +248 -0
  88. package/src/scene/asset-registry.ts +22 -0
  89. package/src/scene/component-registry.ts +14 -3
  90. package/src/scene/defaults.ts +1 -0
  91. package/src/scene/light-camera-factory.ts +11 -3
  92. package/src/scene/parse.ts +133 -0
  93. package/src/scene/scene-apply.ts +55 -4
  94. package/src/scene/scene-loader.ts +91 -123
  95. package/src/scene/scene-types.ts +0 -1
  96. package/src/scene/schema/animation.ts +30 -79
  97. package/src/scene/schema/entity.ts +20 -0
  98. package/src/scene/schema/index.ts +2 -46
  99. package/src/scene/schema/light.ts +16 -1
  100. package/src/scene/schema/material.ts +96 -91
  101. package/src/scene/schema/scene-file.ts +1 -7
  102. package/src/scene/user-data.ts +22 -10
  103. package/src/setup/setup-renderer.ts +10 -3
  104. package/src/tools/define-tool.ts +191 -0
  105. package/src/world2d/authoring-2d.ts +17 -1
  106. package/src/world2d/collision-2d.ts +1 -1
  107. package/src/world2d/pixi-game-adapter.ts +19 -17
  108. package/src/world2d/scene2d-loader.ts +1 -0
  109. package/src/world2d/types.ts +8 -2
  110. package/src/animation/anim-graph.ts +0 -406
  111. package/src/animation/anim-system.ts +0 -28
  112. package/src/animation/property-track.ts +0 -178
  113. package/src/animation/schema.ts +0 -204
  114. package/src/audio/ambient.ts +0 -300
  115. package/src/audio/impacts.ts +0 -212
  116. package/src/audio/movement.ts +0 -140
  117. package/src/audio/musical.ts +0 -200
  118. package/src/audio/ui-sounds.ts +0 -171
  119. package/src/audio/vehicle.ts +0 -235
  120. package/src/audio/weapons.ts +0 -152
  121. package/src/runtime/scene-ui-bridge.ts +0 -86
  122. package/src/runtime/scene-ui-data.ts +0 -119
  123. package/src/scene/schema/ui.ts +0 -602
@@ -0,0 +1,475 @@
1
+ {
2
+ "$comment": "AUTO-GENERATED by scripts/generate-schema.ts — do not edit manually",
3
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
4
+ "type": "object",
5
+ "properties": {
6
+ "version": {
7
+ "description": "Scene format version",
8
+ "type": "number"
9
+ },
10
+ "name": {
11
+ "description": "Scene name. REJECTED at parse (T4.1): declared but has no runtime reader — authoring this field throws. Do not author.",
12
+ "type": "string"
13
+ },
14
+ "surface": {
15
+ "description": "Render surface. Always 'world2d'",
16
+ "type": "string",
17
+ "const": "world2d"
18
+ },
19
+ "gravity": {
20
+ "description": "World gravity [x, y] in px/s^2. Default [0, 980]",
21
+ "type": "array",
22
+ "prefixItems": [
23
+ {
24
+ "type": "number"
25
+ },
26
+ {
27
+ "type": "number"
28
+ }
29
+ ]
30
+ },
31
+ "background": {
32
+ "description": "Background color hex string. Default '#10101a'",
33
+ "type": "string"
34
+ },
35
+ "entities": {
36
+ "type": "array",
37
+ "items": {
38
+ "$ref": "#/$defs/__schema0"
39
+ },
40
+ "description": "Root entities of the world2d scene"
41
+ }
42
+ },
43
+ "required": [
44
+ "entities"
45
+ ],
46
+ "additionalProperties": false,
47
+ "description": "A world2d scene (PixiJS render surface)",
48
+ "$defs": {
49
+ "__schema0": {
50
+ "type": "object",
51
+ "properties": {
52
+ "id": {
53
+ "description": "Unique entity ID. Auto-generated if omitted",
54
+ "type": "string"
55
+ },
56
+ "name": {
57
+ "type": "string",
58
+ "description": "Human-readable entity name (shown in hierarchy panel)"
59
+ },
60
+ "surface": {
61
+ "description": "Render surface that instantiates this entity. Default 'world2d' in a Scene2D file. The 'world3d' value is REJECTED at parse (T4.1): declared but has no runtime reader — authoring surface: 'world3d' throws. Do not author it ('world2d', the default, is fine).",
62
+ "type": "string",
63
+ "enum": [
64
+ "world2d",
65
+ "world3d"
66
+ ]
67
+ },
68
+ "visible": {
69
+ "description": "Whether the entity and its children are rendered",
70
+ "type": "boolean"
71
+ },
72
+ "locked": {
73
+ "description": "Prevent selection and editing in the scene editor. REJECTED at parse (T4.1): declared but has no runtime reader — authoring this field throws. Do not author.",
74
+ "type": "boolean"
75
+ },
76
+ "tags": {
77
+ "description": "Arbitrary string tags for runtime queries. REJECTED at parse (T4.1): declared but has no runtime reader — authoring this field throws. Do not author.",
78
+ "type": "array",
79
+ "items": {
80
+ "type": "string"
81
+ }
82
+ },
83
+ "transform2d": {
84
+ "description": "Local 2D transform relative to parent",
85
+ "type": "object",
86
+ "properties": {
87
+ "position": {
88
+ "description": "Local position [x, y] in world2d pixels",
89
+ "type": "array",
90
+ "prefixItems": [
91
+ {
92
+ "type": "number"
93
+ },
94
+ {
95
+ "type": "number"
96
+ }
97
+ ]
98
+ },
99
+ "rotation": {
100
+ "description": "Rotation in radians about the Z axis. Default 0",
101
+ "type": "number"
102
+ },
103
+ "scale": {
104
+ "description": "Scale per axis [x, y]. Default [1, 1]",
105
+ "type": "array",
106
+ "prefixItems": [
107
+ {
108
+ "type": "number"
109
+ },
110
+ {
111
+ "type": "number"
112
+ }
113
+ ]
114
+ },
115
+ "pivot": {
116
+ "description": "Local pivot point [x, y] (center of rotation/scale)",
117
+ "type": "array",
118
+ "prefixItems": [
119
+ {
120
+ "type": "number"
121
+ },
122
+ {
123
+ "type": "number"
124
+ }
125
+ ]
126
+ }
127
+ },
128
+ "additionalProperties": false
129
+ },
130
+ "pivot": {
131
+ "description": "Local-space pivot point [x, y]",
132
+ "type": "array",
133
+ "prefixItems": [
134
+ {
135
+ "type": "number"
136
+ },
137
+ {
138
+ "type": "number"
139
+ }
140
+ ]
141
+ },
142
+ "sprite": {
143
+ "description": "2D sprite appearance",
144
+ "type": "object",
145
+ "properties": {
146
+ "texture": {
147
+ "description": "Texture asset URL (loaded via PIXI.Assets). Omit for a tintable 1x1 white texture",
148
+ "type": "string"
149
+ },
150
+ "frame": {
151
+ "description": "Spritesheet frame/sub-texture name when `texture` is a spritesheet atlas",
152
+ "type": "string"
153
+ },
154
+ "anchor": {
155
+ "description": "Normalized anchor [x, y] (0..1). Default [0.5, 0.5]",
156
+ "type": "array",
157
+ "prefixItems": [
158
+ {
159
+ "type": "number"
160
+ },
161
+ {
162
+ "type": "number"
163
+ }
164
+ ]
165
+ },
166
+ "tint": {
167
+ "description": "Tint color as hex string (e.g. '#ff8800'). Default white",
168
+ "type": "string"
169
+ },
170
+ "alpha": {
171
+ "description": "Opacity 0..1. Default 1",
172
+ "type": "number",
173
+ "minimum": 0,
174
+ "maximum": 1
175
+ },
176
+ "width": {
177
+ "description": "Explicit display width in pixels (overrides texture size)",
178
+ "type": "number"
179
+ },
180
+ "height": {
181
+ "description": "Explicit display height in pixels (overrides texture size)",
182
+ "type": "number"
183
+ },
184
+ "blendMode": {
185
+ "description": "PixiJS blend mode. Default normal",
186
+ "type": "string",
187
+ "enum": [
188
+ "normal",
189
+ "add",
190
+ "multiply",
191
+ "screen"
192
+ ]
193
+ },
194
+ "interactive": {
195
+ "description": "Enable federated pointer events (eventMode=static) so this sprite can be picked",
196
+ "type": "boolean"
197
+ },
198
+ "filter": {
199
+ "description": "Apply a PixiJS filter (BlurFilter / ColorMatrix desaturate). Default none",
200
+ "type": "string",
201
+ "enum": [
202
+ "none",
203
+ "blur",
204
+ "desaturate"
205
+ ]
206
+ },
207
+ "animationFrames": {
208
+ "description": "If set, build an AnimatedSprite cycling N generated tinted frames",
209
+ "type": "integer",
210
+ "minimum": -9007199254740991,
211
+ "maximum": 9007199254740991
212
+ },
213
+ "fps": {
214
+ "description": "AnimatedSprite playback speed in frames/sec. Default 8",
215
+ "type": "number"
216
+ }
217
+ },
218
+ "additionalProperties": false
219
+ },
220
+ "text": {
221
+ "description": "World-space text label",
222
+ "type": "object",
223
+ "properties": {
224
+ "text": {
225
+ "type": "string",
226
+ "description": "The string to display"
227
+ },
228
+ "fontSize": {
229
+ "description": "Font size in pixels. Default 24",
230
+ "type": "number"
231
+ },
232
+ "fill": {
233
+ "description": "Text color as hex string. Default '#ffffff'",
234
+ "type": "string"
235
+ },
236
+ "anchor": {
237
+ "description": "Normalized anchor [x, y] (0..1). Default [0.5, 0.5]",
238
+ "type": "array",
239
+ "prefixItems": [
240
+ {
241
+ "type": "number"
242
+ },
243
+ {
244
+ "type": "number"
245
+ }
246
+ ]
247
+ }
248
+ },
249
+ "required": [
250
+ "text"
251
+ ],
252
+ "additionalProperties": false
253
+ },
254
+ "tilemap": {
255
+ "description": "2D tilemap (CompositeTilemap)",
256
+ "type": "object",
257
+ "properties": {
258
+ "tileSize": {
259
+ "type": "number",
260
+ "description": "Tile width/height in pixels"
261
+ },
262
+ "palette": {
263
+ "type": "array",
264
+ "items": {
265
+ "type": "string"
266
+ },
267
+ "description": "Hex colors; one generated tile texture per entry (index → color)"
268
+ },
269
+ "tiles": {
270
+ "type": "array",
271
+ "items": {
272
+ "type": "array",
273
+ "items": {
274
+ "type": "integer",
275
+ "minimum": -9007199254740991,
276
+ "maximum": 9007199254740991
277
+ }
278
+ },
279
+ "description": "Row-major grid of palette indices (each row is an array of tile indices)"
280
+ }
281
+ },
282
+ "required": [
283
+ "tileSize",
284
+ "palette",
285
+ "tiles"
286
+ ],
287
+ "additionalProperties": false
288
+ },
289
+ "physics2d": {
290
+ "description": "2D physics rigid body + collider",
291
+ "type": "object",
292
+ "properties": {
293
+ "bodyType": {
294
+ "type": "string",
295
+ "enum": [
296
+ "dynamic",
297
+ "fixed",
298
+ "kinematicVelocity",
299
+ "kinematicPosition"
300
+ ],
301
+ "description": "Rapier 2D rigid-body type"
302
+ },
303
+ "collider": {
304
+ "oneOf": [
305
+ {
306
+ "type": "object",
307
+ "properties": {
308
+ "shape": {
309
+ "type": "string",
310
+ "const": "cuboid",
311
+ "description": "Axis-aligned box collider"
312
+ },
313
+ "halfExtents": {
314
+ "type": "array",
315
+ "prefixItems": [
316
+ {
317
+ "type": "number"
318
+ },
319
+ {
320
+ "type": "number"
321
+ }
322
+ ],
323
+ "description": "Half-width and half-height [hx, hy] in pixels"
324
+ }
325
+ },
326
+ "required": [
327
+ "shape",
328
+ "halfExtents"
329
+ ],
330
+ "additionalProperties": false
331
+ },
332
+ {
333
+ "type": "object",
334
+ "properties": {
335
+ "shape": {
336
+ "type": "string",
337
+ "const": "ball",
338
+ "description": "Circle collider"
339
+ },
340
+ "radius": {
341
+ "type": "number",
342
+ "description": "Radius in pixels"
343
+ }
344
+ },
345
+ "required": [
346
+ "shape",
347
+ "radius"
348
+ ],
349
+ "additionalProperties": false
350
+ },
351
+ {
352
+ "type": "object",
353
+ "properties": {
354
+ "shape": {
355
+ "type": "string",
356
+ "const": "capsule",
357
+ "description": "Capsule collider (vertical)"
358
+ },
359
+ "halfHeight": {
360
+ "type": "number",
361
+ "description": "Half the straight segment length"
362
+ },
363
+ "radius": {
364
+ "type": "number",
365
+ "description": "Cap radius"
366
+ }
367
+ },
368
+ "required": [
369
+ "shape",
370
+ "halfHeight",
371
+ "radius"
372
+ ],
373
+ "additionalProperties": false
374
+ }
375
+ ],
376
+ "description": "Collider shape attached to the body"
377
+ },
378
+ "sensor": {
379
+ "description": "If true, a sensor (trigger) collider — overlaps fire onTriggerEnter/Exit, no solid response",
380
+ "type": "boolean"
381
+ },
382
+ "density": {
383
+ "description": "Collider density (drives mass). Default 1",
384
+ "type": "number"
385
+ },
386
+ "friction": {
387
+ "description": "Coefficient of friction. Default 0.5",
388
+ "type": "number"
389
+ },
390
+ "restitution": {
391
+ "description": "Bounciness 0..1. Default 0",
392
+ "type": "number"
393
+ },
394
+ "linearDamping": {
395
+ "description": "Linear velocity damping. Default 0",
396
+ "type": "number"
397
+ },
398
+ "gravityScale": {
399
+ "description": "Per-body gravity multiplier. Default 1",
400
+ "type": "number"
401
+ },
402
+ "lockRotations": {
403
+ "description": "Lock the body so it cannot rotate. Default false",
404
+ "type": "boolean"
405
+ }
406
+ },
407
+ "required": [
408
+ "bodyType",
409
+ "collider"
410
+ ],
411
+ "additionalProperties": false
412
+ },
413
+ "components": {
414
+ "description": "User-defined components (validated against the world2d component registry)",
415
+ "type": "object",
416
+ "propertyNames": {
417
+ "type": "string"
418
+ },
419
+ "additionalProperties": {
420
+ "type": "object",
421
+ "propertyNames": {
422
+ "type": "string"
423
+ },
424
+ "additionalProperties": {
425
+ "anyOf": [
426
+ {
427
+ "anyOf": [
428
+ {
429
+ "type": "number"
430
+ },
431
+ {
432
+ "type": "string"
433
+ },
434
+ {
435
+ "type": "boolean"
436
+ }
437
+ ]
438
+ },
439
+ {
440
+ "type": "array",
441
+ "items": {
442
+ "type": "number"
443
+ }
444
+ },
445
+ {
446
+ "type": "array",
447
+ "items": {
448
+ "type": "string"
449
+ }
450
+ },
451
+ {
452
+ "type": "array",
453
+ "items": {
454
+ "type": "boolean"
455
+ }
456
+ }
457
+ ]
458
+ }
459
+ }
460
+ },
461
+ "children": {
462
+ "description": "Child entities",
463
+ "type": "array",
464
+ "items": {
465
+ "$ref": "#/$defs/__schema0"
466
+ }
467
+ }
468
+ },
469
+ "required": [
470
+ "name"
471
+ ],
472
+ "additionalProperties": false
473
+ }
474
+ }
475
+ }