incanto 0.56.0 → 0.58.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/README.md +6 -4
- package/bin/incanto-check.mjs +27 -0
- package/bin/incanto-new.mjs +29 -7
- package/bin/incanto-playtest.mjs +28 -2
- package/bin/incanto-verify.mjs +96 -17
- package/bin/incanto.mjs +106 -0
- package/dist/2d.d.ts +59 -7
- package/dist/2d.js +3 -3
- package/dist/3d.d.ts +34 -4
- package/dist/3d.js +5 -5
- package/dist/{behavior-CyQoSu4n.d.ts → behavior-l08AEbq9.d.ts} +5 -0
- package/dist/{create-game-YvaNWhe6.js → create-game-BZwWJIns.js} +146 -7
- package/dist/{create-game-CqJkfMzm.js → create-game-D10bU5_J.js} +83 -78
- package/dist/debug.d.ts +1 -1
- package/dist/{duplicate-MNLMAcbz.js → duplicate-BPLZDZpd.js} +1 -1
- package/dist/{environment-presets-DLHqgNAF.js → environment-presets-CvvQr_bJ.js} +106 -24
- package/dist/{frame-report-njybhZon.js → frame-report-BSMny7oe.js} +1 -1
- package/dist/{frame-report-DZ70IY26.d.ts → frame-report-DCnHFmto.d.ts} +1 -1
- package/dist/{gameplay-C_SPzmUe.js → gameplay-BVphcxmE.js} +89 -13
- package/dist/gameplay.d.ts +26 -1
- package/dist/gameplay.js +1 -1
- package/dist/index.d.ts +45 -5
- package/dist/index.js +8 -9
- package/dist/{loader-DhI1jFW_.d.ts → loader-BbEMTuWg.d.ts} +1 -1
- package/dist/{loader-BTkHYrQn.js → loader-BcrRSjxB.js} +682 -682
- package/dist/net.d.ts +2 -2
- package/dist/net.js +1 -1
- package/dist/{pathfinding-CXGCpRQe.d.ts → pathfinding-mEN4V1CU.d.ts} +1 -1
- package/dist/{physics-2d-CfWAggJ1.js → physics-2d-EqA-jddf.js} +4 -3
- package/dist/{physics-3d-NzDwWPrF.js → physics-3d-Dnz4fsXX.js} +5 -4
- package/dist/quiet-rapier-BAJ4K94N.js +46 -0
- package/dist/react.d.ts +1 -1
- package/dist/react.js +1 -1
- package/dist/{register-en63AEZO.js → register-C6ZBFRjd.js} +63 -60
- package/dist/{register-p48lHE2o.js → register-Ch70uByv.js} +1615 -1502
- package/dist/{replay-ePMz26jw.d.ts → replay-Dw6gMlYA.d.ts} +1 -1
- package/dist/{replay-t1pP0gQg.js → replay-s7I2GstT.js} +31 -11
- package/dist/sheet-grid-BT6N_Bjs.js +59 -0
- package/dist/{split-screen-BsdOHbzP.d.ts → split-screen-B0baBwxI.d.ts} +5 -1
- package/dist/{split-screen-CSb_uZ6W.js → split-screen-DLsUrleX.js} +14 -3
- package/dist/{sprite-animation-7qvUxF6Z.js → sprite-animation-C0wXLBZJ.js} +8 -4
- package/dist/{src-51GA-9m-.js → src-C1J09Op6.js} +55 -2
- package/dist/{teardown-C7uVSJvx.js → teardown-Cs113S9F.js} +74 -2
- package/dist/{test-Bu6SPNsV.js → test-ZBga8kQ9.js} +60 -25
- package/dist/test.d.ts +5 -5
- package/dist/test.js +2 -2
- package/dist/{touch-BnMyy9tr.js → touch-DESwnpOc.js} +173 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +3 -3
- package/editor/assets/{agent8-X0Nesj-k.js → agent8-BQQjE9UQ.js} +1 -1
- package/editor/assets/{debug-TXqu-ftX.js → debug-C9UCsXBS.js} +1 -1
- package/editor/assets/{index-DTdwKKIv.js → index-CBgfM3WD.js} +62 -62
- package/editor/index.html +1 -1
- package/package.json +2 -1
- package/skills/incanto-assets.md +5 -1
- package/skills/incanto-audio.md +7 -1
- package/skills/incanto-building-2d-games.md +13 -0
- package/skills/incanto-building-3d-games.md +3 -3
- package/skills/incanto-gameplay-behaviors.md +2 -1
- package/skills/incanto-hud.md +6 -0
- package/skills/incanto-performance.md +5 -0
- package/skills/incanto-physics-and-input.md +14 -0
- package/skills/incanto-playtesting.md +19 -5
- package/skills/incanto-save-slots.md +2 -1
- package/skills/incanto-verifying-your-game.md +15 -4
- package/templates-app/beacon-isle-3d/package.json +1 -1
- package/templates-app/beacon-isle-3d/src/game.scene.json +7 -6
- package/templates-app/platformer-2d/PROJECT/Context.md +70 -0
- package/templates-app/platformer-2d/PROJECT/Requirements.md +63 -0
- package/templates-app/platformer-2d/PROJECT/Status.md +60 -0
- package/templates-app/platformer-2d/PROJECT/Structure.md +77 -0
- package/templates-app/platformer-2d/docs/project-2d-rules.md +61 -0
- package/templates-app/platformer-2d/index.html +99 -0
- package/templates-app/platformer-2d/package.json +23 -0
- package/templates-app/platformer-2d/src/behaviors.ts +541 -0
- package/templates-app/platformer-2d/src/game.scene.json +2061 -0
- package/templates-app/platformer-2d/src/main.ts +68 -0
- package/templates-app/platformer-2d/tsconfig.json +13 -0
- package/templates-app/platformer-2d/verify.ts +275 -0
- package/templates-app/platformer-2d/vite.config.ts +12 -0
- package/templates-app/star-survivor/PROJECT/Context.md +55 -0
- package/templates-app/star-survivor/PROJECT/Requirements.md +47 -0
- package/templates-app/star-survivor/PROJECT/Status.md +44 -0
- package/templates-app/star-survivor/PROJECT/Structure.md +63 -0
- package/templates-app/star-survivor/docs/project-2d-rules.md +53 -0
- package/templates-app/star-survivor/index.html +232 -0
- package/templates-app/star-survivor/package.json +23 -0
- package/templates-app/star-survivor/src/behaviors.ts +624 -0
- package/templates-app/star-survivor/src/game.scene.json +464 -0
- package/templates-app/star-survivor/src/main.ts +49 -0
- package/templates-app/star-survivor/tsconfig.json +13 -0
- package/templates-app/star-survivor/verify.ts +193 -0
- package/templates-app/star-survivor/vite.config.ts +12 -0
- package/templates-app/tps-3d/package.json +1 -1
- package/templates-app/tps-3d/src/game.scene.json +6 -3
- package/templates-app/tps-3d/verify.ts +17 -1
- package/templates-app/village-quest-3d/package.json +1 -1
- package/templates-app/village-quest-3d/src/grove.scene.json +14 -13
- package/templates-app/village-quest-3d/src/village.scene.json +5 -5
- package/dist/log-report-CPFm4OXf.js +0 -173
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<userRequest>
|
|
2
|
+
YOU MUST follow these rules EXACTLY when vibe-coding on this Incanto template
|
|
3
|
+
(Castle Run — a 2D adventure platformer):
|
|
4
|
+
|
|
5
|
+
1. 📖 READ THE SKILLS FIRST: `node_modules/incanto/skills/` is the engine
|
|
6
|
+
manual, version-pinned to what is installed. Start with
|
|
7
|
+
`incanto-building-2d-games.md` and `incanto-scene-json-authoring.md`, then
|
|
8
|
+
`incanto-gameplay-behaviors.md` (Pickup/Patrol/Oscillate/ScoreKeeper) and
|
|
9
|
+
`incanto-physics-and-input.md` (2D bodies, the input map, units).
|
|
10
|
+
2. 🧱 STRUCTURE IS JSON: scenes, nodes, props, assets, input maps and
|
|
11
|
+
connections all live in `src/game.scene.json`. Add level geometry there (or
|
|
12
|
+
with `npx incanto-editor`), NOT by constructing nodes ad-hoc in code.
|
|
13
|
+
3. 🧠 LOGIC IS BEHAVIORS: prefer a BUILT-IN behavior over custom code (Pickup
|
|
14
|
+
coins/gems, Patrol goblins + the moving platform, Oscillate the lift +
|
|
15
|
+
bobbing pickups, ScoreKeeper score/lives/win-lose, AudioPlayer SFX — all
|
|
16
|
+
wired in JSON). Custom code = small TypeScript Behavior classes registered via
|
|
17
|
+
`createGame2D({ behaviors })` and attached with `"script": { "name": "Name" }`.
|
|
18
|
+
This game's custom behaviors are the platformer GAME FEEL the library leaves
|
|
19
|
+
open: `PlayerController` (coyote-time, jump-buffer, double-jump, variable jump
|
|
20
|
+
height, stomp, knockback, hearts+lives, checkpoint respawn, moving-platform
|
|
21
|
+
carry), `GoblinSkin`, `FollowCam` (follow + screen-shake), `ParallaxLayer`,
|
|
22
|
+
`HudUpdater`.
|
|
23
|
+
4. 🔑 UIDS ARE GENERATED: omit `uid` and the loader assigns one (via the engine's
|
|
24
|
+
`newUid`). NEVER hand-invent readable uid strings.
|
|
25
|
+
5. 📦 ASSETS ARE DECLARED: `assets` entries need `type` + `url`; reference them as
|
|
26
|
+
`"$key"`. The knight + goblin sheets and the coin + gem textures are BUILT-INS
|
|
27
|
+
(`incanto/assets/...`) imported in `main.ts` and injected into the asset url
|
|
28
|
+
placeholders before boot. Free extra key-values are preserved — use them for
|
|
29
|
+
notes (frame ranges, license, source).
|
|
30
|
+
6. ⬇️ Y IS DOWN: 2D space is y-down pixels, (0,0) top-left, clockwise degrees.
|
|
31
|
+
Positive gravity falls (`physics.gravity` is `[0, 1800]`). Up is NEGATIVE
|
|
32
|
+
velocity; a jump subtracts y.
|
|
33
|
+
7. 🧲 COLLIDERS ARE PROPS: `"collider": { "shape": "rect"|"circle"|"capsule", … }`
|
|
34
|
+
on a body node — never child shape nodes. Wrong shapes hard-fail at load.
|
|
35
|
+
7b. 🦶 STAND THE FEET ON THE GROUND: a sprite-sheet `anchor` is the artist's pivot
|
|
36
|
+
(hip/centre), NOT the feet, and the frame has transparent padding below the art —
|
|
37
|
+
so a character will FLOAT unless you align it. MEASURE the feet (bottom opaque row
|
|
38
|
+
÷ frame height) and set `anchor.y` so the visible feet sit at the collider bottom
|
|
39
|
+
(here the knight is `0.464`, goblins `0.348`, not the sheet's ~0.61). See
|
|
40
|
+
`incanto-building-2d-games.md` → AnimatedSprite2D "stand the feet on the ground".
|
|
41
|
+
8. 🎯 DAMAGE IS CENTRALISED + GROUP-DRIVEN: the player takes NO built-in Health —
|
|
42
|
+
`PlayerController` owns hearts/lives and resolves ALL contact by AABB against
|
|
43
|
+
GROUPS each frame, so there's one authority and never a stomp-vs-damage
|
|
44
|
+
double-trigger. Tag content with groups: `enemy` (stompable from above, hurts
|
|
45
|
+
on the side), `hazard` (spikes → lose a heart), `pit` (death plane → instant
|
|
46
|
+
life loss), `checkpoint` (sets respawn), `goal` (win), `platform` (a moving
|
|
47
|
+
body the Feet sensor rides). Add an enemy/hazard = add the node in the right
|
|
48
|
+
group; no wiring needed.
|
|
49
|
+
9. 🐛 DEBUG WHEN UNSURE: `createGame2D({ debug: true })` (or `VITE_INCANTO_DEBUG=1`)
|
|
50
|
+
shows the Explorer/Inspector/Stats; `physics.debugDraw = true` draws colliders.
|
|
51
|
+
10. 🎬 DELTA DISCIPLINE: only write props that differ from defaults — the loader
|
|
52
|
+
treats unknown/garbage props as hard errors, which is your friend.
|
|
53
|
+
11. 🧭 ENGINE ACCESS IS DEFERRED: `this.engine` is NOT available in `onReady`
|
|
54
|
+
during `loadScene` (the scene isn't attached yet) — read scene config
|
|
55
|
+
(gravity, etc.) lazily on the first `fixedUpdate`. `getNode`/signals are fine
|
|
56
|
+
in `onReady`.
|
|
57
|
+
12. ✅ VERIFY LIKE A USER: `bun run check` (scene valid) → `bun run verify`
|
|
58
|
+
(headless run/jump/coin/stomp/checkpoint/win/lose proof) → `bun run dev`,
|
|
59
|
+
open the browser, and actually PLAY what you changed (run, double-jump, stomp
|
|
60
|
+
a goblin, ride the lift, die and respawn at the flag) before declaring done.
|
|
61
|
+
</userRequest>
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><rect width=%22100%22 height=%22100%22 rx=%2220%22 fill=%22%236ee7dc%22/><text x=%2250%22 y=%2268%22 font-size=%2255%22 text-anchor=%22middle%22 font-family=%22Arial%22 font-weight=%22bold%22 fill=%22%230b0d14%22>in</text></svg>" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
|
|
7
|
+
<title>Castle Run — Incanto platformer</title>
|
|
8
|
+
<style>
|
|
9
|
+
html,
|
|
10
|
+
body {
|
|
11
|
+
margin: 0;
|
|
12
|
+
padding: 0;
|
|
13
|
+
height: 100%;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
font-family: Arial, sans-serif;
|
|
16
|
+
background: #6aa9cf;
|
|
17
|
+
}
|
|
18
|
+
canvas {
|
|
19
|
+
display: block;
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 100%;
|
|
22
|
+
}
|
|
23
|
+
.loading-container {
|
|
24
|
+
position: fixed;
|
|
25
|
+
inset: 0;
|
|
26
|
+
z-index: 50;
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
background: #6aa9cf;
|
|
32
|
+
color: white;
|
|
33
|
+
}
|
|
34
|
+
.loading-title {
|
|
35
|
+
font-size: 1.5rem;
|
|
36
|
+
font-weight: bold;
|
|
37
|
+
margin-bottom: 1rem;
|
|
38
|
+
}
|
|
39
|
+
.spinner {
|
|
40
|
+
width: 30px;
|
|
41
|
+
height: 30px;
|
|
42
|
+
border: 3px solid rgba(255, 255, 255, 0.3);
|
|
43
|
+
border-radius: 50%;
|
|
44
|
+
border-top-color: white;
|
|
45
|
+
animation: spin 1s ease-in-out infinite;
|
|
46
|
+
}
|
|
47
|
+
@keyframes spin {
|
|
48
|
+
to {
|
|
49
|
+
transform: rotate(360deg);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
.round-btn {
|
|
53
|
+
position: fixed;
|
|
54
|
+
bottom: 2rem;
|
|
55
|
+
right: 2rem;
|
|
56
|
+
z-index: 1001;
|
|
57
|
+
width: 88px;
|
|
58
|
+
height: 88px;
|
|
59
|
+
border: none;
|
|
60
|
+
border-radius: 9999px;
|
|
61
|
+
background: rgba(255, 209, 102, 0.45);
|
|
62
|
+
color: #1d2a44;
|
|
63
|
+
font-weight: bold;
|
|
64
|
+
font-size: 0.9rem;
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
user-select: none;
|
|
67
|
+
-webkit-user-select: none;
|
|
68
|
+
touch-action: none;
|
|
69
|
+
transition: transform 0.1s;
|
|
70
|
+
}
|
|
71
|
+
.round-btn:active {
|
|
72
|
+
transform: scale(0.9);
|
|
73
|
+
}
|
|
74
|
+
</style>
|
|
75
|
+
</head>
|
|
76
|
+
<body>
|
|
77
|
+
<div class="loading-container" id="loading">
|
|
78
|
+
<h2 class="loading-title">Castle Run</h2>
|
|
79
|
+
<div class="spinner"></div>
|
|
80
|
+
</div>
|
|
81
|
+
<canvas id="game"></canvas>
|
|
82
|
+
<button type="button" id="btn-jump" class="round-btn">JUMP</button>
|
|
83
|
+
<script>
|
|
84
|
+
// agent8 embed harness: report the game size to a hosting iframe parent.
|
|
85
|
+
function postGameSize() {
|
|
86
|
+
window.parent.postMessage(
|
|
87
|
+
{ type: 'GAME_SIZE_RESPONSE', width: document.body.scrollWidth, height: document.body.scrollHeight },
|
|
88
|
+
'*',
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
window.addEventListener('load', postGameSize);
|
|
92
|
+
window.addEventListener('resize', postGameSize);
|
|
93
|
+
window.addEventListener('message', (e) => {
|
|
94
|
+
if (e.data && e.data.type === 'REQUEST_GAME_SIZE') postGameSize();
|
|
95
|
+
});
|
|
96
|
+
</script>
|
|
97
|
+
<script type="module" src="/src/main.ts"></script>
|
|
98
|
+
</body>
|
|
99
|
+
</html>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "platformer-2d",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "vite",
|
|
7
|
+
"build": "vite build",
|
|
8
|
+
"typecheck": "tsc --noEmit",
|
|
9
|
+
"check": "incanto-check src",
|
|
10
|
+
"verify": "bun verify.ts"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@dimforge/rapier2d-compat": "0.19.3",
|
|
14
|
+
"incanto": "^0.58.0",
|
|
15
|
+
"three": "^0.184.0"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/node": "^24.0.0",
|
|
19
|
+
"@types/three": "^0.184.1",
|
|
20
|
+
"typescript": "^6.0.3",
|
|
21
|
+
"vite": "^8.0.16"
|
|
22
|
+
}
|
|
23
|
+
}
|