incanto 0.32.0 → 0.33.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.
- package/dist/2d.d.ts +59 -2
- package/dist/2d.js +3 -3
- package/dist/3d.d.ts +8 -3
- package/dist/3d.js +4 -4
- package/dist/{behavior-D_jMpFh8.d.ts → behavior-CKwTCjfR.d.ts} +140 -1
- package/dist/{create-game-bKHgHcsZ.js → create-game-D2QU5x7S.js} +13 -6
- package/dist/{create-game-gXI7PYl0.js → create-game-sFuTLqjD.js} +11 -5
- package/dist/debug.d.ts +1 -1
- package/dist/{duplicate-KRPtUtzl.js → duplicate-BgnG1Lqz.js} +1 -1
- package/dist/editor.js +35 -0
- package/dist/{environment-presets--DigHNg4.js → environment-presets-CQtEGogB.js} +2 -2
- package/dist/{gameplay-BftxM_It.js → gameplay-BpQCbABv.js} +90 -2
- package/dist/gameplay.d.ts +1 -1
- package/dist/gameplay.js +1 -1
- package/dist/index.d.ts +125 -23
- package/dist/index.js +5 -58
- package/dist/{loader-BlaRQGaA.js → loader-Buk8Bu1h.js} +53 -0
- package/dist/{loader-BYBrqTxP.d.ts → loader-COn5fS0o.d.ts} +1 -1
- package/dist/net.d.ts +1 -1
- package/dist/net.js +3 -3
- package/dist/{pathfinding-BwhqPD3i.d.ts → pathfinding-DUw9mir9.d.ts} +1 -1
- package/dist/{physics-2d-D9wquBvK.js → physics-2d-DjXR5DMu.js} +12 -2
- package/dist/{physics-3d-CnPygVGo.js → physics-3d-DF8npb1O.js} +55 -9
- package/dist/react.d.ts +1 -1
- package/dist/react.js +1 -1
- package/dist/{register-Dzkd6-os.js → register-CscIzJEO.js} +551 -13
- package/dist/{register-CUY284Is.js → register-CtI-itec.js} +2 -2
- package/dist/{register-tkR_8tWg.js → register-FIJtNbub.js} +145 -8
- package/dist/{test-WwRIlXsK.js → test-BRxLd2jH.js} +10 -10
- package/dist/test.d.ts +2 -2
- package/dist/test.js +1 -1
- package/dist/vite.js +1 -1
- package/editor/assets/{agent8-C5k1nTCH.js → agent8-BdDP3xKW.js} +1 -1
- package/editor/assets/{debug-BT_0mjk-.js → debug-DbjTyTlC.js} +1 -1
- package/editor/assets/{index-gfyrByWw.js → index-BWCudoz1.js} +90 -90
- package/editor/index.html +1 -1
- package/package.json +1 -1
- package/schemas/scene.schema.json +520 -0
- package/skills/incanto-audio.md +43 -0
- package/skills/incanto-building-2d-games.md +36 -0
- package/skills/incanto-hud.md +41 -0
- package/skills/incanto-node-reference.md +89 -0
- package/skills/incanto-physics-and-input.md +50 -0
- package/templates-app/beacon-isle-3d/docs/project-3d-rules.md +40 -19
- package/templates-app/beacon-isle-3d/package.json +1 -1
- package/templates-app/tps-3d/docs/project-3d-rules.md +41 -19
- package/templates-app/tps-3d/package.json +1 -1
- package/templates-app/village-quest-3d/docs/project-3d-rules.md +40 -19
- package/templates-app/village-quest-3d/package.json +1 -1
package/skills/incanto-hud.md
CHANGED
|
@@ -80,3 +80,44 @@ Typewriter reveal at `charsPerSecond` (0 = instant); clicking the box
|
|
|
80
80
|
reveals the line then advances; choice lines render buttons and wait for
|
|
81
81
|
`choose(i)`. Buttons opt into pointer events — the rest of the HUD stays
|
|
82
82
|
click-through.
|
|
83
|
+
|
|
84
|
+
## Menus, options and inventories (UiPanel + the value widgets)
|
|
85
|
+
|
|
86
|
+
The HUD widgets can SAY things. These arrange them and take a value back — which
|
|
87
|
+
is what a title screen, pause menu, options panel, shop and inventory grid are.
|
|
88
|
+
Before them every one of those was hand-rolled DOM, which drops the whole screen
|
|
89
|
+
out of scene JSON, out of the editor, out of `incanto-check` and out of every
|
|
90
|
+
headless check you have.
|
|
91
|
+
|
|
92
|
+
**`UiPanel` is the box.** Widgets normally mount into the HudLayer's anchor slot
|
|
93
|
+
no matter how the tree is shaped; anything under a panel mounts into the PANEL,
|
|
94
|
+
so structure in the tree becomes structure on screen. Panels nest.
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
{ "name": "Pause", "type": "UiPanel",
|
|
98
|
+
"props": { "anchor": "center", "layout": "column", "gap": 12, "padding": 20 },
|
|
99
|
+
"children": [
|
|
100
|
+
{ "name": "Title", "type": "UiText", "props": { "text": "PAUSED", "size": 28 } },
|
|
101
|
+
{ "name": "Volume", "type": "UiSlider", "props": { "label": "volume", "value": 0.8 } },
|
|
102
|
+
{ "name": "Invert", "type": "UiToggle", "props": { "label": "invert Y" } },
|
|
103
|
+
{ "name": "Quality", "type": "UiSelect", "props": { "options": "low,medium,high", "value": "high" } },
|
|
104
|
+
{ "name": "Resume", "type": "UiButton", "props": { "label": "Resume" } }
|
|
105
|
+
] }
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
| node | props | signal |
|
|
109
|
+
| --- | --- | --- |
|
|
110
|
+
| `UiPanel` | `layout` (column/row/**grid**), `columns`, `gap`, `padding`, `background`, `radius`, `width`, `height`, `border` | — |
|
|
111
|
+
| `UiImage` | `src` (url or `$assetKey`), `width`, `height`, `fit`, `tint`, `opacity` | — |
|
|
112
|
+
| `UiSlider` | `label`, `value`, `min`, `max`, `step`, `width`, `color` | `changed(value)` |
|
|
113
|
+
| `UiToggle` | `label`, `value` | `changed(bool)` |
|
|
114
|
+
| `UiSelect` | `label`, `options` (`"low,medium,high"`), `value` | `changed(value)` |
|
|
115
|
+
|
|
116
|
+
**An inventory is a grid panel**: `"layout": "grid", "columns": 5`, one child per
|
|
117
|
+
slot, each a small `UiPanel` holding a `UiImage` (`tint` greys out what you
|
|
118
|
+
cannot afford) — and `Clickable` is on the world node, not the widget; for a
|
|
119
|
+
widget use `UiButton`'s `pressed`.
|
|
120
|
+
|
|
121
|
+
Setting `.value` from a behavior updates the control and does **NOT** re-emit
|
|
122
|
+
`changed` — restoring a saved setting must not fire the handler that saved it.
|
|
123
|
+
|
|
@@ -246,6 +246,17 @@ Signals: `triggerEnter(other)` · `triggerExit(other)`
|
|
|
246
246
|
| `jumpHeight` | `64` | number |
|
|
247
247
|
| `moveAction` | `"move"` | string |
|
|
248
248
|
| `jumpAction` | `"jump"` | string |
|
|
249
|
+
| `coyoteSeconds` | `0` | number |
|
|
250
|
+
| `jumpBufferSeconds` | `0` | number |
|
|
251
|
+
| `jumpCutMultiplier` | `1` | number |
|
|
252
|
+
| `maxJumps` | `1` | number |
|
|
253
|
+
| `dashSpeed` | `0` | number |
|
|
254
|
+
| `dashSeconds` | `0.15` | number |
|
|
255
|
+
| `dashAction` | `"dash"` | string |
|
|
256
|
+
| `wallSlideSpeed` | `0` | number |
|
|
257
|
+
| `wallJumpImpulse` | `[0,0]` | array |
|
|
258
|
+
|
|
259
|
+
Signals: `movementStateChanged(state)`
|
|
249
260
|
|
|
250
261
|
## `CharacterController3D` — `incanto/3d`
|
|
251
262
|
|
|
@@ -958,6 +969,63 @@ Signals: `pressed`
|
|
|
958
969
|
|
|
959
970
|
Signals: `lineShown` · `choiceMade` · `dialogueFinished`
|
|
960
971
|
|
|
972
|
+
## `UiImage` — `incanto`
|
|
973
|
+
|
|
974
|
+
| Prop | Default | Kind |
|
|
975
|
+
|---|---|---|
|
|
976
|
+
| `anchor` | `"topLeft"` | one of: `topLeft` `top` `topRight` `left` `center` `right` `bottomLeft` `bottom` `bottomRight` |
|
|
977
|
+
| `visible` | `true` | boolean |
|
|
978
|
+
| `src` | `""` | string |
|
|
979
|
+
| `width` | `48` | number |
|
|
980
|
+
| `height` | `48` | number |
|
|
981
|
+
| `fit` | `"contain"` | one of: `contain` `cover` `fill` |
|
|
982
|
+
| `tint` | `""` | string |
|
|
983
|
+
| `opacity` | `1` | number |
|
|
984
|
+
|
|
985
|
+
## `UiPanel` — `incanto`
|
|
986
|
+
|
|
987
|
+
| Prop | Default | Kind |
|
|
988
|
+
|---|---|---|
|
|
989
|
+
| `anchor` | `"topLeft"` | one of: `topLeft` `top` `topRight` `left` `center` `right` `bottomLeft` `bottom` `bottomRight` |
|
|
990
|
+
| `visible` | `true` | boolean |
|
|
991
|
+
| `layout` | `"column"` | one of: `column` `row` `grid` |
|
|
992
|
+
| `columns` | `4` | number |
|
|
993
|
+
| `gap` | `8` | number |
|
|
994
|
+
| `padding` | `12` | number |
|
|
995
|
+
| `background` | `"rgba(0,0,0,0.55)"` | string |
|
|
996
|
+
| `radius` | `10` | number |
|
|
997
|
+
| `width` | `0` | number |
|
|
998
|
+
| `height` | `0` | number |
|
|
999
|
+
| `border` | `""` | string |
|
|
1000
|
+
|
|
1001
|
+
## `UiSelect` — `incanto`
|
|
1002
|
+
|
|
1003
|
+
| Prop | Default | Kind |
|
|
1004
|
+
|---|---|---|
|
|
1005
|
+
| `anchor` | `"topLeft"` | one of: `topLeft` `top` `topRight` `left` `center` `right` `bottomLeft` `bottom` `bottomRight` |
|
|
1006
|
+
| `visible` | `true` | boolean |
|
|
1007
|
+
| `label` | `""` | string |
|
|
1008
|
+
| `options` | `""` | string |
|
|
1009
|
+
| `value` | `""` | string |
|
|
1010
|
+
|
|
1011
|
+
Signals: `changed`
|
|
1012
|
+
|
|
1013
|
+
## `UiSlider` — `incanto`
|
|
1014
|
+
|
|
1015
|
+
| Prop | Default | Kind |
|
|
1016
|
+
|---|---|---|
|
|
1017
|
+
| `anchor` | `"topLeft"` | one of: `topLeft` `top` `topRight` `left` `center` `right` `bottomLeft` `bottom` `bottomRight` |
|
|
1018
|
+
| `visible` | `true` | boolean |
|
|
1019
|
+
| `label` | `""` | string |
|
|
1020
|
+
| `value` | `0.5` | number |
|
|
1021
|
+
| `min` | `0` | number |
|
|
1022
|
+
| `max` | `1` | number |
|
|
1023
|
+
| `step` | `0.01` | number |
|
|
1024
|
+
| `width` | `180` | number |
|
|
1025
|
+
| `color` | `"#6ee7dc"` | string |
|
|
1026
|
+
|
|
1027
|
+
Signals: `changed`
|
|
1028
|
+
|
|
961
1029
|
## `UiText` — `incanto`
|
|
962
1030
|
|
|
963
1031
|
| Prop | Default | Kind |
|
|
@@ -969,6 +1037,17 @@ Signals: `lineShown` · `choiceMade` · `dialogueFinished`
|
|
|
969
1037
|
| `color` | `"#ffffff"` | string |
|
|
970
1038
|
| `shadow` | `true` | boolean |
|
|
971
1039
|
|
|
1040
|
+
## `UiToggle` — `incanto`
|
|
1041
|
+
|
|
1042
|
+
| Prop | Default | Kind |
|
|
1043
|
+
|---|---|---|
|
|
1044
|
+
| `anchor` | `"topLeft"` | one of: `topLeft` `top` `topRight` `left` `center` `right` `bottomLeft` `bottom` `bottomRight` |
|
|
1045
|
+
| `visible` | `true` | boolean |
|
|
1046
|
+
| `label` | `""` | string |
|
|
1047
|
+
| `value` | `false` | boolean |
|
|
1048
|
+
|
|
1049
|
+
Signals: `changed`
|
|
1050
|
+
|
|
972
1051
|
## `VoxelGrid3D` — `incanto/3d`
|
|
973
1052
|
|
|
974
1053
|
| Prop | Default | Kind |
|
|
@@ -1084,6 +1163,16 @@ Signals: `submerged` · `surfaced`
|
|
|
1084
1163
|
|
|
1085
1164
|
Signals: `reachedTarget` · `lostTarget`
|
|
1086
1165
|
|
|
1166
|
+
### `Clickable`
|
|
1167
|
+
|
|
1168
|
+
| Prop | Default | Kind |
|
|
1169
|
+
|---|---|---|
|
|
1170
|
+
| `button` | `0` | number |
|
|
1171
|
+
| `maxDistance` | `0` | number |
|
|
1172
|
+
| `enabled` | `true` | boolean |
|
|
1173
|
+
|
|
1174
|
+
Signals: `clicked` · `hovered` · `unhovered`
|
|
1175
|
+
|
|
1087
1176
|
### `Collector`
|
|
1088
1177
|
|
|
1089
1178
|
| Prop | Default | Kind |
|
|
@@ -258,6 +258,56 @@ the tree says, without your scene falling over while you look at it. Use it for
|
|
|
258
258
|
any "show me the collision geometry" tool. Do NOT use it to freeze a running
|
|
259
259
|
game — that is `engine.timeScale = 0`, which keeps the world coherent.
|
|
260
260
|
|
|
261
|
+
## Moving platforms carry their riders (2D **and** 3D)
|
|
262
|
+
|
|
263
|
+
A `CharacterBody2D`/`CharacterBody3D` standing on a body that moves is dragged
|
|
264
|
+
along by however far that body moved — elevators, patrol platforms, conveyors,
|
|
265
|
+
rotating discs. It is what makes a floating-island game work.
|
|
266
|
+
|
|
267
|
+
Author it the obvious way: move the platform's `position` (a behavior, a
|
|
268
|
+
`PathFollow`, an `Oscillate`). Nothing else to declare.
|
|
269
|
+
|
|
270
|
+
The carry stops the moment the character is no longer grounded on it, so walking
|
|
271
|
+
off an edge or jumping is not "sticky", and it is vertical as well as horizontal
|
|
272
|
+
— an elevator lifts you.
|
|
273
|
+
|
|
274
|
+
## The mouse as gameplay input (click, hover)
|
|
275
|
+
|
|
276
|
+
`pointerDelta()` answers "how far did the mouse move" — the mouse-look question.
|
|
277
|
+
For match-3, tower defense, card games, point-and-click and RTS that is the
|
|
278
|
+
wrong question, and it used to be the only one the engine could answer.
|
|
279
|
+
|
|
280
|
+
```ts
|
|
281
|
+
engine.input.pointerPosition(); // { x, y } in CANVAS pixels, or null
|
|
282
|
+
engine.input.mousePressed(0); // 0 left · 1 middle · 2 right
|
|
283
|
+
engine.input.mouseJustPressed(0); // and mouseJustReleased(0)
|
|
284
|
+
game.pick(x, y); // the node under that pixel, or null
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
A stretched canvas is handled: `pointerPosition()` scales client → canvas pixels,
|
|
288
|
+
so the coordinates are the ones `pick()` wants.
|
|
289
|
+
|
|
290
|
+
From scene JSON, the **`Clickable`** behavior needs no code at all:
|
|
291
|
+
|
|
292
|
+
```json
|
|
293
|
+
{ "name": "Tile", "type": "MeshInstance3D", "script": { "name": "Clickable" } }
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
| prop | default | |
|
|
297
|
+
| --- | --- | --- |
|
|
298
|
+
| `button` | `0` | 0 left · 1 middle · 2 right |
|
|
299
|
+
| `maxDistance` | `0` | ignore clicks further than this (0 = any) |
|
|
300
|
+
| `enabled` | `true` | stop responding without detaching |
|
|
301
|
+
|
|
302
|
+
Signals: **`clicked`**, **`hovered`**, **`unhovered`** — wire them in
|
|
303
|
+
`connections` like any other. `clicked` fires on RELEASE over the same node the
|
|
304
|
+
press started on (a drag that ends elsewhere is not a click, the way every
|
|
305
|
+
button on every platform behaves), and a hit on a CHILD counts as a hit on the
|
|
306
|
+
node — the raycast lands on the visual mesh, which is usually a child.
|
|
307
|
+
|
|
308
|
+
Headless there is no renderer and therefore no raycast: `Clickable` is inert
|
|
309
|
+
rather than wrong, and `engine.picker` is null.
|
|
310
|
+
|
|
261
311
|
## Placement rules
|
|
262
312
|
|
|
263
313
|
`CharacterController2D` MUST be a direct child of a `CharacterBody2D` — the
|
|
@@ -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-
|
|
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
|
|
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
|
-
|
|
16
|
-
|
|
16
|
+
before writing your own — this template already uses
|
|
17
|
+
Health, DamageOnContact, Interactable, PathFollow, DayNight, and its only custom behaviors are
|
|
18
|
+
`IsleDirector` 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
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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>
|
|
@@ -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
|
|
8
|
+
`incanto-audio.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
|
|
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
|
-
|
|
16
|
-
|
|
16
|
+
before writing your own — this template already uses
|
|
17
|
+
Health, DamageOnContact, Chase, WaveSpawner, ScoreKeeper, and its only custom behaviors are
|
|
18
|
+
`Shoot` and `HudUpdater`.
|
|
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,41 @@ 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
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
8. 🖥️ THE HUD IS DOM HERE: this template's HUD, crosshair and banner are
|
|
29
|
+
plain HTML in `index.html`, and `HudUpdater` writes the live numbers into
|
|
30
|
+
them (guarded, so headless runs are a no-op). That is a CHOICE, not a
|
|
31
|
+
limit — `HudLayer` + `UiText`/`UiBar` nodes work in 3D scenes too (see
|
|
32
|
+
`incanto-hud.md`, and the `beacon-isle-3d` template). Do not mix them in
|
|
33
|
+
one screen.
|
|
34
|
+
9. 🐛 DEBUG WHEN UNSURE: `VITE_INCANTO_DEBUG=1 bun run dev` adds the ☰ debug
|
|
35
|
+
menu — Explorer/Inspector (click a node, see and edit its live props), Logs,
|
|
36
|
+
Stats and Colliders (every physics shape as a wireframe, drawn by the same
|
|
37
|
+
Rapier the game runs). There is NO `VITE_INCANTO_DEBUG=1` URL toggle: it was
|
|
38
|
+
removed as deploy-unsafe. Never ship the env flag on.
|
|
33
39
|
10. 🎬 DELTA DISCIPLINE: only write props that differ from defaults — the
|
|
34
40
|
loader treats unknown/garbage props as hard errors, which is your friend.
|
|
35
|
-
11. ✅ VERIFY LIKE A USER
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
11. ✅ VERIFY LIKE A USER, THEN READ THE FOUR SIGNALS. `bun run check` and
|
|
42
|
+
`bun run verify` are the start, not the end — you cannot SEE this game, and
|
|
43
|
+
each of these answers a failure that otherwise looks like nothing at all:
|
|
44
|
+
|
|
45
|
+
| read | it is not clean when |
|
|
46
|
+
| --- | --- |
|
|
47
|
+
| `bunx incanto-check` | the scene will not load, or renders black (no light) |
|
|
48
|
+
| `stats().errors` | something threw and was skipped to keep the game alive |
|
|
49
|
+
| `assetErrors()` | a model or texture 404'd — the thing is simply not there |
|
|
50
|
+
| `framing` | the camera points the wrong way, or nothing is lit |
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
printf 'step 500\nframing\nquit\n' | bunx incanto-play src/game.scene.json
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
`framing` reports what the camera SEES — on screen / off screen / behind it
|
|
57
|
+
— plus what lights the scene and which colliders intersect. `behind` looks
|
|
58
|
+
exactly like "my model did not load"; nothing else can tell you apart.
|
|
59
|
+
Then `bun run dev` and actually PLAY what you changed.
|
|
60
|
+
12. 🧯 A THROWN ERROR NO LONGER STOPS THE GAME: a behavior that throws is
|
|
61
|
+
reported once (node, script, phase, file:line) and SKIPPED — your script
|
|
62
|
+
stops, the node it is attached to keeps running, the game plays on. So a
|
|
63
|
+
game that looks fine can still be broken: read `stats().errors`, and
|
|
64
|
+
`engine.resumeErroredNodes()` after you fix it.
|
|
43
65
|
</userRequest>
|
|
@@ -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-
|
|
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
|
|
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
|
-
|
|
16
|
-
|
|
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
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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>
|