@vgai/engine 0.5.0 → 0.5.2

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 (538) hide show
  1. package/package.json +1 -1
  2. package/schemas/engine-capabilities.json +4 -4
  3. package/schemas/vgai-game.schema.json +2 -2
  4. package/src/adapter/authoring.ts +42 -0
  5. package/src/adapter/index.ts +3 -0
  6. package/src/adapter/ingest/overlay-apply.ts +50 -6
  7. package/src/adapter/ingest/scene-capture.ts +51 -2
  8. package/src/adapter/vgai-scene-game-adapter.ts +24 -0
  9. package/src/manifest/schema.ts +7 -3
  10. package/src/runtime/create-runtime.ts +97 -0
  11. package/src/runtime/game.ts +11 -1
  12. package/src/scene/asset-ref-check.ts +1 -1
  13. package/src/scene/scene-loader.ts +2 -2
  14. package/src/scene/user-data.ts +18 -0
  15. package/src/world3d-react/behavior.tsx +19 -11
  16. package/src/world3d-react/r3f-adapter.tsx +8 -0
  17. package/dist/adapter/adapter-surface.d.ts +0 -30
  18. package/dist/adapter/adapter-surface.d.ts.map +0 -1
  19. package/dist/adapter/adapter-surface.js +0 -18
  20. package/dist/adapter/authoring.d.ts +0 -461
  21. package/dist/adapter/authoring.d.ts.map +0 -1
  22. package/dist/adapter/authoring.js +0 -22
  23. package/dist/adapter/colyseus-networking-adapter.d.ts +0 -43
  24. package/dist/adapter/colyseus-networking-adapter.d.ts.map +0 -1
  25. package/dist/adapter/colyseus-networking-adapter.js +0 -38
  26. package/dist/adapter/first-party-systems.d.ts +0 -38
  27. package/dist/adapter/first-party-systems.d.ts.map +0 -1
  28. package/dist/adapter/first-party-systems.js +0 -77
  29. package/dist/adapter/game-adapter.d.ts +0 -133
  30. package/dist/adapter/game-adapter.d.ts.map +0 -1
  31. package/dist/adapter/game-adapter.js +0 -10
  32. package/dist/adapter/host-context.d.ts +0 -71
  33. package/dist/adapter/host-context.d.ts.map +0 -1
  34. package/dist/adapter/host-context.js +0 -16
  35. package/dist/adapter/index.d.ts +0 -22
  36. package/dist/adapter/index.d.ts.map +0 -1
  37. package/dist/adapter/index.js +0 -15
  38. package/dist/adapter/ingest/game-contract.d.ts +0 -53
  39. package/dist/adapter/ingest/game-contract.d.ts.map +0 -1
  40. package/dist/adapter/ingest/game-contract.js +0 -30
  41. package/dist/adapter/ingest/overlay-applier.d.ts +0 -118
  42. package/dist/adapter/ingest/overlay-applier.d.ts.map +0 -1
  43. package/dist/adapter/ingest/overlay-applier.js +0 -132
  44. package/dist/adapter/ingest/overlay-apply.d.ts +0 -60
  45. package/dist/adapter/ingest/overlay-apply.d.ts.map +0 -1
  46. package/dist/adapter/ingest/overlay-apply.js +0 -101
  47. package/dist/adapter/ingest/overlay-file.d.ts +0 -79
  48. package/dist/adapter/ingest/overlay-file.d.ts.map +0 -1
  49. package/dist/adapter/ingest/overlay-file.js +0 -66
  50. package/dist/adapter/ingest/overlay-report.d.ts +0 -113
  51. package/dist/adapter/ingest/overlay-report.d.ts.map +0 -1
  52. package/dist/adapter/ingest/overlay-report.js +0 -103
  53. package/dist/adapter/ingest/scene-capture.d.ts +0 -97
  54. package/dist/adapter/ingest/scene-capture.d.ts.map +0 -1
  55. package/dist/adapter/ingest/scene-capture.js +0 -248
  56. package/dist/adapter/ingest/upstream-pin.d.ts +0 -47
  57. package/dist/adapter/ingest/upstream-pin.d.ts.map +0 -1
  58. package/dist/adapter/ingest/upstream-pin.js +0 -50
  59. package/dist/adapter/loop-gate-report.d.ts +0 -34
  60. package/dist/adapter/loop-gate-report.d.ts.map +0 -1
  61. package/dist/adapter/loop-gate-report.js +0 -37
  62. package/dist/adapter/rapier-physics-adapter.d.ts +0 -12
  63. package/dist/adapter/rapier-physics-adapter.d.ts.map +0 -1
  64. package/dist/adapter/rapier-physics-adapter.js +0 -46
  65. package/dist/adapter/system-adapter.d.ts +0 -206
  66. package/dist/adapter/system-adapter.d.ts.map +0 -1
  67. package/dist/adapter/system-adapter.js +0 -13
  68. package/dist/adapter/transform.d.ts +0 -18
  69. package/dist/adapter/transform.d.ts.map +0 -1
  70. package/dist/adapter/transform.js +0 -1
  71. package/dist/adapter/vgai-scene-game-adapter.d.ts +0 -108
  72. package/dist/adapter/vgai-scene-game-adapter.d.ts.map +0 -1
  73. package/dist/adapter/vgai-scene-game-adapter.js +0 -762
  74. package/dist/ai/navigation.d.ts +0 -64
  75. package/dist/ai/navigation.d.ts.map +0 -1
  76. package/dist/ai/navigation.js +0 -133
  77. package/dist/animation/anim-graph-types.d.ts +0 -25
  78. package/dist/animation/anim-graph-types.d.ts.map +0 -1
  79. package/dist/animation/anim-graph-types.js +0 -1
  80. package/dist/animation/animation-clock.d.ts +0 -213
  81. package/dist/animation/animation-clock.d.ts.map +0 -1
  82. package/dist/animation/animation-clock.js +0 -301
  83. package/dist/animation/blend-node.d.ts +0 -22
  84. package/dist/animation/blend-node.d.ts.map +0 -1
  85. package/dist/animation/blend-node.js +0 -97
  86. package/dist/animation/camera-ownership.d.ts +0 -250
  87. package/dist/animation/camera-ownership.d.ts.map +0 -1
  88. package/dist/animation/camera-ownership.js +0 -169
  89. package/dist/animation/cinematic-cues.d.ts +0 -200
  90. package/dist/animation/cinematic-cues.d.ts.map +0 -1
  91. package/dist/animation/cinematic-cues.js +0 -213
  92. package/dist/animation/clip-map.d.ts +0 -12
  93. package/dist/animation/clip-map.d.ts.map +0 -1
  94. package/dist/animation/clip-map.js +0 -37
  95. package/dist/animation/gsap-registration.d.ts +0 -119
  96. package/dist/animation/gsap-registration.d.ts.map +0 -1
  97. package/dist/animation/gsap-registration.js +0 -92
  98. package/dist/animation/theatre-clock-binding.d.ts +0 -89
  99. package/dist/animation/theatre-clock-binding.d.ts.map +0 -1
  100. package/dist/animation/theatre-clock-binding.js +0 -29
  101. package/dist/animation/theatre-director.d.ts +0 -242
  102. package/dist/animation/theatre-director.d.ts.map +0 -1
  103. package/dist/animation/theatre-director.js +0 -235
  104. package/dist/animation/theatre-object-binding.d.ts +0 -305
  105. package/dist/animation/theatre-object-binding.d.ts.map +0 -1
  106. package/dist/animation/theatre-object-binding.js +0 -351
  107. package/dist/animation/xstate-animation-binding.d.ts +0 -56
  108. package/dist/animation/xstate-animation-binding.d.ts.map +0 -1
  109. package/dist/animation/xstate-animation-binding.js +0 -331
  110. package/dist/animation/xstate-animation-meta.d.ts +0 -266
  111. package/dist/animation/xstate-animation-meta.d.ts.map +0 -1
  112. package/dist/animation/xstate-animation-meta.js +0 -252
  113. package/dist/assets.d.ts +0 -26
  114. package/dist/assets.d.ts.map +0 -1
  115. package/dist/assets.js +0 -55
  116. package/dist/audio/index.d.ts +0 -4
  117. package/dist/audio/index.d.ts.map +0 -1
  118. package/dist/audio/index.js +0 -24
  119. package/dist/audio/tone-clock-binding.d.ts +0 -75
  120. package/dist/audio/tone-clock-binding.d.ts.map +0 -1
  121. package/dist/audio/tone-clock-binding.js +0 -29
  122. package/dist/audio/tone-context.d.ts +0 -114
  123. package/dist/audio/tone-context.d.ts.map +0 -1
  124. package/dist/audio/tone-context.js +0 -39
  125. package/dist/audio/tone-offline-render.d.ts +0 -90
  126. package/dist/audio/tone-offline-render.d.ts.map +0 -1
  127. package/dist/audio/tone-offline-render.js +0 -56
  128. package/dist/audio/wav-encode.d.ts +0 -38
  129. package/dist/audio/wav-encode.d.ts.map +0 -1
  130. package/dist/audio/wav-encode.js +0 -97
  131. package/dist/character/cloth-sim.d.ts +0 -179
  132. package/dist/character/cloth-sim.d.ts.map +0 -1
  133. package/dist/character/cloth-sim.js +0 -334
  134. package/dist/character/spring-chain.d.ts +0 -135
  135. package/dist/character/spring-chain.d.ts.map +0 -1
  136. package/dist/character/spring-chain.js +0 -165
  137. package/dist/core/game-loop.d.ts +0 -42
  138. package/dist/core/game-loop.d.ts.map +0 -1
  139. package/dist/core/game-loop.js +0 -167
  140. package/dist/core/seeded-random.d.ts +0 -69
  141. package/dist/core/seeded-random.d.ts.map +0 -1
  142. package/dist/core/seeded-random.js +0 -121
  143. package/dist/core/system-runner.d.ts +0 -120
  144. package/dist/core/system-runner.d.ts.map +0 -1
  145. package/dist/core/system-runner.js +0 -297
  146. package/dist/core/types.d.ts +0 -92
  147. package/dist/core/types.d.ts.map +0 -1
  148. package/dist/core/types.js +0 -25
  149. package/dist/data/data-asset.d.ts +0 -101
  150. package/dist/data/data-asset.d.ts.map +0 -1
  151. package/dist/data/data-asset.js +0 -122
  152. package/dist/data/data-check-core.d.ts +0 -110
  153. package/dist/data/data-check-core.d.ts.map +0 -1
  154. package/dist/data/data-check-core.js +0 -178
  155. package/dist/data/data-ref.d.ts +0 -79
  156. package/dist/data/data-ref.d.ts.map +0 -1
  157. package/dist/data/data-ref.js +0 -130
  158. package/dist/data/vite-plugin-data.d.ts +0 -79
  159. package/dist/data/vite-plugin-data.d.ts.map +0 -1
  160. package/dist/data/vite-plugin-data.js +0 -217
  161. package/dist/dev/console-bridge.d.ts +0 -22
  162. package/dist/dev/console-bridge.d.ts.map +0 -1
  163. package/dist/dev/console-bridge.js +0 -71
  164. package/dist/dev/debug-draw.d.ts +0 -24
  165. package/dist/dev/debug-draw.d.ts.map +0 -1
  166. package/dist/dev/debug-draw.js +0 -73
  167. package/dist/dev/logger.d.ts +0 -30
  168. package/dist/dev/logger.d.ts.map +0 -1
  169. package/dist/dev/logger.js +0 -90
  170. package/dist/dev/performance-profiler.d.ts +0 -60
  171. package/dist/dev/performance-profiler.d.ts.map +0 -1
  172. package/dist/dev/performance-profiler.js +0 -181
  173. package/dist/dev/webgl-gpu-timer.d.ts +0 -8
  174. package/dist/dev/webgl-gpu-timer.d.ts.map +0 -1
  175. package/dist/dev/webgl-gpu-timer.js +0 -52
  176. package/dist/ecs/component-manager.d.ts +0 -205
  177. package/dist/ecs/component-manager.d.ts.map +0 -1
  178. package/dist/ecs/component-manager.js +0 -706
  179. package/dist/ecs/game-component.d.ts +0 -146
  180. package/dist/ecs/game-component.d.ts.map +0 -1
  181. package/dist/ecs/game-component.js +0 -141
  182. package/dist/ecs/hmr-swap-report.d.ts +0 -53
  183. package/dist/ecs/hmr-swap-report.d.ts.map +0 -1
  184. package/dist/ecs/hmr-swap-report.js +0 -55
  185. package/dist/humanoid/bake.operation.d.ts +0 -119
  186. package/dist/humanoid/bake.operation.d.ts.map +0 -1
  187. package/dist/humanoid/bake.operation.js +0 -228
  188. package/dist/humanoid/body.d.ts +0 -101
  189. package/dist/humanoid/body.d.ts.map +0 -1
  190. package/dist/humanoid/body.js +0 -530
  191. package/dist/humanoid/clips.d.ts +0 -62
  192. package/dist/humanoid/clips.d.ts.map +0 -1
  193. package/dist/humanoid/clips.js +0 -121
  194. package/dist/humanoid/compose.d.ts +0 -75
  195. package/dist/humanoid/compose.d.ts.map +0 -1
  196. package/dist/humanoid/compose.js +0 -176
  197. package/dist/humanoid/generate.d.ts +0 -92
  198. package/dist/humanoid/generate.d.ts.map +0 -1
  199. package/dist/humanoid/generate.js +0 -124
  200. package/dist/humanoid/index.d.ts +0 -24
  201. package/dist/humanoid/index.d.ts.map +0 -1
  202. package/dist/humanoid/index.js +0 -18
  203. package/dist/humanoid/schema.d.ts +0 -35
  204. package/dist/humanoid/schema.d.ts.map +0 -1
  205. package/dist/humanoid/schema.js +0 -87
  206. package/dist/humanoid/skeleton.d.ts +0 -103
  207. package/dist/humanoid/skeleton.d.ts.map +0 -1
  208. package/dist/humanoid/skeleton.js +0 -289
  209. package/dist/index.d.ts +0 -37
  210. package/dist/index.d.ts.map +0 -1
  211. package/dist/index.js +0 -30
  212. package/dist/input/input-manager.d.ts +0 -945
  213. package/dist/input/input-manager.d.ts.map +0 -1
  214. package/dist/input/input-manager.js +0 -2207
  215. package/dist/input/input-types.d.ts +0 -174
  216. package/dist/input/input-types.d.ts.map +0 -1
  217. package/dist/input/input-types.js +0 -1
  218. package/dist/input/prompt-labels.d.ts +0 -21
  219. package/dist/input/prompt-labels.d.ts.map +0 -1
  220. package/dist/input/prompt-labels.js +0 -121
  221. package/dist/input/rebind-controller.d.ts +0 -59
  222. package/dist/input/rebind-controller.d.ts.map +0 -1
  223. package/dist/input/rebind-controller.js +0 -85
  224. package/dist/input/schema.d.ts +0 -16
  225. package/dist/input/schema.d.ts.map +0 -1
  226. package/dist/input/schema.js +0 -228
  227. package/dist/loader.d.ts +0 -43
  228. package/dist/loader.d.ts.map +0 -1
  229. package/dist/loader.js +0 -59
  230. package/dist/manifest/index.d.ts +0 -5
  231. package/dist/manifest/index.d.ts.map +0 -1
  232. package/dist/manifest/index.js +0 -8
  233. package/dist/manifest/load-file.d.ts +0 -4
  234. package/dist/manifest/load-file.d.ts.map +0 -1
  235. package/dist/manifest/load-file.js +0 -14
  236. package/dist/manifest/load.d.ts +0 -144
  237. package/dist/manifest/load.d.ts.map +0 -1
  238. package/dist/manifest/load.js +0 -273
  239. package/dist/manifest/schema.d.ts +0 -230
  240. package/dist/manifest/schema.d.ts.map +0 -1
  241. package/dist/manifest/schema.js +0 -394
  242. package/dist/physics/collision-system.d.ts +0 -41
  243. package/dist/physics/collision-system.d.ts.map +0 -1
  244. package/dist/physics/collision-system.js +0 -64
  245. package/dist/physics/physics-registry.d.ts +0 -45
  246. package/dist/physics/physics-registry.d.ts.map +0 -1
  247. package/dist/physics/physics-registry.js +0 -65
  248. package/dist/physics/transform-writer.d.ts +0 -16
  249. package/dist/physics/transform-writer.d.ts.map +0 -1
  250. package/dist/physics/transform-writer.js +0 -38
  251. package/dist/physics/trigger-dispatch.d.ts +0 -24
  252. package/dist/physics/trigger-dispatch.d.ts.map +0 -1
  253. package/dist/physics/trigger-dispatch.js +0 -80
  254. package/dist/react/game-state.d.ts +0 -156
  255. package/dist/react/game-state.d.ts.map +0 -1
  256. package/dist/react/game-state.js +0 -222
  257. package/dist/react/root-adapter.d.ts +0 -11
  258. package/dist/react/root-adapter.d.ts.map +0 -1
  259. package/dist/react/root-adapter.js +0 -41
  260. package/dist/react/unmanaged-root-detector.d.ts +0 -12
  261. package/dist/react/unmanaged-root-detector.d.ts.map +0 -1
  262. package/dist/react/unmanaged-root-detector.js +0 -45
  263. package/dist/react/use-data.d.ts +0 -60
  264. package/dist/react/use-data.d.ts.map +0 -1
  265. package/dist/react/use-data.js +0 -101
  266. package/dist/react/use-selection.d.ts +0 -75
  267. package/dist/react/use-selection.d.ts.map +0 -1
  268. package/dist/react/use-selection.js +0 -90
  269. package/dist/render/auto-batcher.d.ts +0 -34
  270. package/dist/render/auto-batcher.d.ts.map +0 -1
  271. package/dist/render/auto-batcher.js +0 -140
  272. package/dist/render/render-batch-system.d.ts +0 -33
  273. package/dist/render/render-batch-system.d.ts.map +0 -1
  274. package/dist/render/render-batch-system.js +0 -230
  275. package/dist/render/render-features.d.ts +0 -47
  276. package/dist/render/render-features.d.ts.map +0 -1
  277. package/dist/render/render-features.js +0 -105
  278. package/dist/render/render-settings.d.ts +0 -36
  279. package/dist/render/render-settings.d.ts.map +0 -1
  280. package/dist/render/render-settings.js +0 -51
  281. package/dist/runtime/create-runtime.d.ts +0 -249
  282. package/dist/runtime/create-runtime.d.ts.map +0 -1
  283. package/dist/runtime/create-runtime.js +0 -641
  284. package/dist/runtime/debug-bridge.d.ts +0 -257
  285. package/dist/runtime/debug-bridge.d.ts.map +0 -1
  286. package/dist/runtime/debug-bridge.js +0 -224
  287. package/dist/runtime/debug-registry.d.ts +0 -288
  288. package/dist/runtime/debug-registry.d.ts.map +0 -1
  289. package/dist/runtime/debug-registry.js +0 -513
  290. package/dist/runtime/frame-selector-cache.d.ts +0 -41
  291. package/dist/runtime/frame-selector-cache.d.ts.map +0 -1
  292. package/dist/runtime/frame-selector-cache.js +0 -65
  293. package/dist/runtime/game.d.ts +0 -496
  294. package/dist/runtime/game.d.ts.map +0 -1
  295. package/dist/runtime/game.js +0 -741
  296. package/dist/runtime/gameplay-rng-trap.d.ts +0 -48
  297. package/dist/runtime/gameplay-rng-trap.d.ts.map +0 -1
  298. package/dist/runtime/gameplay-rng-trap.js +0 -96
  299. package/dist/runtime/input-router.d.ts +0 -78
  300. package/dist/runtime/input-router.d.ts.map +0 -1
  301. package/dist/runtime/input-router.js +0 -171
  302. package/dist/runtime/mount-game.d.ts +0 -129
  303. package/dist/runtime/mount-game.d.ts.map +0 -1
  304. package/dist/runtime/mount-game.js +0 -152
  305. package/dist/runtime/mount-manifest.d.ts +0 -173
  306. package/dist/runtime/mount-manifest.d.ts.map +0 -1
  307. package/dist/runtime/mount-manifest.js +0 -297
  308. package/dist/runtime/render-audio-control.d.ts +0 -110
  309. package/dist/runtime/render-audio-control.d.ts.map +0 -1
  310. package/dist/runtime/render-audio-control.js +0 -111
  311. package/dist/runtime/render-control.d.ts +0 -291
  312. package/dist/runtime/render-control.d.ts.map +0 -1
  313. package/dist/runtime/render-control.js +0 -264
  314. package/dist/runtime/render-seed.d.ts +0 -57
  315. package/dist/runtime/render-seed.d.ts.map +0 -1
  316. package/dist/runtime/render-seed.js +0 -74
  317. package/dist/runtime/state-bridge.d.ts +0 -61
  318. package/dist/runtime/state-bridge.d.ts.map +0 -1
  319. package/dist/runtime/state-bridge.js +0 -63
  320. package/dist/runtime/types.d.ts +0 -253
  321. package/dist/runtime/types.d.ts.map +0 -1
  322. package/dist/runtime/types.js +0 -1
  323. package/dist/scene/asset-loaders.d.ts +0 -79
  324. package/dist/scene/asset-loaders.d.ts.map +0 -1
  325. package/dist/scene/asset-loaders.js +0 -141
  326. package/dist/scene/asset-paths.d.ts +0 -11
  327. package/dist/scene/asset-paths.d.ts.map +0 -1
  328. package/dist/scene/asset-paths.js +0 -108
  329. package/dist/scene/asset-ref-check.d.ts +0 -88
  330. package/dist/scene/asset-ref-check.d.ts.map +0 -1
  331. package/dist/scene/asset-ref-check.js +0 -214
  332. package/dist/scene/asset-registry.d.ts +0 -38
  333. package/dist/scene/asset-registry.d.ts.map +0 -1
  334. package/dist/scene/asset-registry.js +0 -66
  335. package/dist/scene/collider-dimensions.d.ts +0 -63
  336. package/dist/scene/collider-dimensions.d.ts.map +0 -1
  337. package/dist/scene/collider-dimensions.js +0 -98
  338. package/dist/scene/component-registry.d.ts +0 -22
  339. package/dist/scene/component-registry.d.ts.map +0 -1
  340. package/dist/scene/component-registry.js +0 -37
  341. package/dist/scene/defaults.d.ts +0 -252
  342. package/dist/scene/defaults.d.ts.map +0 -1
  343. package/dist/scene/defaults.js +0 -151
  344. package/dist/scene/geometries/index.d.ts +0 -8
  345. package/dist/scene/geometries/index.d.ts.map +0 -1
  346. package/dist/scene/geometries/index.js +0 -7
  347. package/dist/scene/geometries/terrain.d.ts +0 -2
  348. package/dist/scene/geometries/terrain.d.ts.map +0 -1
  349. package/dist/scene/geometries/terrain.js +0 -37
  350. package/dist/scene/geometry-registry.d.ts +0 -24
  351. package/dist/scene/geometry-registry.d.ts.map +0 -1
  352. package/dist/scene/geometry-registry.js +0 -20
  353. package/dist/scene/instance-registry.d.ts +0 -36
  354. package/dist/scene/instance-registry.d.ts.map +0 -1
  355. package/dist/scene/instance-registry.js +0 -55
  356. package/dist/scene/instancers/grid.d.ts +0 -2
  357. package/dist/scene/instancers/grid.d.ts.map +0 -1
  358. package/dist/scene/instancers/grid.js +0 -36
  359. package/dist/scene/instancers/index.d.ts +0 -8
  360. package/dist/scene/instancers/index.d.ts.map +0 -1
  361. package/dist/scene/instancers/index.js +0 -7
  362. package/dist/scene/light-camera-factory.d.ts +0 -23
  363. package/dist/scene/light-camera-factory.d.ts.map +0 -1
  364. package/dist/scene/light-camera-factory.js +0 -68
  365. package/dist/scene/material-factory.d.ts +0 -17
  366. package/dist/scene/material-factory.d.ts.map +0 -1
  367. package/dist/scene/material-factory.js +0 -197
  368. package/dist/scene/material-registry.d.ts +0 -40
  369. package/dist/scene/material-registry.d.ts.map +0 -1
  370. package/dist/scene/material-registry.js +0 -44
  371. package/dist/scene/materials/index.d.ts +0 -8
  372. package/dist/scene/materials/index.d.ts.map +0 -1
  373. package/dist/scene/materials/index.js +0 -7
  374. package/dist/scene/materials/water.d.ts +0 -2
  375. package/dist/scene/materials/water.d.ts.map +0 -1
  376. package/dist/scene/materials/water.js +0 -54
  377. package/dist/scene/parse.d.ts +0 -23
  378. package/dist/scene/parse.d.ts.map +0 -1
  379. package/dist/scene/parse.js +0 -179
  380. package/dist/scene/particles-factory.d.ts +0 -33
  381. package/dist/scene/particles-factory.d.ts.map +0 -1
  382. package/dist/scene/particles-factory.js +0 -282
  383. package/dist/scene/scene-apply.d.ts +0 -109
  384. package/dist/scene/scene-apply.d.ts.map +0 -1
  385. package/dist/scene/scene-apply.js +0 -370
  386. package/dist/scene/scene-diff-schema.d.ts +0 -285
  387. package/dist/scene/scene-diff-schema.d.ts.map +0 -1
  388. package/dist/scene/scene-diff-schema.js +0 -92
  389. package/dist/scene/scene-diff-types.d.ts +0 -40
  390. package/dist/scene/scene-diff-types.d.ts.map +0 -1
  391. package/dist/scene/scene-diff-types.js +0 -14
  392. package/dist/scene/scene-loader.d.ts +0 -167
  393. package/dist/scene/scene-loader.d.ts.map +0 -1
  394. package/dist/scene/scene-loader.js +0 -1211
  395. package/dist/scene/scene-query.d.ts +0 -11
  396. package/dist/scene/scene-query.d.ts.map +0 -1
  397. package/dist/scene/scene-query.js +0 -63
  398. package/dist/scene/scene-types.d.ts +0 -10
  399. package/dist/scene/scene-types.d.ts.map +0 -1
  400. package/dist/scene/scene-types.js +0 -8
  401. package/dist/scene/scene-version.d.ts +0 -26
  402. package/dist/scene/scene-version.d.ts.map +0 -1
  403. package/dist/scene/scene-version.js +0 -34
  404. package/dist/scene/schema/animation.d.ts +0 -8
  405. package/dist/scene/schema/animation.d.ts.map +0 -1
  406. package/dist/scene/schema/animation.js +0 -42
  407. package/dist/scene/schema/audio.d.ts +0 -13
  408. package/dist/scene/schema/audio.d.ts.map +0 -1
  409. package/dist/scene/schema/audio.js +0 -22
  410. package/dist/scene/schema/camera.d.ts +0 -28
  411. package/dist/scene/schema/camera.d.ts.map +0 -1
  412. package/dist/scene/schema/camera.js +0 -17
  413. package/dist/scene/schema/collider.d.ts +0 -40
  414. package/dist/scene/schema/collider.d.ts.map +0 -1
  415. package/dist/scene/schema/collider.js +0 -55
  416. package/dist/scene/schema/entity-ref.d.ts +0 -31
  417. package/dist/scene/schema/entity-ref.d.ts.map +0 -1
  418. package/dist/scene/schema/entity-ref.js +0 -61
  419. package/dist/scene/schema/entity.d.ts +0 -1036
  420. package/dist/scene/schema/entity.d.ts.map +0 -1
  421. package/dist/scene/schema/entity.js +0 -153
  422. package/dist/scene/schema/environment.d.ts +0 -425
  423. package/dist/scene/schema/environment.d.ts.map +0 -1
  424. package/dist/scene/schema/environment.js +0 -357
  425. package/dist/scene/schema/index.d.ts +0 -37
  426. package/dist/scene/schema/index.d.ts.map +0 -1
  427. package/dist/scene/schema/index.js +0 -19
  428. package/dist/scene/schema/instances.d.ts +0 -14
  429. package/dist/scene/schema/instances.d.ts.map +0 -1
  430. package/dist/scene/schema/instances.js +0 -28
  431. package/dist/scene/schema/joint.d.ts +0 -23
  432. package/dist/scene/schema/joint.d.ts.map +0 -1
  433. package/dist/scene/schema/joint.js +0 -23
  434. package/dist/scene/schema/light.d.ts +0 -38
  435. package/dist/scene/schema/light.d.ts.map +0 -1
  436. package/dist/scene/schema/light.js +0 -26
  437. package/dist/scene/schema/material.d.ts +0 -199
  438. package/dist/scene/schema/material.d.ts.map +0 -1
  439. package/dist/scene/schema/material.js +0 -103
  440. package/dist/scene/schema/mesh.d.ts +0 -48
  441. package/dist/scene/schema/mesh.d.ts.map +0 -1
  442. package/dist/scene/schema/mesh.js +0 -82
  443. package/dist/scene/schema/particles.d.ts +0 -2178
  444. package/dist/scene/schema/particles.d.ts.map +0 -1
  445. package/dist/scene/schema/particles.js +0 -321
  446. package/dist/scene/schema/physics.d.ts +0 -56
  447. package/dist/scene/schema/physics.d.ts.map +0 -1
  448. package/dist/scene/schema/physics.js +0 -37
  449. package/dist/scene/schema/scene-file.d.ts +0 -303
  450. package/dist/scene/schema/scene-file.d.ts.map +0 -1
  451. package/dist/scene/schema/scene-file.js +0 -256
  452. package/dist/scene/schema/shadow.d.ts +0 -28
  453. package/dist/scene/schema/shadow.d.ts.map +0 -1
  454. package/dist/scene/schema/shadow.js +0 -20
  455. package/dist/scene/schema/spline.d.ts +0 -25
  456. package/dist/scene/schema/spline.d.ts.map +0 -1
  457. package/dist/scene/schema/spline.js +0 -15
  458. package/dist/scene/schema/tuples.d.ts +0 -12
  459. package/dist/scene/schema/tuples.d.ts.map +0 -1
  460. package/dist/scene/schema/tuples.js +0 -14
  461. package/dist/scene/user-data.d.ts +0 -185
  462. package/dist/scene/user-data.d.ts.map +0 -1
  463. package/dist/scene/user-data.js +0 -144
  464. package/dist/setup/setup-audio.d.ts +0 -20
  465. package/dist/setup/setup-audio.d.ts.map +0 -1
  466. package/dist/setup/setup-audio.js +0 -41
  467. package/dist/setup/setup-particles.d.ts +0 -17
  468. package/dist/setup/setup-particles.d.ts.map +0 -1
  469. package/dist/setup/setup-particles.js +0 -16
  470. package/dist/setup/setup-physics.d.ts +0 -25
  471. package/dist/setup/setup-physics.d.ts.map +0 -1
  472. package/dist/setup/setup-physics.js +0 -51
  473. package/dist/setup/setup-renderer.d.ts +0 -69
  474. package/dist/setup/setup-renderer.d.ts.map +0 -1
  475. package/dist/setup/setup-renderer.js +0 -363
  476. package/dist/tools/define-tool.d.ts +0 -130
  477. package/dist/tools/define-tool.d.ts.map +0 -1
  478. package/dist/tools/define-tool.js +0 -96
  479. package/dist/world2d/authoring-2d.d.ts +0 -80
  480. package/dist/world2d/authoring-2d.d.ts.map +0 -1
  481. package/dist/world2d/authoring-2d.js +0 -195
  482. package/dist/world2d/capture-to-scene2d.d.ts +0 -5
  483. package/dist/world2d/capture-to-scene2d.d.ts.map +0 -1
  484. package/dist/world2d/capture-to-scene2d.js +0 -49
  485. package/dist/world2d/collision-2d.d.ts +0 -52
  486. package/dist/world2d/collision-2d.d.ts.map +0 -1
  487. package/dist/world2d/collision-2d.js +0 -70
  488. package/dist/world2d/components-2d.d.ts +0 -47
  489. package/dist/world2d/components-2d.d.ts.map +0 -1
  490. package/dist/world2d/components-2d.js +0 -77
  491. package/dist/world2d/index.d.ts +0 -34
  492. package/dist/world2d/index.d.ts.map +0 -1
  493. package/dist/world2d/index.js +0 -32
  494. package/dist/world2d/ingest-iframe-2d.d.ts +0 -82
  495. package/dist/world2d/ingest-iframe-2d.d.ts.map +0 -1
  496. package/dist/world2d/ingest-iframe-2d.js +0 -166
  497. package/dist/world2d/ingest2d.d.ts +0 -97
  498. package/dist/world2d/ingest2d.d.ts.map +0 -1
  499. package/dist/world2d/ingest2d.js +0 -40
  500. package/dist/world2d/physics2d-registry.d.ts +0 -24
  501. package/dist/world2d/physics2d-registry.d.ts.map +0 -1
  502. package/dist/world2d/physics2d-registry.js +0 -38
  503. package/dist/world2d/pixi-game-adapter.d.ts +0 -107
  504. package/dist/world2d/pixi-game-adapter.d.ts.map +0 -1
  505. package/dist/world2d/pixi-game-adapter.js +0 -210
  506. package/dist/world2d/pixi-surface.d.ts +0 -39
  507. package/dist/world2d/pixi-surface.d.ts.map +0 -1
  508. package/dist/world2d/pixi-surface.js +0 -47
  509. package/dist/world2d/scene-capture-2d.d.ts +0 -43
  510. package/dist/world2d/scene-capture-2d.d.ts.map +0 -1
  511. package/dist/world2d/scene-capture-2d.js +0 -92
  512. package/dist/world2d/scene2d-loader.d.ts +0 -27
  513. package/dist/world2d/scene2d-loader.d.ts.map +0 -1
  514. package/dist/world2d/scene2d-loader.js +0 -275
  515. package/dist/world2d/schema/entity2d.d.ts +0 -102
  516. package/dist/world2d/schema/entity2d.d.ts.map +0 -1
  517. package/dist/world2d/schema/entity2d.js +0 -119
  518. package/dist/world2d/schema/physics2d.d.ts +0 -46
  519. package/dist/world2d/schema/physics2d.d.ts.map +0 -1
  520. package/dist/world2d/schema/physics2d.js +0 -45
  521. package/dist/world2d/schema/sprite.d.ts +0 -42
  522. package/dist/world2d/schema/sprite.d.ts.map +0 -1
  523. package/dist/world2d/schema/sprite.js +0 -63
  524. package/dist/world2d/schema/tilemap.d.ts +0 -15
  525. package/dist/world2d/schema/tilemap.d.ts.map +0 -1
  526. package/dist/world2d/schema/tilemap.js +0 -19
  527. package/dist/world2d/schema/tuples2d.d.ts +0 -20
  528. package/dist/world2d/schema/tuples2d.d.ts.map +0 -1
  529. package/dist/world2d/schema/tuples2d.js +0 -19
  530. package/dist/world2d/system-adapters-2d.d.ts +0 -16
  531. package/dist/world2d/system-adapters-2d.d.ts.map +0 -1
  532. package/dist/world2d/system-adapters-2d.js +0 -37
  533. package/dist/world2d/transform-writer-2d.d.ts +0 -16
  534. package/dist/world2d/transform-writer-2d.d.ts.map +0 -1
  535. package/dist/world2d/transform-writer-2d.js +0 -22
  536. package/dist/world2d/types.d.ts +0 -59
  537. package/dist/world2d/types.d.ts.map +0 -1
  538. package/dist/world2d/types.js +0 -1
@@ -1,394 +0,0 @@
1
- // T3.1 slice 1 — the game manifest schema (`vgai.game.json`).
2
- //
3
- // This is the serialized form of the Game's root list
4
- // (docs/GAME-ROOT-DESIGN.md §1, D6) — see docs/GAME-MANIFEST-DESIGN.md §3 for
5
- // the adjudicated field list this file implements exactly. `load.ts` is this
6
- // schema's runtime reader (T4.1 policy): it parses via this schema, then
7
- // layers the cross-field checks and default resolution §3/§5 describe. Every
8
- // field below has a `.describe()` (repo policy — powers
9
- // `scripts/generate-schema.ts` and the T4.1 schema-walk coverage test).
10
- //
11
- // Naming: this file follows the repo's `XxxSchema` (Zod schema) / `Xxx`
12
- // (inferred type) convention used throughout `scene/schema/` — the design
13
- // doc's §3 sketch names the bare consts (`Tier`, `IngestStrategy`,
14
- // `AdapterRoot`) without the `Schema` suffix; that sketch is explicitly a
15
- // "Zod sketch" the doc tells implementers to adapt to real code style
16
- // ("mirror the style in scene/schema/scene-file.ts" per CLAUDE.md), so the
17
- // schema consts here are suffixed and the bare names are reserved for the
18
- // inferred types, matching every other schema file in the repo.
19
- //
20
- // Adapter surface values mirror `AdapterSurface` in
21
- // `packages/engine/src/runtime/game.ts` (`'threejs' | 'pixijs' | 'react'`)
22
- // by value, not by import. The adapter remains the sole root discriminator.
23
- import { z } from 'zod';
24
- /**
25
- * Current on-disk `vgai.game.json` format. Exported so editor/server
26
- * compatibility checks do not duplicate the schema's literal value.
27
- */
28
- export const GAME_MANIFEST_VERSION = 2;
29
- // ---------------------------------------------------------------------------
30
- // Ingest capture strategy (world2d today; the general vocabulary D6/§4 names)
31
- // ---------------------------------------------------------------------------
32
- export const IngestStrategySchema = z.enum([
33
- 'shared', // game imports host-served ESM three — full in-realm capture
34
- 'deduped', // game source built by OUR pipeline, bundler dedupe — full capture
35
- 'iframe-reachable', // prebuilt bundle in iframe, three reachable — cross-realm capture
36
- 'opaque-embed', // prebuilt bundle, nothing reachable — host lifecycle only
37
- ]);
38
- // ---------------------------------------------------------------------------
39
- // Capability tier — one ordered enum, declared per delivery context (§4)
40
- // ---------------------------------------------------------------------------
41
- export const TierSchema = z.enum([
42
- 'first-party', // vgai-native root: full editor, full loop control
43
- 'shared', // = IngestStrategy 'shared' rung
44
- 'deduped', // = IngestStrategy 'deduped' rung
45
- 'iframe-reachable', // = IngestStrategy 'iframe-reachable' rung
46
- 'opaque-embed', // = IngestStrategy 'opaque-embed' rung
47
- 'unsupported', // this root does not function in this delivery context
48
- ]);
49
- // ---------------------------------------------------------------------------
50
- // Root adapter identity. The adapter is the sole discriminator: a root never
51
- // repeats its rendering substrate in a sibling `kind` field. Module and ingest
52
- // adapters carry the surface their adapter contract exposes because the host
53
- // must allocate a layer before the module has mounted.
54
- // ---------------------------------------------------------------------------
55
- export const RootAdapterSchema = z
56
- .union([
57
- z.enum(['threejs', 'pixijs', 'react']),
58
- z
59
- .object({
60
- module: z
61
- .string()
62
- .describe('Game-folder-relative path to a custom adapter module (trust boundary)'),
63
- surface: z
64
- .enum(['threejs', 'pixijs', 'react'])
65
- .describe('Native surface exposed by this custom adapter contract'),
66
- })
67
- .strict(),
68
- z
69
- .object({
70
- surface: z
71
- .enum(['threejs', 'pixijs', 'react'])
72
- .describe('Native surface captured from the unmodified game'),
73
- ingest: z
74
- .object({
75
- strategy: IngestStrategySchema.describe('Capture mechanics rung this ingested root uses (§4) — also the root`s natural local capability tier'),
76
- entryHtml: z
77
- .string()
78
- .optional()
79
- .describe('Entry HTML path, project-relative. WIRED for opaque-embed (D-W2, ' +
80
- 'docs/WAVE4-FTUE-HARDENING-DESIGN.md): the file`s bytes are read verbatim through ' +
81
- 'the project-static route and hosted in a sandboxed iframe (embed-only, no scene ' +
82
- 'introspection), for both pixijs and threejs roots. Legal but NOT wired to a ' +
83
- 'mount for iframe-reachable (a named error at resolve names this — use `bundleUrl` ' +
84
- 'instead, the wired reachable route).'),
85
- assets: z
86
- .record(z.string(), z.string())
87
- .optional()
88
- .describe('Path-substring -> served-URL rewrites for this ingested game (IngestGame.assets today)'),
89
- domStubs: z
90
- .array(z.string())
91
- .optional()
92
- .describe('DOM API stub ids this ingested game requires to run headlessly/in-realm'),
93
- captureTimeoutMs: z
94
- .number()
95
- .optional()
96
- .describe('Max time to wait for in-realm/cross-realm capture before failing loudly'),
97
- // Track P (docs/PIXI-INGEST-LANDING-DESIGN.md §2) — the six
98
- // iframe-reachable-multi mount fields (`ingest-iframe-2d.ts`'s
99
- // `IframeReachableMultiOpts`), legal ONLY when `strategy` is
100
- // 'iframe-reachable' (enforced by the `.superRefine` below).
101
- bundleUrl: z
102
- .string()
103
- .optional()
104
- .describe('Absolute URL of the externalized built game bundle — the WIRED iframe-reachable ' +
105
- 'mount route (iframe-reachable only), for BOTH pixijs (Track P, ' +
106
- "ingest-iframe-2d.ts's mountIngestGame2DIframeReachableMulti) and threejs (D-W1, " +
107
- 'docs/WAVE4-FTUE-HARDENING-DESIGN.md, ' +
108
- "ingest-iframe-reachable-adapter.ts's mountIngestGameIframeReachableBundle). " +
109
- 'PRECONDITION: the bundle must externalize its root`s own runtime as a bare, ' +
110
- 'un-rewritten import (`pixi.js` for pixijs, `three` for threejs — `vgai bundle` ' +
111
- 'does this for you) so it resolves through the iframe importmap to the HOST ' +
112
- 'instance the capture trap is installed on; a bundle with an inlined runtime is ' +
113
- 'unreachable and degrades to the embed-only floor. Exactly one of bundleUrl/' +
114
- 'entryHtml is required when strategy is iframe-reachable.'),
115
- baseHref: z
116
- .string()
117
- .optional()
118
- .describe("Iframe <base href> so the game's relative asset URLs resolve (iframe-reachable only)."),
119
- assetBaseUrl: z
120
- .string()
121
- .optional()
122
- .describe("Host-side basePath forced onto the trapped runtime's own asset resolution — " +
123
- "pixi's `Assets.init` for a pixijs root, three's " +
124
- '`DefaultLoadingManager.setURLModifier` for a threejs root (D-W1) — absolute, or ' +
125
- "root-relative (resolved against the editor page's own origin at mount time, " +
126
- 'ingest-mode.ts, so a static manifest never has to know the dev-server port) ' +
127
- '(iframe-reachable only — a document.write iframe keeps the parent window.location).'),
128
- extraDeps: z
129
- .array(z.string())
130
- .optional()
131
- .describe("Bare specifiers of this root's externalized deps beyond its own runtime " +
132
- "(pixi.js/three — e.g. '@pixi/sound', 'gsap'). Resolved by the editor's " +
133
- 'host-namespace registry into module namespaces when known (D-P1 — the manifest ' +
134
- 'carries data, not code); an unregistered specifier falls back to the open ' +
135
- "project's own node_modules (D-Z3, docs/WAVE3-ADAPTER-PLUMBING-DESIGN.md), served " +
136
- 'as a verbatim iframe importmap URL. Throws a named error if neither resolves it ' +
137
- '(iframe-reachable only).'),
138
- pixiModuleUrl: z
139
- .string()
140
- .optional()
141
- .describe('PIXI-ONLY: standalone matching-major pixi ESM URL to trap instead of the host ' +
142
- "pixi, for version-skewed games (e.g. a v6 game on a v8 host); this field's " +
143
- 'PRESENCE is how the skew is expressed (D-P2 — no separate strategy/tier for ' +
144
- 'version skew) (iframe-reachable only). Declaring this on a `kind: "threejs"` ' +
145
- 'root is schema-legal (this field is kind-agnostic here) but throws a NAMED ' +
146
- 'not-supported error at resolve — three has no version-skew mount this wave (D-W7, ' +
147
- 'docs/WAVE4-FTUE-HARDENING-DESIGN.md: a hypothetical `threeModuleUrl` is explicitly ' +
148
- 'parked, no consumer exists).'),
149
- bodyHtml: z
150
- .string()
151
- .optional()
152
- .describe('HTML injected into the iframe body before the game script boots (e.g. a ' +
153
- '`<div id="game-root">` the game expects to find) (iframe-reachable only).'),
154
- })
155
- .describe('Ingest adapter configuration for an unmodified game (a repo-vendored game or your ' +
156
- 'own external folder)')
157
- .superRefine((ingest, ctx) => {
158
- // Track P (docs/PIXI-INGEST-LANDING-DESIGN.md §2/D-P4): the six
159
- // iframe-reachable-multi fields only make sense for the
160
- // iframe-reachable-multi mount — reject them under any other
161
- // strategy (mirrors ui.ts's dead-field-under-wrong-variant pattern).
162
- const iframeOnlyFields = [
163
- ['bundleUrl', ingest.bundleUrl !== undefined],
164
- ['baseHref', ingest.baseHref !== undefined],
165
- ['assetBaseUrl', ingest.assetBaseUrl !== undefined],
166
- ['extraDeps', ingest.extraDeps !== undefined],
167
- ['pixiModuleUrl', ingest.pixiModuleUrl !== undefined],
168
- ['bodyHtml', ingest.bodyHtml !== undefined],
169
- ];
170
- if (ingest.strategy !== 'iframe-reachable') {
171
- for (const [key, present] of iframeOnlyFields) {
172
- if (present) {
173
- ctx.addIssue({
174
- code: z.ZodIssueCode.custom,
175
- message: `\`${key}\` is only legal when strategy is 'iframe-reachable' (got ` +
176
- `"${ingest.strategy}") — bundleUrl/baseHref/assetBaseUrl/extraDeps/` +
177
- "pixiModuleUrl/bodyHtml are the iframe-reachable-multi mount's options " +
178
- '(pixijs: ingest-iframe-2d.ts IframeReachableMultiOpts; threejs, D-W1: ' +
179
- 'ingest-iframe-reachable-adapter.ts IframeReachableBundleOpts) and have no ' +
180
- 'meaning under any other strategy.',
181
- path: [key],
182
- });
183
- }
184
- }
185
- return;
186
- }
187
- const hasBundleUrl = ingest.bundleUrl !== undefined;
188
- const hasEntryHtml = ingest.entryHtml !== undefined;
189
- if (hasBundleUrl === hasEntryHtml) {
190
- ctx.addIssue({
191
- code: z.ZodIssueCode.custom,
192
- message: "strategy 'iframe-reachable' requires EXACTLY ONE of `bundleUrl` (externalized " +
193
- 'multi-file bundle, the iframe-reachable-multi mount) or `entryHtml` (single-' +
194
- `file/legacy iframe entry) — ${hasBundleUrl ? 'both are present' : 'neither is present'}.`,
195
- path: hasBundleUrl ? ['bundleUrl'] : ['entryHtml'],
196
- });
197
- }
198
- }),
199
- })
200
- .strict(),
201
- ])
202
- .describe("Root adapter identity: built-in 'threejs'/'pixijs'/'react', a custom " +
203
- '{ module, surface } adapter, or an { ingest, surface } adapter for an unmodified game');
204
- // ---------------------------------------------------------------------------
205
- // Root entry
206
- // ---------------------------------------------------------------------------
207
- export const AdapterRootSchema = z
208
- .object({
209
- id: z
210
- .string()
211
- .describe('Unique id for this root within the manifest (enforced-unique, D-V6 — GameManifestSchema.roots rejects duplicates)'),
212
- description: z
213
- .string()
214
- .optional()
215
- .describe("Optional one-line description of this root's game/content (e.g. an ingested game's " +
216
- "blurb — the manifest-native replacement for a registry entry's description field)"),
217
- adapter: RootAdapterSchema.describe("This root's adapter and sole rendering/lifecycle discriminator"),
218
- scene: z
219
- .string()
220
- .optional()
221
- .describe('.vscn.json / .scn2d.json scene path (default adapters only — ingest adapters keep their own formats)'),
222
- entry: z
223
- .string()
224
- .optional()
225
- .describe("Module exporting setup()/adapter (default adapters' code-authored alternative to `scene`)"),
226
- zOrder: z
227
- .number()
228
- .int()
229
- .default(0)
230
- .describe('Canvas stacking order (COMPOSITION-DESIGN); ties broken by array order'),
231
- pausable: z
232
- .boolean()
233
- .default(true)
234
- .describe('Whether play-mode pause/step applies to this root'),
235
- loop: z
236
- .enum(['gated', 'self-driven'])
237
- .default('gated')
238
- .describe('gated: host-driven loop (default). self-driven: this root drives its own loop ' +
239
- '(the "composited, unsynchronized" tier) — an axis independent of capability tier'),
240
- capabilities: z
241
- .object({
242
- local: TierSchema.optional().describe('Declared capability tier when served via the local CLI (Vite pipeline); omitted -> derived (§4)'),
243
- hosted: TierSchema.optional().describe('Declared capability tier when served hosted (no bundler: esbuild-wasm + externals only); omitted -> derived (§4)'),
244
- })
245
- .optional()
246
- .describe("Per-delivery-context capability tier declarations (§4). Declaring above the adapter's " +
247
- 'ceiling for that context is an error; declaring at or below it (including `unsupported`) is legal.'),
248
- })
249
- .strict();
250
- // ---------------------------------------------------------------------------
251
- // Game manifest (vgai.game.json)
252
- // ---------------------------------------------------------------------------
253
- export const GameManifestSchema = z
254
- .object({
255
- $schema: z
256
- .string()
257
- .optional()
258
- .describe('Optional JSON Schema URI for editor autocomplete and validation'),
259
- manifestVersion: z
260
- .literal(GAME_MANIFEST_VERSION)
261
- .describe('Manifest file format version (v2 clean roots)'),
262
- name: z.string().describe('Game display name'),
263
- appId: z
264
- .string()
265
- .optional()
266
- .describe('Stable reverse-domain application id used by packaged targets'),
267
- editorPort: z
268
- .number()
269
- .int()
270
- .min(1024)
271
- .max(65535)
272
- .optional()
273
- .describe('Stable preferred local editor port; launchers may fall forward when occupied'),
274
- version: z.string().describe("The game's own version (used for orphan detection)"),
275
- engine: z
276
- .object({
277
- version: z
278
- .string()
279
- .describe('Exact @vgai/engine semver this game was scaffolded/last upgraded against — an ' +
280
- 'identity pin, not a range'),
281
- })
282
- .describe('Engine version pin'),
283
- roots: z
284
- .array(AdapterRootSchema)
285
- .min(1)
286
- .superRefine((roots, ctx) => {
287
- // D-V6 (docs/WAVE5-MULTIWORLD-INGEST-DESIGN.md §1G debt,
288
- // docs/MULTI-WORLD-DESIGN.md §1G): root ids are described as unique
289
- // above but that was describe-only at the SCHEMA level — only
290
- // load.ts's loader-level cross-field check caught a collision, so
291
- // any OTHER consumer of this schema (the generated JSON Schema,
292
- // editor tooling) saw duplicate ids as legal. Enforced HERE instead,
293
- // naming every colliding id (not just the first found) — overlay
294
- // files are keyed by root id (`.vgai/overlays/<id>.json`), so a
295
- // silently-permitted duplicate would have two roots silently share
296
- // one overlay.
297
- const counts = new Map();
298
- for (const root of roots)
299
- counts.set(root.id, (counts.get(root.id) ?? 0) + 1);
300
- const duplicates = [...counts.entries()].filter(([, n]) => n > 1).map(([id]) => id);
301
- if (duplicates.length === 0)
302
- return;
303
- const idsText = duplicates.map((id) => `"${id}"`).join(', ');
304
- ctx.addIssue({
305
- code: z.ZodIssueCode.custom,
306
- message: duplicates.length === 1
307
- ? `Game manifest: duplicate root id ${idsText} — root ids must be unique across the manifest (enforced-unique).`
308
- : `Game manifest: duplicate root ids: ${idsText} — root ids must be unique across the manifest (enforced-unique).`,
309
- });
310
- })
311
- .describe("The Game's explicit, non-empty adapter-root composition. There is no implicit root."),
312
- authoring: z
313
- .object({
314
- hierarchy: z
315
- .object({
316
- rootLabels: z
317
- .record(z.string(), z.string())
318
- .optional()
319
- .describe('Optional editor labels keyed by adapter-root id'),
320
- groups: z
321
- .array(z.object({
322
- id: z.string().describe('Unique editor-only group id'),
323
- label: z.string().describe('Editor-only group label'),
324
- roots: z
325
- .array(z.string())
326
- .min(1)
327
- .describe('Adapter-root ids shown under this editor-only group'),
328
- }))
329
- .optional()
330
- .describe('Optional editor-only hierarchy groups'),
331
- })
332
- .optional()
333
- .describe('Editor projection for native adapter roots'),
334
- })
335
- .optional()
336
- .describe('Editor-only authoring metadata; never runtime ownership'),
337
- server: z
338
- .object({
339
- room: z.string().describe('Colyseus room name'),
340
- module: z
341
- .string()
342
- .optional()
343
- .describe('Module path for the Colyseus room bootstrap; defaults to the scaffolded server bootstrap'),
344
- })
345
- .optional()
346
- .describe('Multiplayer server config (Colyseus), if this game registers a room'),
347
- resolution: z
348
- .object({
349
- width: z.number().describe('Canvas width in pixels'),
350
- height: z.number().describe('Canvas height in pixels'),
351
- })
352
- .optional()
353
- .describe('Canvas resolution'),
354
- debug: z
355
- .object({
356
- allowInProduction: z
357
- .boolean()
358
- .describe('Allow the ?vgai-debug=1 introspection bridge and debug-command invocation in ' +
359
- 'production builds. Default false: the bridge only installs in dev builds. The ' +
360
- 'runtime reader is the debug-bridge installer (D18).'),
361
- })
362
- .optional()
363
- .describe('Debug-bridge production gating (D18) — governs whether ?vgai-debug=1 installs ' +
364
- 'window.__vgai outside dev builds.'),
365
- determinism: z
366
- .object({
367
- seededRandom: z
368
- .boolean()
369
- .describe('Declares that ALL gameplay RNG in this project flows through ctx.random (the ' +
370
- 'named-stream seeded PRNG, docs/D15-DETERMINISM-DESIGN.md) rather than raw ' +
371
- 'Math.random/Date.now/performance.now. Three runtime enforcers key off this flag: ' +
372
- 'the boot-time seeding reader (mount-manifest.ts seeds ctx.random from ' +
373
- 'defaultSeed/?vgai-seed=/explicit config, in that precedence, only when true), the ' +
374
- 'gameplay-rng-ban burn-down scan (test/gameplay-rng-ban.test.ts — lints this ' +
375
- "project's src/ for raw RNG/wall-clock calls), and the dev-mode Math.random phase " +
376
- 'trap (runtime/gameplay-rng-trap.ts — warns once per call site during a gameplay ' +
377
- 'frame, never throws). Default false: an undeclared project gets no determinism ' +
378
- 'contract at all (that IS the opt-out — no dead field, per the T4.1 policy).'),
379
- defaultSeed: z
380
- .number()
381
- .int()
382
- .optional()
383
- .describe('The seed ctx.random boots from when seededRandom is true, unless overridden by ' +
384
- '?vgai-seed=<int> (the query param always wins over this manifest default) or an ' +
385
- 'even higher-precedence explicit config value a host passes directly. Optional — ' +
386
- "omit to fall back to the runtime's own fixed default seed."),
387
- })
388
- .optional()
389
- .describe('Seeded-RNG determinism contract (D15, docs/D15-DETERMINISM-DESIGN.md) — governs ' +
390
- 'whether ctx.random is boot-seeded from a reproducible seed and whether the ' +
391
- 'gameplay-rng-ban scan / dev-mode Math.random phase trap are active for this project.'),
392
- })
393
- .strict()
394
- .describe('Game manifest (vgai.game.json) — the complete v2 project configuration');
@@ -1,41 +0,0 @@
1
- import type RAPIER from '@dimforge/rapier3d-compat';
2
- /**
3
- * Collision event handler.
4
- * Called with the two collider handles and whether contact started or stopped.
5
- */
6
- export type CollisionHandler = (handleA: number, handleB: number, started: boolean) => void;
7
- /**
8
- * Drains the Rapier event queue each frame and dispatches collision events.
9
- *
10
- * Usage:
11
- * const collisions = createCollisionSystem(rapierWorld, eventQueue);
12
- * collisions.onCollision((a, b, started) => { ... });
13
- * // In physics phase: rapierWorld.step(eventQueue);
14
- * // In postPhysics: collisions.drain();
15
- */
16
- export declare function createCollisionSystem(rapierWorld: RAPIER.World, eventQueue: RAPIER.EventQueue): {
17
- /** Register a collision handler. */
18
- onCollision(handler: CollisionHandler): void;
19
- /** Remove a collision handler. */
20
- offCollision(handler: CollisionHandler): void;
21
- /**
22
- * Drain the event queue and dispatch collision events.
23
- * Call this in POST_PHYSICS phase, after rapierWorld.step(eventQueue).
24
- *
25
- * Events are buffered first, then handlers run *after* the drain callback
26
- * returns. This is required: a handler that calls back into the Rapier world
27
- * (e.g. trigger dispatch resolving a collider, or an `onTriggerEnter` that
28
- * spawns/removes a body) would otherwise re-enter Rapier while it is still
29
- * borrowed by `drainCollisionEvents`, throwing "recursive use of an object
30
- * ... unsafe aliasing in rust".
31
- */
32
- drain(): void;
33
- /**
34
- * Look up the rigid body handle that owns a collider handle.
35
- * To resolve a collider directly to its Object3D entity, use the physics
36
- * registry's `getByColliderHandle` reverse index instead.
37
- */
38
- getBodyHandleFromCollider(colliderHandle: number): number | undefined;
39
- };
40
- export type CollisionSystem = ReturnType<typeof createCollisionSystem>;
41
- //# sourceMappingURL=collision-system.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"collision-system.d.ts","sourceRoot":"","sources":["../../src/physics/collision-system.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AAEpD;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;AAE5F;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU;IAI1F,oCAAoC;yBACf,gBAAgB;IAIrC,kCAAkC;0BACZ,gBAAgB;IAKtC;;;;;;;;;;OAUG;;IAkBH;;;;OAIG;8CACuC,MAAM,GAAG,MAAM,GAAG,SAAS;EAQxE;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -1,64 +0,0 @@
1
- /**
2
- * Drains the Rapier event queue each frame and dispatches collision events.
3
- *
4
- * Usage:
5
- * const collisions = createCollisionSystem(rapierWorld, eventQueue);
6
- * collisions.onCollision((a, b, started) => { ... });
7
- * // In physics phase: rapierWorld.step(eventQueue);
8
- * // In postPhysics: collisions.drain();
9
- */
10
- export function createCollisionSystem(rapierWorld, eventQueue) {
11
- const handlers = [];
12
- return {
13
- /** Register a collision handler. */
14
- onCollision(handler) {
15
- handlers.push(handler);
16
- },
17
- /** Remove a collision handler. */
18
- offCollision(handler) {
19
- const idx = handlers.indexOf(handler);
20
- if (idx !== -1)
21
- handlers.splice(idx, 1);
22
- },
23
- /**
24
- * Drain the event queue and dispatch collision events.
25
- * Call this in POST_PHYSICS phase, after rapierWorld.step(eventQueue).
26
- *
27
- * Events are buffered first, then handlers run *after* the drain callback
28
- * returns. This is required: a handler that calls back into the Rapier world
29
- * (e.g. trigger dispatch resolving a collider, or an `onTriggerEnter` that
30
- * spawns/removes a body) would otherwise re-enter Rapier while it is still
31
- * borrowed by `drainCollisionEvents`, throwing "recursive use of an object
32
- * ... unsafe aliasing in rust".
33
- */
34
- drain() {
35
- const events = [];
36
- eventQueue.drainCollisionEvents((handle1, handle2, started) => {
37
- events.push([handle1, handle2, started]);
38
- });
39
- eventQueue.drainContactForceEvents((_event) => {
40
- // Contact force events available for advanced use.
41
- // Game code can subscribe to these by extending this system.
42
- });
43
- for (const [handle1, handle2, started] of events) {
44
- for (let i = 0; i < handlers.length; i++) {
45
- handlers[i](handle1, handle2, started);
46
- }
47
- }
48
- },
49
- /**
50
- * Look up the rigid body handle that owns a collider handle.
51
- * To resolve a collider directly to its Object3D entity, use the physics
52
- * registry's `getByColliderHandle` reverse index instead.
53
- */
54
- getBodyHandleFromCollider(colliderHandle) {
55
- const collider = rapierWorld.getCollider(colliderHandle);
56
- if (!collider)
57
- return undefined;
58
- const body = collider.parent();
59
- if (!body)
60
- return undefined;
61
- return body.handle;
62
- },
63
- };
64
- }
@@ -1,45 +0,0 @@
1
- import type RAPIER from '@dimforge/rapier3d-compat';
2
- import type * as THREE from 'three';
3
- /** The Rapier handles owned by a single Object3D entity. */
4
- export interface PhysicsRefs {
5
- body: RAPIER.RigidBody;
6
- collider: RAPIER.Collider;
7
- }
8
- /**
9
- * Maps Three.js Object3Ds to their Rapier bodies/colliders, and Rapier collider
10
- * handles back to Object3Ds.
11
- *
12
- * Replaces the old bitecs RigidBodyRef/ColliderRef SoA components. Two indexes:
13
- * - `Object3D → {body, collider}` for the postPhysics transform writer and for
14
- * GameComponents/editor to reach an entity's physics.
15
- * - `colliderHandle → Object3D` reverse index for collision/trigger dispatch
16
- * (Rapier collision events report collider handles).
17
- */
18
- export declare function createPhysicsRegistry(): {
19
- /** Register an Object3D's body + collider, indexing both directions. */
20
- add(object3D: THREE.Object3D, body: RAPIER.RigidBody, collider: RAPIER.Collider): void;
21
- /** Get the physics refs for an Object3D, if any. */
22
- get(object3D: THREE.Object3D): PhysicsRefs | undefined;
23
- /** Resolve a Rapier collider handle to the Object3D that owns it. */
24
- getByColliderHandle(handle: number): THREE.Object3D | undefined;
25
- /**
26
- * Register a callback fired synchronously, just before an entry is torn
27
- * down, for every `remove()` call (both indexes are still intact at call
28
- * time). Used by trigger-dispatch (T1.12d) to flush any pending
29
- * `onTriggerExit` for a sensor overlap involving this object before the
30
- * collider handle becomes unresolvable — otherwise an entity despawned
31
- * between the physical exit and the next `collisions.drain()` silently
32
- * drops the exit callback on its still-live overlap partner.
33
- */
34
- onRemove(listener: (object3D: THREE.Object3D, refs: PhysicsRefs) => void): void;
35
- /** Remove an Object3D's entry from both indexes. */
36
- remove(object3D: THREE.Object3D): void;
37
- /** Iterate every (Object3D, refs) pair — used by the transform writer. */
38
- entries(): IterableIterator<[THREE.Object3D, PhysicsRefs]>;
39
- /** Number of registered physics entities. */
40
- readonly size: number;
41
- /** Clear both indexes (does not free Rapier bodies). */
42
- clear(): void;
43
- };
44
- export type PhysicsRegistry = ReturnType<typeof createPhysicsRegistry>;
45
- //# sourceMappingURL=physics-registry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"physics-registry.d.ts","sourceRoot":"","sources":["../../src/physics/physics-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AACpD,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAEpC,4DAA4D;AAC5D,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;CAC3B;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB;IAMjC,wEAAwE;kBAC1D,KAAK,CAAC,QAAQ,QAAQ,MAAM,CAAC,SAAS,YAAY,MAAM,CAAC,QAAQ,GAAG,IAAI;IAKtF,oDAAoD;kBACtC,KAAK,CAAC,QAAQ,GAAG,WAAW,GAAG,SAAS;IAItD,qEAAqE;gCACzC,MAAM,GAAG,KAAK,CAAC,QAAQ,GAAG,SAAS;IAI/D;;;;;;;;OAQG;uBACgB,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,WAAW,KAAK,IAAI,GAAG,IAAI;IAI/E,oDAAoD;qBACnC,KAAK,CAAC,QAAQ,GAAG,IAAI;IAStC,0EAA0E;eAC/D,gBAAgB,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IAI1D,6CAA6C;mBACjC,MAAM;IAIlB,wDAAwD;aAC/C,IAAI;EAKhB;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -1,65 +0,0 @@
1
- /**
2
- * Maps Three.js Object3Ds to their Rapier bodies/colliders, and Rapier collider
3
- * handles back to Object3Ds.
4
- *
5
- * Replaces the old bitecs RigidBodyRef/ColliderRef SoA components. Two indexes:
6
- * - `Object3D → {body, collider}` for the postPhysics transform writer and for
7
- * GameComponents/editor to reach an entity's physics.
8
- * - `colliderHandle → Object3D` reverse index for collision/trigger dispatch
9
- * (Rapier collision events report collider handles).
10
- */
11
- export function createPhysicsRegistry() {
12
- const byObject = new Map();
13
- const byColliderHandle = new Map();
14
- const removeListeners = [];
15
- return {
16
- /** Register an Object3D's body + collider, indexing both directions. */
17
- add(object3D, body, collider) {
18
- byObject.set(object3D, { body, collider });
19
- byColliderHandle.set(collider.handle, object3D);
20
- },
21
- /** Get the physics refs for an Object3D, if any. */
22
- get(object3D) {
23
- return byObject.get(object3D);
24
- },
25
- /** Resolve a Rapier collider handle to the Object3D that owns it. */
26
- getByColliderHandle(handle) {
27
- return byColliderHandle.get(handle);
28
- },
29
- /**
30
- * Register a callback fired synchronously, just before an entry is torn
31
- * down, for every `remove()` call (both indexes are still intact at call
32
- * time). Used by trigger-dispatch (T1.12d) to flush any pending
33
- * `onTriggerExit` for a sensor overlap involving this object before the
34
- * collider handle becomes unresolvable — otherwise an entity despawned
35
- * between the physical exit and the next `collisions.drain()` silently
36
- * drops the exit callback on its still-live overlap partner.
37
- */
38
- onRemove(listener) {
39
- removeListeners.push(listener);
40
- },
41
- /** Remove an Object3D's entry from both indexes. */
42
- remove(object3D) {
43
- const refs = byObject.get(object3D);
44
- if (refs) {
45
- for (const listener of removeListeners)
46
- listener(object3D, refs);
47
- byColliderHandle.delete(refs.collider.handle);
48
- }
49
- byObject.delete(object3D);
50
- },
51
- /** Iterate every (Object3D, refs) pair — used by the transform writer. */
52
- entries() {
53
- return byObject.entries();
54
- },
55
- /** Number of registered physics entities. */
56
- get size() {
57
- return byObject.size;
58
- },
59
- /** Clear both indexes (does not free Rapier bodies). */
60
- clear() {
61
- byObject.clear();
62
- byColliderHandle.clear();
63
- },
64
- };
65
- }
@@ -1,16 +0,0 @@
1
- import * as THREE from 'three';
2
- import type { PhysicsRegistry } from './physics-registry';
3
- /**
4
- * Build the single postPhysics transform writer.
5
- *
6
- * Replaces the old three-step path (physicsSyncSystem → ECS Position/Rotation →
7
- * vnode-manager.syncTransforms). Rapier always reports world-space transforms, so
8
- * for objects parented under something other than the scene root we convert the
9
- * body's world position/rotation into the parent's local space (P1.5) — the old
10
- * vnode path wrote world transforms as local and mis-placed parented children.
11
- *
12
- * Scale is left untouched: Rapier carries no scale, so the Object3D keeps its
13
- * authored local scale.
14
- */
15
- export declare function createTransformWriter(physics: PhysicsRegistry, sceneRoot: THREE.Object3D): () => void;
16
- //# sourceMappingURL=transform-writer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transform-writer.d.ts","sourceRoot":"","sources":["../../src/physics/transform-writer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAM1D;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,KAAK,CAAC,QAAQ,SACpD,IAAI,CAoBxC"}