@vgai/engine 0.5.21 → 0.5.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/dist/adapter/adapter-module.d.ts.map +1 -1
- package/dist/adapter/adapter-module.js +2 -4
- package/dist/adapter/adapter-surface.d.ts +1 -1
- package/dist/adapter/adapter-surface.js +1 -1
- package/dist/adapter/authoring.d.ts +19 -21
- package/dist/adapter/authoring.d.ts.map +1 -1
- package/dist/adapter/authoring.js +2 -2
- package/dist/adapter/binding.d.ts +341 -0
- package/dist/adapter/binding.d.ts.map +1 -0
- package/dist/adapter/binding.js +148 -0
- package/dist/adapter/colyseus-networking-adapter.d.ts.map +1 -1
- package/dist/adapter/colyseus-networking-adapter.js +23 -4
- package/dist/adapter/entrypoint-selection-readers.d.ts +24 -0
- package/dist/adapter/entrypoint-selection-readers.d.ts.map +1 -0
- package/dist/adapter/entrypoint-selection-readers.js +63 -0
- package/dist/adapter/entrypoint-selection-source.d.ts.map +1 -1
- package/dist/adapter/entrypoint-selection-source.js +1 -44
- package/dist/adapter/finders/scenes-from-entrypoint-selection.d.ts.map +1 -1
- package/dist/adapter/finders/scenes-from-entrypoint-selection.js +1 -52
- package/dist/adapter/host-context.d.ts +46 -15
- package/dist/adapter/host-context.d.ts.map +1 -1
- package/dist/adapter/host-context.js +2 -9
- package/dist/adapter/index.d.ts +11 -12
- package/dist/adapter/index.d.ts.map +1 -1
- package/dist/adapter/index.js +9 -10
- package/dist/adapter/ingest/game-contract.d.ts +0 -3
- package/dist/adapter/ingest/game-contract.d.ts.map +1 -1
- package/dist/adapter/ingest/game-contract.js +0 -3
- package/dist/adapter/ingest/scene-capture.d.ts +19 -23
- package/dist/adapter/ingest/scene-capture.d.ts.map +1 -1
- package/dist/adapter/ingest/scene-capture.js +143 -17
- package/dist/adapter/ingest/visible-capture-window.d.ts +34 -0
- package/dist/adapter/ingest/visible-capture-window.d.ts.map +1 -1
- package/dist/adapter/manifest-interpreter.d.ts +59 -0
- package/dist/adapter/manifest-interpreter.d.ts.map +1 -0
- package/dist/adapter/manifest-interpreter.js +50 -0
- package/dist/adapter/native-debug-module.d.ts +71 -3
- package/dist/adapter/native-debug-module.d.ts.map +1 -1
- package/dist/adapter/native-debug-module.js +146 -10
- package/dist/adapter/rapier-physics-adapter.d.ts +31 -1
- package/dist/adapter/rapier-physics-adapter.d.ts.map +1 -1
- package/dist/adapter/rapier-physics-adapter.js +50 -36
- package/dist/adapter/renderer-config.d.ts +3 -3
- package/dist/adapter/renderer-config.js +3 -3
- package/dist/adapter/root-adapter.d.ts +7 -7
- package/dist/adapter/root-adapter.js +4 -4
- package/dist/adapter/system-adapter.d.ts +45 -7
- package/dist/adapter/system-adapter.d.ts.map +1 -1
- package/dist/adapter/system-seam-contract.d.ts +3 -3
- package/dist/adapter/system-seam-contract.js +3 -3
- package/dist/adapter/system-slot.d.ts +168 -0
- package/dist/adapter/system-slot.d.ts.map +1 -0
- package/dist/adapter/system-slot.js +229 -0
- package/dist/adapter/transform.d.ts +11 -1
- package/dist/adapter/transform.d.ts.map +1 -1
- package/dist/ai/navigation.d.ts +17 -1
- package/dist/ai/navigation.d.ts.map +1 -1
- package/dist/ai/navigation.js +26 -5
- package/dist/animation/anim-graph-types.d.ts +11 -3
- package/dist/animation/anim-graph-types.d.ts.map +1 -1
- package/dist/animation/theatre-clock-binding.d.ts +4 -4
- package/dist/animation/theatre-clock-binding.js +4 -4
- package/dist/animation/xstate-animation-binding.d.ts.map +1 -1
- package/dist/animation/xstate-animation-binding.js +2 -2
- package/dist/animation/xstate-animation-meta.d.ts +13 -0
- package/dist/animation/xstate-animation-meta.d.ts.map +1 -1
- package/dist/animation/xstate-animation-meta.js +14 -0
- package/dist/asset-formats/index.d.ts +4 -7
- package/dist/asset-formats/index.d.ts.map +1 -1
- package/dist/asset-formats/index.js +4 -7
- package/dist/asset-formats/render-env.d.ts +5 -8
- package/dist/asset-formats/render-env.d.ts.map +1 -1
- package/dist/asset-formats/render-env.js +3 -6
- package/dist/asset-parse-error.d.ts +2 -5
- package/dist/asset-parse-error.d.ts.map +1 -1
- package/dist/asset-parse-error.js +2 -5
- package/dist/audio/bus-mixer.d.ts +101 -0
- package/dist/audio/bus-mixer.d.ts.map +1 -0
- package/dist/audio/bus-mixer.js +115 -0
- package/dist/canvas-react/index.d.ts +5 -12
- package/dist/canvas-react/index.d.ts.map +1 -1
- package/dist/canvas-react/index.js +5 -12
- package/dist/canvas-react/pixi-react-root-factory.d.ts +34 -21
- package/dist/canvas-react/pixi-react-root-factory.d.ts.map +1 -1
- package/dist/canvas-react/pixi-react-root-factory.js +274 -36
- package/dist/core/countdown-timer.d.ts +118 -0
- package/dist/core/countdown-timer.d.ts.map +1 -0
- package/dist/core/countdown-timer.js +137 -0
- package/dist/core/deferred-commands.d.ts +127 -0
- package/dist/core/deferred-commands.d.ts.map +1 -0
- package/dist/core/deferred-commands.js +132 -0
- package/dist/core/frame-pacing.d.ts +1 -1
- package/dist/core/frame-pacing.js +2 -2
- package/dist/core/game-loop.d.ts +1 -3
- package/dist/core/game-loop.d.ts.map +1 -1
- package/dist/core/game-loop.js +1 -3
- package/dist/core/seeded-random.d.ts +1 -1
- package/dist/core/sim-clock.d.ts +19 -8
- package/dist/core/sim-clock.d.ts.map +1 -1
- package/dist/core/sim-clock.js +18 -7
- package/dist/core/types.d.ts +1 -3
- package/dist/core/types.d.ts.map +1 -1
- package/dist/defaults.d.ts +6 -14
- package/dist/defaults.d.ts.map +1 -1
- package/dist/defaults.js +6 -14
- package/dist/dev/instruments.d.ts +38 -11
- package/dist/dev/instruments.d.ts.map +1 -1
- package/dist/dev/instruments.js +81 -11
- package/dist/dev/register-render-vitals.d.ts +1 -4
- package/dist/dev/register-render-vitals.d.ts.map +1 -1
- package/dist/dev/register-render-vitals.js +1 -4
- package/dist/dev/render-debug-adapter.d.ts +2 -3
- package/dist/dev/render-debug-adapter.d.ts.map +1 -1
- package/dist/dev/render-debug-adapter.js +2 -3
- package/dist/dev/render-vitals.d.ts +3 -3
- package/dist/dev/render-vitals.js +3 -3
- package/dist/dev/webgl-frame-capture.d.ts +1 -1
- package/dist/dev/webgl-frame-capture.js +1 -1
- package/dist/index.d.ts +2 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -4
- package/dist/input/host-pointer.d.ts +122 -0
- package/dist/input/host-pointer.d.ts.map +1 -0
- package/dist/input/host-pointer.js +160 -0
- package/dist/input/input-manager.d.ts +33 -5
- package/dist/input/input-manager.d.ts.map +1 -1
- package/dist/input/input-manager.js +48 -13
- package/dist/input/rebind-controller.d.ts.map +1 -1
- package/dist/input/rebind-controller.js +6 -8
- package/dist/input/schema.d.ts.map +1 -1
- package/dist/input/schema.js +56 -28
- package/dist/manifest/filename.d.ts.map +1 -1
- package/dist/manifest/filename.js +8 -12
- package/dist/manifest/load.d.ts +10 -10
- package/dist/manifest/load.d.ts.map +1 -1
- package/dist/manifest/load.js +9 -6
- package/dist/manifest/schema.d.ts +17 -21
- package/dist/manifest/schema.d.ts.map +1 -1
- package/dist/manifest/schema.js +45 -35
- package/dist/physics/collider-dimensions.d.ts +8 -12
- package/dist/physics/collider-dimensions.d.ts.map +1 -1
- package/dist/physics/collider-dimensions.js +8 -12
- package/dist/pixi/scene-capture.d.ts +11 -13
- package/dist/pixi/scene-capture.d.ts.map +1 -1
- package/dist/react/world-state.d.ts +1 -1
- package/dist/react/world-state.d.ts.map +1 -1
- package/dist/render/directional-shadow-fit.d.ts +88 -0
- package/dist/render/directional-shadow-fit.d.ts.map +1 -0
- package/dist/render/directional-shadow-fit.js +133 -0
- package/dist/render/environment-capture.d.ts +68 -0
- package/dist/render/environment-capture.d.ts.map +1 -0
- package/dist/render/environment-capture.js +90 -0
- package/dist/render/ibl-override-material.d.ts +97 -0
- package/dist/render/ibl-override-material.d.ts.map +1 -0
- package/dist/render/ibl-override-material.js +114 -0
- package/dist/render/light-camera-factory.d.ts +5 -7
- package/dist/render/light-camera-factory.d.ts.map +1 -1
- package/dist/render/light-camera-factory.js +8 -11
- package/dist/render/material-factory.js +1 -1
- package/dist/render/render-batch-system.d.ts.map +1 -1
- package/dist/render/render-features.d.ts +17 -6
- package/dist/render/render-features.d.ts.map +1 -1
- package/dist/render/render-features.js +0 -28
- package/dist/runtime/create-runtime.d.ts +34 -25
- package/dist/runtime/create-runtime.d.ts.map +1 -1
- package/dist/runtime/create-runtime.js +218 -93
- package/dist/runtime/debug-registry.d.ts +77 -8
- package/dist/runtime/debug-registry.d.ts.map +1 -1
- package/dist/runtime/debug-registry.js +3 -3
- package/dist/runtime/dev-build.d.ts +2 -2
- package/dist/runtime/dev-build.js +2 -2
- package/dist/runtime/game-input-seams.d.ts +51 -0
- package/dist/runtime/game-input-seams.d.ts.map +1 -0
- package/dist/runtime/game-input-seams.js +86 -0
- package/dist/runtime/game.d.ts +104 -40
- package/dist/runtime/game.d.ts.map +1 -1
- package/dist/runtime/game.js +119 -61
- package/dist/runtime/mount-game.d.ts +0 -16
- package/dist/runtime/mount-game.d.ts.map +1 -1
- package/dist/runtime/mount-game.js +26 -41
- package/dist/runtime/mount-manifest.d.ts +22 -14
- package/dist/runtime/mount-manifest.d.ts.map +1 -1
- package/dist/runtime/mount-manifest.js +22 -20
- package/dist/runtime/playtest.d.ts +22 -0
- package/dist/runtime/playtest.d.ts.map +1 -0
- package/dist/runtime/playtest.js +12 -0
- package/dist/runtime/state-bridge.d.ts +2 -3
- package/dist/runtime/state-bridge.d.ts.map +1 -1
- package/dist/runtime/state-bridge.js +1 -0
- package/dist/setup/setup-audio.d.ts +12 -0
- package/dist/setup/setup-audio.d.ts.map +1 -1
- package/dist/setup/setup-audio.js +9 -10
- package/dist/setup/setup-renderer.d.ts +2 -25
- package/dist/setup/setup-renderer.d.ts.map +1 -1
- package/dist/setup/setup-renderer.js +2 -31
- package/dist/world3d-react/index.d.ts +15 -25
- package/dist/world3d-react/index.d.ts.map +1 -1
- package/dist/world3d-react/index.js +15 -25
- package/dist/world3d-react/r3f-root-factory.d.ts +28 -34
- package/dist/world3d-react/r3f-root-factory.d.ts.map +1 -1
- package/dist/world3d-react/r3f-root-factory.js +403 -57
- package/dist/world3d-react/rapier-physics-bridge.d.ts +30 -17
- package/dist/world3d-react/rapier-physics-bridge.d.ts.map +1 -1
- package/dist/world3d-react/rapier-physics-bridge.js +143 -58
- package/package.json +1 -1
- package/schemas/engine-capabilities.json +16 -14
- package/schemas/vgai-project.schema.json +35 -26
- package/src/adapter/adapter-module.ts +2 -4
- package/src/adapter/adapter-surface.ts +1 -1
- package/src/adapter/authoring.ts +19 -21
- package/src/adapter/binding.ts +468 -0
- package/src/adapter/colyseus-networking-adapter.ts +20 -5
- package/src/adapter/entrypoint-selection-readers.ts +66 -0
- package/src/adapter/entrypoint-selection-source.ts +1 -40
- package/src/adapter/finders/scenes-from-entrypoint-selection.ts +1 -48
- package/src/adapter/host-context.ts +45 -15
- package/src/adapter/index.ts +23 -11
- package/src/adapter/ingest/game-contract.ts +0 -3
- package/src/adapter/ingest/scene-capture.ts +190 -39
- package/src/adapter/ingest/visible-capture-window.ts +35 -0
- package/src/adapter/manifest-interpreter.ts +64 -0
- package/src/adapter/native-debug-module.ts +248 -15
- package/src/adapter/rapier-physics-adapter.ts +76 -20
- package/src/adapter/renderer-config.ts +3 -3
- package/src/adapter/root-adapter.ts +7 -7
- package/src/adapter/system-adapter.ts +43 -8
- package/src/adapter/system-seam-contract.ts +3 -3
- package/src/adapter/system-slot.ts +291 -0
- package/src/adapter/transform.ts +18 -1
- package/src/ai/navigation.ts +30 -3
- package/src/animation/anim-graph-types.ts +11 -3
- package/src/animation/theatre-clock-binding.ts +4 -4
- package/src/animation/xstate-animation-binding.ts +2 -2
- package/src/animation/xstate-animation-meta.ts +16 -0
- package/src/asset-formats/index.ts +4 -7
- package/src/asset-formats/render-env.ts +3 -6
- package/src/asset-parse-error.ts +2 -5
- package/src/audio/bus-mixer.ts +161 -0
- package/src/canvas-react/index.ts +5 -21
- package/src/canvas-react/pixi-react-root-factory.tsx +301 -39
- package/src/core/countdown-timer.ts +188 -0
- package/src/core/deferred-commands.ts +174 -0
- package/src/core/frame-pacing.ts +2 -2
- package/src/core/game-loop.ts +1 -3
- package/src/core/seeded-random.ts +1 -1
- package/src/core/sim-clock.ts +19 -8
- package/src/core/types.ts +1 -3
- package/src/defaults.ts +6 -14
- package/src/dev/instruments.ts +108 -11
- package/src/dev/register-render-vitals.ts +1 -4
- package/src/dev/render-debug-adapter.ts +2 -3
- package/src/dev/render-vitals.ts +3 -3
- package/src/dev/webgl-frame-capture.ts +1 -1
- package/src/index.ts +2 -5
- package/src/input/host-pointer.ts +230 -0
- package/src/input/input-manager.ts +49 -13
- package/src/input/input-types.ts +1 -1
- package/src/input/rebind-controller.ts +6 -8
- package/src/input/schema.ts +216 -188
- package/src/manifest/filename.ts +8 -12
- package/src/manifest/load.ts +17 -13
- package/src/manifest/schema.ts +55 -47
- package/src/physics/collider-dimensions.ts +8 -12
- package/src/pixi/scene-capture.ts +12 -15
- package/src/react/world-state.tsx +1 -1
- package/src/render/directional-shadow-fit.ts +156 -0
- package/src/render/environment-capture.ts +102 -0
- package/src/render/ibl-override-material.ts +170 -0
- package/src/render/light-camera-factory.ts +8 -11
- package/src/render/material-factory.ts +1 -1
- package/src/render/render-batch-system.ts +14 -6
- package/src/render/render-features.ts +17 -35
- package/src/runtime/create-runtime.ts +270 -108
- package/src/runtime/debug-registry.ts +84 -8
- package/src/runtime/dev-build.ts +2 -2
- package/src/runtime/game-input-seams.ts +108 -0
- package/src/runtime/game.ts +231 -85
- package/src/runtime/mount-game.ts +31 -57
- package/src/runtime/mount-manifest.ts +47 -36
- package/src/runtime/playtest.ts +22 -0
- package/src/runtime/state-bridge.ts +3 -3
- package/src/setup/setup-audio.ts +21 -11
- package/src/setup/setup-renderer.ts +2 -61
- package/src/world3d-react/index.ts +15 -31
- package/src/world3d-react/r3f-root-factory.tsx +451 -60
- package/src/world3d-react/rapier-physics-bridge.tsx +154 -58
- package/dist/adapter/setup-three-root-adapter.d.ts +0 -86
- package/dist/adapter/setup-three-root-adapter.d.ts.map +0 -1
- package/dist/adapter/setup-three-root-adapter.js +0 -908
- 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 -31
- package/dist/asset-registry.d.ts +0 -38
- package/dist/asset-registry.d.ts.map +0 -1
- package/dist/asset-registry.js +0 -66
- package/dist/canvas-react/engine-bridge.d.ts +0 -45
- package/dist/canvas-react/engine-bridge.d.ts.map +0 -1
- package/dist/canvas-react/engine-bridge.js +0 -45
- package/dist/canvas-react/pixi-react-adapter.d.ts +0 -77
- package/dist/canvas-react/pixi-react-adapter.d.ts.map +0 -1
- package/dist/canvas-react/pixi-react-adapter.js +0 -294
- package/dist/canvas-react/world-context.d.ts +0 -98
- package/dist/canvas-react/world-context.d.ts.map +0 -1
- package/dist/canvas-react/world-context.js +0 -173
- 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/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/lod.d.ts +0 -13
- package/dist/render/lod.d.ts.map +0 -1
- package/dist/render/lod.js +0 -16
- package/dist/runtime/types.d.ts +0 -303
- package/dist/runtime/types.d.ts.map +0 -1
- package/dist/runtime/types.js +0 -1
- package/dist/world3d-react/engine-bridge.d.ts +0 -47
- package/dist/world3d-react/engine-bridge.d.ts.map +0 -1
- package/dist/world3d-react/engine-bridge.js +0 -73
- package/dist/world3d-react/r3f-adapter.d.ts +0 -58
- package/dist/world3d-react/r3f-adapter.d.ts.map +0 -1
- package/dist/world3d-react/r3f-adapter.js +0 -634
- package/dist/world3d-react/world-context.d.ts +0 -182
- package/dist/world3d-react/world-context.d.ts.map +0 -1
- package/dist/world3d-react/world-context.js +0 -235
- package/src/adapter/setup-three-root-adapter.ts +0 -1032
- package/src/animation/clip-map.ts +0 -34
- package/src/asset-registry.ts +0 -89
- package/src/canvas-react/engine-bridge.ts +0 -59
- package/src/canvas-react/pixi-react-adapter.tsx +0 -356
- package/src/canvas-react/world-context.ts +0 -253
- package/src/dev/debug-draw.ts +0 -80
- package/src/render/auto-batcher.ts +0 -168
- package/src/render/lod.ts +0 -17
- package/src/runtime/types.ts +0 -328
- package/src/world3d-react/engine-bridge.ts +0 -86
- package/src/world3d-react/r3f-adapter.tsx +0 -717
- package/src/world3d-react/world-context.ts +0 -358
package/src/input/schema.ts
CHANGED
|
@@ -37,62 +37,74 @@
|
|
|
37
37
|
import { z } from 'zod';
|
|
38
38
|
import type { InputAction, InputBinding, InputMapFile } from './input-types';
|
|
39
39
|
|
|
40
|
-
const KeyBindingSchema = z
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
const KeyBindingSchema = z
|
|
41
|
+
.object({
|
|
42
|
+
type: z.literal('key').describe('Binding kind: a keyboard key (KeyboardEvent.code)'),
|
|
43
|
+
code: z.string().describe('KeyboardEvent.code value, e.g. "KeyW", "Space", "ArrowUp"'),
|
|
44
|
+
})
|
|
45
|
+
.strict();
|
|
44
46
|
|
|
45
|
-
const MouseButtonBindingSchema = z
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
const MouseButtonBindingSchema = z
|
|
48
|
+
.object({
|
|
49
|
+
type: z.literal('mouse_button').describe('Binding kind: a mouse button'),
|
|
50
|
+
button: z.number().describe('MouseEvent.button index (0 = left, 1 = middle, 2 = right)'),
|
|
51
|
+
})
|
|
52
|
+
.strict();
|
|
49
53
|
|
|
50
|
-
const MouseMoveBindingSchema = z
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
54
|
+
const MouseMoveBindingSchema = z
|
|
55
|
+
.object({
|
|
56
|
+
type: z
|
|
57
|
+
.literal('mouse_move')
|
|
58
|
+
.describe(
|
|
59
|
+
'Binding kind: raw mouse movement (F2, spec §12 "Complete Device Backends"). Feeds a ' +
|
|
60
|
+
"'pointerDelta'-valueType action with the raw accumulated mouse delta (no deadzone), and " +
|
|
61
|
+
"can also feed a 'vector2'-valueType action (the same delta, radial-deadzoned + unit-" +
|
|
62
|
+
'circle-clamped via `deadzone`).',
|
|
63
|
+
),
|
|
64
|
+
deadzone: z
|
|
65
|
+
.number()
|
|
66
|
+
.optional()
|
|
67
|
+
.describe(
|
|
68
|
+
"Radial deadzone magnitude applied only when this binding feeds a 'vector2'-valueType " +
|
|
69
|
+
"action (default 0 — no deadzone; ignored for 'pointerDelta' reads, which are never " +
|
|
70
|
+
'deadzoned).',
|
|
71
|
+
),
|
|
72
|
+
})
|
|
73
|
+
.strict();
|
|
68
74
|
|
|
69
|
-
const GamepadButtonBindingSchema = z
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
75
|
+
const GamepadButtonBindingSchema = z
|
|
76
|
+
.object({
|
|
77
|
+
type: z.literal('gamepad_button').describe('Binding kind: a gamepad face/shoulder button'),
|
|
78
|
+
button: z.number().describe('Standard Gamepad API button index'),
|
|
79
|
+
})
|
|
80
|
+
.strict();
|
|
73
81
|
|
|
74
|
-
const GamepadAxisBindingSchema = z
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
const GamepadAxisBindingSchema = z
|
|
83
|
+
.object({
|
|
84
|
+
type: z.literal('gamepad_axis').describe('Binding kind: a single thresholded gamepad axis'),
|
|
85
|
+
axis: z.number().describe('Standard Gamepad API axis index'),
|
|
86
|
+
direction: z
|
|
87
|
+
.enum(['positive', 'negative'])
|
|
88
|
+
.describe('Which side of the deadzone counts as "pressed"'),
|
|
89
|
+
deadzone: z.number().optional().describe('Deadzone magnitude (default 0.15 if omitted)'),
|
|
90
|
+
})
|
|
91
|
+
.strict();
|
|
82
92
|
|
|
83
|
-
const GamepadAxisPairBindingSchema = z
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
'
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
const GamepadAxisPairBindingSchema = z
|
|
94
|
+
.object({
|
|
95
|
+
type: z
|
|
96
|
+
.literal('gamepad_axis_pair')
|
|
97
|
+
.describe(
|
|
98
|
+
'Binding kind: a coupled (x, y) gamepad axis pair, e.g. a stick used as a 2D vector ' +
|
|
99
|
+
'(look/aim/movement) (F2, spec §12 "Complete Device Backends"). Feeds a ' +
|
|
100
|
+
"'vector2'-valueType action: (xAxis, yAxis) read together, radial-deadzoned + unit-" +
|
|
101
|
+
'circle-clamped the same way a real analog stick is.',
|
|
102
|
+
),
|
|
103
|
+
xAxis: z.number().describe('Standard Gamepad API axis index for the X component'),
|
|
104
|
+
yAxis: z.number().describe('Standard Gamepad API axis index for the Y component'),
|
|
105
|
+
deadzone: z.number().optional().describe('Deadzone magnitude (default 0.15 if omitted)'),
|
|
106
|
+
})
|
|
107
|
+
.strict();
|
|
96
108
|
|
|
97
109
|
// ---------------------------------------------------------------------------
|
|
98
110
|
// F1 (spec §12) — injected test input bindings. LIVE (real runtime readers in
|
|
@@ -102,78 +114,86 @@ const GamepadAxisPairBindingSchema = z.object({
|
|
|
102
114
|
// aggregation path these exercise today.
|
|
103
115
|
// ---------------------------------------------------------------------------
|
|
104
116
|
|
|
105
|
-
const TestAxisBindingSchema = z
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
'deadzone
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
117
|
+
const TestAxisBindingSchema = z
|
|
118
|
+
.object({
|
|
119
|
+
type: z
|
|
120
|
+
.literal('test_axis')
|
|
121
|
+
.describe(
|
|
122
|
+
"Binding kind: an injected synthetic scalar value for a 'scalar'-valueType action " +
|
|
123
|
+
'(InputManager.injectAxis/getScalar) — the "injected test input" backend named in F2, ' +
|
|
124
|
+
"built in F1 as the typed scalar value model's testable source.",
|
|
125
|
+
),
|
|
126
|
+
sourceId: z
|
|
127
|
+
.string()
|
|
128
|
+
.describe('Names the injected test source this binding reads (InputManager.injectAxis).'),
|
|
129
|
+
deadzone: z
|
|
130
|
+
.number()
|
|
131
|
+
.optional()
|
|
132
|
+
.describe(
|
|
133
|
+
'1D deadzone magnitude applied to the injected raw value before combine (default 0 — no ' +
|
|
134
|
+
'deadzone). Values below it read as 0; values at/above it rescale from 0 (at the ' +
|
|
135
|
+
'deadzone edge) to ±1 (at |raw| = 1), sign preserved.',
|
|
136
|
+
),
|
|
137
|
+
})
|
|
138
|
+
.strict();
|
|
125
139
|
|
|
126
|
-
const TestVector2BindingSchema = z
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
'
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
140
|
+
const TestVector2BindingSchema = z
|
|
141
|
+
.object({
|
|
142
|
+
type: z
|
|
143
|
+
.literal('test_vector2')
|
|
144
|
+
.describe(
|
|
145
|
+
"Binding kind: an injected synthetic {x,y} value for a 'vector2'-valueType action " +
|
|
146
|
+
'(InputManager.injectVector2/getVector2) — the "injected test input" backend named in ' +
|
|
147
|
+
"F2, built in F1 as the typed Vector2 value model's testable source.",
|
|
148
|
+
),
|
|
149
|
+
sourceId: z
|
|
150
|
+
.string()
|
|
151
|
+
.describe('Names the injected test source this binding reads (InputManager.injectVector2).'),
|
|
152
|
+
deadzone: z
|
|
153
|
+
.number()
|
|
154
|
+
.optional()
|
|
155
|
+
.describe(
|
|
156
|
+
'Radial deadzone magnitude applied to the injected raw {x,y} before combine (default 0 ' +
|
|
157
|
+
'— no deadzone). Vectors whose magnitude is below it read as {0,0}; at/above it, ' +
|
|
158
|
+
'direction is preserved and magnitude rescales the same way the scalar deadzone does, ' +
|
|
159
|
+
'then the result is clamped to the unit circle (magnitude <= 1).',
|
|
160
|
+
),
|
|
161
|
+
})
|
|
162
|
+
.strict();
|
|
147
163
|
|
|
148
|
-
const TestPointerDeltaBindingSchema = z
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
164
|
+
const TestPointerDeltaBindingSchema = z
|
|
165
|
+
.object({
|
|
166
|
+
type: z
|
|
167
|
+
.literal('test_pointer_delta')
|
|
168
|
+
.describe(
|
|
169
|
+
"Binding kind: an injected synthetic per-frame {x,y} delta for a 'pointerDelta'-" +
|
|
170
|
+
'valueType action (InputManager.injectPointerDelta/getPointerDelta) — the "injected ' +
|
|
171
|
+
'test input" backend named in F2. No deadzone (deltas are not deadzoned).',
|
|
172
|
+
),
|
|
173
|
+
sourceId: z
|
|
174
|
+
.string()
|
|
175
|
+
.describe(
|
|
176
|
+
'Names the injected test source this binding reads (InputManager.injectPointerDelta).',
|
|
177
|
+
),
|
|
178
|
+
})
|
|
179
|
+
.strict();
|
|
162
180
|
|
|
163
|
-
const TestPointerPositionBindingSchema = z
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
181
|
+
const TestPointerPositionBindingSchema = z
|
|
182
|
+
.object({
|
|
183
|
+
type: z
|
|
184
|
+
.literal('test_pointer_position')
|
|
185
|
+
.describe(
|
|
186
|
+
"Binding kind: an injected synthetic absolute {x,y} position for a 'pointerPosition'-" +
|
|
187
|
+
'valueType action (InputManager.injectPointerPosition/getPointerPosition) — the ' +
|
|
188
|
+
'"injected test input" backend named in F2.',
|
|
189
|
+
),
|
|
190
|
+
sourceId: z
|
|
191
|
+
.string()
|
|
192
|
+
.describe(
|
|
193
|
+
'Names the injected test source this binding reads (InputManager.injectPointerPosition).',
|
|
194
|
+
),
|
|
195
|
+
})
|
|
196
|
+
.strict();
|
|
177
197
|
|
|
178
198
|
// ---------------------------------------------------------------------------
|
|
179
199
|
// F2 (spec §12 "Complete Device Backends") — touch/virtual-control bindings.
|
|
@@ -185,44 +205,48 @@ const TestPointerPositionBindingSchema = z.object({
|
|
|
185
205
|
// thin adapter at the edge, out of scope here — see input-manager.ts).
|
|
186
206
|
// ---------------------------------------------------------------------------
|
|
187
207
|
|
|
188
|
-
const TouchButtonBindingSchema = z
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
'
|
|
201
|
-
|
|
202
|
-
|
|
208
|
+
const TouchButtonBindingSchema = z
|
|
209
|
+
.object({
|
|
210
|
+
type: z
|
|
211
|
+
.literal('touch_button')
|
|
212
|
+
.describe(
|
|
213
|
+
"Binding kind: a virtual on-screen button for a 'digital' action " +
|
|
214
|
+
'(InputManager.setTouchButton/isPressed) — edge-tracked (isJustPressed/isJustReleased) ' +
|
|
215
|
+
'the same way a real mouse/keyboard button is.',
|
|
216
|
+
),
|
|
217
|
+
sourceId: z
|
|
218
|
+
.string()
|
|
219
|
+
.describe(
|
|
220
|
+
'Names the virtual control zone this binding reads (InputManager.setTouchButton) — a ' +
|
|
221
|
+
'touch-UI-chosen id, not a real device index.',
|
|
222
|
+
),
|
|
223
|
+
})
|
|
224
|
+
.strict();
|
|
203
225
|
|
|
204
|
-
const TouchStickBindingSchema = z
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
'
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
'deadzone
|
|
224
|
-
|
|
225
|
-
|
|
226
|
+
const TouchStickBindingSchema = z
|
|
227
|
+
.object({
|
|
228
|
+
type: z
|
|
229
|
+
.literal('touch_stick')
|
|
230
|
+
.describe(
|
|
231
|
+
"Binding kind: a virtual on-screen analog stick for a 'vector2' action " +
|
|
232
|
+
'(InputManager.setTouchStick/getVector2) — radial-deadzoned + unit-circle-clamped the ' +
|
|
233
|
+
'same way a real gamepad stick is.',
|
|
234
|
+
),
|
|
235
|
+
sourceId: z
|
|
236
|
+
.string()
|
|
237
|
+
.describe(
|
|
238
|
+
'Names the virtual control zone this binding reads (InputManager.setTouchStick) — a ' +
|
|
239
|
+
'touch-UI-chosen id, not a real device index.',
|
|
240
|
+
),
|
|
241
|
+
deadzone: z
|
|
242
|
+
.number()
|
|
243
|
+
.optional()
|
|
244
|
+
.describe(
|
|
245
|
+
'Radial deadzone magnitude applied to the raw {x,y} before combine (default 0 — no ' +
|
|
246
|
+
'deadzone).',
|
|
247
|
+
),
|
|
248
|
+
})
|
|
249
|
+
.strict();
|
|
226
250
|
|
|
227
251
|
/** A single input binding. Every kind listed here is LIVE — F2 (spec §12) closed the last two
|
|
228
252
|
* dead stubs (`mouse_move`/`gamepad_axis_pair`) by giving both real `InputManager` readers. */
|
|
@@ -242,31 +266,33 @@ export const InputBindingSchema: z.ZodType<InputBinding> = z.discriminatedUnion(
|
|
|
242
266
|
]) as z.ZodType<InputBinding>;
|
|
243
267
|
|
|
244
268
|
/** An action has a name (the record key) and one or more bindings. */
|
|
245
|
-
export const InputActionSchema: z.ZodType<InputAction> = z
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
'
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
'
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
269
|
+
export const InputActionSchema: z.ZodType<InputAction> = z
|
|
270
|
+
.object({
|
|
271
|
+
valueType: z
|
|
272
|
+
.enum(['digital', 'scalar', 'vector2', 'pointerDelta', 'pointerPosition'])
|
|
273
|
+
.default('digital')
|
|
274
|
+
.describe(
|
|
275
|
+
"This action's declared value shape (F1, spec §12). 'digital' (boolean, with " +
|
|
276
|
+
'pressed/justPressed/justReleased edges) is the default when omitted, matching every ' +
|
|
277
|
+
"action authored before F1. 'scalar' is a single deadzone-rescaled float axis. " +
|
|
278
|
+
"'vector2' is a radial-deadzoned, unit-circle-normalized {x,y}. 'pointerDelta' is a " +
|
|
279
|
+
"per-frame {x,y} movement delta, summed across sources. 'pointerPosition' is an " +
|
|
280
|
+
'absolute {x,y}, last-write-wins across sources. InputManager enforces this at read ' +
|
|
281
|
+
'time: reading an action through the wrong typed getter (e.g. getScalar on a ' +
|
|
282
|
+
"'digital' action) throws.",
|
|
283
|
+
),
|
|
284
|
+
bindings: z
|
|
285
|
+
.array(InputBindingSchema)
|
|
286
|
+
.describe(
|
|
287
|
+
'Bindings that all trigger/feed this action. Digital actions combine via OR (any one ' +
|
|
288
|
+
'binding satisfied is enough). Scalar actions combine via max-magnitude across ' +
|
|
289
|
+
'contributing bindings (ties keep the first-listed binding). Vector2 actions combine ' +
|
|
290
|
+
'by summing contributing {x,y} values then clamping to the unit circle. PointerDelta ' +
|
|
291
|
+
'actions sum contributing deltas. PointerPosition actions use the most-recently-' +
|
|
292
|
+
'written contributing source (last-write-wins).',
|
|
293
|
+
),
|
|
294
|
+
})
|
|
295
|
+
.strict();
|
|
270
296
|
|
|
271
297
|
/**
|
|
272
298
|
* The `.inputmap.json` file format (`InputManager.loadMap`).
|
|
@@ -275,9 +301,11 @@ export const InputActionSchema: z.ZodType<InputAction> = z.object({
|
|
|
275
301
|
* same convention `2d.version`/`Scene2DSchema` used before T2.3 gave the 3D
|
|
276
302
|
* scene version axis a real reader; see `schema-consumption-map.ts`).
|
|
277
303
|
*/
|
|
278
|
-
export const InputMapFileSchema: z.ZodType<InputMapFile> = z
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
304
|
+
export const InputMapFileSchema: z.ZodType<InputMapFile> = z
|
|
305
|
+
.object({
|
|
306
|
+
version: z.number().describe('Input map file format version (RESERVED — no range check yet)'),
|
|
307
|
+
actions: z
|
|
308
|
+
.record(z.string(), InputActionSchema)
|
|
309
|
+
.describe('Named actions, each with a list of bindings (InputManager.loadMap)'),
|
|
310
|
+
})
|
|
311
|
+
.strict() as z.ZodType<InputMapFile>;
|
package/src/manifest/filename.ts
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
// The project manifest's FILENAME. There is exactly ONE.
|
|
2
2
|
//
|
|
3
|
-
// The manifest is `vgai.project.json
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
// software, no such constituency exists, and a second way to spell the
|
|
9
|
-
// manifest is the defect — two accepted names meant both kept being written,
|
|
10
|
-
// and copies of the "try both" probe grew in five modules that agreed with the
|
|
11
|
-
// real resolver only by coincidence.
|
|
3
|
+
// The manifest is `vgai.project.json`, and NOTHING reads a second spelling
|
|
4
|
+
// (the legacy-removal doctrine, `docs/ARCHITECTURE-CORE.md` §Vocabulary). Two
|
|
5
|
+
// accepted names is the defect, not the convenience: both get written, and
|
|
6
|
+
// copies of the "try both" probe spread into modules that agree with the real
|
|
7
|
+
// resolver only by coincidence.
|
|
12
8
|
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
9
|
+
// The removed name REJECTS LOUDLY, naming the exact one-line fix — never
|
|
10
|
+
// silently ignored, never redirected. A directory
|
|
15
11
|
// carrying only `vgai.game.json` is an error with a `git mv` in the message,
|
|
16
12
|
// not a project that quietly fails to open.
|
|
17
13
|
//
|
|
@@ -40,7 +36,7 @@ export function isManifestFilename(name: string): boolean {
|
|
|
40
36
|
export function removedManifestFilenameMessage(where: string): string {
|
|
41
37
|
return (
|
|
42
38
|
`${where}: found \`${REMOVED_MANIFEST_FILENAME}\` and no \`${MANIFEST_FILENAME}\`. ` +
|
|
43
|
-
`\`${REMOVED_MANIFEST_FILENAME}\` was REMOVED (
|
|
39
|
+
`\`${REMOVED_MANIFEST_FILENAME}\` was REMOVED (the legacy-removal doctrine, ` +
|
|
44
40
|
'docs/ARCHITECTURE-CORE.md §Vocabulary) — nothing reads it any more, and it is ' +
|
|
45
41
|
'deliberately NOT read as a fallback, because a second accepted name is the defect.\n' +
|
|
46
42
|
`Fix: rename it — \`git mv ${REMOVED_MANIFEST_FILENAME} ${MANIFEST_FILENAME}\`. ` +
|
package/src/manifest/load.ts
CHANGED
|
@@ -62,13 +62,6 @@ export type ResolvedAdapter =
|
|
|
62
62
|
readonly assets: Record<string, string> | undefined;
|
|
63
63
|
readonly domStubs: string[] | undefined;
|
|
64
64
|
readonly captureTimeoutMs: number | undefined;
|
|
65
|
-
/**
|
|
66
|
-
* The component this root'''s WORLD is, in the game'''s own source (see the
|
|
67
|
-
* field'''s schema description). Present ⇒ Edit mounts THAT component
|
|
68
|
-
* alone as a still design-time document and Play mounts the game
|
|
69
|
-
* through `entry`; absent ⇒ `entry` is what both modes mount.
|
|
70
|
-
*/
|
|
71
|
-
readonly world?: { readonly entry: string; readonly export?: string | undefined } | undefined;
|
|
72
65
|
};
|
|
73
66
|
|
|
74
67
|
export interface ResolvedAdapterRoot {
|
|
@@ -77,6 +70,13 @@ export interface ResolvedAdapterRoot {
|
|
|
77
70
|
readonly description: string | undefined;
|
|
78
71
|
readonly adapter: ResolvedAdapter;
|
|
79
72
|
readonly entry: string | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* The component this root's WORLD is, in the game's own source (see the
|
|
75
|
+
* field's schema description). Present ⇒ Edit mounts THAT component alone as
|
|
76
|
+
* its design-time document and Play mounts the game through `entry`;
|
|
77
|
+
* absent ⇒ `entry` is what both modes mount.
|
|
78
|
+
*/
|
|
79
|
+
readonly world?: { readonly entry: string; readonly export: string | undefined } | undefined;
|
|
80
80
|
readonly zOrder: number;
|
|
81
81
|
readonly pausable: boolean;
|
|
82
82
|
readonly loop: 'gated' | 'self-driven';
|
|
@@ -231,7 +231,6 @@ function resolveAdapter(root: AdapterRoot): ResolvedAdapter {
|
|
|
231
231
|
assets: ingest.assets,
|
|
232
232
|
domStubs: ingest.domStubs,
|
|
233
233
|
captureTimeoutMs: ingest.captureTimeoutMs,
|
|
234
|
-
world: ingest.world,
|
|
235
234
|
};
|
|
236
235
|
}
|
|
237
236
|
|
|
@@ -251,11 +250,14 @@ function checkEngineVersionPin(version: string): void {
|
|
|
251
250
|
* `id` drives uniqueness; `adapter` (incl. its surface and
|
|
252
251
|
* `module`/`ingest.*` sub-fields) drives adapter identity
|
|
253
252
|
* resolution; `entry` drives the entry cross-field rule and is
|
|
254
|
-
* carried through; `
|
|
253
|
+
* carried through; `world` is carried through for the ONE reader that mounts a
|
|
254
|
+
* design-time document (the editor's design session) and is deliberately not
|
|
255
|
+
* cross-checked against `entry` — the two name different modules on purpose;
|
|
256
|
+
* `zOrder` drives the final sort; `pausable`/`loop` are
|
|
255
257
|
* carried through as-is (their consumers are the runtime/CLI, T3.2/T3.3);
|
|
256
258
|
* `description` (T3.3
|
|
257
259
|
* slice 3) is carried through as-is — its consumer today is
|
|
258
|
-
* `resolveIngestDescriptor` (packages/editor/src/
|
|
260
|
+
* `resolveIngestDescriptor` (packages/editor/src/ingest/resolve-three.ts), which
|
|
259
261
|
* threads an ingest-three root's description into `IngestGame.description`.
|
|
260
262
|
*/
|
|
261
263
|
function resolveRoot(root: AdapterRoot): ResolvedAdapterRoot {
|
|
@@ -268,6 +270,8 @@ function resolveRoot(root: AdapterRoot): ResolvedAdapterRoot {
|
|
|
268
270
|
description: root.description,
|
|
269
271
|
adapter,
|
|
270
272
|
entry: root.entry,
|
|
273
|
+
world:
|
|
274
|
+
root.world === undefined ? undefined : { entry: root.world.entry, export: root.world.export },
|
|
271
275
|
zOrder: root.zOrder,
|
|
272
276
|
pausable: root.pausable,
|
|
273
277
|
loop: root.loop,
|
|
@@ -285,9 +289,9 @@ function resolveRoot(root: AdapterRoot): ResolvedAdapterRoot {
|
|
|
285
289
|
* any Zod validation failure or cross-field rule violation.
|
|
286
290
|
*/
|
|
287
291
|
export function loadGameManifest(raw: unknown): ResolvedGameManifest {
|
|
288
|
-
// Removed-format guard FIRST, on the raw value: a
|
|
289
|
-
// would otherwise fail Zod's `roots` discriminated union with
|
|
290
|
-
// shape error instead of
|
|
292
|
+
// Removed-format guard FIRST, on the raw value: a root declaring a removed
|
|
293
|
+
// content field would otherwise fail Zod's `roots` discriminated union with
|
|
294
|
+
// a confusing shape error instead of the named migration message.
|
|
291
295
|
const parsed = GameManifestSchema.safeParse(raw);
|
|
292
296
|
if (!parsed.success) {
|
|
293
297
|
// D-V6: the `roots` `superRefine`'s composition issues — a duplicate root
|