@vgai/engine 0.4.1 → 0.5.0-canary.20260719.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/README.md +48 -15
  2. package/package.json +11 -25
  3. package/schemas/engine-capabilities.json +10 -10
  4. package/schemas/entity2d.schema.json +468 -0
  5. package/schemas/mat.schema.json +2 -33
  6. package/schemas/prefab.schema.json +16 -172
  7. package/schemas/scn2d.schema.json +42 -23
  8. package/schemas/vgai-game.schema.json +34 -0
  9. package/schemas/vscn.schema.json +16 -172
  10. package/src/adapter/authoring.ts +152 -2
  11. package/src/adapter/colyseus-networking-adapter.ts +35 -1
  12. package/src/adapter/first-party-systems.ts +7 -1
  13. package/src/adapter/game-adapter.ts +13 -0
  14. package/src/adapter/index.ts +25 -0
  15. package/src/adapter/rapier-physics-adapter.ts +55 -2
  16. package/src/adapter/system-adapter.ts +249 -2
  17. package/src/adapter/vgai-scene-game-adapter.ts +149 -25
  18. package/src/ai/navigation.ts +28 -0
  19. package/src/animation/clip-map.ts +1 -8
  20. package/src/animation/theatre-director.ts +50 -0
  21. package/src/animation/xstate-animation-binding.ts +6 -0
  22. package/src/audio/audio-introspection.ts +290 -0
  23. package/src/audio/tone-context.ts +46 -0
  24. package/src/dev/chrome-trace.ts +153 -0
  25. package/src/dev/performance-profiler.ts +93 -6
  26. package/src/dev/render-debug-adapter.ts +199 -0
  27. package/src/dev/render-memory.ts +243 -0
  28. package/src/dev/webgl-frame-capture.ts +424 -0
  29. package/src/ecs/component-manager.ts +43 -10
  30. package/src/ecs/game-component.ts +39 -10
  31. package/src/input/input-manager.ts +24 -19
  32. package/src/input/input-types.ts +1 -1
  33. package/src/loader.ts +7 -0
  34. package/src/manifest/load.ts +14 -0
  35. package/src/manifest/schema.ts +65 -0
  36. package/src/react/game-state.tsx +1 -1
  37. package/src/render/render-batch-system.ts +26 -12
  38. package/src/render/spark-renderer-lifecycle.ts +64 -0
  39. package/src/runtime/create-runtime.ts +33 -5
  40. package/src/runtime/debug-bridge.ts +5 -5
  41. package/src/runtime/game.ts +102 -20
  42. package/src/runtime/mount-manifest.ts +1 -1
  43. package/src/runtime/render-control.ts +121 -0
  44. package/src/runtime/types.ts +1 -1
  45. package/src/scene/asset-loaders.ts +77 -3
  46. package/src/scene/instance-mesh.ts +25 -0
  47. package/src/scene/material-factory.ts +4 -15
  48. package/src/scene/mesh-shadow.ts +18 -0
  49. package/src/scene/particles-factory.ts +59 -0
  50. package/src/scene/scene-loader.ts +41 -16
  51. package/src/scene/schema/instances.ts +1 -2
  52. package/src/scene/schema/material.ts +83 -94
  53. package/src/scene/schema/mesh.ts +76 -90
  54. package/src/scene/schema/scene-file.ts +1 -2
  55. package/src/scene/user-data.ts +30 -14
  56. package/src/setup/setup-renderer.ts +6 -1
  57. package/src/world2d/asset-paths2d.ts +44 -0
  58. package/src/world2d/collision-2d.ts +7 -14
  59. package/src/world2d/entity2d-asset.ts +22 -0
  60. package/src/world2d/index.ts +27 -2
  61. package/src/world2d/physics2d-transform.ts +173 -0
  62. package/src/world2d/physics2d-units.ts +10 -0
  63. package/src/world2d/pixi-game-adapter.ts +148 -36
  64. package/src/world2d/scene2d-identity.ts +49 -0
  65. package/src/world2d/scene2d-loader.ts +243 -119
  66. package/src/world2d/schema/entity2d.ts +51 -33
  67. package/src/world2d/schema/physics2d.ts +14 -3
  68. package/src/world2d/schema/sprite.ts +32 -4
  69. package/src/world2d/schema/tilemap.ts +26 -9
  70. package/src/world2d/transform-writer-2d.ts +29 -11
  71. package/src/world2d/types.ts +21 -8
  72. package/src/world3d-react/behavior.tsx +138 -0
  73. package/src/world3d-react/engine-bridge.ts +48 -0
  74. package/src/world3d-react/index.ts +44 -0
  75. package/src/world3d-react/r3f-adapter.tsx +303 -0
  76. package/src/world3d-react/world-context.ts +294 -0
  77. package/vendor/realism-effects/LICENSE.md +21 -0
  78. package/vendor/realism-effects/UPSTREAM.md +19 -0
  79. package/vendor/realism-effects/dist/index.cjs +3447 -0
  80. package/vendor/realism-effects/dist/index.d.ts +59 -0
  81. package/vendor/realism-effects/dist/index.js +3434 -0
  82. package/vendor/realism-effects/package.json +23 -0
  83. package/src/character/cloth-sim.ts +0 -533
  84. package/src/character/spring-chain.ts +0 -307
  85. package/src/humanoid/body.ts +0 -663
  86. package/src/humanoid/clips.ts +0 -149
  87. package/src/humanoid/compose.ts +0 -209
  88. package/src/humanoid/generate.ts +0 -189
  89. package/src/humanoid/index.ts +0 -36
  90. package/src/humanoid/schema.ts +0 -108
  91. package/src/humanoid/skeleton.ts +0 -345
  92. package/src/react/humanoid-bake.document.tsx +0 -337
  93. package/src/scene/geometries/index.ts +0 -7
  94. package/src/scene/geometries/terrain.ts +0 -42
  95. package/src/scene/geometry-registry.ts +0 -42
  96. package/src/scene/instance-registry.ts +0 -84
  97. package/src/scene/instancers/grid.ts +0 -38
  98. package/src/scene/instancers/index.ts +0 -7
  99. package/src/scene/material-registry.ts +0 -73
  100. package/src/scene/materials/index.ts +0 -7
  101. package/src/scene/materials/water.ts +0 -56
  102. package/src/world2d/components-2d.ts +0 -86
  103. package/tools/humanoid-bake.tool.ts +0 -274
package/README.md CHANGED
@@ -13,25 +13,58 @@ and the world2d PixiJS stack.
13
13
  **License: Apache-2.0** (see [LICENSE](./LICENSE)). Your game code that
14
14
  imports this package carries no copyleft obligations.
15
15
 
16
- ## How it's consumed
16
+ ## Create a complete VGAI game project
17
17
 
18
- This package is **not yet published to npm**. A project scaffolded with
19
- `create-vgai-project` consumes the engine as **source**, via a vendored
20
- `file:` dependency plus `@engine/*` path aliases back into the checkout you
21
- scaffolded from. That is deliberate: the engine is meant to be read,
22
- stepped through, and understood — not treated as a black box. (Editing it
23
- edits the shared checkout for every project scaffolded from it; a game
24
- that needs a divergent engine forks the checkout.)
18
+ If you want the editor, project manifest, validation, agent guidance, and
19
+ working starter together, use the public CLI instead of assembling packages
20
+ by hand:
21
+
22
+ ```bash
23
+ npx @vgai/cli@latest create my-game
24
+ ```
25
+
26
+ The command creates a standalone project, installs its versioned VGAI
27
+ dependencies, and opens the visual editor.
28
+
29
+ ## Use the engine directly
30
+
31
+ Install the engine in a TypeScript-aware project:
32
+
33
+ ```bash
34
+ npm install @vgai/engine
35
+ ```
36
+
37
+ The bare package exposes the small game/setup surface:
38
+
39
+ ```ts
40
+ import {
41
+ GameComponent,
42
+ fromSetup,
43
+ loadGameManifest,
44
+ mountManifestWorlds,
45
+ type GameContext,
46
+ } from '@vgai/engine';
47
+ ```
48
+
49
+ Most engine APIs use readable source subpaths, for example
50
+ `@vgai/engine/animation/xstate-animation-binding`. The package deliberately
51
+ ships `src/`, generated schemas, and build output. Vite and TypeScript can
52
+ read and step through the same source a generated game uses; publishing the
53
+ package does not turn the engine into a black box.
54
+
55
+ Node.js 22 or newer is required. React and ReactDOM are optional peers needed
56
+ only for React adapter roots; `@vgai/editor-sdk` is optional when no editor
57
+ control integration is used.
25
58
 
26
59
  ## Orientation
27
60
 
28
- - Read the repo-root [ARCHITECTURE.md](../../ARCHITECTURE.md) first — the
29
- target architecture (universal host, adapter layer) and what's built,
30
- honestly marked.
61
+ - Public Learn/manual: https://vgai-learn.pages.dev
62
+ - Hosted editor: https://vgai-editor.pages.dev
63
+ - In a source checkout, read the repo-root `ARCHITECTURE.md` first—the target
64
+ architecture and current implementation are marked separately.
31
65
  - Scene/format schemas: `src/scene/schema/` (every field `.describe()`d;
32
66
  `npm run generate-schema` emits JSON Schema for autocomplete).
33
67
  - The component model: `src/ecs/game-component.ts`.
34
- - The adapter contracts: `src/adapter/` +
35
- [docs/ADAPTER-AUTHORING-GUIDE.md](../../docs/ADAPTER-AUTHORING-GUIDE.md).
36
- - Tests are headless with real dependencies (real Rapier WASM, real
37
- Three.js graphs): `npm run test:unit` from the repo root.
68
+ - The adapter contracts: `src/adapter/`.
69
+ - Source-checkout tests are headless with real dependencies: `npm run
70
+ test:unit` from the repository root.
package/package.json CHANGED
@@ -2,10 +2,11 @@
2
2
  "name": "@vgai/engine",
3
3
  "author": "Volter AI, Inc.",
4
4
  "license": "Apache-2.0",
5
- "version": "0.4.1",
5
+ "version": "0.5.0-canary.20260719.0",
6
+ "description": "Readable TypeScript game engine and universal host for Three.js, PixiJS, and React games.",
7
+ "keywords": ["game-engine", "three.js", "pixijs", "react", "ai-agents"],
6
8
  "type": "module",
7
- "description": "The vgai game engine — core loop, GameComponent model, physics, scene loader, adapter seam.",
8
- "homepage": "https://github.com/volter-ai/vgai-engine#readme",
9
+ "homepage": "https://vgai-learn.pages.dev",
9
10
  "repository": {
10
11
  "type": "git",
11
12
  "url": "git+https://github.com/volter-ai/vgai-engine.git",
@@ -14,21 +15,6 @@
14
15
  "publishConfig": {
15
16
  "access": "public"
16
17
  },
17
- "vgai": {
18
- "tools": [
19
- {
20
- "entry": "./tools/humanoid-bake.tool.ts",
21
- "contributions": [
22
- {
23
- "id": "humanoid-builder",
24
- "point": "workspace.document",
25
- "title": "Humanoid Builder",
26
- "entry": "./src/react/humanoid-bake.document.tsx"
27
- }
28
- ]
29
- }
30
- ]
31
- },
32
18
  "exports": {
33
19
  ".": "./src/index.ts",
34
20
  "./package.json": "./package.json",
@@ -36,9 +22,9 @@
36
22
  },
37
23
  "files": [
38
24
  "src",
39
- "tools",
40
25
  "dist",
41
- "schemas"
26
+ "schemas",
27
+ "vendor"
42
28
  ],
43
29
  "engines": {
44
30
  "node": ">=22.0.0"
@@ -48,18 +34,18 @@
48
34
  },
49
35
  "dependencies": {
50
36
  "@dimforge/rapier2d-compat": "^0.14.0",
51
- "@pixi/tilemap": "^5.0.0",
52
37
  "@dimforge/rapier3d-compat": "^0.14.0",
38
+ "@pixi/tilemap": "^5.0.0",
53
39
  "@recast-navigation/three": "^0.43.0",
40
+ "@sparkjsdev/spark": "^2.1.0",
41
+ "@theatre/core": "0.7.2",
42
+ "gsap": "^3.12.0",
54
43
  "loglayer": "^9.1.0",
55
44
  "n8ao": "^1.10.1",
56
45
  "pixi.js": "^8.6.0",
57
46
  "postprocessing": "^6.38.0",
58
- "realism-effects": "^1.1.2",
59
47
  "recast-navigation": "^0.43.0",
60
- "@theatre/core": "0.7.2",
61
- "gsap": "^3.12.0",
62
- "three": "^0.170.0",
48
+ "three": "^0.180.0",
63
49
  "three.quarks": "^0.16.0",
64
50
  "tone": "^15.1.22",
65
51
  "xstate": "^5.32.4",
@@ -2,7 +2,7 @@
2
2
  "$comment": "Curated by human/agent review, NOT auto-generated (unlike engine-api.json beside it). Every claim was verified against code — see each entry's `evidence`. Staleness is machine-checked at two granularities: `schemaDirHash` (sha256 over packages/engine/src/scene/schema/) and per-entry `evidenceHashes` (sha256 of each cited evidence FILE — catches drift in files outside the schema dir, which is where most entries' evidence lives; T5.5/MASTER-ARCHITECTURE-REVIEW.md §7.2).",
3
3
  "_readme": "Read this before authoring scene JSON or engine code, to avoid the negatives below. Refresh flow after a schema-dir OR evidence-file change: `npx tsx scripts/capabilities-hash.ts --check` (fails naming the stale entry) -> re-review affected entries against current code -> `--write` to record fresh hashes. The pre-commit hook runs --check automatically. Each entry's `evidenceHashes` maps the repo-relative file path parsed off the front of each `evidence[]` citation (before any `:line-range` suffix) to a sha256 of that file's current content.",
4
4
  "schemaDirPath": "packages/engine/src/scene/schema/",
5
- "schemaDirHash": "3530962568323eb7f0ea4aca8262c616d59fcc64c5fc5a171e4066f672bb77e1",
5
+ "schemaDirHash": "d092efe0ed1fffc07d8a759d16deecb978f89b0386e2a375243804e84f7e74e5",
6
6
  "reviewedAt": "2026-07-01",
7
7
  "entries": [
8
8
  {
@@ -12,12 +12,12 @@
12
12
  "claim": "No Continuous Collision Detection (CCD). Fast/small dynamic bodies can tunnel through thin colliders in one step.",
13
13
  "evidence": [
14
14
  "packages/engine/src/scene/scene-loader.ts (the `bodyDesc` switch: fixed/kinematicPositionBased/dynamic only; file under concurrent edit elsewhere this wave, so no line numbers — grep 'RigidBodyDesc')",
15
- "packages/engine/src/world2d/scene2d-loader.ts:144-154 (2D bodyDesc: same four stock constructors)"
15
+ "packages/engine/src/world2d/scene2d-loader.ts:168-179 (2D bodyDesc: same four stock constructors)"
16
16
  ],
17
17
  "notes": "Grepped packages/engine/src for ccd/CCD/setCcdEnabled: zero matches, 2D and 3D. No call ever sets a ccd flag. Workaround: keep dynamic-body per-step travel small relative to the thinnest collider, or add intermediate colliders.",
18
18
  "evidenceHashes": {
19
- "packages/engine/src/scene/scene-loader.ts": "58ed692dc8bc71ab40839ff5ab48f392f90839734262da2a96bedddc81af09b5",
20
- "packages/engine/src/world2d/scene2d-loader.ts": "125f51fd58d6a7912a22c9b8a78f280c59f1a9c035343faf1d266ee81efaa9a6"
19
+ "packages/engine/src/scene/scene-loader.ts": "53c8f6d756363c0638c576b7e5a3d425fe0e77ce929dac9d462b8999b7000db8",
20
+ "packages/engine/src/world2d/scene2d-loader.ts": "f0f74eefd9cce16bbe7826225a52f2b0407ab141641dcdd370bcff1d091bce69"
21
21
  }
22
22
  },
23
23
  {
@@ -32,7 +32,7 @@
32
32
  "notes": "Grepped for maxBodies/MAX_ENTITIES/entity limit/body limit/entityCount: no matches. No invented numbers — nothing caps entity/body count and no perf test here establishes a safe ceiling. Treat large counts (hundreds+ dynamic bodies) as unvalidated, not 'supported at scale'.",
33
33
  "evidenceHashes": {
34
34
  "packages/engine/src/setup/setup-physics.ts": "0540c502f420018b24dac8b77c486f30f905f0a05b02ead7ed3899e5aa612ee5",
35
- "packages/engine/src/scene/scene-loader.ts": "58ed692dc8bc71ab40839ff5ab48f392f90839734262da2a96bedddc81af09b5"
35
+ "packages/engine/src/scene/scene-loader.ts": "53c8f6d756363c0638c576b7e5a3d425fe0e77ce929dac9d462b8999b7000db8"
36
36
  }
37
37
  },
38
38
  {
@@ -46,8 +46,8 @@
46
46
  ],
47
47
  "notes": "gamepad disconnect/reconnect needs no special-cased code: poll() re-reads navigator.getGamepads() and every read skips a null slot, so a disconnected gamepad's actions go neutral with a correct isJustReleased edge for free — see input-device-backends-f2.test.ts.",
48
48
  "evidenceHashes": {
49
- "packages/engine/src/input/input-types.ts": "361c2618f5a55ecd8ec6b59689a9ab2a92590d86a694d33d21e825f250675ca0",
50
- "packages/engine/src/input/input-manager.ts": "15dc63f60713a6f4087d4e761b5da178555984e939328bb40bf271d9ec76ee30"
49
+ "packages/engine/src/input/input-types.ts": "d6c7a6d1eda6b71665407fd5ac35d414dccf4156d4f79c56671b07e0a60b7f7c",
50
+ "packages/engine/src/input/input-manager.ts": "f3c2683397ed36eeb34ffd54861d14e4c0675bc7fbaef5530e7552a1edd129d4"
51
51
  }
52
52
  },
53
53
  {
@@ -62,7 +62,7 @@
62
62
  "notes": "XState remains the only transition language. Parallel regions use distinct layer names. The binding filters native clip tracks, uses AnimationUtils.makeClipAdditive, can register with ctx.systems, and exposes live owner inspection data until disposal.",
63
63
  "evidenceHashes": {
64
64
  "packages/engine/src/animation/xstate-animation-meta.ts": "80376ac74819803616c4b396244a971cb9a6b2859c33409d032363bfeb3db44f",
65
- "packages/engine/src/animation/xstate-animation-binding.ts": "bfccffe15e265fa2d3843dfaad0d3f1b6a7227a23742efa1f0e11182c8efc33a"
65
+ "packages/engine/src/animation/xstate-animation-binding.ts": "34e94a7db674ea3d8a98cf98359a9ba8cdd2af9266d1e857a6ad5df02d5a5f73"
66
66
  }
67
67
  },
68
68
  {
@@ -91,7 +91,7 @@
91
91
  ],
92
92
  "notes": "Track P shipped 2026-07-03; proven: bubbo-bubbo/puzzling-potions/flappy-pixi. Tiers/limits: docs/CAPABILITY-TIERS.md, docs/PIXI-INGEST-LANDING-DESIGN.md.",
93
93
  "evidenceHashes": {
94
- "docs/BACKBONE-TASKS.md": "0a39f9539731af1de5440aa53ad92d463b809fd7458edb7e34df5dac71e911ac"
94
+ "docs/BACKBONE-TASKS.md": "206ce2818efcf2b12876160d7366d41a6afec6b545b025a98a3fcf2915cdf824"
95
95
  }
96
96
  },
97
97
  {
@@ -104,7 +104,7 @@
104
104
  ],
105
105
  "notes": "Scope is native-DOM React ONLY (D-N1): R3F/@pixi/react games are canvas games and ride the three.js/pixi seams instead. Generality limit: ONE proven game (react-rpg — menu-to-dungeon e2e under React 19; both game-2 candidates rejected on evidence, R-N7). Game deps must be host-installed root deps (D-N6). Open R-N6: vendored react games' raw window listeners bypass the play-mode input gate. Design: docs/REACT-INGEST-LANDING-DESIGN.md.",
106
106
  "evidenceHashes": {
107
- "docs/BACKBONE-TASKS.md": "0a39f9539731af1de5440aa53ad92d463b809fd7458edb7e34df5dac71e911ac"
107
+ "docs/BACKBONE-TASKS.md": "206ce2818efcf2b12876160d7366d41a6afec6b545b025a98a3fcf2915cdf824"
108
108
  }
109
109
  },
110
110
  {