@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.
- package/package.json +1 -1
- package/schemas/engine-capabilities.json +4 -4
- package/schemas/vgai-game.schema.json +2 -2
- package/src/adapter/authoring.ts +42 -0
- package/src/adapter/index.ts +3 -0
- package/src/adapter/ingest/overlay-apply.ts +50 -6
- package/src/adapter/ingest/scene-capture.ts +51 -2
- package/src/adapter/vgai-scene-game-adapter.ts +24 -0
- package/src/manifest/schema.ts +7 -3
- package/src/runtime/create-runtime.ts +97 -0
- package/src/runtime/game.ts +11 -1
- package/src/scene/asset-ref-check.ts +1 -1
- package/src/scene/scene-loader.ts +2 -2
- package/src/scene/user-data.ts +18 -0
- package/src/world3d-react/behavior.tsx +19 -11
- package/src/world3d-react/r3f-adapter.tsx +8 -0
- package/dist/adapter/adapter-surface.d.ts +0 -30
- package/dist/adapter/adapter-surface.d.ts.map +0 -1
- package/dist/adapter/adapter-surface.js +0 -18
- package/dist/adapter/authoring.d.ts +0 -461
- package/dist/adapter/authoring.d.ts.map +0 -1
- package/dist/adapter/authoring.js +0 -22
- package/dist/adapter/colyseus-networking-adapter.d.ts +0 -43
- package/dist/adapter/colyseus-networking-adapter.d.ts.map +0 -1
- package/dist/adapter/colyseus-networking-adapter.js +0 -38
- package/dist/adapter/first-party-systems.d.ts +0 -38
- package/dist/adapter/first-party-systems.d.ts.map +0 -1
- package/dist/adapter/first-party-systems.js +0 -77
- package/dist/adapter/game-adapter.d.ts +0 -133
- package/dist/adapter/game-adapter.d.ts.map +0 -1
- package/dist/adapter/game-adapter.js +0 -10
- package/dist/adapter/host-context.d.ts +0 -71
- package/dist/adapter/host-context.d.ts.map +0 -1
- package/dist/adapter/host-context.js +0 -16
- package/dist/adapter/index.d.ts +0 -22
- package/dist/adapter/index.d.ts.map +0 -1
- package/dist/adapter/index.js +0 -15
- package/dist/adapter/ingest/game-contract.d.ts +0 -53
- package/dist/adapter/ingest/game-contract.d.ts.map +0 -1
- package/dist/adapter/ingest/game-contract.js +0 -30
- package/dist/adapter/ingest/overlay-applier.d.ts +0 -118
- package/dist/adapter/ingest/overlay-applier.d.ts.map +0 -1
- package/dist/adapter/ingest/overlay-applier.js +0 -132
- package/dist/adapter/ingest/overlay-apply.d.ts +0 -60
- package/dist/adapter/ingest/overlay-apply.d.ts.map +0 -1
- package/dist/adapter/ingest/overlay-apply.js +0 -101
- package/dist/adapter/ingest/overlay-file.d.ts +0 -79
- package/dist/adapter/ingest/overlay-file.d.ts.map +0 -1
- package/dist/adapter/ingest/overlay-file.js +0 -66
- package/dist/adapter/ingest/overlay-report.d.ts +0 -113
- package/dist/adapter/ingest/overlay-report.d.ts.map +0 -1
- package/dist/adapter/ingest/overlay-report.js +0 -103
- package/dist/adapter/ingest/scene-capture.d.ts +0 -97
- package/dist/adapter/ingest/scene-capture.d.ts.map +0 -1
- package/dist/adapter/ingest/scene-capture.js +0 -248
- package/dist/adapter/ingest/upstream-pin.d.ts +0 -47
- package/dist/adapter/ingest/upstream-pin.d.ts.map +0 -1
- package/dist/adapter/ingest/upstream-pin.js +0 -50
- package/dist/adapter/loop-gate-report.d.ts +0 -34
- package/dist/adapter/loop-gate-report.d.ts.map +0 -1
- package/dist/adapter/loop-gate-report.js +0 -37
- package/dist/adapter/rapier-physics-adapter.d.ts +0 -12
- package/dist/adapter/rapier-physics-adapter.d.ts.map +0 -1
- package/dist/adapter/rapier-physics-adapter.js +0 -46
- package/dist/adapter/system-adapter.d.ts +0 -206
- package/dist/adapter/system-adapter.d.ts.map +0 -1
- package/dist/adapter/system-adapter.js +0 -13
- package/dist/adapter/transform.d.ts +0 -18
- package/dist/adapter/transform.d.ts.map +0 -1
- package/dist/adapter/transform.js +0 -1
- package/dist/adapter/vgai-scene-game-adapter.d.ts +0 -108
- package/dist/adapter/vgai-scene-game-adapter.d.ts.map +0 -1
- package/dist/adapter/vgai-scene-game-adapter.js +0 -762
- package/dist/ai/navigation.d.ts +0 -64
- package/dist/ai/navigation.d.ts.map +0 -1
- package/dist/ai/navigation.js +0 -133
- package/dist/animation/anim-graph-types.d.ts +0 -25
- package/dist/animation/anim-graph-types.d.ts.map +0 -1
- package/dist/animation/anim-graph-types.js +0 -1
- package/dist/animation/animation-clock.d.ts +0 -213
- package/dist/animation/animation-clock.d.ts.map +0 -1
- package/dist/animation/animation-clock.js +0 -301
- package/dist/animation/blend-node.d.ts +0 -22
- package/dist/animation/blend-node.d.ts.map +0 -1
- package/dist/animation/blend-node.js +0 -97
- package/dist/animation/camera-ownership.d.ts +0 -250
- package/dist/animation/camera-ownership.d.ts.map +0 -1
- package/dist/animation/camera-ownership.js +0 -169
- package/dist/animation/cinematic-cues.d.ts +0 -200
- package/dist/animation/cinematic-cues.d.ts.map +0 -1
- package/dist/animation/cinematic-cues.js +0 -213
- package/dist/animation/clip-map.d.ts +0 -12
- package/dist/animation/clip-map.d.ts.map +0 -1
- package/dist/animation/clip-map.js +0 -37
- package/dist/animation/gsap-registration.d.ts +0 -119
- package/dist/animation/gsap-registration.d.ts.map +0 -1
- package/dist/animation/gsap-registration.js +0 -92
- package/dist/animation/theatre-clock-binding.d.ts +0 -89
- package/dist/animation/theatre-clock-binding.d.ts.map +0 -1
- package/dist/animation/theatre-clock-binding.js +0 -29
- package/dist/animation/theatre-director.d.ts +0 -242
- package/dist/animation/theatre-director.d.ts.map +0 -1
- package/dist/animation/theatre-director.js +0 -235
- package/dist/animation/theatre-object-binding.d.ts +0 -305
- package/dist/animation/theatre-object-binding.d.ts.map +0 -1
- package/dist/animation/theatre-object-binding.js +0 -351
- package/dist/animation/xstate-animation-binding.d.ts +0 -56
- package/dist/animation/xstate-animation-binding.d.ts.map +0 -1
- package/dist/animation/xstate-animation-binding.js +0 -331
- package/dist/animation/xstate-animation-meta.d.ts +0 -266
- package/dist/animation/xstate-animation-meta.d.ts.map +0 -1
- package/dist/animation/xstate-animation-meta.js +0 -252
- package/dist/assets.d.ts +0 -26
- package/dist/assets.d.ts.map +0 -1
- package/dist/assets.js +0 -55
- package/dist/audio/index.d.ts +0 -4
- package/dist/audio/index.d.ts.map +0 -1
- package/dist/audio/index.js +0 -24
- package/dist/audio/tone-clock-binding.d.ts +0 -75
- package/dist/audio/tone-clock-binding.d.ts.map +0 -1
- package/dist/audio/tone-clock-binding.js +0 -29
- package/dist/audio/tone-context.d.ts +0 -114
- package/dist/audio/tone-context.d.ts.map +0 -1
- package/dist/audio/tone-context.js +0 -39
- package/dist/audio/tone-offline-render.d.ts +0 -90
- package/dist/audio/tone-offline-render.d.ts.map +0 -1
- package/dist/audio/tone-offline-render.js +0 -56
- package/dist/audio/wav-encode.d.ts +0 -38
- package/dist/audio/wav-encode.d.ts.map +0 -1
- package/dist/audio/wav-encode.js +0 -97
- package/dist/character/cloth-sim.d.ts +0 -179
- package/dist/character/cloth-sim.d.ts.map +0 -1
- package/dist/character/cloth-sim.js +0 -334
- package/dist/character/spring-chain.d.ts +0 -135
- package/dist/character/spring-chain.d.ts.map +0 -1
- package/dist/character/spring-chain.js +0 -165
- package/dist/core/game-loop.d.ts +0 -42
- package/dist/core/game-loop.d.ts.map +0 -1
- package/dist/core/game-loop.js +0 -167
- package/dist/core/seeded-random.d.ts +0 -69
- package/dist/core/seeded-random.d.ts.map +0 -1
- package/dist/core/seeded-random.js +0 -121
- package/dist/core/system-runner.d.ts +0 -120
- package/dist/core/system-runner.d.ts.map +0 -1
- package/dist/core/system-runner.js +0 -297
- package/dist/core/types.d.ts +0 -92
- package/dist/core/types.d.ts.map +0 -1
- package/dist/core/types.js +0 -25
- package/dist/data/data-asset.d.ts +0 -101
- package/dist/data/data-asset.d.ts.map +0 -1
- package/dist/data/data-asset.js +0 -122
- package/dist/data/data-check-core.d.ts +0 -110
- package/dist/data/data-check-core.d.ts.map +0 -1
- package/dist/data/data-check-core.js +0 -178
- package/dist/data/data-ref.d.ts +0 -79
- package/dist/data/data-ref.d.ts.map +0 -1
- package/dist/data/data-ref.js +0 -130
- package/dist/data/vite-plugin-data.d.ts +0 -79
- package/dist/data/vite-plugin-data.d.ts.map +0 -1
- package/dist/data/vite-plugin-data.js +0 -217
- package/dist/dev/console-bridge.d.ts +0 -22
- package/dist/dev/console-bridge.d.ts.map +0 -1
- package/dist/dev/console-bridge.js +0 -71
- package/dist/dev/debug-draw.d.ts +0 -24
- package/dist/dev/debug-draw.d.ts.map +0 -1
- package/dist/dev/debug-draw.js +0 -73
- package/dist/dev/logger.d.ts +0 -30
- package/dist/dev/logger.d.ts.map +0 -1
- package/dist/dev/logger.js +0 -90
- package/dist/dev/performance-profiler.d.ts +0 -60
- package/dist/dev/performance-profiler.d.ts.map +0 -1
- package/dist/dev/performance-profiler.js +0 -181
- package/dist/dev/webgl-gpu-timer.d.ts +0 -8
- package/dist/dev/webgl-gpu-timer.d.ts.map +0 -1
- package/dist/dev/webgl-gpu-timer.js +0 -52
- package/dist/ecs/component-manager.d.ts +0 -205
- package/dist/ecs/component-manager.d.ts.map +0 -1
- package/dist/ecs/component-manager.js +0 -706
- package/dist/ecs/game-component.d.ts +0 -146
- package/dist/ecs/game-component.d.ts.map +0 -1
- package/dist/ecs/game-component.js +0 -141
- package/dist/ecs/hmr-swap-report.d.ts +0 -53
- package/dist/ecs/hmr-swap-report.d.ts.map +0 -1
- package/dist/ecs/hmr-swap-report.js +0 -55
- package/dist/humanoid/bake.operation.d.ts +0 -119
- package/dist/humanoid/bake.operation.d.ts.map +0 -1
- package/dist/humanoid/bake.operation.js +0 -228
- package/dist/humanoid/body.d.ts +0 -101
- package/dist/humanoid/body.d.ts.map +0 -1
- package/dist/humanoid/body.js +0 -530
- package/dist/humanoid/clips.d.ts +0 -62
- package/dist/humanoid/clips.d.ts.map +0 -1
- package/dist/humanoid/clips.js +0 -121
- package/dist/humanoid/compose.d.ts +0 -75
- package/dist/humanoid/compose.d.ts.map +0 -1
- package/dist/humanoid/compose.js +0 -176
- package/dist/humanoid/generate.d.ts +0 -92
- package/dist/humanoid/generate.d.ts.map +0 -1
- package/dist/humanoid/generate.js +0 -124
- package/dist/humanoid/index.d.ts +0 -24
- package/dist/humanoid/index.d.ts.map +0 -1
- package/dist/humanoid/index.js +0 -18
- package/dist/humanoid/schema.d.ts +0 -35
- package/dist/humanoid/schema.d.ts.map +0 -1
- package/dist/humanoid/schema.js +0 -87
- package/dist/humanoid/skeleton.d.ts +0 -103
- package/dist/humanoid/skeleton.d.ts.map +0 -1
- package/dist/humanoid/skeleton.js +0 -289
- package/dist/index.d.ts +0 -37
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -30
- package/dist/input/input-manager.d.ts +0 -945
- package/dist/input/input-manager.d.ts.map +0 -1
- package/dist/input/input-manager.js +0 -2207
- package/dist/input/input-types.d.ts +0 -174
- package/dist/input/input-types.d.ts.map +0 -1
- package/dist/input/input-types.js +0 -1
- package/dist/input/prompt-labels.d.ts +0 -21
- package/dist/input/prompt-labels.d.ts.map +0 -1
- package/dist/input/prompt-labels.js +0 -121
- package/dist/input/rebind-controller.d.ts +0 -59
- package/dist/input/rebind-controller.d.ts.map +0 -1
- package/dist/input/rebind-controller.js +0 -85
- package/dist/input/schema.d.ts +0 -16
- package/dist/input/schema.d.ts.map +0 -1
- package/dist/input/schema.js +0 -228
- package/dist/loader.d.ts +0 -43
- package/dist/loader.d.ts.map +0 -1
- package/dist/loader.js +0 -59
- package/dist/manifest/index.d.ts +0 -5
- package/dist/manifest/index.d.ts.map +0 -1
- package/dist/manifest/index.js +0 -8
- package/dist/manifest/load-file.d.ts +0 -4
- package/dist/manifest/load-file.d.ts.map +0 -1
- package/dist/manifest/load-file.js +0 -14
- package/dist/manifest/load.d.ts +0 -144
- package/dist/manifest/load.d.ts.map +0 -1
- package/dist/manifest/load.js +0 -273
- package/dist/manifest/schema.d.ts +0 -230
- package/dist/manifest/schema.d.ts.map +0 -1
- package/dist/manifest/schema.js +0 -394
- package/dist/physics/collision-system.d.ts +0 -41
- package/dist/physics/collision-system.d.ts.map +0 -1
- package/dist/physics/collision-system.js +0 -64
- package/dist/physics/physics-registry.d.ts +0 -45
- package/dist/physics/physics-registry.d.ts.map +0 -1
- package/dist/physics/physics-registry.js +0 -65
- package/dist/physics/transform-writer.d.ts +0 -16
- package/dist/physics/transform-writer.d.ts.map +0 -1
- package/dist/physics/transform-writer.js +0 -38
- package/dist/physics/trigger-dispatch.d.ts +0 -24
- package/dist/physics/trigger-dispatch.d.ts.map +0 -1
- package/dist/physics/trigger-dispatch.js +0 -80
- package/dist/react/game-state.d.ts +0 -156
- package/dist/react/game-state.d.ts.map +0 -1
- package/dist/react/game-state.js +0 -222
- package/dist/react/root-adapter.d.ts +0 -11
- package/dist/react/root-adapter.d.ts.map +0 -1
- package/dist/react/root-adapter.js +0 -41
- package/dist/react/unmanaged-root-detector.d.ts +0 -12
- package/dist/react/unmanaged-root-detector.d.ts.map +0 -1
- package/dist/react/unmanaged-root-detector.js +0 -45
- package/dist/react/use-data.d.ts +0 -60
- package/dist/react/use-data.d.ts.map +0 -1
- package/dist/react/use-data.js +0 -101
- package/dist/react/use-selection.d.ts +0 -75
- package/dist/react/use-selection.d.ts.map +0 -1
- package/dist/react/use-selection.js +0 -90
- package/dist/render/auto-batcher.d.ts +0 -34
- package/dist/render/auto-batcher.d.ts.map +0 -1
- package/dist/render/auto-batcher.js +0 -140
- package/dist/render/render-batch-system.d.ts +0 -33
- package/dist/render/render-batch-system.d.ts.map +0 -1
- package/dist/render/render-batch-system.js +0 -230
- package/dist/render/render-features.d.ts +0 -47
- package/dist/render/render-features.d.ts.map +0 -1
- package/dist/render/render-features.js +0 -105
- package/dist/render/render-settings.d.ts +0 -36
- package/dist/render/render-settings.d.ts.map +0 -1
- package/dist/render/render-settings.js +0 -51
- package/dist/runtime/create-runtime.d.ts +0 -249
- package/dist/runtime/create-runtime.d.ts.map +0 -1
- package/dist/runtime/create-runtime.js +0 -641
- package/dist/runtime/debug-bridge.d.ts +0 -257
- package/dist/runtime/debug-bridge.d.ts.map +0 -1
- package/dist/runtime/debug-bridge.js +0 -224
- package/dist/runtime/debug-registry.d.ts +0 -288
- package/dist/runtime/debug-registry.d.ts.map +0 -1
- package/dist/runtime/debug-registry.js +0 -513
- package/dist/runtime/frame-selector-cache.d.ts +0 -41
- package/dist/runtime/frame-selector-cache.d.ts.map +0 -1
- package/dist/runtime/frame-selector-cache.js +0 -65
- package/dist/runtime/game.d.ts +0 -496
- package/dist/runtime/game.d.ts.map +0 -1
- package/dist/runtime/game.js +0 -741
- package/dist/runtime/gameplay-rng-trap.d.ts +0 -48
- package/dist/runtime/gameplay-rng-trap.d.ts.map +0 -1
- package/dist/runtime/gameplay-rng-trap.js +0 -96
- package/dist/runtime/input-router.d.ts +0 -78
- package/dist/runtime/input-router.d.ts.map +0 -1
- package/dist/runtime/input-router.js +0 -171
- package/dist/runtime/mount-game.d.ts +0 -129
- package/dist/runtime/mount-game.d.ts.map +0 -1
- package/dist/runtime/mount-game.js +0 -152
- package/dist/runtime/mount-manifest.d.ts +0 -173
- package/dist/runtime/mount-manifest.d.ts.map +0 -1
- package/dist/runtime/mount-manifest.js +0 -297
- package/dist/runtime/render-audio-control.d.ts +0 -110
- package/dist/runtime/render-audio-control.d.ts.map +0 -1
- package/dist/runtime/render-audio-control.js +0 -111
- package/dist/runtime/render-control.d.ts +0 -291
- package/dist/runtime/render-control.d.ts.map +0 -1
- package/dist/runtime/render-control.js +0 -264
- package/dist/runtime/render-seed.d.ts +0 -57
- package/dist/runtime/render-seed.d.ts.map +0 -1
- package/dist/runtime/render-seed.js +0 -74
- package/dist/runtime/state-bridge.d.ts +0 -61
- package/dist/runtime/state-bridge.d.ts.map +0 -1
- package/dist/runtime/state-bridge.js +0 -63
- package/dist/runtime/types.d.ts +0 -253
- package/dist/runtime/types.d.ts.map +0 -1
- package/dist/runtime/types.js +0 -1
- package/dist/scene/asset-loaders.d.ts +0 -79
- package/dist/scene/asset-loaders.d.ts.map +0 -1
- package/dist/scene/asset-loaders.js +0 -141
- package/dist/scene/asset-paths.d.ts +0 -11
- package/dist/scene/asset-paths.d.ts.map +0 -1
- package/dist/scene/asset-paths.js +0 -108
- package/dist/scene/asset-ref-check.d.ts +0 -88
- package/dist/scene/asset-ref-check.d.ts.map +0 -1
- package/dist/scene/asset-ref-check.js +0 -214
- package/dist/scene/asset-registry.d.ts +0 -38
- package/dist/scene/asset-registry.d.ts.map +0 -1
- package/dist/scene/asset-registry.js +0 -66
- package/dist/scene/collider-dimensions.d.ts +0 -63
- package/dist/scene/collider-dimensions.d.ts.map +0 -1
- package/dist/scene/collider-dimensions.js +0 -98
- package/dist/scene/component-registry.d.ts +0 -22
- package/dist/scene/component-registry.d.ts.map +0 -1
- package/dist/scene/component-registry.js +0 -37
- package/dist/scene/defaults.d.ts +0 -252
- package/dist/scene/defaults.d.ts.map +0 -1
- package/dist/scene/defaults.js +0 -151
- package/dist/scene/geometries/index.d.ts +0 -8
- package/dist/scene/geometries/index.d.ts.map +0 -1
- package/dist/scene/geometries/index.js +0 -7
- package/dist/scene/geometries/terrain.d.ts +0 -2
- package/dist/scene/geometries/terrain.d.ts.map +0 -1
- package/dist/scene/geometries/terrain.js +0 -37
- package/dist/scene/geometry-registry.d.ts +0 -24
- package/dist/scene/geometry-registry.d.ts.map +0 -1
- package/dist/scene/geometry-registry.js +0 -20
- package/dist/scene/instance-registry.d.ts +0 -36
- package/dist/scene/instance-registry.d.ts.map +0 -1
- package/dist/scene/instance-registry.js +0 -55
- package/dist/scene/instancers/grid.d.ts +0 -2
- package/dist/scene/instancers/grid.d.ts.map +0 -1
- package/dist/scene/instancers/grid.js +0 -36
- package/dist/scene/instancers/index.d.ts +0 -8
- package/dist/scene/instancers/index.d.ts.map +0 -1
- package/dist/scene/instancers/index.js +0 -7
- package/dist/scene/light-camera-factory.d.ts +0 -23
- package/dist/scene/light-camera-factory.d.ts.map +0 -1
- package/dist/scene/light-camera-factory.js +0 -68
- package/dist/scene/material-factory.d.ts +0 -17
- package/dist/scene/material-factory.d.ts.map +0 -1
- package/dist/scene/material-factory.js +0 -197
- package/dist/scene/material-registry.d.ts +0 -40
- package/dist/scene/material-registry.d.ts.map +0 -1
- package/dist/scene/material-registry.js +0 -44
- package/dist/scene/materials/index.d.ts +0 -8
- package/dist/scene/materials/index.d.ts.map +0 -1
- package/dist/scene/materials/index.js +0 -7
- package/dist/scene/materials/water.d.ts +0 -2
- package/dist/scene/materials/water.d.ts.map +0 -1
- package/dist/scene/materials/water.js +0 -54
- package/dist/scene/parse.d.ts +0 -23
- package/dist/scene/parse.d.ts.map +0 -1
- package/dist/scene/parse.js +0 -179
- package/dist/scene/particles-factory.d.ts +0 -33
- package/dist/scene/particles-factory.d.ts.map +0 -1
- package/dist/scene/particles-factory.js +0 -282
- package/dist/scene/scene-apply.d.ts +0 -109
- package/dist/scene/scene-apply.d.ts.map +0 -1
- package/dist/scene/scene-apply.js +0 -370
- package/dist/scene/scene-diff-schema.d.ts +0 -285
- package/dist/scene/scene-diff-schema.d.ts.map +0 -1
- package/dist/scene/scene-diff-schema.js +0 -92
- package/dist/scene/scene-diff-types.d.ts +0 -40
- package/dist/scene/scene-diff-types.d.ts.map +0 -1
- package/dist/scene/scene-diff-types.js +0 -14
- package/dist/scene/scene-loader.d.ts +0 -167
- package/dist/scene/scene-loader.d.ts.map +0 -1
- package/dist/scene/scene-loader.js +0 -1211
- package/dist/scene/scene-query.d.ts +0 -11
- package/dist/scene/scene-query.d.ts.map +0 -1
- package/dist/scene/scene-query.js +0 -63
- package/dist/scene/scene-types.d.ts +0 -10
- package/dist/scene/scene-types.d.ts.map +0 -1
- package/dist/scene/scene-types.js +0 -8
- package/dist/scene/scene-version.d.ts +0 -26
- package/dist/scene/scene-version.d.ts.map +0 -1
- package/dist/scene/scene-version.js +0 -34
- package/dist/scene/schema/animation.d.ts +0 -8
- package/dist/scene/schema/animation.d.ts.map +0 -1
- package/dist/scene/schema/animation.js +0 -42
- package/dist/scene/schema/audio.d.ts +0 -13
- package/dist/scene/schema/audio.d.ts.map +0 -1
- package/dist/scene/schema/audio.js +0 -22
- package/dist/scene/schema/camera.d.ts +0 -28
- package/dist/scene/schema/camera.d.ts.map +0 -1
- package/dist/scene/schema/camera.js +0 -17
- package/dist/scene/schema/collider.d.ts +0 -40
- package/dist/scene/schema/collider.d.ts.map +0 -1
- package/dist/scene/schema/collider.js +0 -55
- package/dist/scene/schema/entity-ref.d.ts +0 -31
- package/dist/scene/schema/entity-ref.d.ts.map +0 -1
- package/dist/scene/schema/entity-ref.js +0 -61
- package/dist/scene/schema/entity.d.ts +0 -1036
- package/dist/scene/schema/entity.d.ts.map +0 -1
- package/dist/scene/schema/entity.js +0 -153
- package/dist/scene/schema/environment.d.ts +0 -425
- package/dist/scene/schema/environment.d.ts.map +0 -1
- package/dist/scene/schema/environment.js +0 -357
- package/dist/scene/schema/index.d.ts +0 -37
- package/dist/scene/schema/index.d.ts.map +0 -1
- package/dist/scene/schema/index.js +0 -19
- package/dist/scene/schema/instances.d.ts +0 -14
- package/dist/scene/schema/instances.d.ts.map +0 -1
- package/dist/scene/schema/instances.js +0 -28
- package/dist/scene/schema/joint.d.ts +0 -23
- package/dist/scene/schema/joint.d.ts.map +0 -1
- package/dist/scene/schema/joint.js +0 -23
- package/dist/scene/schema/light.d.ts +0 -38
- package/dist/scene/schema/light.d.ts.map +0 -1
- package/dist/scene/schema/light.js +0 -26
- package/dist/scene/schema/material.d.ts +0 -199
- package/dist/scene/schema/material.d.ts.map +0 -1
- package/dist/scene/schema/material.js +0 -103
- package/dist/scene/schema/mesh.d.ts +0 -48
- package/dist/scene/schema/mesh.d.ts.map +0 -1
- package/dist/scene/schema/mesh.js +0 -82
- package/dist/scene/schema/particles.d.ts +0 -2178
- package/dist/scene/schema/particles.d.ts.map +0 -1
- package/dist/scene/schema/particles.js +0 -321
- package/dist/scene/schema/physics.d.ts +0 -56
- package/dist/scene/schema/physics.d.ts.map +0 -1
- package/dist/scene/schema/physics.js +0 -37
- package/dist/scene/schema/scene-file.d.ts +0 -303
- package/dist/scene/schema/scene-file.d.ts.map +0 -1
- package/dist/scene/schema/scene-file.js +0 -256
- package/dist/scene/schema/shadow.d.ts +0 -28
- package/dist/scene/schema/shadow.d.ts.map +0 -1
- package/dist/scene/schema/shadow.js +0 -20
- package/dist/scene/schema/spline.d.ts +0 -25
- package/dist/scene/schema/spline.d.ts.map +0 -1
- package/dist/scene/schema/spline.js +0 -15
- package/dist/scene/schema/tuples.d.ts +0 -12
- package/dist/scene/schema/tuples.d.ts.map +0 -1
- package/dist/scene/schema/tuples.js +0 -14
- package/dist/scene/user-data.d.ts +0 -185
- package/dist/scene/user-data.d.ts.map +0 -1
- package/dist/scene/user-data.js +0 -144
- package/dist/setup/setup-audio.d.ts +0 -20
- package/dist/setup/setup-audio.d.ts.map +0 -1
- package/dist/setup/setup-audio.js +0 -41
- package/dist/setup/setup-particles.d.ts +0 -17
- package/dist/setup/setup-particles.d.ts.map +0 -1
- package/dist/setup/setup-particles.js +0 -16
- package/dist/setup/setup-physics.d.ts +0 -25
- package/dist/setup/setup-physics.d.ts.map +0 -1
- package/dist/setup/setup-physics.js +0 -51
- package/dist/setup/setup-renderer.d.ts +0 -69
- package/dist/setup/setup-renderer.d.ts.map +0 -1
- package/dist/setup/setup-renderer.js +0 -363
- package/dist/tools/define-tool.d.ts +0 -130
- package/dist/tools/define-tool.d.ts.map +0 -1
- package/dist/tools/define-tool.js +0 -96
- package/dist/world2d/authoring-2d.d.ts +0 -80
- package/dist/world2d/authoring-2d.d.ts.map +0 -1
- package/dist/world2d/authoring-2d.js +0 -195
- package/dist/world2d/capture-to-scene2d.d.ts +0 -5
- package/dist/world2d/capture-to-scene2d.d.ts.map +0 -1
- package/dist/world2d/capture-to-scene2d.js +0 -49
- package/dist/world2d/collision-2d.d.ts +0 -52
- package/dist/world2d/collision-2d.d.ts.map +0 -1
- package/dist/world2d/collision-2d.js +0 -70
- package/dist/world2d/components-2d.d.ts +0 -47
- package/dist/world2d/components-2d.d.ts.map +0 -1
- package/dist/world2d/components-2d.js +0 -77
- package/dist/world2d/index.d.ts +0 -34
- package/dist/world2d/index.d.ts.map +0 -1
- package/dist/world2d/index.js +0 -32
- package/dist/world2d/ingest-iframe-2d.d.ts +0 -82
- package/dist/world2d/ingest-iframe-2d.d.ts.map +0 -1
- package/dist/world2d/ingest-iframe-2d.js +0 -166
- package/dist/world2d/ingest2d.d.ts +0 -97
- package/dist/world2d/ingest2d.d.ts.map +0 -1
- package/dist/world2d/ingest2d.js +0 -40
- package/dist/world2d/physics2d-registry.d.ts +0 -24
- package/dist/world2d/physics2d-registry.d.ts.map +0 -1
- package/dist/world2d/physics2d-registry.js +0 -38
- package/dist/world2d/pixi-game-adapter.d.ts +0 -107
- package/dist/world2d/pixi-game-adapter.d.ts.map +0 -1
- package/dist/world2d/pixi-game-adapter.js +0 -210
- package/dist/world2d/pixi-surface.d.ts +0 -39
- package/dist/world2d/pixi-surface.d.ts.map +0 -1
- package/dist/world2d/pixi-surface.js +0 -47
- package/dist/world2d/scene-capture-2d.d.ts +0 -43
- package/dist/world2d/scene-capture-2d.d.ts.map +0 -1
- package/dist/world2d/scene-capture-2d.js +0 -92
- package/dist/world2d/scene2d-loader.d.ts +0 -27
- package/dist/world2d/scene2d-loader.d.ts.map +0 -1
- package/dist/world2d/scene2d-loader.js +0 -275
- package/dist/world2d/schema/entity2d.d.ts +0 -102
- package/dist/world2d/schema/entity2d.d.ts.map +0 -1
- package/dist/world2d/schema/entity2d.js +0 -119
- package/dist/world2d/schema/physics2d.d.ts +0 -46
- package/dist/world2d/schema/physics2d.d.ts.map +0 -1
- package/dist/world2d/schema/physics2d.js +0 -45
- package/dist/world2d/schema/sprite.d.ts +0 -42
- package/dist/world2d/schema/sprite.d.ts.map +0 -1
- package/dist/world2d/schema/sprite.js +0 -63
- package/dist/world2d/schema/tilemap.d.ts +0 -15
- package/dist/world2d/schema/tilemap.d.ts.map +0 -1
- package/dist/world2d/schema/tilemap.js +0 -19
- package/dist/world2d/schema/tuples2d.d.ts +0 -20
- package/dist/world2d/schema/tuples2d.d.ts.map +0 -1
- package/dist/world2d/schema/tuples2d.js +0 -19
- package/dist/world2d/system-adapters-2d.d.ts +0 -16
- package/dist/world2d/system-adapters-2d.d.ts.map +0 -1
- package/dist/world2d/system-adapters-2d.js +0 -37
- package/dist/world2d/transform-writer-2d.d.ts +0 -16
- package/dist/world2d/transform-writer-2d.d.ts.map +0 -1
- package/dist/world2d/transform-writer-2d.js +0 -22
- package/dist/world2d/types.d.ts +0 -59
- package/dist/world2d/types.d.ts.map +0 -1
- package/dist/world2d/types.js +0 -1
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Render-control runtime seam (I2, `docs/AI-NATIVE-AUTHORING-IMPLEMENTATION-SPEC.md`
|
|
3
|
-
* §15 I2). This is the harness a deterministic-capture host (Playwright/CDP,
|
|
4
|
-
* I0/I3/I4) drives: exact-time seeks against the canonical
|
|
5
|
-
* `AnimationClock` (`animation/animation-clock.ts`), and single
|
|
6
|
-
* `preRender`+`render` phase passes across every world on a `Game`
|
|
7
|
-
* (`runtime/game.ts`) — WITHOUT ever advancing gameplay fixed-step substeps
|
|
8
|
-
* (`input`/`prePhysics`/`physics`/`postPhysics`/`gameLogic`/`animation` are
|
|
9
|
-
* never invoked by this seam; `--simulate` (I5) is a different, later, path
|
|
10
|
-
* that deliberately drives `game.runFrame(fixedDt)` instead).
|
|
11
|
-
*
|
|
12
|
-
* This module does NOT reuse `PlayState.step()` (`Game.play.step()`) — that
|
|
13
|
-
* surface only advances the currently-FROZEN (paused) set of roots and is a
|
|
14
|
-
* whole-call no-op while unpaused (see its doc comment in `runtime/game.ts`);
|
|
15
|
-
* the spec review explicitly flagged it as the wrong seam. `renderOnce`
|
|
16
|
-
* instead walks `game.roots` directly and calls each world's own
|
|
17
|
-
* `WorldFrameHooks.runPhase` for exactly two phases.
|
|
18
|
-
*
|
|
19
|
-
* Also does NOT install anything by default — a caller must explicitly call
|
|
20
|
-
* {@link installRenderControlHarness}, and even then it only actually
|
|
21
|
-
* publishes `window.__vgaiRender` when the page's URL opts in via
|
|
22
|
-
* `?vgai-render=1` (AC 4: unavailable/protected in normal production
|
|
23
|
-
* gameplay unless explicitly enabled). See `render-seed.ts` for the
|
|
24
|
-
* matching `Math.random` determinism hardening, which must run BEFORE this
|
|
25
|
-
* module (or any other game module) is even imported.
|
|
26
|
-
*
|
|
27
|
-
* I5 (`--simulate` render, §15 I5) is implemented HERE, alongside `renderOnce`:
|
|
28
|
-
* {@link VgaiRenderHarness.simulateSubsteps} drives `game.runFrame(fixedDt)` a
|
|
29
|
-
* fixed integer number of times — the FULL fixed-step gameplay frame (every
|
|
30
|
-
* phase in `PHASE_ORDER`, including `physics`/`gameLogic`/`animation`), unlike
|
|
31
|
-
* `renderOnce`'s deliberately gameplay-free `preRender`+`render`-only pass.
|
|
32
|
-
* A caller that never invokes `simulateSubsteps` (the default, sequence-
|
|
33
|
-
* controlled render — I4) gets byte-identical behavior to before this method
|
|
34
|
-
* existed: `renderOnce`/`seek`/`seekFrame`/`advanceFrame` are untouched by
|
|
35
|
-
* this addition.
|
|
36
|
-
*/
|
|
37
|
-
import { SystemPhase } from '../core/types';
|
|
38
|
-
import { RENDER_MODE_QUERY_PARAM } from './render-seed';
|
|
39
|
-
/** Shared by {@link installRenderControlHarness} and any caller that wants
|
|
40
|
-
* to check the opt-in flag before doing render-mode-only setup work (e.g.
|
|
41
|
-
* `render-seed.ts`'s own gate uses the same query param name). */
|
|
42
|
-
export function isRenderModeRequested(location) {
|
|
43
|
-
return new URLSearchParams(location.search).get(RENDER_MODE_QUERY_PARAM) === '1';
|
|
44
|
-
}
|
|
45
|
-
const RENDER_ONLY_PHASES = [SystemPhase.PRE_RENDER, SystemPhase.RENDER];
|
|
46
|
-
/**
|
|
47
|
-
* Run exactly one `preRender`+`render` phase pass across every host-driven
|
|
48
|
-
* (`!drivesOwnLoop`) world on `game`, then await the GPU/DOM composition
|
|
49
|
-
* fence. This is the ENTIRE frame this call drives — no `input`,
|
|
50
|
-
* `prePhysics`, `physics`, `postPhysics`, `gameLogic`, or `animation` phase
|
|
51
|
-
* is ever touched, which is what makes this safe to call from a paused-or-
|
|
52
|
-
* stopped clock without silently ticking gameplay. Phases are run as global
|
|
53
|
-
* barriers across roots (mirroring `GameInternal.runFrame`'s own phase-then-
|
|
54
|
-
* world nesting in `runtime/game.ts`): every world's `preRender` runs before
|
|
55
|
-
* any world's `render`, in `game.roots` declaration order.
|
|
56
|
-
*
|
|
57
|
-
* Ordering within a phase mirrors `GameInternal.runFrame` EXACTLY (see its
|
|
58
|
-
* doc comment in `runtime/game.ts`): the game-scoped `SystemRunner`
|
|
59
|
-
* (`game.systems`) runs FIRST, before any world's frame hooks. `game.systems`
|
|
60
|
-
* is empty for every game today (nothing registers against it yet), so this
|
|
61
|
-
* is a no-op in practice — but a later slice that registers a Game-scoped
|
|
62
|
-
* `preRender`/`render` system (e.g. a cinematic camera crossfade that must
|
|
63
|
-
* paint once per captured frame) would otherwise be silently MISSED by
|
|
64
|
-
* capture while running fine in live playback, since live playback goes
|
|
65
|
-
* through `runFrame`. Running it here keeps the seam a faithful subset of
|
|
66
|
-
* `runFrame`'s phase pass, not a divergent one.
|
|
67
|
-
*
|
|
68
|
-
* A `drivesOwnLoop` world (self-driven, raw-rAF) has no phase hooks this
|
|
69
|
-
* seam can drive — it is skipped with a loud, once-per-call warning rather
|
|
70
|
-
* than silently omitted, mirroring this file's "fail loudly, never a silent
|
|
71
|
-
* no-op" convention. A host-driven world with no `frame` (an opaque/foreign
|
|
72
|
-
* mount) is skipped the same way — there is no phase hook to call. Both
|
|
73
|
-
* checks happen ONCE, up front (see {@link renderableWorlds}), not per
|
|
74
|
-
* phase — a world unrenderable in `preRender` is unrenderable in `render`
|
|
75
|
-
* too, so warning twice would just be noise.
|
|
76
|
-
*/
|
|
77
|
-
async function renderOnce(game) {
|
|
78
|
-
const roots = renderableWorlds(game);
|
|
79
|
-
for (const phase of RENDER_ONLY_PHASES) {
|
|
80
|
-
// Game-scoped systems first, then per-world frame hooks — the SAME order
|
|
81
|
-
// GameInternal.runFrame uses (runtime/game.ts). See doc comment above.
|
|
82
|
-
game.systems.runPhase(phase, 0);
|
|
83
|
-
for (const world of roots) {
|
|
84
|
-
world.frame.runPhase(phase, 0);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
await compositionFence();
|
|
88
|
-
}
|
|
89
|
-
/** Filter `game.roots` down to the ones {@link renderOnce} can actually
|
|
90
|
-
* drive (host-driven, with real `WorldFrameHooks`) — see that function's
|
|
91
|
-
* doc comment for why an excluded world is warned about loudly, not
|
|
92
|
-
* silently dropped. */
|
|
93
|
-
function renderableWorlds(game) {
|
|
94
|
-
const result = [];
|
|
95
|
-
for (const world of game.roots) {
|
|
96
|
-
if (world.mounted.drivesOwnLoop) {
|
|
97
|
-
warnUnrenderable(world.id, 'drives its own loop — renderOnce() cannot frame-gate it ' +
|
|
98
|
-
'(docs/AI-NATIVE-AUTHORING-IMPLEMENTATION-SPEC.md §15 I5 names this policy)');
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
|
-
if (!world.frame) {
|
|
102
|
-
warnUnrenderable(world.id, `(kind: ${world.kind}) has no phase hooks — renderOnce() cannot drive it (opaque/foreign ` +
|
|
103
|
-
'mount with no frame-gated entry point)');
|
|
104
|
-
continue;
|
|
105
|
-
}
|
|
106
|
-
result.push({ id: world.id, frame: world.frame });
|
|
107
|
-
}
|
|
108
|
-
return result;
|
|
109
|
-
}
|
|
110
|
-
function warnUnrenderable(worldLabel, reason) {
|
|
111
|
-
// biome-ignore lint/suspicious/noConsole: structured, greppable — mirrors runtime/game.ts's own direct console.warn idiom for "cannot gate this world" capability shortfalls.
|
|
112
|
-
console.warn(`[render-control] world "${worldLabel}" ${reason}.`);
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* I5 AC 5 policy text for the two conditions {@link renderableWorlds} skips —
|
|
116
|
-
* shared so {@link VgaiRenderHarness.excludedFromDeterminism} names the SAME
|
|
117
|
-
* roots `renderOnce()` warns about, in the SAME words, rather than
|
|
118
|
-
* maintaining a second, driftable description of the same two checks.
|
|
119
|
-
*/
|
|
120
|
-
function computeWorldExclusionReasons(game) {
|
|
121
|
-
const reasons = [];
|
|
122
|
-
for (const world of game.roots) {
|
|
123
|
-
if (world.mounted.drivesOwnLoop) {
|
|
124
|
-
reasons.push(`world "${world.id}" drives its own loop — cannot be frame-gated for deterministic ` +
|
|
125
|
-
'capture (docs/AI-NATIVE-AUTHORING-IMPLEMENTATION-SPEC.md §15 I5 names this policy: ' +
|
|
126
|
-
'FAIL LOUDLY or be excluded only by an explicit declared policy).');
|
|
127
|
-
continue;
|
|
128
|
-
}
|
|
129
|
-
if (!world.frame) {
|
|
130
|
-
reasons.push(`world "${world.id}" (kind: ${world.kind}) has no phase hooks — an opaque/foreign mount ` +
|
|
131
|
-
'with no frame-gated entry point cannot participate in deterministic capture.');
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
return reasons;
|
|
135
|
-
}
|
|
136
|
-
function nextAnimationFrame() {
|
|
137
|
-
return new Promise((resolve) => {
|
|
138
|
-
requestAnimationFrame(() => resolve());
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* GPU/DOM composition fence (I2 AC: "waits for GPU/DOM composition
|
|
143
|
-
* (double-rAF fence ... ) rather than an arbitrary sleep"). Two nested
|
|
144
|
-
* `requestAnimationFrame` callbacks: the first fires once the browser has
|
|
145
|
-
* scheduled a new frame after our `render()` calls above; the second fires
|
|
146
|
-
* once THAT frame has itself been produced and composited — by the time the
|
|
147
|
-
* second callback runs, the compositor has committed the frame our render
|
|
148
|
-
* calls painted, so a screenshot taken immediately after this resolves
|
|
149
|
-
* reflects the seeked state, not a stale one. (The CDP screenshot
|
|
150
|
-
* compositor-commit wait itself is the capture host's job — I0/I3 — this
|
|
151
|
-
* fence is the runtime-side half.)
|
|
152
|
-
*/
|
|
153
|
-
async function compositionFence() {
|
|
154
|
-
await nextAnimationFrame();
|
|
155
|
-
await nextAnimationFrame();
|
|
156
|
-
}
|
|
157
|
-
async function resolveHook(hook) {
|
|
158
|
-
if (!hook)
|
|
159
|
-
return { status: 'not-applicable' };
|
|
160
|
-
try {
|
|
161
|
-
await hook();
|
|
162
|
-
return { status: 'ready' };
|
|
163
|
-
}
|
|
164
|
-
catch (err) {
|
|
165
|
-
return { status: 'error', detail: err instanceof Error ? err.message : String(err) };
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
async function checkFontsReady() {
|
|
169
|
-
if (typeof document === 'undefined' || !document.fonts)
|
|
170
|
-
return { status: 'not-applicable' };
|
|
171
|
-
try {
|
|
172
|
-
await document.fonts.ready;
|
|
173
|
-
return { status: 'ready' };
|
|
174
|
-
}
|
|
175
|
-
catch (err) {
|
|
176
|
-
return { status: 'error', detail: err instanceof Error ? err.message : String(err) };
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
async function buildReadinessReport(hooks) {
|
|
180
|
-
const [assets, shaders, fonts, theatre, tone, scene] = await Promise.all([
|
|
181
|
-
resolveHook(hooks.assets),
|
|
182
|
-
resolveHook(hooks.shaders),
|
|
183
|
-
checkFontsReady(),
|
|
184
|
-
resolveHook(hooks.theatre),
|
|
185
|
-
resolveHook(hooks.tone),
|
|
186
|
-
resolveHook(hooks.scene),
|
|
187
|
-
]);
|
|
188
|
-
return { assets, shaders, fonts, theatre, tone, scene };
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Build (and, when render mode is actually requested, publish) the
|
|
192
|
-
* `window.__vgaiRender` harness. AC 4 — production protection — lives HERE,
|
|
193
|
-
* not just at the call site: even if a host application calls this
|
|
194
|
-
* unconditionally on every boot, the harness is only ever constructed *and*
|
|
195
|
-
* attached to `target` when `isRenderModeRequested(location)` is true;
|
|
196
|
-
* otherwise this is a no-op that returns `undefined`. A normal production
|
|
197
|
-
* gameplay page therefore never gets `window.__vgaiRender` no matter how
|
|
198
|
-
* this function is wired into its entry point.
|
|
199
|
-
*/
|
|
200
|
-
export function installRenderControlHarness(opts) {
|
|
201
|
-
const location = opts.location ?? window.location;
|
|
202
|
-
if (!isRenderModeRequested(location))
|
|
203
|
-
return undefined;
|
|
204
|
-
const { game, clock, readiness = {} } = opts;
|
|
205
|
-
const target = opts.target ?? window;
|
|
206
|
-
const frameAdvancers = opts.frameAdvancers ?? [];
|
|
207
|
-
const simulateFixedDt = opts.simulateFixedDt ?? 1 / 60;
|
|
208
|
-
const declaredExclusions = opts.excludedFromDeterminism ?? [];
|
|
209
|
-
const harness = {
|
|
210
|
-
seek(t) {
|
|
211
|
-
clock.seek(t);
|
|
212
|
-
},
|
|
213
|
-
seekFrame(n, fps) {
|
|
214
|
-
clock.seekFrame(n, fps);
|
|
215
|
-
},
|
|
216
|
-
advanceFrame(dt) {
|
|
217
|
-
for (const advancer of frameAdvancers)
|
|
218
|
-
advancer(dt);
|
|
219
|
-
},
|
|
220
|
-
renderOnce() {
|
|
221
|
-
return renderOnce(game);
|
|
222
|
-
},
|
|
223
|
-
ready() {
|
|
224
|
-
return buildReadinessReport(readiness);
|
|
225
|
-
},
|
|
226
|
-
simulateSubsteps(steps) {
|
|
227
|
-
for (let i = 0; i < steps; i++) {
|
|
228
|
-
game.runFrame(simulateFixedDt);
|
|
229
|
-
}
|
|
230
|
-
},
|
|
231
|
-
excludedFromDeterminism() {
|
|
232
|
-
return [...declaredExclusions, ...computeWorldExclusionReasons(game)];
|
|
233
|
-
},
|
|
234
|
-
simulateFixedDt() {
|
|
235
|
-
return simulateFixedDt;
|
|
236
|
-
},
|
|
237
|
-
};
|
|
238
|
-
target['__vgaiRender'] = harness;
|
|
239
|
-
return harness;
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Defensive assertion for the I2 AC "Pixi roots are pinned to the WebGL
|
|
243
|
-
* renderer (not WebGPU) in render mode". In THIS engine that invariant
|
|
244
|
-
* already holds unconditionally — `world2d/pixi-surface.ts`'s
|
|
245
|
-
* `createPixiSurface` hardcodes `preference: 'webgl'` on every
|
|
246
|
-
* `Application.init()` call it makes, and `setup/setup-renderer.ts` never
|
|
247
|
-
* constructs a `WebGPURenderer` for threejs roots either — so there is no
|
|
248
|
-
* live WebGPU code path for a first-party render-mode page to disable.
|
|
249
|
-
* This helper exists for a render-mode installer that mounts a CUSTOM/
|
|
250
|
-
* foreign pixi adapter (`create-runtime.ts`'s `{ module }` pixi path) this
|
|
251
|
-
* engine did not construct itself, to assert the invariant against the
|
|
252
|
-
* live mounted renderer rather than merely trusting it. Duck-typed against
|
|
253
|
-
* pixi.js v8's numeric `RendererType` (`WEBGL = 1`, `WEBGPU = 2`,
|
|
254
|
-
* `CANVAS = 4`) so this file never value-imports `pixi.js` (the same
|
|
255
|
-
* type-only-pixi rule `runtime/game.ts`/`create-runtime.ts` document for
|
|
256
|
-
* themselves).
|
|
257
|
-
*/
|
|
258
|
-
export function assertPixiWorldIsWebGL(rendererType, worldId) {
|
|
259
|
-
const isWebGPU = rendererType === 2 || (typeof rendererType === 'string' && /webgpu/i.test(rendererType));
|
|
260
|
-
if (isWebGPU) {
|
|
261
|
-
throw new Error(`[render-control] world "${worldId}": Pixi renderer is WebGPU in render mode — ` +
|
|
262
|
-
'render-control requires WebGL (docs/AI-NATIVE-AUTHORING-IMPLEMENTATION-SPEC.md §15 I2).');
|
|
263
|
-
}
|
|
264
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deterministic `Math.random` seeding for render-control mode (I2 AC,
|
|
3
|
-
* `docs/AI-NATIVE-AUTHORING-IMPLEMENTATION-SPEC.md` §15 I2: "`Math.random`
|
|
4
|
-
* is deterministically seeded/stubbed page-wide before any game module
|
|
5
|
-
* executes").
|
|
6
|
-
*
|
|
7
|
-
* Deliberately a ZERO-IMPORT module (no `three`, no other engine file) so
|
|
8
|
-
* its own evaluation is instantaneous — a render-mode entry page loads this
|
|
9
|
-
* as its FIRST `<script type="module">` tag, before the tag that pulls in
|
|
10
|
-
* the actual game/runtime modules. Per the HTML module-script ordering
|
|
11
|
-
* rules, sibling `<script type="module">` tags without `async` execute in
|
|
12
|
-
* document order, and each one's own dependency graph (here, empty) is
|
|
13
|
-
* fully evaluated before the browser moves to the next tag — so calling
|
|
14
|
-
* {@link maybeInstallRenderModeRandom} from this module's importer, in a
|
|
15
|
-
* script tag placed before the game's own entry tag, guarantees every
|
|
16
|
-
* subsequent module's top-level code (and everything it does at runtime)
|
|
17
|
-
* observes the seeded generator, never the platform's real
|
|
18
|
-
* cryptographically-random `Math.random`.
|
|
19
|
-
*
|
|
20
|
-
* This module does not decide WHETHER to seed on its own (importing it has
|
|
21
|
-
* no side effect) — the caller decides, by calling
|
|
22
|
-
* {@link maybeInstallRenderModeRandom} (query-param gated) or
|
|
23
|
-
* {@link installDeterministicRandom} (unconditional) from a tiny bootstrap
|
|
24
|
-
* entry. See `packages/engine/e2e/fixture/render-seed-entry.ts` for the
|
|
25
|
-
* worked bootstrap this module is designed to be loaded from.
|
|
26
|
-
*/
|
|
27
|
-
/**
|
|
28
|
-
* mulberry32 — a small, fast, deterministic 32-bit PRNG. Not cryptographic;
|
|
29
|
-
* this is explicitly a determinism tool (reproducible capture), not a
|
|
30
|
-
* security primitive. Returns a function with the same call signature as
|
|
31
|
-
* `Math.random` (no arguments, `[0, 1)` float).
|
|
32
|
-
*/
|
|
33
|
-
export declare function createMulberry32(seed: number): () => number;
|
|
34
|
-
/**
|
|
35
|
-
* Replace the global `Math.random` with a seeded, deterministic generator.
|
|
36
|
-
* Idempotent to call more than once (each call re-seeds from scratch — the
|
|
37
|
-
* last call wins), which matters for HMR-style re-execution the same way
|
|
38
|
-
* `main.ts`'s `registerAdapterSurface` guard does elsewhere in this runtime.
|
|
39
|
-
*/
|
|
40
|
-
export declare function installDeterministicRandom(seed: number): void;
|
|
41
|
-
/** Query-param name that opts a page into render-control mode (I2 AC 4: the
|
|
42
|
-
* mode must be unavailable/protected in normal production gameplay unless
|
|
43
|
-
* explicitly enabled). Shared with `render-control.ts`'s own production
|
|
44
|
-
* guard so both checks agree on the same flag. */
|
|
45
|
-
export declare const RENDER_MODE_QUERY_PARAM = "vgai-render";
|
|
46
|
-
/** Optional query param to pin a specific seed (default below when absent). */
|
|
47
|
-
export declare const RENDER_SEED_QUERY_PARAM = "vgai-seed";
|
|
48
|
-
/**
|
|
49
|
-
* Seed `Math.random` iff the page's URL opts into render mode
|
|
50
|
-
* (`?vgai-render=1`), reading an optional `?vgai-seed=<int>` override.
|
|
51
|
-
* Returns whether it seeded, purely for the caller's own diagnostics/log —
|
|
52
|
-
* the bootstrap entry doesn't need to branch on it.
|
|
53
|
-
*/
|
|
54
|
-
export declare function maybeInstallRenderModeRandom(location?: {
|
|
55
|
-
search: string;
|
|
56
|
-
}): boolean;
|
|
57
|
-
//# sourceMappingURL=render-seed.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"render-seed.d.ts","sourceRoot":"","sources":["../../src/runtime/render-seed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;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"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deterministic `Math.random` seeding for render-control mode (I2 AC,
|
|
3
|
-
* `docs/AI-NATIVE-AUTHORING-IMPLEMENTATION-SPEC.md` §15 I2: "`Math.random`
|
|
4
|
-
* is deterministically seeded/stubbed page-wide before any game module
|
|
5
|
-
* executes").
|
|
6
|
-
*
|
|
7
|
-
* Deliberately a ZERO-IMPORT module (no `three`, no other engine file) so
|
|
8
|
-
* its own evaluation is instantaneous — a render-mode entry page loads this
|
|
9
|
-
* as its FIRST `<script type="module">` tag, before the tag that pulls in
|
|
10
|
-
* the actual game/runtime modules. Per the HTML module-script ordering
|
|
11
|
-
* rules, sibling `<script type="module">` tags without `async` execute in
|
|
12
|
-
* document order, and each one's own dependency graph (here, empty) is
|
|
13
|
-
* fully evaluated before the browser moves to the next tag — so calling
|
|
14
|
-
* {@link maybeInstallRenderModeRandom} from this module's importer, in a
|
|
15
|
-
* script tag placed before the game's own entry tag, guarantees every
|
|
16
|
-
* subsequent module's top-level code (and everything it does at runtime)
|
|
17
|
-
* observes the seeded generator, never the platform's real
|
|
18
|
-
* cryptographically-random `Math.random`.
|
|
19
|
-
*
|
|
20
|
-
* This module does not decide WHETHER to seed on its own (importing it has
|
|
21
|
-
* no side effect) — the caller decides, by calling
|
|
22
|
-
* {@link maybeInstallRenderModeRandom} (query-param gated) or
|
|
23
|
-
* {@link installDeterministicRandom} (unconditional) from a tiny bootstrap
|
|
24
|
-
* entry. See `packages/engine/e2e/fixture/render-seed-entry.ts` for the
|
|
25
|
-
* worked bootstrap this module is designed to be loaded from.
|
|
26
|
-
*/
|
|
27
|
-
/**
|
|
28
|
-
* mulberry32 — a small, fast, deterministic 32-bit PRNG. Not cryptographic;
|
|
29
|
-
* this is explicitly a determinism tool (reproducible capture), not a
|
|
30
|
-
* security primitive. Returns a function with the same call signature as
|
|
31
|
-
* `Math.random` (no arguments, `[0, 1)` float).
|
|
32
|
-
*/
|
|
33
|
-
export function createMulberry32(seed) {
|
|
34
|
-
let state = seed >>> 0;
|
|
35
|
-
return function mulberry32() {
|
|
36
|
-
state = (state + 0x6d2b79f5) | 0;
|
|
37
|
-
let t = state;
|
|
38
|
-
t = Math.imul(t ^ (t >>> 15), t | 1);
|
|
39
|
-
t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
|
|
40
|
-
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Replace the global `Math.random` with a seeded, deterministic generator.
|
|
45
|
-
* Idempotent to call more than once (each call re-seeds from scratch — the
|
|
46
|
-
* last call wins), which matters for HMR-style re-execution the same way
|
|
47
|
-
* `main.ts`'s `registerAdapterSurface` guard does elsewhere in this runtime.
|
|
48
|
-
*/
|
|
49
|
-
export function installDeterministicRandom(seed) {
|
|
50
|
-
Math.random = createMulberry32(seed);
|
|
51
|
-
}
|
|
52
|
-
/** Query-param name that opts a page into render-control mode (I2 AC 4: the
|
|
53
|
-
* mode must be unavailable/protected in normal production gameplay unless
|
|
54
|
-
* explicitly enabled). Shared with `render-control.ts`'s own production
|
|
55
|
-
* guard so both checks agree on the same flag. */
|
|
56
|
-
export const RENDER_MODE_QUERY_PARAM = 'vgai-render';
|
|
57
|
-
/** Optional query param to pin a specific seed (default below when absent). */
|
|
58
|
-
export const RENDER_SEED_QUERY_PARAM = 'vgai-seed';
|
|
59
|
-
const DEFAULT_RENDER_SEED = 0x9e3779b9; // golden-ratio constant — an arbitrary but fixed default
|
|
60
|
-
/**
|
|
61
|
-
* Seed `Math.random` iff the page's URL opts into render mode
|
|
62
|
-
* (`?vgai-render=1`), reading an optional `?vgai-seed=<int>` override.
|
|
63
|
-
* Returns whether it seeded, purely for the caller's own diagnostics/log —
|
|
64
|
-
* the bootstrap entry doesn't need to branch on it.
|
|
65
|
-
*/
|
|
66
|
-
export function maybeInstallRenderModeRandom(location = window.location) {
|
|
67
|
-
const params = new URLSearchParams(location.search);
|
|
68
|
-
if (params.get(RENDER_MODE_QUERY_PARAM) !== '1')
|
|
69
|
-
return false;
|
|
70
|
-
const seedParam = params.get(RENDER_SEED_QUERY_PARAM);
|
|
71
|
-
const seed = seedParam !== null && seedParam !== '' ? Number(seedParam) : DEFAULT_RENDER_SEED;
|
|
72
|
-
installDeterministicRandom(Number.isFinite(seed) ? seed : DEFAULT_RENDER_SEED);
|
|
73
|
-
return true;
|
|
74
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Frame-versioned game state bridge (T7.4 slice 1 — `docs/REACT-STATE-BRIDGE.md`
|
|
3
|
-
* §2, the D7 remainder). Components mutate state on `this` freely during
|
|
4
|
-
* ticks — there is no proxy, no dirty tracking, no event per mutation (Track
|
|
5
|
-
* A: no mirror, no sync layer). So the unit of change a subscriber can
|
|
6
|
-
* observe is the FRAME: `GameInternal.runFrame` bumps `frameVersion` and
|
|
7
|
-
* notifies subscribers at most once, at its tail, AFTER every phase of every
|
|
8
|
-
* world and every world's `endFrame` hook has run (see the wiring in
|
|
9
|
-
* `runtime/game.ts`) — mirroring the D7 "from `gameLogic` onward, every
|
|
10
|
-
* world's post-step state is readable" guarantee, extended to "after the
|
|
11
|
-
* frame, ALL state is readable".
|
|
12
|
-
*
|
|
13
|
-
* This file is plain, react-free TypeScript any consumer could use — no
|
|
14
|
-
* react import here, or anywhere under `runtime/` (the react-facing
|
|
15
|
-
* `useGameState` hook, which DOES import React, lives at
|
|
16
|
-
* `packages/engine/src/react/game-state.tsx`).
|
|
17
|
-
*
|
|
18
|
-
* SECOND trigger for `bump()` (`Game.registerWorld`, `runtime/game.ts`): the
|
|
19
|
-
* `roots` list is also state a `useGameState` selector can read
|
|
20
|
-
* (`g.roots.map(...)`, the T6.2 two-world-compose gate), and it changes
|
|
21
|
-
* OUTSIDE the frame loop — `registerWorld` is called as each world finishes
|
|
22
|
-
* mounting, which can happen well before the host's loop has ticked even
|
|
23
|
-
* once. Without an immediate notification here, a selector that first reads
|
|
24
|
-
* `g.roots` before every world has registered stays stuck on that stale
|
|
25
|
-
* snapshot until the next completed frame — which, on a slow/contended host
|
|
26
|
-
* or a backgrounded tab, may be arbitrarily delayed. See `registerWorld`'s
|
|
27
|
-
* own doc comment for the concrete CI failure this closes.
|
|
28
|
-
*/
|
|
29
|
-
/** Frame-versioned, react-free subscription surface — `docs/REACT-STATE-BRIDGE.md` §2. */
|
|
30
|
-
export interface GameStateBridge {
|
|
31
|
-
/** Monotonic; bumped once per completed `runFrame`, AND once per
|
|
32
|
-
* `Game.registerWorld` call (world-list changes are observable state too
|
|
33
|
-
* — see this file's module doc comment). Starts at 0 before the first of
|
|
34
|
-
* either has happened. Never treat this as a literal frame COUNT — only
|
|
35
|
-
* "did it change" is a contract any consumer may rely on. */
|
|
36
|
-
readonly frameVersion: number;
|
|
37
|
-
/** Notified at most once per frame, after ALL phases of ALL roots (and
|
|
38
|
-
* their `endFrame` hooks) have run. Returns an unsubscribe function. */
|
|
39
|
-
subscribe(onFrame: () => void): () => void;
|
|
40
|
-
}
|
|
41
|
-
/** Host-internal extension of {@link GameStateBridge}: adds `bump`, called
|
|
42
|
-
* both by `GameInternal.runFrame` at its tail AND by `Game.registerWorld`
|
|
43
|
-
* when the world list changes (see this file's module doc comment). NOT
|
|
44
|
-
* part of the game-facing `Game.state` surface (typed as the narrower
|
|
45
|
-
* `GameStateBridge` there) — games/components/hooks never call `bump`
|
|
46
|
-
* directly; only the frame executor and the world registry do. */
|
|
47
|
-
export interface GameStateBridgeInternal extends GameStateBridge {
|
|
48
|
-
/** Bump `frameVersion` by one and notify every current subscriber, in
|
|
49
|
-
* subscription order. Subscriber errors are isolated (per-subscriber
|
|
50
|
-
* try/catch, loud `console.error`, never swallowed silently) — mirrors
|
|
51
|
-
* the error-isolation idiom in `ecs/component-manager.ts`'s per-component
|
|
52
|
-
* `update()` calls: one offending subscriber must not stop its siblings
|
|
53
|
-
* from being notified, and must not break the frame loop. */
|
|
54
|
-
bump(): void;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Construct a fresh bridge. One per `Game` (created alongside the other
|
|
58
|
-
* game-scoped state in `createGame`, `runtime/game.ts`).
|
|
59
|
-
*/
|
|
60
|
-
export declare function createStateBridge(): GameStateBridgeInternal;
|
|
61
|
-
//# sourceMappingURL=state-bridge.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state-bridge.d.ts","sourceRoot":"","sources":["../../src/runtime/state-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,0FAA0F;AAC1F,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"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Frame-versioned game state bridge (T7.4 slice 1 — `docs/REACT-STATE-BRIDGE.md`
|
|
3
|
-
* §2, the D7 remainder). Components mutate state on `this` freely during
|
|
4
|
-
* ticks — there is no proxy, no dirty tracking, no event per mutation (Track
|
|
5
|
-
* A: no mirror, no sync layer). So the unit of change a subscriber can
|
|
6
|
-
* observe is the FRAME: `GameInternal.runFrame` bumps `frameVersion` and
|
|
7
|
-
* notifies subscribers at most once, at its tail, AFTER every phase of every
|
|
8
|
-
* world and every world's `endFrame` hook has run (see the wiring in
|
|
9
|
-
* `runtime/game.ts`) — mirroring the D7 "from `gameLogic` onward, every
|
|
10
|
-
* world's post-step state is readable" guarantee, extended to "after the
|
|
11
|
-
* frame, ALL state is readable".
|
|
12
|
-
*
|
|
13
|
-
* This file is plain, react-free TypeScript any consumer could use — no
|
|
14
|
-
* react import here, or anywhere under `runtime/` (the react-facing
|
|
15
|
-
* `useGameState` hook, which DOES import React, lives at
|
|
16
|
-
* `packages/engine/src/react/game-state.tsx`).
|
|
17
|
-
*
|
|
18
|
-
* SECOND trigger for `bump()` (`Game.registerWorld`, `runtime/game.ts`): the
|
|
19
|
-
* `roots` list is also state a `useGameState` selector can read
|
|
20
|
-
* (`g.roots.map(...)`, the T6.2 two-world-compose gate), and it changes
|
|
21
|
-
* OUTSIDE the frame loop — `registerWorld` is called as each world finishes
|
|
22
|
-
* mounting, which can happen well before the host's loop has ticked even
|
|
23
|
-
* once. Without an immediate notification here, a selector that first reads
|
|
24
|
-
* `g.roots` before every world has registered stays stuck on that stale
|
|
25
|
-
* snapshot until the next completed frame — which, on a slow/contended host
|
|
26
|
-
* or a backgrounded tab, may be arbitrarily delayed. See `registerWorld`'s
|
|
27
|
-
* own doc comment for the concrete CI failure this closes.
|
|
28
|
-
*/
|
|
29
|
-
/**
|
|
30
|
-
* Construct a fresh bridge. One per `Game` (created alongside the other
|
|
31
|
-
* game-scoped state in `createGame`, `runtime/game.ts`).
|
|
32
|
-
*/
|
|
33
|
-
export function createStateBridge() {
|
|
34
|
-
let frameVersion = 0;
|
|
35
|
-
const subscribers = new Set();
|
|
36
|
-
return {
|
|
37
|
-
get frameVersion() {
|
|
38
|
-
return frameVersion;
|
|
39
|
-
},
|
|
40
|
-
subscribe(onFrame) {
|
|
41
|
-
subscribers.add(onFrame);
|
|
42
|
-
return () => {
|
|
43
|
-
subscribers.delete(onFrame);
|
|
44
|
-
};
|
|
45
|
-
},
|
|
46
|
-
bump() {
|
|
47
|
-
frameVersion++;
|
|
48
|
-
// Snapshot before iterating (same idiom as ComponentManager's
|
|
49
|
-
// per-phase `list = byPhase.get(phase)!.slice()`): a subscriber that
|
|
50
|
-
// subscribes/unsubscribes from WITHIN a notification must not affect
|
|
51
|
-
// which of ITS SIBLINGS get notified this same bump.
|
|
52
|
-
const notified = Array.from(subscribers);
|
|
53
|
-
for (const onFrame of notified) {
|
|
54
|
-
try {
|
|
55
|
-
onFrame();
|
|
56
|
-
}
|
|
57
|
-
catch (err) {
|
|
58
|
-
console.error('[state-bridge] subscriber threw:', err);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
}
|