incanto 0.32.0 → 0.34.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 (49) hide show
  1. package/dist/2d.d.ts +59 -2
  2. package/dist/2d.js +3 -3
  3. package/dist/3d.d.ts +8 -3
  4. package/dist/3d.js +4 -4
  5. package/dist/{behavior-D_jMpFh8.d.ts → behavior-CtPScDMo.d.ts} +149 -1
  6. package/dist/{create-game-bKHgHcsZ.js → create-game-CFNqoqOX.js} +13 -6
  7. package/dist/{create-game-gXI7PYl0.js → create-game-QTfghzwM.js} +11 -5
  8. package/dist/debug.d.ts +1 -1
  9. package/dist/{duplicate-KRPtUtzl.js → duplicate-DlOvknDO.js} +1 -1
  10. package/dist/editor.js +35 -0
  11. package/dist/{environment-presets--DigHNg4.js → environment-presets-B6WiUsaO.js} +2 -2
  12. package/dist/{gameplay-BftxM_It.js → gameplay-BxFtmfSe.js} +90 -2
  13. package/dist/gameplay.d.ts +1 -1
  14. package/dist/gameplay.js +1 -1
  15. package/dist/index.d.ts +175 -23
  16. package/dist/index.js +5 -58
  17. package/dist/{loader-BlaRQGaA.js → loader-BwR0DxeM.js} +66 -0
  18. package/dist/{loader-BYBrqTxP.d.ts → loader-DmXfj6Uv.d.ts} +1 -1
  19. package/dist/net.d.ts +1 -1
  20. package/dist/net.js +3 -3
  21. package/dist/{pathfinding-BwhqPD3i.d.ts → pathfinding-DRCe89SI.d.ts} +1 -1
  22. package/dist/{physics-2d-D9wquBvK.js → physics-2d-BuyAwsW5.js} +12 -2
  23. package/dist/{physics-3d-CnPygVGo.js → physics-3d-C8Kn_Nyb.js} +55 -9
  24. package/dist/react.d.ts +1 -1
  25. package/dist/react.js +1 -1
  26. package/dist/{register-tkR_8tWg.js → register-BLPC10Mj.js} +145 -8
  27. package/dist/{register-Dzkd6-os.js → register-G3edsjJ2.js} +752 -16
  28. package/dist/{register-CUY284Is.js → register-OodmuUMK.js} +2 -2
  29. package/dist/{test-WwRIlXsK.js → test-C4B5znap.js} +10 -10
  30. package/dist/test.d.ts +2 -2
  31. package/dist/test.js +1 -1
  32. package/dist/vite.js +1 -1
  33. package/editor/assets/{agent8-C5k1nTCH.js → agent8-BTODHtdM.js} +1 -1
  34. package/editor/assets/{debug-BT_0mjk-.js → debug-CJEz4EwC.js} +1 -1
  35. package/editor/assets/{index-gfyrByWw.js → index-BYCso8Bf.js} +90 -90
  36. package/editor/index.html +1 -1
  37. package/package.json +1 -1
  38. package/schemas/scene.schema.json +667 -11
  39. package/skills/incanto-audio.md +43 -0
  40. package/skills/incanto-building-2d-games.md +36 -0
  41. package/skills/incanto-hud.md +97 -0
  42. package/skills/incanto-node-reference.md +131 -3
  43. package/skills/incanto-physics-and-input.md +50 -0
  44. package/templates-app/beacon-isle-3d/docs/project-3d-rules.md +40 -19
  45. package/templates-app/beacon-isle-3d/package.json +1 -1
  46. package/templates-app/tps-3d/docs/project-3d-rules.md +41 -19
  47. package/templates-app/tps-3d/package.json +1 -1
  48. package/templates-app/village-quest-3d/docs/project-3d-rules.md +40 -19
  49. package/templates-app/village-quest-3d/package.json +1 -1
@@ -5,15 +5,17 @@ YOU MUST follow these rules EXACTLY when vibe-coding on this Incanto template:
5
5
  manual, version-pinned to what is installed. Start with
6
6
  `incanto-building-3d-games.md`, `incanto-3d-character.md`,
7
7
  `incanto-gameplay-behaviors.md`, `incanto-environment.md` and
8
- `incanto-audio.md` — this template composes all five.
8
+ `incanto-hud.md` — this template composes them —
9
+ and FINISH with `incanto-verifying-your-game.md` (rule 11).
9
10
  2. 🧱 STRUCTURE IS JSON: scenes, nodes, props, assets, input maps and
10
- replication all live in `src/game.scene.json`. Add nodes there (or with
11
+ replication all live in `src/*.scene.json`. Add nodes there (or with
11
12
  `npx incanto-editor`), NOT by constructing them ad-hoc in code.
12
13
  3. 🧠 LOGIC IS BEHAVIORS: gameplay code = small TypeScript Behavior classes,
13
14
  registered with `registerBehavior('Name', Class)` and attached in JSON via
14
15
  `"script": { "name": "Name" }`. Reach for a BUILT-IN gameplay behavior
15
- (Health, Chase, WaveSpawner, DamageOnContact, ScoreKeeper…) before writing
16
- your own — this game's only custom behaviors are `Shoot` and `HudUpdater`.
16
+ before writing your own — this template already uses
17
+ Health, DamageOnContact, Interactable, PathFollow, and its only custom behaviors are
18
+ `VillageDirector`, `GroveDirector` and `SwordStrike`.
17
19
  4. 🔑 UIDS ARE GENERATED: every node uid comes from
18
20
  `import { newUid } from 'incanto'`. NEVER invent readable uid strings.
19
21
  5. 📦 ASSETS ARE DECLARED: `assets` entries need `type` + `url`; reference
@@ -23,21 +25,40 @@ YOU MUST follow these rules EXACTLY when vibe-coding on this Incanto template:
23
25
  (Euler XYZ). Negative gravity falls.
24
26
  7. 🧲 COLLIDERS ARE PROPS: `"collider": { "shape": "box"|"sphere"|"capsule", … }`
25
27
  on a body node — never child shape nodes. Wrong shapes hard-fail at load.
26
- 8. 🖥️ THE HUD IS DOM, NOT NODES: 3D scenes have no 2D `UILayer`/`Label` nodes
27
- (those are `incanto/2d`). The HUD + crosshair + banner are plain HTML in
28
- `index.html`; `HudUpdater` writes the live numbers into them (guarded so
29
- headless runs are a no-op).
30
- 9. 🐛 DEBUG WHEN UNSURE: `physics.debugDraw = true` (the object
31
- `enablePhysics3D` returns) draws every collider in the running game; or boot
32
- with `?incanto_debug=1` for the live Explorer/Inspector/Stats overlay.
28
+ 8. 🖥️ THE HUD IS NODES: this template's HUD lives in the scene as a
29
+ `HudLayer` with `UiText`/`UiBar` children — the engine builds the DOM for
30
+ them and positions them by anchor. Edit the HUD in `*.scene.json` like any
31
+ other node. (A DOM-in-`index.html` HUD is the other valid shape, and what
32
+ `tps-3d` does; both are supported — do not mix them in one screen.)
33
+ 9. 🐛 DEBUG WHEN UNSURE: `VITE_INCANTO_DEBUG=1 bun run dev` adds the ☰ debug
34
+ menu — Explorer/Inspector (click a node, see and edit its live props), Logs,
35
+ Stats and Colliders (every physics shape as a wireframe, drawn by the same
36
+ Rapier the game runs). There is NO `VITE_INCANTO_DEBUG=1` URL toggle: it was
37
+ removed as deploy-unsafe. Never ship the env flag on.
33
38
  10. 🎬 DELTA DISCIPLINE: only write props that differ from defaults — the
34
39
  loader treats unknown/garbage props as hard errors, which is your friend.
35
- 11. ✅ VERIFY LIKE A USER: `bun run check` validates the scene, `bun run verify`
36
- proves the loop headlessly, then `bun run dev` and actually PLAY what you
37
- changed (move, shoot, clear a wave) before declaring it done.
38
- 12. 🔍 X-RAY WHEN IT LOOKS WRONG: `VITE_INCANTO_DEBUG=1 bun run dev` adds a ☰
39
- debug menu — Explorer/Inspector (click a node, see and edit its live props),
40
- Logs, Stats (fps · tris · draw calls) and Colliders (every physics shape as
41
- wireframe). Blocked in mid-air or falling through the floor is a Colliders
42
- question; a mystery frame-rate is a Stats question. Never ship the flag on.
40
+ 11. ✅ VERIFY LIKE A USER, THEN READ THE FOUR SIGNALS. `bun run check` and
41
+ `bun run verify` are the start, not the end — you cannot SEE this game, and
42
+ each of these answers a failure that otherwise looks like nothing at all:
43
+
44
+ | read | it is not clean when |
45
+ | --- | --- |
46
+ | `bunx incanto-check` | the scene will not load, or renders black (no light) |
47
+ | `stats().errors` | something threw and was skipped to keep the game alive |
48
+ | `assetErrors()` | a model or texture 404'd — the thing is simply not there |
49
+ | `framing` | the camera points the wrong way, or nothing is lit |
50
+
51
+ ```bash
52
+ printf 'step 500\nframing\nquit\n' | bunx incanto-play src/game.scene.json
53
+ ```
54
+
55
+ `framing` reports what the camera SEES — on screen / off screen / behind it
56
+ — plus what lights the scene and which colliders intersect. `behind` looks
57
+ exactly like "my model did not load"; nothing else can tell you apart.
58
+ Then `bun run dev` and actually PLAY what you changed.
59
+ 12. 🧯 A THROWN ERROR NO LONGER STOPS THE GAME: a behavior that throws is
60
+ reported once (node, script, phase, file:line) and SKIPPED — your script
61
+ stops, the node it is attached to keeps running, the game plays on. So a
62
+ game that looks fine can still be broken: read `stats().errors`, and
63
+ `engine.resumeErroredNodes()` after you fix it.
43
64
  </userRequest>
@@ -13,7 +13,7 @@
13
13
  "@dimforge/rapier2d-compat": "0.19.3",
14
14
  "@dimforge/rapier3d-compat": "0.19.3",
15
15
  "@pixiv/three-vrm": "^3.5.3",
16
- "incanto": "^0.32.0",
16
+ "incanto": "^0.34.0",
17
17
  "three": "^0.184.0"
18
18
  },
19
19
  "devDependencies": {