@vgai/engine 0.5.5 → 0.5.6
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/dist/adapter/adapter-surface.d.ts +30 -0
- package/dist/adapter/adapter-surface.d.ts.map +1 -0
- package/dist/adapter/adapter-surface.js +18 -0
- package/dist/adapter/authoring.d.ts +597 -0
- package/dist/adapter/authoring.d.ts.map +1 -0
- package/dist/adapter/authoring.js +22 -0
- package/dist/adapter/colyseus-networking-adapter.d.ts +77 -0
- package/dist/adapter/colyseus-networking-adapter.d.ts.map +1 -0
- package/dist/adapter/colyseus-networking-adapter.js +76 -0
- package/dist/adapter/first-party-systems.d.ts +23 -0
- package/dist/adapter/first-party-systems.d.ts.map +1 -0
- package/dist/adapter/first-party-systems.js +196 -0
- package/dist/adapter/host-context.d.ts +194 -0
- package/dist/adapter/host-context.d.ts.map +1 -0
- package/dist/adapter/host-context.js +80 -0
- package/dist/adapter/index.d.ts +33 -0
- package/dist/adapter/index.d.ts.map +1 -0
- package/dist/adapter/index.js +25 -0
- package/dist/adapter/ingest/game-contract.d.ts +53 -0
- package/dist/adapter/ingest/game-contract.d.ts.map +1 -0
- package/dist/adapter/ingest/game-contract.js +30 -0
- package/dist/adapter/ingest/scene-capture.d.ts +121 -0
- package/dist/adapter/ingest/scene-capture.d.ts.map +1 -0
- package/dist/adapter/ingest/scene-capture.js +270 -0
- package/dist/adapter/ingest/structural-ids.d.ts +64 -0
- package/dist/adapter/ingest/structural-ids.d.ts.map +1 -0
- package/dist/adapter/ingest/structural-ids.js +110 -0
- package/dist/adapter/ingest/upstream-pin.d.ts +44 -0
- package/dist/adapter/ingest/upstream-pin.d.ts.map +1 -0
- package/dist/adapter/ingest/upstream-pin.js +47 -0
- package/dist/adapter/loop-gate-report.d.ts +34 -0
- package/dist/adapter/loop-gate-report.d.ts.map +1 -0
- package/dist/adapter/loop-gate-report.js +37 -0
- package/dist/adapter/rapier-physics-adapter.d.ts +69 -0
- package/dist/adapter/rapier-physics-adapter.d.ts.map +1 -0
- package/dist/adapter/rapier-physics-adapter.js +135 -0
- package/dist/adapter/root-adapter.d.ts +195 -0
- package/dist/adapter/root-adapter.d.ts.map +1 -0
- package/dist/adapter/root-adapter.js +25 -0
- package/dist/adapter/setup-three-root-adapter.d.ts +87 -0
- package/dist/adapter/setup-three-root-adapter.d.ts.map +1 -0
- package/dist/adapter/setup-three-root-adapter.js +791 -0
- package/dist/adapter/system-adapter.d.ts +453 -0
- package/dist/adapter/system-adapter.d.ts.map +1 -0
- package/dist/adapter/system-adapter.js +13 -0
- package/dist/adapter/transform.d.ts +18 -0
- package/dist/adapter/transform.d.ts.map +1 -0
- package/dist/adapter/transform.js +1 -0
- package/dist/ai/navigation.d.ts +78 -0
- package/dist/ai/navigation.d.ts.map +1 -0
- package/dist/ai/navigation.js +152 -0
- package/dist/animation/anim-graph-types.d.ts +25 -0
- package/dist/animation/anim-graph-types.d.ts.map +1 -0
- package/dist/animation/anim-graph-types.js +1 -0
- package/dist/animation/animation-clock.d.ts +213 -0
- package/dist/animation/animation-clock.d.ts.map +1 -0
- package/dist/animation/animation-clock.js +301 -0
- package/dist/animation/blend-node.d.ts +22 -0
- package/dist/animation/blend-node.d.ts.map +1 -0
- package/dist/animation/blend-node.js +97 -0
- package/dist/animation/camera-ownership.d.ts +249 -0
- package/dist/animation/camera-ownership.d.ts.map +1 -0
- package/dist/animation/camera-ownership.js +169 -0
- package/dist/animation/cinematic-cues.d.ts +200 -0
- package/dist/animation/cinematic-cues.d.ts.map +1 -0
- package/dist/animation/cinematic-cues.js +213 -0
- package/dist/animation/clip-map.d.ts +12 -0
- package/dist/animation/clip-map.d.ts.map +1 -0
- package/dist/animation/clip-map.js +31 -0
- package/dist/animation/cubic-spline-interpolant.d.ts +54 -0
- package/dist/animation/cubic-spline-interpolant.d.ts.map +1 -0
- package/dist/animation/cubic-spline-interpolant.js +111 -0
- package/dist/animation/theatre-clock-binding.d.ts +89 -0
- package/dist/animation/theatre-clock-binding.d.ts.map +1 -0
- package/dist/animation/theatre-clock-binding.js +29 -0
- package/dist/animation/theatre-director.d.ts +277 -0
- package/dist/animation/theatre-director.d.ts.map +1 -0
- package/dist/animation/theatre-director.js +248 -0
- package/dist/animation/theatre-object-binding.d.ts +305 -0
- package/dist/animation/theatre-object-binding.d.ts.map +1 -0
- package/dist/animation/theatre-object-binding.js +351 -0
- package/dist/animation/xstate-animation-binding.d.ts +119 -0
- package/dist/animation/xstate-animation-binding.d.ts.map +1 -0
- package/dist/animation/xstate-animation-binding.js +349 -0
- package/dist/animation/xstate-animation-meta.d.ts +266 -0
- package/dist/animation/xstate-animation-meta.d.ts.map +1 -0
- package/dist/animation/xstate-animation-meta.js +252 -0
- package/dist/asset-formats/camera.d.ts +15 -0
- package/dist/asset-formats/camera.d.ts.map +1 -0
- package/dist/asset-formats/camera.js +15 -0
- package/dist/asset-formats/collider.d.ts +21 -0
- package/dist/asset-formats/collider.d.ts.map +1 -0
- package/dist/asset-formats/collider.js +53 -0
- package/dist/asset-formats/index.d.ts +46 -0
- package/dist/asset-formats/index.d.ts.map +1 -0
- package/dist/asset-formats/index.js +36 -0
- package/dist/asset-formats/instances.d.ts +17 -0
- package/dist/asset-formats/instances.d.ts.map +1 -0
- package/dist/asset-formats/instances.js +31 -0
- package/dist/asset-formats/light.d.ts +21 -0
- package/dist/asset-formats/light.d.ts.map +1 -0
- package/dist/asset-formats/light.js +35 -0
- package/dist/asset-formats/material.d.ts +129 -0
- package/dist/asset-formats/material.d.ts.map +1 -0
- package/dist/asset-formats/material.js +88 -0
- package/dist/asset-formats/mesh.d.ts +22 -0
- package/dist/asset-formats/mesh.d.ts.map +1 -0
- package/dist/asset-formats/mesh.js +64 -0
- package/dist/asset-formats/parse.d.ts +20 -0
- package/dist/asset-formats/parse.d.ts.map +1 -0
- package/dist/asset-formats/parse.js +34 -0
- package/dist/asset-formats/particles.d.ts +1390 -0
- package/dist/asset-formats/particles.d.ts.map +1 -0
- package/dist/asset-formats/particles.js +319 -0
- package/dist/asset-formats/render-env.d.ts +387 -0
- package/dist/asset-formats/render-env.d.ts.map +1 -0
- package/dist/asset-formats/render-env.js +300 -0
- package/dist/asset-formats/tuples.d.ts +12 -0
- package/dist/asset-formats/tuples.d.ts.map +1 -0
- package/dist/asset-formats/tuples.js +14 -0
- package/dist/asset-loaders.d.ts +97 -0
- package/dist/asset-loaders.d.ts.map +1 -0
- package/dist/asset-loaders.js +209 -0
- package/dist/asset-parse-error.d.ts +24 -0
- package/dist/asset-parse-error.d.ts.map +1 -0
- package/dist/asset-parse-error.js +29 -0
- package/dist/asset-registry.d.ts +38 -0
- package/dist/asset-registry.d.ts.map +1 -0
- package/dist/asset-registry.js +66 -0
- package/dist/assets.d.ts +26 -0
- package/dist/assets.d.ts.map +1 -0
- package/dist/assets.js +55 -0
- package/dist/audio/wav-encode.d.ts +38 -0
- package/dist/audio/wav-encode.d.ts.map +1 -0
- package/dist/audio/wav-encode.js +97 -0
- package/dist/canvas-react/engine-bridge.d.ts +45 -0
- package/dist/canvas-react/engine-bridge.d.ts.map +1 -0
- package/dist/canvas-react/engine-bridge.js +45 -0
- package/dist/canvas-react/index.d.ts +42 -0
- package/dist/canvas-react/index.d.ts.map +1 -0
- package/dist/canvas-react/index.js +41 -0
- package/dist/canvas-react/pixi-primitive.d.ts +85 -0
- package/dist/canvas-react/pixi-primitive.d.ts.map +1 -0
- package/dist/canvas-react/pixi-primitive.js +181 -0
- package/dist/canvas-react/pixi-react-adapter.d.ts +71 -0
- package/dist/canvas-react/pixi-react-adapter.d.ts.map +1 -0
- package/dist/canvas-react/pixi-react-adapter.js +229 -0
- package/dist/canvas-react/pixi-react-root-factory.d.ts +56 -0
- package/dist/canvas-react/pixi-react-root-factory.d.ts.map +1 -0
- package/dist/canvas-react/pixi-react-root-factory.js +73 -0
- package/dist/canvas-react/world-context.d.ts +88 -0
- package/dist/canvas-react/world-context.d.ts.map +1 -0
- package/dist/canvas-react/world-context.js +212 -0
- package/dist/config.d.ts +9 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +8 -0
- package/dist/core/frame-pacing.d.ts +90 -0
- package/dist/core/frame-pacing.d.ts.map +1 -0
- package/dist/core/frame-pacing.js +89 -0
- package/dist/core/game-loop.d.ts +62 -0
- package/dist/core/game-loop.d.ts.map +1 -0
- package/dist/core/game-loop.js +189 -0
- package/dist/core/seeded-random.d.ts +69 -0
- package/dist/core/seeded-random.d.ts.map +1 -0
- package/dist/core/seeded-random.js +121 -0
- package/dist/core/sim-clock.d.ts +199 -0
- package/dist/core/sim-clock.d.ts.map +1 -0
- package/dist/core/sim-clock.js +291 -0
- package/dist/core/system-runner.d.ts +96 -0
- package/dist/core/system-runner.d.ts.map +1 -0
- package/dist/core/system-runner.js +253 -0
- package/dist/core/types.d.ts +111 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +25 -0
- package/dist/data/data-asset.d.ts +101 -0
- package/dist/data/data-asset.d.ts.map +1 -0
- package/dist/data/data-asset.js +122 -0
- package/dist/data/data-check-core.d.ts +109 -0
- package/dist/data/data-check-core.d.ts.map +1 -0
- package/dist/data/data-check-core.js +177 -0
- package/dist/data/data-ref.d.ts +79 -0
- package/dist/data/data-ref.d.ts.map +1 -0
- package/dist/data/data-ref.js +130 -0
- package/dist/data/vite-plugin-data.d.ts +79 -0
- package/dist/data/vite-plugin-data.d.ts.map +1 -0
- package/dist/data/vite-plugin-data.js +217 -0
- package/dist/defaults.d.ts +233 -0
- package/dist/defaults.d.ts.map +1 -0
- package/dist/defaults.js +137 -0
- package/dist/dev/chrome-trace.d.ts +45 -0
- package/dist/dev/chrome-trace.d.ts.map +1 -0
- package/dist/dev/chrome-trace.js +114 -0
- package/dist/dev/console-bridge.d.ts +22 -0
- package/dist/dev/console-bridge.d.ts.map +1 -0
- package/dist/dev/console-bridge.js +71 -0
- package/dist/dev/debug-draw.d.ts +24 -0
- package/dist/dev/debug-draw.d.ts.map +1 -0
- package/dist/dev/debug-draw.js +73 -0
- package/dist/dev/instruments.d.ts +133 -0
- package/dist/dev/instruments.d.ts.map +1 -0
- package/dist/dev/instruments.js +231 -0
- package/dist/dev/logger.d.ts +30 -0
- package/dist/dev/logger.d.ts.map +1 -0
- package/dist/dev/logger.js +90 -0
- package/dist/dev/performance-profiler.d.ts +111 -0
- package/dist/dev/performance-profiler.d.ts.map +1 -0
- package/dist/dev/performance-profiler.js +215 -0
- package/dist/dev/render-debug-adapter.d.ts +57 -0
- package/dist/dev/render-debug-adapter.d.ts.map +1 -0
- package/dist/dev/render-debug-adapter.js +141 -0
- package/dist/dev/render-memory.d.ts +53 -0
- package/dist/dev/render-memory.d.ts.map +1 -0
- package/dist/dev/render-memory.js +190 -0
- package/dist/dev/webgl-frame-capture.d.ts +134 -0
- package/dist/dev/webgl-frame-capture.d.ts.map +1 -0
- package/dist/dev/webgl-frame-capture.js +270 -0
- package/dist/dev/webgl-gpu-timer.d.ts +8 -0
- package/dist/dev/webgl-gpu-timer.d.ts.map +1 -0
- package/dist/dev/webgl-gpu-timer.js +52 -0
- package/dist/ecs/scene-index.d.ts +179 -0
- package/dist/ecs/scene-index.d.ts.map +1 -0
- package/dist/ecs/scene-index.js +331 -0
- package/dist/ecs/scene-query.d.ts +6 -0
- package/dist/ecs/scene-query.d.ts.map +1 -0
- package/dist/ecs/scene-query.js +40 -0
- package/dist/ecs/user-data.d.ts +193 -0
- package/dist/ecs/user-data.d.ts.map +1 -0
- package/dist/ecs/user-data.js +145 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/input/input-manager.d.ts +944 -0
- package/dist/input/input-manager.d.ts.map +1 -0
- package/dist/input/input-manager.js +2209 -0
- package/dist/input/input-types.d.ts +174 -0
- package/dist/input/input-types.d.ts.map +1 -0
- package/dist/input/input-types.js +1 -0
- package/dist/input/prompt-labels.d.ts +21 -0
- package/dist/input/prompt-labels.d.ts.map +1 -0
- package/dist/input/prompt-labels.js +121 -0
- package/dist/input/rebind-controller.d.ts +59 -0
- package/dist/input/rebind-controller.d.ts.map +1 -0
- package/dist/input/rebind-controller.js +85 -0
- package/dist/input/schema.d.ts +16 -0
- package/dist/input/schema.d.ts.map +1 -0
- package/dist/input/schema.js +228 -0
- package/dist/loader.d.ts +76 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +114 -0
- package/dist/manifest/editor-port.d.ts +53 -0
- package/dist/manifest/editor-port.d.ts.map +1 -0
- package/dist/manifest/editor-port.js +67 -0
- package/dist/manifest/filename.d.ts +14 -0
- package/dist/manifest/filename.d.ts.map +1 -0
- package/dist/manifest/filename.js +43 -0
- package/dist/manifest/index.d.ts +6 -0
- package/dist/manifest/index.d.ts.map +1 -0
- package/dist/manifest/index.js +9 -0
- package/dist/manifest/load-file.d.ts +7 -0
- package/dist/manifest/load-file.d.ts.map +1 -0
- package/dist/manifest/load-file.js +23 -0
- package/dist/manifest/load.d.ts +161 -0
- package/dist/manifest/load.d.ts.map +1 -0
- package/dist/manifest/load.js +269 -0
- package/dist/manifest/locate.d.ts +24 -0
- package/dist/manifest/locate.d.ts.map +1 -0
- package/dist/manifest/locate.js +48 -0
- package/dist/manifest/schema.d.ts +293 -0
- package/dist/manifest/schema.d.ts.map +1 -0
- package/dist/manifest/schema.js +633 -0
- package/dist/physics/collider-dimensions.d.ts +63 -0
- package/dist/physics/collider-dimensions.d.ts.map +1 -0
- package/dist/physics/collider-dimensions.js +98 -0
- package/dist/physics/collision-system.d.ts +41 -0
- package/dist/physics/collision-system.d.ts.map +1 -0
- package/dist/physics/collision-system.js +64 -0
- package/dist/physics/physics-registry.d.ts +45 -0
- package/dist/physics/physics-registry.d.ts.map +1 -0
- package/dist/physics/physics-registry.js +65 -0
- package/dist/physics/transform-writer.d.ts +16 -0
- package/dist/physics/transform-writer.d.ts.map +1 -0
- package/dist/physics/transform-writer.js +38 -0
- package/dist/pixi/authoring.d.ts +93 -0
- package/dist/pixi/authoring.d.ts.map +1 -0
- package/dist/pixi/authoring.js +207 -0
- package/dist/pixi/index.d.ts +16 -0
- package/dist/pixi/index.d.ts.map +1 -0
- package/dist/pixi/index.js +15 -0
- package/dist/pixi/ingest-iframe.d.ts +82 -0
- package/dist/pixi/ingest-iframe.d.ts.map +1 -0
- package/dist/pixi/ingest-iframe.js +166 -0
- package/dist/pixi/ingest.d.ts +97 -0
- package/dist/pixi/ingest.d.ts.map +1 -0
- package/dist/pixi/ingest.js +40 -0
- package/dist/pixi/physics-registry.d.ts +24 -0
- package/dist/pixi/physics-registry.d.ts.map +1 -0
- package/dist/pixi/physics-registry.js +38 -0
- package/dist/pixi/scene-capture.d.ts +43 -0
- package/dist/pixi/scene-capture.d.ts.map +1 -0
- package/dist/pixi/scene-capture.js +92 -0
- package/dist/pixi/system-adapters.d.ts +16 -0
- package/dist/pixi/system-adapters.d.ts.map +1 -0
- package/dist/pixi/system-adapters.js +37 -0
- package/dist/react/unmanaged-root-detector.d.ts +18 -0
- package/dist/react/unmanaged-root-detector.d.ts.map +1 -0
- package/dist/react/unmanaged-root-detector.js +70 -0
- package/dist/react/use-data.d.ts +60 -0
- package/dist/react/use-data.d.ts.map +1 -0
- package/dist/react/use-data.js +101 -0
- package/dist/react/use-selection.d.ts +54 -0
- package/dist/react/use-selection.d.ts.map +1 -0
- package/dist/react/use-selection.js +71 -0
- package/dist/react/world-state.d.ts +154 -0
- package/dist/react/world-state.d.ts.map +1 -0
- package/dist/react/world-state.js +220 -0
- package/dist/render/auto-batcher.d.ts +34 -0
- package/dist/render/auto-batcher.d.ts.map +1 -0
- package/dist/render/auto-batcher.js +140 -0
- package/dist/render/instance-mesh.d.ts +5 -0
- package/dist/render/instance-mesh.d.ts.map +1 -0
- package/dist/render/instance-mesh.js +19 -0
- package/dist/render/light-camera-factory.d.ts +24 -0
- package/dist/render/light-camera-factory.d.ts.map +1 -0
- package/dist/render/light-camera-factory.js +71 -0
- package/dist/render/lod.d.ts +13 -0
- package/dist/render/lod.d.ts.map +1 -0
- package/dist/render/lod.js +16 -0
- package/dist/render/material-factory.d.ts +15 -0
- package/dist/render/material-factory.d.ts.map +1 -0
- package/dist/render/material-factory.js +186 -0
- package/dist/render/mesh-shadow.d.ts +11 -0
- package/dist/render/mesh-shadow.d.ts.map +1 -0
- package/dist/render/mesh-shadow.js +19 -0
- package/dist/render/particles-factory.d.ts +99 -0
- package/dist/render/particles-factory.d.ts.map +1 -0
- package/dist/render/particles-factory.js +361 -0
- package/dist/render/render-batch-system.d.ts +33 -0
- package/dist/render/render-batch-system.d.ts.map +1 -0
- package/dist/render/render-batch-system.js +223 -0
- package/dist/render/render-features.d.ts +47 -0
- package/dist/render/render-features.d.ts.map +1 -0
- package/dist/render/render-features.js +105 -0
- package/dist/render/render-settings.d.ts +35 -0
- package/dist/render/render-settings.d.ts.map +1 -0
- package/dist/render/render-settings.js +51 -0
- package/dist/render/spark-renderer-lifecycle.d.ts +18 -0
- package/dist/render/spark-renderer-lifecycle.d.ts.map +1 -0
- package/dist/render/spark-renderer-lifecycle.js +57 -0
- package/dist/render/viewport-shading.d.ts +17 -0
- package/dist/render/viewport-shading.d.ts.map +1 -0
- package/dist/render/viewport-shading.js +87 -0
- package/dist/runtime/create-runtime.d.ts +259 -0
- package/dist/runtime/create-runtime.d.ts.map +1 -0
- package/dist/runtime/create-runtime.js +666 -0
- package/dist/runtime/debug-bridge.d.ts +288 -0
- package/dist/runtime/debug-bridge.d.ts.map +1 -0
- package/dist/runtime/debug-bridge.js +277 -0
- package/dist/runtime/debug-registry.d.ts +287 -0
- package/dist/runtime/debug-registry.d.ts.map +1 -0
- package/dist/runtime/debug-registry.js +528 -0
- package/dist/runtime/dev-layers.d.ts +34 -0
- package/dist/runtime/dev-layers.d.ts.map +1 -0
- package/dist/runtime/dev-layers.js +40 -0
- package/dist/runtime/frame-selector-cache.d.ts +41 -0
- package/dist/runtime/frame-selector-cache.d.ts.map +1 -0
- package/dist/runtime/frame-selector-cache.js +65 -0
- package/dist/runtime/game.d.ts +576 -0
- package/dist/runtime/game.d.ts.map +1 -0
- package/dist/runtime/game.js +1003 -0
- package/dist/runtime/gameplay-rng-trap.d.ts +47 -0
- package/dist/runtime/gameplay-rng-trap.d.ts.map +1 -0
- package/dist/runtime/gameplay-rng-trap.js +95 -0
- package/dist/runtime/input-router.d.ts +78 -0
- package/dist/runtime/input-router.d.ts.map +1 -0
- package/dist/runtime/input-router.js +171 -0
- package/dist/runtime/mount-game.d.ts +126 -0
- package/dist/runtime/mount-game.d.ts.map +1 -0
- package/dist/runtime/mount-game.js +159 -0
- package/dist/runtime/mount-manifest.d.ts +174 -0
- package/dist/runtime/mount-manifest.d.ts.map +1 -0
- package/dist/runtime/mount-manifest.js +304 -0
- package/dist/runtime/presentation.d.ts +85 -0
- package/dist/runtime/presentation.d.ts.map +1 -0
- package/dist/runtime/presentation.js +92 -0
- package/dist/runtime/render-audio-control.d.ts +126 -0
- package/dist/runtime/render-audio-control.d.ts.map +1 -0
- package/dist/runtime/render-audio-control.js +116 -0
- package/dist/runtime/render-control.d.ts +347 -0
- package/dist/runtime/render-control.d.ts.map +1 -0
- package/dist/runtime/render-control.js +317 -0
- package/dist/runtime/render-seed.d.ts +56 -0
- package/dist/runtime/render-seed.d.ts.map +1 -0
- package/dist/runtime/render-seed.js +73 -0
- package/dist/runtime/state-bridge.d.ts +60 -0
- package/dist/runtime/state-bridge.d.ts.map +1 -0
- package/dist/runtime/state-bridge.js +62 -0
- package/dist/runtime/types.d.ts +285 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +1 -0
- package/dist/runtime/unexported-game-trap.d.ts +36 -0
- package/dist/runtime/unexported-game-trap.d.ts.map +1 -0
- package/dist/runtime/unexported-game-trap.js +80 -0
- package/dist/setup/setup-audio.d.ts +20 -0
- package/dist/setup/setup-audio.d.ts.map +1 -0
- package/dist/setup/setup-audio.js +41 -0
- package/dist/setup/setup-particles.d.ts +17 -0
- package/dist/setup/setup-particles.d.ts.map +1 -0
- package/dist/setup/setup-particles.js +16 -0
- package/dist/setup/setup-physics.d.ts +25 -0
- package/dist/setup/setup-physics.d.ts.map +1 -0
- package/dist/setup/setup-physics.js +51 -0
- package/dist/setup/setup-renderer.d.ts +82 -0
- package/dist/setup/setup-renderer.d.ts.map +1 -0
- package/dist/setup/setup-renderer.js +381 -0
- package/dist/world3d-react/engine-bridge.d.ts +47 -0
- package/dist/world3d-react/engine-bridge.d.ts.map +1 -0
- package/dist/world3d-react/engine-bridge.js +48 -0
- package/dist/world3d-react/index.d.ts +47 -0
- package/dist/world3d-react/index.d.ts.map +1 -0
- package/dist/world3d-react/index.js +46 -0
- package/dist/world3d-react/r3f-adapter.d.ts +51 -0
- package/dist/world3d-react/r3f-adapter.d.ts.map +1 -0
- package/dist/world3d-react/r3f-adapter.js +368 -0
- package/dist/world3d-react/r3f-root-factory.d.ts +62 -0
- package/dist/world3d-react/r3f-root-factory.d.ts.map +1 -0
- package/dist/world3d-react/r3f-root-factory.js +79 -0
- package/dist/world3d-react/rapier-physics-bridge.d.ts +76 -0
- package/dist/world3d-react/rapier-physics-bridge.d.ts.map +1 -0
- package/dist/world3d-react/rapier-physics-bridge.js +120 -0
- package/dist/world3d-react/renderer-config.d.ts +58 -0
- package/dist/world3d-react/renderer-config.d.ts.map +1 -0
- package/dist/world3d-react/renderer-config.js +96 -0
- package/dist/world3d-react/world-context.d.ts +123 -0
- package/dist/world3d-react/world-context.d.ts.map +1 -0
- package/dist/world3d-react/world-context.js +204 -0
- package/dist-config/config.js +303 -0
- package/dist-config/config.js.map +7 -0
- package/package.json +14 -3
- package/src/adapter/rapier-physics-adapter.ts +77 -34
- package/src/config.ts +8 -0
- package/src/core/frame-pacing.ts +26 -0
- package/src/core/game-loop.ts +4 -3
- package/src/dev/instruments.ts +302 -0
- package/src/setup/setup-renderer.ts +2 -0
- package/src/world3d-react/index.ts +9 -0
- package/src/world3d-react/rapier-physics-bridge.tsx +137 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic `Math.random` seeding for render-control mode (I2 AC:
|
|
3
|
+
* "`Math.random` is deterministically seeded/stubbed page-wide before any
|
|
4
|
+
* game module executes").
|
|
5
|
+
*
|
|
6
|
+
* Deliberately a ZERO-IMPORT module (no `three`, no other engine file) so
|
|
7
|
+
* its own evaluation is instantaneous — a render-mode entry page loads this
|
|
8
|
+
* as its FIRST `<script type="module">` tag, before the tag that pulls in
|
|
9
|
+
* the actual game/runtime modules. Per the HTML module-script ordering
|
|
10
|
+
* rules, sibling `<script type="module">` tags without `async` execute in
|
|
11
|
+
* document order, and each one's own dependency graph (here, empty) is
|
|
12
|
+
* fully evaluated before the browser moves to the next tag — so calling
|
|
13
|
+
* {@link maybeInstallRenderModeRandom} from this module's importer, in a
|
|
14
|
+
* script tag placed before the game's own entry tag, guarantees every
|
|
15
|
+
* subsequent module's top-level code (and everything it does at runtime)
|
|
16
|
+
* observes the seeded generator, never the platform's real
|
|
17
|
+
* cryptographically-random `Math.random`.
|
|
18
|
+
*
|
|
19
|
+
* This module does not decide WHETHER to seed on its own (importing it has
|
|
20
|
+
* no side effect) — the caller decides, by calling
|
|
21
|
+
* {@link maybeInstallRenderModeRandom} (query-param gated) or
|
|
22
|
+
* {@link installDeterministicRandom} (unconditional) from a tiny bootstrap
|
|
23
|
+
* entry. See `packages/engine/e2e/fixture/render-seed-entry.ts` for the
|
|
24
|
+
* worked bootstrap this module is designed to be loaded from.
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* mulberry32 — a small, fast, deterministic 32-bit PRNG. Not cryptographic;
|
|
28
|
+
* this is explicitly a determinism tool (reproducible capture), not a
|
|
29
|
+
* security primitive. Returns a function with the same call signature as
|
|
30
|
+
* `Math.random` (no arguments, `[0, 1)` float).
|
|
31
|
+
*/
|
|
32
|
+
export declare function createMulberry32(seed: number): () => number;
|
|
33
|
+
/**
|
|
34
|
+
* Replace the global `Math.random` with a seeded, deterministic generator.
|
|
35
|
+
* Idempotent to call more than once (each call re-seeds from scratch — the
|
|
36
|
+
* last call wins), which matters for HMR-style re-execution the same way
|
|
37
|
+
* `main.ts`'s `registerAdapterSurface` guard does elsewhere in this runtime.
|
|
38
|
+
*/
|
|
39
|
+
export declare function installDeterministicRandom(seed: number): void;
|
|
40
|
+
/** Query-param name that opts a page into render-control mode (I2 AC 4: the
|
|
41
|
+
* mode must be unavailable/protected in normal production gameplay unless
|
|
42
|
+
* explicitly enabled). Shared with `render-control.ts`'s own production
|
|
43
|
+
* guard so both checks agree on the same flag. */
|
|
44
|
+
export declare const RENDER_MODE_QUERY_PARAM = "vgai-render";
|
|
45
|
+
/** Optional query param to pin a specific seed (default below when absent). */
|
|
46
|
+
export declare const RENDER_SEED_QUERY_PARAM = "vgai-seed";
|
|
47
|
+
/**
|
|
48
|
+
* Seed `Math.random` iff the page's URL opts into render mode
|
|
49
|
+
* (`?vgai-render=1`), reading an optional `?vgai-seed=<int>` override.
|
|
50
|
+
* Returns whether it seeded, purely for the caller's own diagnostics/log —
|
|
51
|
+
* the bootstrap entry doesn't need to branch on it.
|
|
52
|
+
*/
|
|
53
|
+
export declare function maybeInstallRenderModeRandom(location?: {
|
|
54
|
+
search: string;
|
|
55
|
+
}): boolean;
|
|
56
|
+
//# sourceMappingURL=render-seed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-seed.d.ts","sourceRoot":"","sources":["../../src/runtime/render-seed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,MAAM,CAS3D;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE7D;AAED;;;mDAGmD;AACnD,eAAO,MAAM,uBAAuB,gBAAgB,CAAC;AACrD,+EAA+E;AAC/E,eAAO,MAAM,uBAAuB,cAAc,CAAC;AAGnD;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,QAAQ,GAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAoB,GAC7C,OAAO,CAOT"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic `Math.random` seeding for render-control mode (I2 AC:
|
|
3
|
+
* "`Math.random` is deterministically seeded/stubbed page-wide before any
|
|
4
|
+
* game module executes").
|
|
5
|
+
*
|
|
6
|
+
* Deliberately a ZERO-IMPORT module (no `three`, no other engine file) so
|
|
7
|
+
* its own evaluation is instantaneous — a render-mode entry page loads this
|
|
8
|
+
* as its FIRST `<script type="module">` tag, before the tag that pulls in
|
|
9
|
+
* the actual game/runtime modules. Per the HTML module-script ordering
|
|
10
|
+
* rules, sibling `<script type="module">` tags without `async` execute in
|
|
11
|
+
* document order, and each one's own dependency graph (here, empty) is
|
|
12
|
+
* fully evaluated before the browser moves to the next tag — so calling
|
|
13
|
+
* {@link maybeInstallRenderModeRandom} from this module's importer, in a
|
|
14
|
+
* script tag placed before the game's own entry tag, guarantees every
|
|
15
|
+
* subsequent module's top-level code (and everything it does at runtime)
|
|
16
|
+
* observes the seeded generator, never the platform's real
|
|
17
|
+
* cryptographically-random `Math.random`.
|
|
18
|
+
*
|
|
19
|
+
* This module does not decide WHETHER to seed on its own (importing it has
|
|
20
|
+
* no side effect) — the caller decides, by calling
|
|
21
|
+
* {@link maybeInstallRenderModeRandom} (query-param gated) or
|
|
22
|
+
* {@link installDeterministicRandom} (unconditional) from a tiny bootstrap
|
|
23
|
+
* entry. See `packages/engine/e2e/fixture/render-seed-entry.ts` for the
|
|
24
|
+
* worked bootstrap this module is designed to be loaded from.
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* mulberry32 — a small, fast, deterministic 32-bit PRNG. Not cryptographic;
|
|
28
|
+
* this is explicitly a determinism tool (reproducible capture), not a
|
|
29
|
+
* security primitive. Returns a function with the same call signature as
|
|
30
|
+
* `Math.random` (no arguments, `[0, 1)` float).
|
|
31
|
+
*/
|
|
32
|
+
export function createMulberry32(seed) {
|
|
33
|
+
let state = seed >>> 0;
|
|
34
|
+
return function mulberry32() {
|
|
35
|
+
state = (state + 0x6d2b79f5) | 0;
|
|
36
|
+
let t = state;
|
|
37
|
+
t = Math.imul(t ^ (t >>> 15), t | 1);
|
|
38
|
+
t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
|
|
39
|
+
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Replace the global `Math.random` with a seeded, deterministic generator.
|
|
44
|
+
* Idempotent to call more than once (each call re-seeds from scratch — the
|
|
45
|
+
* last call wins), which matters for HMR-style re-execution the same way
|
|
46
|
+
* `main.ts`'s `registerAdapterSurface` guard does elsewhere in this runtime.
|
|
47
|
+
*/
|
|
48
|
+
export function installDeterministicRandom(seed) {
|
|
49
|
+
Math.random = createMulberry32(seed);
|
|
50
|
+
}
|
|
51
|
+
/** Query-param name that opts a page into render-control mode (I2 AC 4: the
|
|
52
|
+
* mode must be unavailable/protected in normal production gameplay unless
|
|
53
|
+
* explicitly enabled). Shared with `render-control.ts`'s own production
|
|
54
|
+
* guard so both checks agree on the same flag. */
|
|
55
|
+
export const RENDER_MODE_QUERY_PARAM = 'vgai-render';
|
|
56
|
+
/** Optional query param to pin a specific seed (default below when absent). */
|
|
57
|
+
export const RENDER_SEED_QUERY_PARAM = 'vgai-seed';
|
|
58
|
+
const DEFAULT_RENDER_SEED = 0x9e3779b9; // golden-ratio constant — an arbitrary but fixed default
|
|
59
|
+
/**
|
|
60
|
+
* Seed `Math.random` iff the page's URL opts into render mode
|
|
61
|
+
* (`?vgai-render=1`), reading an optional `?vgai-seed=<int>` override.
|
|
62
|
+
* Returns whether it seeded, purely for the caller's own diagnostics/log —
|
|
63
|
+
* the bootstrap entry doesn't need to branch on it.
|
|
64
|
+
*/
|
|
65
|
+
export function maybeInstallRenderModeRandom(location = window.location) {
|
|
66
|
+
const params = new URLSearchParams(location.search);
|
|
67
|
+
if (params.get(RENDER_MODE_QUERY_PARAM) !== '1')
|
|
68
|
+
return false;
|
|
69
|
+
const seedParam = params.get(RENDER_SEED_QUERY_PARAM);
|
|
70
|
+
const seed = seedParam !== null && seedParam !== '' ? Number(seedParam) : DEFAULT_RENDER_SEED;
|
|
71
|
+
installDeterministicRandom(Number.isFinite(seed) ? seed : DEFAULT_RENDER_SEED);
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Frame-versioned game state bridge (T7.4 slice 1, the D7 remainder). Components
|
|
3
|
+
* mutate state on `this` freely during ticks — there is no proxy, no dirty
|
|
4
|
+
* tracking, no event per mutation (Track A: no mirror, no sync layer). So the
|
|
5
|
+
* unit of change a subscriber can observe is the FRAME: `GameInternal.runFrame`
|
|
6
|
+
* bumps `frameVersion` and notifies subscribers at most once, at its tail, AFTER
|
|
7
|
+
* every phase of every world and every world's `endFrame` hook has run (see the
|
|
8
|
+
* wiring in `runtime/game.ts`) — mirroring the D7 "from `gameLogic` onward,
|
|
9
|
+
* every world's post-step state is readable" guarantee, extended to "after the
|
|
10
|
+
* frame, ALL state is readable".
|
|
11
|
+
*
|
|
12
|
+
* This file is plain, react-free TypeScript any consumer could use — no
|
|
13
|
+
* react import here, or anywhere under `runtime/` (the react-facing
|
|
14
|
+
* `useWorldState` hook, which DOES import React, lives at
|
|
15
|
+
* `packages/engine/src/react/world-state.tsx`).
|
|
16
|
+
*
|
|
17
|
+
* SECOND trigger for `bump()` (`Game.registerRoot`, `runtime/game.ts`): the
|
|
18
|
+
* `roots` list is also state a `useWorldState` selector can read
|
|
19
|
+
* (`g.roots.map(...)`, the T6.2 two-world-compose gate), and it changes
|
|
20
|
+
* OUTSIDE the frame loop — `registerRoot` is called as each world finishes
|
|
21
|
+
* mounting, which can happen well before the host's loop has ticked even
|
|
22
|
+
* once. Without an immediate notification here, a selector that first reads
|
|
23
|
+
* `g.roots` before every world has registered stays stuck on that stale
|
|
24
|
+
* snapshot until the next completed frame — which, on a slow/contended host
|
|
25
|
+
* or a backgrounded tab, may be arbitrarily delayed. See `registerRoot`'s
|
|
26
|
+
* own doc comment for the concrete CI failure this closes.
|
|
27
|
+
*/
|
|
28
|
+
/** Frame-versioned, react-free subscription surface. */
|
|
29
|
+
export interface GameStateBridge {
|
|
30
|
+
/** Monotonic; bumped once per completed `runFrame`, AND once per
|
|
31
|
+
* `Game.registerRoot` call (world-list changes are observable state too
|
|
32
|
+
* — see this file's module doc comment). Starts at 0 before the first of
|
|
33
|
+
* either has happened. Never treat this as a literal frame COUNT — only
|
|
34
|
+
* "did it change" is a contract any consumer may rely on. */
|
|
35
|
+
readonly frameVersion: number;
|
|
36
|
+
/** Notified at most once per frame, after ALL phases of ALL roots (and
|
|
37
|
+
* their `endFrame` hooks) have run. Returns an unsubscribe function. */
|
|
38
|
+
subscribe(onFrame: () => void): () => void;
|
|
39
|
+
}
|
|
40
|
+
/** Host-internal extension of {@link GameStateBridge}: adds `bump`, called
|
|
41
|
+
* both by `GameInternal.runFrame` at its tail AND by `Game.registerRoot`
|
|
42
|
+
* when the world list changes (see this file's module doc comment). NOT
|
|
43
|
+
* part of the game-facing `Game.state` surface (typed as the narrower
|
|
44
|
+
* `GameStateBridge` there) — games/components/hooks never call `bump`
|
|
45
|
+
* directly; only the frame executor and the world registry do. */
|
|
46
|
+
export interface GameStateBridgeInternal extends GameStateBridge {
|
|
47
|
+
/** Bump `frameVersion` by one and notify every current subscriber, in
|
|
48
|
+
* subscription order. Subscriber errors are isolated (per-subscriber
|
|
49
|
+
* try/catch, loud `console.error`, never swallowed silently) — mirrors
|
|
50
|
+
* the error-isolation idiom in `ecs/component-manager.ts`'s per-component
|
|
51
|
+
* `update()` calls: one offending subscriber must not stop its siblings
|
|
52
|
+
* from being notified, and must not break the frame loop. */
|
|
53
|
+
bump(): void;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Construct a fresh bridge. One per `Game` (created alongside the other
|
|
57
|
+
* game-scoped state in `createGame`, `runtime/game.ts`).
|
|
58
|
+
*/
|
|
59
|
+
export declare function createStateBridge(): GameStateBridgeInternal;
|
|
60
|
+
//# sourceMappingURL=state-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-bridge.d.ts","sourceRoot":"","sources":["../../src/runtime/state-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,wDAAwD;AACxD,MAAM,WAAW,eAAe;IAC9B;;;;kEAI8D;IAC9D,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B;6EACyE;IACzE,SAAS,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;CAC5C;AAED;;;;;mEAKmE;AACnE,MAAM,WAAW,uBAAwB,SAAQ,eAAe;IAC9D;;;;;kEAK8D;IAC9D,IAAI,IAAI,IAAI,CAAC;CACd;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,uBAAuB,CA8B3D"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Frame-versioned game state bridge (T7.4 slice 1, the D7 remainder). Components
|
|
3
|
+
* mutate state on `this` freely during ticks — there is no proxy, no dirty
|
|
4
|
+
* tracking, no event per mutation (Track A: no mirror, no sync layer). So the
|
|
5
|
+
* unit of change a subscriber can observe is the FRAME: `GameInternal.runFrame`
|
|
6
|
+
* bumps `frameVersion` and notifies subscribers at most once, at its tail, AFTER
|
|
7
|
+
* every phase of every world and every world's `endFrame` hook has run (see the
|
|
8
|
+
* wiring in `runtime/game.ts`) — mirroring the D7 "from `gameLogic` onward,
|
|
9
|
+
* every world's post-step state is readable" guarantee, extended to "after the
|
|
10
|
+
* frame, ALL state is readable".
|
|
11
|
+
*
|
|
12
|
+
* This file is plain, react-free TypeScript any consumer could use — no
|
|
13
|
+
* react import here, or anywhere under `runtime/` (the react-facing
|
|
14
|
+
* `useWorldState` hook, which DOES import React, lives at
|
|
15
|
+
* `packages/engine/src/react/world-state.tsx`).
|
|
16
|
+
*
|
|
17
|
+
* SECOND trigger for `bump()` (`Game.registerRoot`, `runtime/game.ts`): the
|
|
18
|
+
* `roots` list is also state a `useWorldState` selector can read
|
|
19
|
+
* (`g.roots.map(...)`, the T6.2 two-world-compose gate), and it changes
|
|
20
|
+
* OUTSIDE the frame loop — `registerRoot` is called as each world finishes
|
|
21
|
+
* mounting, which can happen well before the host's loop has ticked even
|
|
22
|
+
* once. Without an immediate notification here, a selector that first reads
|
|
23
|
+
* `g.roots` before every world has registered stays stuck on that stale
|
|
24
|
+
* snapshot until the next completed frame — which, on a slow/contended host
|
|
25
|
+
* or a backgrounded tab, may be arbitrarily delayed. See `registerRoot`'s
|
|
26
|
+
* own doc comment for the concrete CI failure this closes.
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* Construct a fresh bridge. One per `Game` (created alongside the other
|
|
30
|
+
* game-scoped state in `createGame`, `runtime/game.ts`).
|
|
31
|
+
*/
|
|
32
|
+
export function createStateBridge() {
|
|
33
|
+
let frameVersion = 0;
|
|
34
|
+
const subscribers = new Set();
|
|
35
|
+
return {
|
|
36
|
+
get frameVersion() {
|
|
37
|
+
return frameVersion;
|
|
38
|
+
},
|
|
39
|
+
subscribe(onFrame) {
|
|
40
|
+
subscribers.add(onFrame);
|
|
41
|
+
return () => {
|
|
42
|
+
subscribers.delete(onFrame);
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
bump() {
|
|
46
|
+
frameVersion++;
|
|
47
|
+
// Snapshot before iterating (same idiom as ComponentManager's
|
|
48
|
+
// per-phase `list = byPhase.get(phase)!.slice()`): a subscriber that
|
|
49
|
+
// subscribes/unsubscribes from WITHIN a notification must not affect
|
|
50
|
+
// which of ITS SIBLINGS get notified this same bump.
|
|
51
|
+
const notified = Array.from(subscribers);
|
|
52
|
+
for (const onFrame of notified) {
|
|
53
|
+
try {
|
|
54
|
+
onFrame();
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
console.error('[state-bridge] subscriber threw:', err);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import type RAPIER from '@dimforge/rapier3d-compat';
|
|
2
|
+
import type { EffectComposer } from 'postprocessing';
|
|
3
|
+
import type * as THREE from 'three';
|
|
4
|
+
import type { z } from 'zod';
|
|
5
|
+
import type { SystemAdapters } from '../adapter/system-adapter';
|
|
6
|
+
import type { AssetCache } from '../assets';
|
|
7
|
+
import type { SeededRandom } from '../core/seeded-random';
|
|
8
|
+
import type { SimClock } from '../core/sim-clock';
|
|
9
|
+
import type { createSystemRunner } from '../core/system-runner';
|
|
10
|
+
import type { createDebugDraw } from '../dev/debug-draw';
|
|
11
|
+
import type { SceneIndex } from '../ecs/scene-index';
|
|
12
|
+
import type { InputManager } from '../input/input-manager';
|
|
13
|
+
import type { CollisionSystem } from '../physics/collision-system';
|
|
14
|
+
import type { PhysicsRegistry } from '../physics/physics-registry';
|
|
15
|
+
import type { AudioContext as GameAudio } from '../setup/setup-audio';
|
|
16
|
+
import type { ParticlesContext } from '../setup/setup-particles';
|
|
17
|
+
import type { Game, RootInstance } from './game';
|
|
18
|
+
/**
|
|
19
|
+
* The minimal structural shape `ctx.debug.attachRoom` needs from a joined
|
|
20
|
+
* Colyseus room: just enough to send the reserved `__vgai:debugCommand`
|
|
21
|
+
* message and listen for its `__vgai:debugCommandResult` reply. Structural,
|
|
22
|
+
* not a Colyseus type import — the same seam-boundary style every other
|
|
23
|
+
* `DebugCtxSurface` member uses (no wrapper around Colyseus itself, D2).
|
|
24
|
+
* `onMessage`'s return type is `unknown` because Colyseus's own return shape
|
|
25
|
+
* (void in some client versions, an unsubscribe function in others) isn't
|
|
26
|
+
* load-bearing here: the registry calls it defensively (invokes it on detach
|
|
27
|
+
* only if it's actually a function).
|
|
28
|
+
*/
|
|
29
|
+
export interface DebugRoomHandle {
|
|
30
|
+
send(type: string, message?: unknown): void;
|
|
31
|
+
onMessage(type: string, cb: (message: unknown) => void): unknown;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Infers a `registerCommand`/`registerReactCommand`/`useDebugCommand`
|
|
35
|
+
* handler's parameter tuple from its declared Zod `args` tuple (dry-run
|
|
36
|
+
* finding, ledger — "`registerCommand` fn typing forces `unknown[]` casts"):
|
|
37
|
+
* a real `z.ZodTuple` infers its element types (`z.tuple([z.number(),
|
|
38
|
+
* z.string()])` → `(n: number, s: string) => ...`), while omitting `args`
|
|
39
|
+
* (the generic's `undefined` default) resolves to the original permissive
|
|
40
|
+
* `(...args: unknown[]) => ...` shape every command had before this generic
|
|
41
|
+
* existed. That permissive fallback is deliberate, not just a placeholder —
|
|
42
|
+
* it keeps every existing no-schema registration (including ones whose
|
|
43
|
+
* handler reads positional args the runtime never validates, since
|
|
44
|
+
* `invoke()` only parses `args` against a schema when one is declared)
|
|
45
|
+
* compiling byte-for-byte unchanged.
|
|
46
|
+
*/
|
|
47
|
+
export type DebugCommandArgs<T extends z.ZodTuple | undefined = undefined> = T extends z.ZodTuple ? z.infer<T> : unknown[];
|
|
48
|
+
/**
|
|
49
|
+
* The authoring half of the debug/synthetic-player seam — the read/actuate half is
|
|
50
|
+
* `SystemAdapters.DebugAdapter` (`adapter/system-adapter.ts`). Callable from any
|
|
51
|
+
* `init` (one file per new provider/command), or from a react world's
|
|
52
|
+
* `useDebugProvider`/`useDebugCommand`/`useDebugEmit` hooks. Every registration feeds the ONE
|
|
53
|
+
* game-scoped registry (`runtime/debug-registry.ts`) — never a per-world accumulator.
|
|
54
|
+
*/
|
|
55
|
+
export interface DebugCtxSurface {
|
|
56
|
+
/** Register (or replace) a named, JSON-serializable state read. Duplicate
|
|
57
|
+
* names from the SAME world replace + warn once; the SAME name from a
|
|
58
|
+
* DIFFERENT world throws (`DebugError` code `DEBUG_NAME_COLLISION`). */
|
|
59
|
+
registerStateProvider(name: string, fn: () => unknown, opts?: {
|
|
60
|
+
tier?: 'observable' | 'assisted';
|
|
61
|
+
}): void;
|
|
62
|
+
/** Register (or replace) an invokable command. `locus` is REQUIRED once the
|
|
63
|
+
* project declares a Colyseus room (`DebugRegistry.setRoomDeclared`) — a
|
|
64
|
+
* fixture must say whether it mutates authoritative (server) or predicted
|
|
65
|
+
* (client) state.
|
|
66
|
+
*
|
|
67
|
+
* Generic over the declared `args` Zod tuple ({@link DebugCommandArgs}) so
|
|
68
|
+
* `fn`'s parameters INFER from it: `registerCommand('setHp', { args:
|
|
69
|
+
* z.tuple([z.number()]) }, (hp) => ...)` types `hp` as `number` with no
|
|
70
|
+
* cast. Leaving `args` off keeps `fn` typed `(...args: unknown[]) => ...`,
|
|
71
|
+
* same as before this generic existed. */
|
|
72
|
+
registerCommand<T extends z.ZodTuple | undefined = undefined>(name: string, spec: {
|
|
73
|
+
description?: string;
|
|
74
|
+
args?: T;
|
|
75
|
+
locus?: 'client' | 'server';
|
|
76
|
+
}, fn: (...args: DebugCommandArgs<T>) => unknown | Promise<unknown>): void;
|
|
77
|
+
/** Push a tick-stamped event onto the debug event ring (spec §3.3) — the
|
|
78
|
+
* engine stamps `tick`/`simT` at emission, not at read time. */
|
|
79
|
+
emit(event: string, detail?: unknown): void;
|
|
80
|
+
/**
|
|
81
|
+
* Task 2.2 — server-locus command routing (client leg). Call once your
|
|
82
|
+
* game code has joined its Colyseus room, so `locus: 'server'` commands
|
|
83
|
+
* have somewhere to send `__vgai:debugCommand`. Returns a detach function
|
|
84
|
+
* (call on room leave/dispose) — game-scoped, last-attached room wins.
|
|
85
|
+
*/
|
|
86
|
+
attachRoom(room: DebugRoomHandle): () => void;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* All engine subsystems, passed to every game `setup(ctx)` and to each
|
|
90
|
+
* game lifecycle callback.
|
|
91
|
+
*
|
|
92
|
+
* The surface is intentionally split in two:
|
|
93
|
+
*
|
|
94
|
+
* - **Raw libraries** — the actual Three.js / Rapier / postprocessing objects.
|
|
95
|
+
* Call their documented APIs directly; do NOT build wrappers around them.
|
|
96
|
+
* - **Engine handles** — thin VGAI-owned managers that bridge those libraries
|
|
97
|
+
* into the phase-ordered game loop. Reach for these when you need behavior the
|
|
98
|
+
* raw library doesn't provide (physics↔Object3D mapping, system phases, etc.).
|
|
99
|
+
*/
|
|
100
|
+
/** Host-supplied identity for one private play run or coordinated team test.
|
|
101
|
+
* Games may pass `roomKey` as a Colyseus filter/join option; the engine never
|
|
102
|
+
* joins a room or couples this authoring identity to a networking library. */
|
|
103
|
+
export interface PlaytestContext {
|
|
104
|
+
readonly mode: 'private' | 'team';
|
|
105
|
+
readonly id: string;
|
|
106
|
+
readonly roomKey: string;
|
|
107
|
+
readonly revision: number | null;
|
|
108
|
+
readonly participantId: string | null;
|
|
109
|
+
}
|
|
110
|
+
export interface GameContext {
|
|
111
|
+
/** Three.js scene graph root. Add/remove any `Object3D` (meshes, lights,
|
|
112
|
+
* groups) here. This is THE scene — there is no separate engine scene. */
|
|
113
|
+
scene: THREE.Scene;
|
|
114
|
+
/** The single render camera. Move/aim it directly, or (preferred) drive it
|
|
115
|
+
* from game code — see the camera-precedence note below. */
|
|
116
|
+
camera: THREE.PerspectiveCamera;
|
|
117
|
+
/** The Rapier physics `World`. Step/query it, create bodies & colliders via
|
|
118
|
+
* `ctx.rapier`. One shared world for the whole scene. */
|
|
119
|
+
rapierWorld: RAPIER.World;
|
|
120
|
+
/** The Rapier module namespace itself (`RigidBodyDesc`, `ColliderDesc`,
|
|
121
|
+
* `Vector3`, enums, …). Use to construct physics descriptors. */
|
|
122
|
+
rapier: typeof RAPIER;
|
|
123
|
+
/** The `postprocessing` EffectComposer driving the final render. Use to
|
|
124
|
+
* add/remove passes (bloom, vignette, …) or reach the underlying
|
|
125
|
+
* `WebGLRenderer` via `composer.getRenderer()`. */
|
|
126
|
+
composer: EffectComposer;
|
|
127
|
+
/** Keyboard/mouse/gamepad input. Polled once per frame in the `input` phase;
|
|
128
|
+
* read action/axis state inside your `update`. */
|
|
129
|
+
input: InputManager;
|
|
130
|
+
/** Rapier collision-event dispatcher. Register handlers with
|
|
131
|
+
* `collisions.onCollision(...)`; it is drained each `postPhysics`. Prefer a
|
|
132
|
+
* own handler for per-entity sensor logic. */
|
|
133
|
+
collisions: CollisionSystem;
|
|
134
|
+
/** `Object3D ↔ Rapier body/collider` registry (+ collider→Object3D reverse
|
|
135
|
+
* index). Use to find an entity's body/collider, or the entity behind a
|
|
136
|
+
* raw collision. Inside a component, `this.rigidBody`/`this.collider` are
|
|
137
|
+
* pre-resolved from here. */
|
|
138
|
+
physics: PhysicsRegistry;
|
|
139
|
+
/** Procedural audio: master gain, listener, and one-shot/impact helpers.
|
|
140
|
+
* Use for SFX and music; the listener tracks the camera. */
|
|
141
|
+
audio: GameAudio;
|
|
142
|
+
/** three.quarks particle system: the batched renderer + spawn helpers. Use
|
|
143
|
+
* to emit runtime particle effects; declarative scene particles register
|
|
144
|
+
* here automatically. */
|
|
145
|
+
particles: ParticlesContext;
|
|
146
|
+
/** Immediate-mode debug drawing (`line`/`box`/`sphere`/`arrow`). Drawn
|
|
147
|
+
* objects persist until you call `debugDraw.clear()` yourself (the
|
|
148
|
+
* adapter also clears on scene dispose/hot-reload) — nothing clears it
|
|
149
|
+
* automatically per frame. Dev-only visualization — not for shipped
|
|
150
|
+
* visuals. */
|
|
151
|
+
debugDraw: ReturnType<typeof createDebugDraw>;
|
|
152
|
+
/** Shared GLTF/texture cache. Use `assets.loadGLTF(...)` etc. to load+cache
|
|
153
|
+
* models at runtime so repeated loads reuse geometry/material. */
|
|
154
|
+
assets: AssetCache;
|
|
155
|
+
/** The phase-ordered system runner. `systems.add(phase, fn)` registers a
|
|
156
|
+
* per-frame callback. Reserve this for non-gameplay infra (audio mixers,
|
|
157
|
+
* network send); per-entity GAMEPLAY belongs in a `useFrame` hook. */
|
|
158
|
+
systems: ReturnType<typeof createSystemRunner>;
|
|
159
|
+
/**
|
|
160
|
+
* P3 — the SIM-TIME scheduler (`core/sim-clock.ts`). `await ctx.clock.delay(n)`
|
|
161
|
+
* waits `n` seconds of the fixed loop's own time, so it pauses when the game
|
|
162
|
+
* pauses, steps when `Game.play.step()` steps, and reproduces exactly in an
|
|
163
|
+
* offline export; `ctx.clock.after(n, fn)` is the frame-exact synchronous
|
|
164
|
+
* form, and `ctx.clock.disposeAfter(obj, n)` is debris removal. Cancellation
|
|
165
|
+
* is `AbortSignal`.
|
|
166
|
+
*
|
|
167
|
+
* REQUIRED, unlike `debug`/`random` above: every world has a sim clock. When
|
|
168
|
+
* a Game hosts the mount it is the ONE game-scoped clock the fixed loop
|
|
169
|
+
* flushes; a bare harness mount with no Game shell gets a private,
|
|
170
|
+
* mount-local clock that nothing advances (so `now()` stays 0) rather than an
|
|
171
|
+
* absent field.
|
|
172
|
+
*
|
|
173
|
+
* NOT `AnimationClock` (`animation/animation-clock.ts`) — that one is the
|
|
174
|
+
* seekable cinematic playhead and runs backwards. This one is monotonic and
|
|
175
|
+
* never rewinds, which is exactly why a Promise can be bound to it. See
|
|
176
|
+
* `core/sim-clock.ts`'s header.
|
|
177
|
+
*/
|
|
178
|
+
clock: SimClock;
|
|
179
|
+
/** The live scene index for this root (P2 `observe`): tag/entity-id lookup
|
|
180
|
+
* that never traverses, plus the change signals — `entityadded`,
|
|
181
|
+
* `entityremoved`, `tagadded`, `tagremoved`, `attributechanged` — on a plain
|
|
182
|
+
* `EventTarget`, unsubscribed with an `AbortSignal`. Maintained from three's
|
|
183
|
+
* own `childadded`/`childremoved` parent events, so it costs nothing on a
|
|
184
|
+
* frame where nothing changes. See `ecs/scene-index.ts`; the one-shot
|
|
185
|
+
* `ecs/scene-query.ts` walks remain for a single ad-hoc question. */
|
|
186
|
+
sceneIndex: SceneIndex;
|
|
187
|
+
/** Register a game-owned `SystemAdapters` capability (networking,
|
|
188
|
+
* navigation, …) on the mounted game's adapter surface, so the editor's
|
|
189
|
+
* introspection panels (via `getActiveSystems()`) can see it. The engine
|
|
190
|
+
* wires the first-party physics/input/assets/audio entries itself;
|
|
191
|
+
* capabilities the GAME owns (a Colyseus connection, a NavMeshManager)
|
|
192
|
+
* are registered here by the game's setup. Optional capability — absent
|
|
193
|
+
* in contexts that expose no adapter surface (some test harnesses);
|
|
194
|
+
* call as `ctx.registerSystemAdapter?.(…)`.
|
|
195
|
+
*
|
|
196
|
+
* Ordering contract: **game registrations always win** — the engine seeds
|
|
197
|
+
* its first-party entries (physics/input/assets/audio) BEFORE setup()
|
|
198
|
+
* runs, so a game that registers any of those same kinds during its own
|
|
199
|
+
* setup overrides the engine's entry, not the other way around. This also
|
|
200
|
+
* holds across a warm restart (`hotReload`): every kind the outgoing game
|
|
201
|
+
* registered is stripped back to the engine's entry (or absent, for
|
|
202
|
+
* game-only kinds like networking/navigation) before the incoming game's
|
|
203
|
+
* setup runs, so a disposed game's adapter is never left stale on the
|
|
204
|
+
* mounted surface. */
|
|
205
|
+
registerSystemAdapter?<K extends keyof SystemAdapters>(kind: K, adapter: SystemAdapters[K]): void;
|
|
206
|
+
/** The debug/synthetic-player authoring surface — see {@link DebugCtxSurface}.
|
|
207
|
+
* Optional, same absence precedent as `registerSystemAdapter`: present on every
|
|
208
|
+
* first-party mount, absent only in bare test harnesses that build a
|
|
209
|
+
* hand-rolled `ctx`. */
|
|
210
|
+
debug?: DebugCtxSurface;
|
|
211
|
+
/**
|
|
212
|
+
* D15 (T-D15.1) — the game-scoped, named-stream seeded PRNG. `ctx.random()`
|
|
213
|
+
* draws from the `'gameplay'` stream; `ctx.random.stream('vfx')` (or any other
|
|
214
|
+
* name) draws from an INDEPENDENT stream, so a cosmetic/VFX draw can never
|
|
215
|
+
* shift the gameplay draw sequence. Use this instead of raw `Math.random()` for
|
|
216
|
+
* anything a project wants to keep reproducible; `ctx.random` itself always
|
|
217
|
+
* exists and is always internally consistent (same seed ⇒ same sequence)
|
|
218
|
+
* whether or not the project's manifest declares `determinism.seededRandom` —
|
|
219
|
+
* that flag only gates the BOOT-TIME seeding from
|
|
220
|
+
* `manifest.determinism.defaultSeed`/`?vgai-seed=`, the burn-down lint scan,
|
|
221
|
+
* and the dev-mode `Math.random` phase trap (three separate enforcers,
|
|
222
|
+
* `test/gameplay-rng-ban.test.ts` + `runtime/gameplay-rng-trap.ts`), never
|
|
223
|
+
* `ctx.random`'s mere presence. Same absence precedent as `debug` above:
|
|
224
|
+
* present on every first-party mount, optional only for bare test harnesses
|
|
225
|
+
* that build a hand-rolled `ctx`. `reseed(seed)` (future draws only) is
|
|
226
|
+
* `play.seed.set`'s eventual target (T-D15.6, not yet wired).
|
|
227
|
+
*/
|
|
228
|
+
random?: SeededRandom;
|
|
229
|
+
/** The Game root — the loop, the world registry, and game-scoped handles.
|
|
230
|
+
* Absent only in bare test harnesses that construct a partial context (the
|
|
231
|
+
* host always sets it in `createGameRuntime`). Optional so every existing
|
|
232
|
+
* harness that builds a hand-rolled `ctx` object keeps compiling
|
|
233
|
+
* unmodified — the same precedent as `registerSystemAdapter`. */
|
|
234
|
+
game?: Game | undefined;
|
|
235
|
+
/** Alias for `game.roots` — the live, declaration-ordered world registry.
|
|
236
|
+
* Same optionality/absence rule as `game` above. */
|
|
237
|
+
roots?: ReadonlyArray<RootInstance> | undefined;
|
|
238
|
+
/** The host's current private play or Team Test identity. Optional for
|
|
239
|
+
* standalone/custom hosts; networking remains game-owned and direct. */
|
|
240
|
+
playtest?: PlaytestContext | null | undefined;
|
|
241
|
+
}
|
|
242
|
+
/** Return value from a game setup function. */
|
|
243
|
+
export interface GameCleanup {
|
|
244
|
+
dispose: () => void;
|
|
245
|
+
}
|
|
246
|
+
/** Context passed to setup() when launched from the editor's play mode. */
|
|
247
|
+
export interface EditorPreview {
|
|
248
|
+
/** Editor viewport camera transform — use this as the initial game camera viewpoint. */
|
|
249
|
+
viewportCamera?: {
|
|
250
|
+
position: [number, number, number];
|
|
251
|
+
quaternion: [number, number, number, number];
|
|
252
|
+
};
|
|
253
|
+
/**
|
|
254
|
+
* Which bundled example the static/browser build's project picker wants to
|
|
255
|
+
* run (Adjudication H).
|
|
256
|
+
*
|
|
257
|
+
* Its one former reader — `browser-play-entry.ts`'s whole-bundle `setup()`,
|
|
258
|
+
* which dispatched over the generated `SETUP_BY_EXAMPLE_ID` table — is
|
|
259
|
+
* DELETED. Hosted dispatch is per-root (`ADAPTER_BY_EXAMPLE_ROOT` /
|
|
260
|
+
* `REACT_BY_EXAMPLE_ROOT`, resolved in `adapter-resolver.ts`) and never
|
|
261
|
+
* consults this field; `exampleDispatchFor` still sets it as the marker for
|
|
262
|
+
* "play the project's own shipped game" rather than a `?scene=` override
|
|
263
|
+
* (which sets `assetPrefix` instead — that one IS read, by
|
|
264
|
+
* `SetupThreeRootAdapter`). Every `GameSetupFn` consumer ignores it.
|
|
265
|
+
*/
|
|
266
|
+
exampleId?: string | undefined;
|
|
267
|
+
/**
|
|
268
|
+
* Asset prefix for the static/browser build's GENERIC scene-loader fallback,
|
|
269
|
+
* set INSTEAD of `exampleId` when the editor has a non-default scene of a
|
|
270
|
+
* bundled example open (hosted `?project=<id>&scene=<project-relative>` —
|
|
271
|
+
* Track H): the open scene plays via `sceneData`, but its relative asset
|
|
272
|
+
* refs still live under the example's staged `/examples/<id>/` public root.
|
|
273
|
+
* Ignored whenever `exampleId` is set; undefined ⇒ root prefix `/`.
|
|
274
|
+
*/
|
|
275
|
+
assetPrefix?: string | undefined;
|
|
276
|
+
}
|
|
277
|
+
/** A game setup function: receives engine context, returns cleanup.
|
|
278
|
+
*
|
|
279
|
+
* This is the MOUNT body of the FIRST-PARTY implementer. The host no longer
|
|
280
|
+
* depends on it — the host depends on `RootAdapter` (`@engine/adapter`), and
|
|
281
|
+
* `GameSetupFn` is wrapped into a `SetupThreeRootAdapter` via `fromSetup`.. (The
|
|
282
|
+
* former `RootAdapter` `{ setup, components }` interface lived here; it is
|
|
283
|
+
* superseded by the real adapter interfaces in `@engine/adapter`.) */
|
|
284
|
+
export type GameSetupFn = (ctx: GameContext, editor?: EditorPreview) => Promise<GameCleanup>;
|
|
285
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/runtime/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE UNEXPORTED-GAME TRAP: a dev-served standalone game page REFUSES to boot.
|
|
3
|
+
*
|
|
4
|
+
* Owner decision (2026-08-09): until a game is EXPORTED, it is never played
|
|
5
|
+
* outside the editor. The editor is the one authoring, viewing and
|
|
6
|
+
* verification surface; the standalone page exists to serve the exported
|
|
7
|
+
* artifact, not to be a second door during development.
|
|
8
|
+
*
|
|
9
|
+
* Why this is a trap in CODE and not a rule in prose: the rule already
|
|
10
|
+
* existed, and it drifted. When an editor session broke mid-task, an agent
|
|
11
|
+
* "temporarily" switched to `npm run game`, the fallback fed its whole
|
|
12
|
+
* feedback loop (pixels for screenshots), nothing broken ever pushed it back,
|
|
13
|
+
* and hours of verification ran outside the editor without anyone deciding
|
|
14
|
+
* that. A workaround whose cost lands outside the loop that chose it is
|
|
15
|
+
* sticky; the only fix that holds is for the workaround PATH ITSELF to fail
|
|
16
|
+
* immediately, loudly, and with the way back in its hands. That is this file.
|
|
17
|
+
*
|
|
18
|
+
* The boundary is DEV-SERVED vs EXPORTED, decided by the bundler: a Vite dev
|
|
19
|
+
* server strips nothing, so `import.meta.env.DEV` is true; a production build
|
|
20
|
+
* (`vite build` — what `vgai deploy` runs) compiles it false and this module
|
|
21
|
+
* costs an exported game nothing. Headless contexts (unit tests, playtest's
|
|
22
|
+
* node leg) have no real browser page and never trip it — the check requires
|
|
23
|
+
* a document whose `defaultView` is the window, which no test stub wires up.
|
|
24
|
+
*
|
|
25
|
+
* There is deliberately NO opt-out flag, env var, or query param. An escape
|
|
26
|
+
* hatch an agent can reach for is the workaround again, one hop later.
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* Throws (and paints a full-screen refusal, so a human at the tab sees it as
|
|
30
|
+
* immediately as a harness watching the console does) when an unexported game
|
|
31
|
+
* is being mounted on a dev-served page. Called by `mountGameFromManifest`
|
|
32
|
+
* before any root is resolved; exported builds and headless tests pass
|
|
33
|
+
* through untouched.
|
|
34
|
+
*/
|
|
35
|
+
export declare function assertExportedOrInEditor(): void;
|
|
36
|
+
//# sourceMappingURL=unexported-game-trap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unexported-game-trap.d.ts","sourceRoot":"","sources":["../../src/runtime/unexported-game-trap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AA4BH;;;;;;GAMG;AACH,wBAAgB,wBAAwB,IAAI,IAAI,CAoB/C"}
|