create-threenative 0.2.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 +16 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +283 -0
- package/dist/threenative.d.ts +6 -0
- package/dist/threenative.js +757 -0
- package/package.json +44 -0
- package/templates/action-rpg/.mcp.json +16 -0
- package/templates/action-rpg/AGENTS.md +40 -0
- package/templates/action-rpg/CLAUDE.md +42 -0
- package/templates/action-rpg/index.html +13 -0
- package/templates/action-rpg/kit.json +7 -0
- package/templates/action-rpg/package.json +47 -0
- package/templates/action-rpg/playtests/combat.playtest.json +61 -0
- package/templates/action-rpg/playtests/fail.playtest.json +21 -0
- package/templates/action-rpg/playtests/inventory.playtest.json +111 -0
- package/templates/action-rpg/playtests/progress.playtest.json +99 -0
- package/templates/action-rpg/playtests/survives.playtest.json +32 -0
- package/templates/action-rpg/playtests/win.playtest.json +30 -0
- package/templates/action-rpg/public/favicon.svg +5 -0
- package/templates/action-rpg/src/abilities/Ability.ts +45 -0
- package/templates/action-rpg/src/entities/Enemy.ts +143 -0
- package/templates/action-rpg/src/entities/Player.ts +83 -0
- package/templates/action-rpg/src/game.ts +40 -0
- package/templates/action-rpg/src/items/Inventory.ts +163 -0
- package/templates/action-rpg/src/loot/drops.ts +40 -0
- package/templates/action-rpg/src/main.ts +15 -0
- package/templates/action-rpg/src/physics.ts +40 -0
- package/templates/action-rpg/src/playtest-events.ts +15 -0
- package/templates/action-rpg/src/progress.ts +35 -0
- package/templates/action-rpg/src/render/camera.ts +26 -0
- package/templates/action-rpg/src/render/lighting.ts +30 -0
- package/templates/action-rpg/src/render/loading.ts +90 -0
- package/templates/action-rpg/src/render/materials.ts +40 -0
- package/templates/action-rpg/src/render/palette.ts +9 -0
- package/templates/action-rpg/src/render/postprocessing.ts +18 -0
- package/templates/action-rpg/src/render/shapes.ts +110 -0
- package/templates/action-rpg/src/render/sky.ts +18 -0
- package/templates/action-rpg/src/render/types.ts +3 -0
- package/templates/action-rpg/src/scenes/Boot.ts +12 -0
- package/templates/action-rpg/src/scenes/Play.ts +449 -0
- package/templates/action-rpg/src/state.ts +40 -0
- package/templates/action-rpg/src/stats/StatBlock.ts +57 -0
- package/templates/action-rpg/src/style.css +32 -0
- package/templates/action-rpg/src/ui/AbilityBar.tsx +28 -0
- package/templates/action-rpg/src/ui/App.tsx +21 -0
- package/templates/action-rpg/src/ui/CharacterPanel.tsx +31 -0
- package/templates/action-rpg/src/ui/Hud.tsx +29 -0
- package/templates/action-rpg/src/ui/InventoryPanel.tsx +37 -0
- package/templates/action-rpg/tailwind.config.ts +7 -0
- package/templates/action-rpg/threenative.config.ts +29 -0
- package/templates/action-rpg/tsconfig.json +17 -0
- package/templates/action-rpg/vite.config.ts +8 -0
- package/templates/defense/.mcp.json +16 -0
- package/templates/defense/AGENTS.md +53 -0
- package/templates/defense/CLAUDE.md +55 -0
- package/templates/defense/README.md +9 -0
- package/templates/defense/index.html +13 -0
- package/templates/defense/kit.json +7 -0
- package/templates/defense/package.json +46 -0
- package/templates/defense/playtests/leak.playtest.json +18 -0
- package/templates/defense/playtests/placement.playtest.json +40 -0
- package/templates/defense/playtests/scan.playtest.json +20 -0
- package/templates/defense/playtests/survive.playtest.json +26 -0
- package/templates/defense/playtests/survives.playtest.json +36 -0
- package/templates/defense/public/favicon.svg +5 -0
- package/templates/defense/src/attackers/Attacker.ts +104 -0
- package/templates/defense/src/board/Route.ts +80 -0
- package/templates/defense/src/economy.ts +36 -0
- package/templates/defense/src/entities/Player.ts +44 -0
- package/templates/defense/src/game.ts +30 -0
- package/templates/defense/src/main.ts +15 -0
- package/templates/defense/src/physics.ts +43 -0
- package/templates/defense/src/placement/Buildable.ts +49 -0
- package/templates/defense/src/playtest-events.ts +15 -0
- package/templates/defense/src/render/camera.ts +10 -0
- package/templates/defense/src/render/lighting.ts +32 -0
- package/templates/defense/src/render/loading.ts +89 -0
- package/templates/defense/src/render/materials.ts +13 -0
- package/templates/defense/src/render/palette.ts +21 -0
- package/templates/defense/src/render/postprocessing.ts +14 -0
- package/templates/defense/src/render/shapes.ts +89 -0
- package/templates/defense/src/render/sky.ts +45 -0
- package/templates/defense/src/scenes/Boot.ts +12 -0
- package/templates/defense/src/scenes/Defense.ts +165 -0
- package/templates/defense/src/state.ts +50 -0
- package/templates/defense/src/style.css +32 -0
- package/templates/defense/src/towers/Tower.ts +96 -0
- package/templates/defense/src/towers/targeting.ts +53 -0
- package/templates/defense/src/ui/App.tsx +17 -0
- package/templates/defense/src/ui/Hud.tsx +61 -0
- package/templates/defense/src/ui/Menu.tsx +7 -0
- package/templates/defense/src/waves.ts +40 -0
- package/templates/defense/tailwind.config.ts +1 -0
- package/templates/defense/threenative.config.ts +29 -0
- package/templates/defense/tsconfig.json +17 -0
- package/templates/defense/vite.config.ts +5 -0
- package/templates/minimal/.mcp.json +16 -0
- package/templates/minimal/AGENTS.md +400 -0
- package/templates/minimal/CLAUDE.md +402 -0
- package/templates/minimal/assets/.gitkeep +0 -0
- package/templates/minimal/index.html +14 -0
- package/templates/minimal/kit.json +7 -0
- package/templates/minimal/package.json +40 -0
- package/templates/minimal/playtests/play.playtest.json +32 -0
- package/templates/minimal/playtests/survives.playtest.json +32 -0
- package/templates/minimal/public/.gitkeep +0 -0
- package/templates/minimal/public/favicon.svg +4 -0
- package/templates/minimal/public/icon.png +0 -0
- package/templates/minimal/src/entities/Player.ts +66 -0
- package/templates/minimal/src/game.ts +28 -0
- package/templates/minimal/src/main.ts +17 -0
- package/templates/minimal/src/render/camera.ts +11 -0
- package/templates/minimal/src/render/hud.ts +53 -0
- package/templates/minimal/src/render/lighting.ts +46 -0
- package/templates/minimal/src/render/loading.ts +113 -0
- package/templates/minimal/src/render/materials.ts +16 -0
- package/templates/minimal/src/render/palette.ts +9 -0
- package/templates/minimal/src/render/postprocessing.ts +20 -0
- package/templates/minimal/src/render/sky.ts +41 -0
- package/templates/minimal/src/scenes/Boot.ts +5 -0
- package/templates/minimal/src/scenes/Play.ts +65 -0
- package/templates/minimal/src/state.ts +1 -0
- package/templates/minimal/src/style.css +41 -0
- package/templates/minimal/threenative.config.ts +32 -0
- package/templates/minimal/tsconfig.json +16 -0
- package/templates/minimal/vite.config.ts +3 -0
- package/templates/platformer/.mcp.json +16 -0
- package/templates/platformer/AGENTS.md +199 -0
- package/templates/platformer/CLAUDE.md +201 -0
- package/templates/platformer/assets/.gitkeep +0 -0
- package/templates/platformer/index.html +13 -0
- package/templates/platformer/kit.json +7 -0
- package/templates/platformer/package.json +50 -0
- package/templates/platformer/playtests/avoidance.playtest.json +23 -0
- package/templates/platformer/playtests/buffer.playtest.json +17 -0
- package/templates/platformer/playtests/chase.playtest.json +21 -0
- package/templates/platformer/playtests/collect.playtest.json +56 -0
- package/templates/platformer/playtests/collision-layers.playtest.json +36 -0
- package/templates/platformer/playtests/coyote.playtest.json +21 -0
- package/templates/platformer/playtests/damage.playtest.json +31 -0
- package/templates/platformer/playtests/dash.playtest.json +21 -0
- package/templates/platformer/playtests/jump.playtest.json +21 -0
- package/templates/platformer/playtests/oneway.playtest.json +17 -0
- package/templates/platformer/playtests/patrol.playtest.json +13 -0
- package/templates/platformer/playtests/performance.playtest.json +21 -0
- package/templates/platformer/playtests/physics.playtest.json +14 -0
- package/templates/platformer/playtests/respawn.playtest.json +31 -0
- package/templates/platformer/playtests/stomp-rise.playtest.json +41 -0
- package/templates/platformer/playtests/stomp.playtest.json +34 -0
- package/templates/platformer/playtests/survives.playtest.json +32 -0
- package/templates/platformer/playtests/terminal-loop-fail.playtest.json +29 -0
- package/templates/platformer/playtests/terminal-loop-win.playtest.json +52 -0
- package/templates/platformer/public/.gitkeep +0 -0
- package/templates/platformer/public/favicon.svg +4 -0
- package/templates/platformer/public/icon.png +0 -0
- package/templates/platformer/src/entities/Character.ts +218 -0
- package/templates/platformer/src/entities/Chaser.ts +118 -0
- package/templates/platformer/src/entities/Patrol.ts +88 -0
- package/templates/platformer/src/entities/Pickup.ts +72 -0
- package/templates/platformer/src/game.ts +27 -0
- package/templates/platformer/src/level/Checkpoints.ts +66 -0
- package/templates/platformer/src/level/Platform.ts +34 -0
- package/templates/platformer/src/main.ts +14 -0
- package/templates/platformer/src/playtest-events.ts +15 -0
- package/templates/platformer/src/render/camera.ts +8 -0
- package/templates/platformer/src/render/lighting.ts +38 -0
- package/templates/platformer/src/render/loading.ts +113 -0
- package/templates/platformer/src/render/materials.ts +11 -0
- package/templates/platformer/src/render/palette.ts +54 -0
- package/templates/platformer/src/render/postprocessing.ts +18 -0
- package/templates/platformer/src/render/rig.ts +60 -0
- package/templates/platformer/src/render/sky.ts +47 -0
- package/templates/platformer/src/render/terrain.ts +31 -0
- package/templates/platformer/src/render/touch-controls.ts +157 -0
- package/templates/platformer/src/render/touch-layout.ts +63 -0
- package/templates/platformer/src/scenes/Boot.ts +12 -0
- package/templates/platformer/src/scenes/Level.ts +176 -0
- package/templates/platformer/src/state.ts +23 -0
- package/templates/platformer/src/style.css +31 -0
- package/templates/platformer/src/ui/App.tsx +17 -0
- package/templates/platformer/src/ui/Hud.tsx +41 -0
- package/templates/platformer/src/ui/Menu.tsx +7 -0
- package/templates/platformer/tailwind.config.ts +2 -0
- package/templates/platformer/threenative.config.ts +32 -0
- package/templates/platformer/tsconfig.json +17 -0
- package/templates/platformer/vite.config.ts +5 -0
- package/templates/racing/.mcp.json +16 -0
- package/templates/racing/AGENTS.md +48 -0
- package/templates/racing/CLAUDE.md +50 -0
- package/templates/racing/index.html +13 -0
- package/templates/racing/kit.json +7 -0
- package/templates/racing/package.json +46 -0
- package/templates/racing/playtests/boost.playtest.json +45 -0
- package/templates/racing/playtests/outcome.playtest.json +78 -0
- package/templates/racing/playtests/ranking.playtest.json +37 -0
- package/templates/racing/playtests/rescue.playtest.json +28 -0
- package/templates/racing/playtests/reverse.playtest.json +37 -0
- package/templates/racing/playtests/shortcut.playtest.json +44 -0
- package/templates/racing/playtests/survives.playtest.json +32 -0
- package/templates/racing/public/favicon.svg +6 -0
- package/templates/racing/src/entities/RacingCar.ts +114 -0
- package/templates/racing/src/entities/Rival.ts +46 -0
- package/templates/racing/src/game.ts +29 -0
- package/templates/racing/src/kart/boost.ts +38 -0
- package/templates/racing/src/main.ts +15 -0
- package/templates/racing/src/playtest-events.ts +15 -0
- package/templates/racing/src/render/camera.ts +28 -0
- package/templates/racing/src/render/lighting.ts +32 -0
- package/templates/racing/src/render/loading.ts +58 -0
- package/templates/racing/src/render/materials.ts +15 -0
- package/templates/racing/src/render/palette.ts +30 -0
- package/templates/racing/src/render/postprocessing.ts +14 -0
- package/templates/racing/src/render/shapes.ts +37 -0
- package/templates/racing/src/render/sky.ts +45 -0
- package/templates/racing/src/scenes/Boot.ts +12 -0
- package/templates/racing/src/scenes/Race.ts +180 -0
- package/templates/racing/src/state.ts +35 -0
- package/templates/racing/src/style.css +32 -0
- package/templates/racing/src/track/Checkline.ts +19 -0
- package/templates/racing/src/track/Lap.ts +104 -0
- package/templates/racing/src/track/Ranking.ts +35 -0
- package/templates/racing/src/track/Track.ts +229 -0
- package/templates/racing/src/track/TrackSector.ts +77 -0
- package/templates/racing/src/track/rescue.ts +21 -0
- package/templates/racing/src/ui/App.tsx +17 -0
- package/templates/racing/src/ui/Hud.tsx +71 -0
- package/templates/racing/src/ui/Menu.tsx +7 -0
- package/templates/racing/tailwind.config.ts +2 -0
- package/templates/racing/threenative.config.ts +29 -0
- package/templates/racing/tsconfig.json +17 -0
- package/templates/racing/vite.config.ts +5 -0
- package/templates/shooter/.mcp.json +16 -0
- package/templates/shooter/AGENTS.md +69 -0
- package/templates/shooter/CLAUDE.md +71 -0
- package/templates/shooter/index.html +13 -0
- package/templates/shooter/kit.json +7 -0
- package/templates/shooter/package.json +46 -0
- package/templates/shooter/playtests/fail.playtest.json +30 -0
- package/templates/shooter/playtests/shooter.playtest.json +89 -0
- package/templates/shooter/playtests/survives.playtest.json +32 -0
- package/templates/shooter/public/favicon.svg +4 -0
- package/templates/shooter/src/combat/damage.ts +41 -0
- package/templates/shooter/src/entities/Pickup.ts +70 -0
- package/templates/shooter/src/entities/Player.ts +93 -0
- package/templates/shooter/src/entities/Target.ts +103 -0
- package/templates/shooter/src/game.ts +36 -0
- package/templates/shooter/src/level/SpawnPoints.ts +28 -0
- package/templates/shooter/src/main.ts +26 -0
- package/templates/shooter/src/physics.ts +49 -0
- package/templates/shooter/src/playtest-events.ts +15 -0
- package/templates/shooter/src/render/camera.ts +29 -0
- package/templates/shooter/src/render/lighting.ts +38 -0
- package/templates/shooter/src/render/loading.ts +86 -0
- package/templates/shooter/src/render/materials.ts +38 -0
- package/templates/shooter/src/render/palette.ts +9 -0
- package/templates/shooter/src/render/postprocessing.ts +19 -0
- package/templates/shooter/src/render/shapes.ts +194 -0
- package/templates/shooter/src/render/sky.ts +37 -0
- package/templates/shooter/src/render/types.ts +3 -0
- package/templates/shooter/src/render/ui.css +212 -0
- package/templates/shooter/src/render/ui.ts +59 -0
- package/templates/shooter/src/scenes/Boot.ts +12 -0
- package/templates/shooter/src/scenes/Play.ts +428 -0
- package/templates/shooter/src/state.ts +29 -0
- package/templates/shooter/src/ui/App.tsx +25 -0
- package/templates/shooter/src/ui/Hud.tsx +49 -0
- package/templates/shooter/src/ui/Menu.tsx +26 -0
- package/templates/shooter/src/waves.ts +50 -0
- package/templates/shooter/src/weapons/Hitscan.ts +43 -0
- package/templates/shooter/src/weapons/Projectile.ts +76 -0
- package/templates/shooter/tailwind.config.ts +5 -0
- package/templates/shooter/threenative.config.ts +29 -0
- package/templates/shooter/tsconfig.json +17 -0
- package/templates/shooter/vite.config.ts +8 -0
- package/templates/starter/.mcp.json +16 -0
- package/templates/starter/AGENTS.md +450 -0
- package/templates/starter/CLAUDE.md +452 -0
- package/templates/starter/assets/.gitkeep +0 -0
- package/templates/starter/index.html +13 -0
- package/templates/starter/kit.json +7 -0
- package/templates/starter/package.json +49 -0
- package/templates/starter/playtests/buffer.playtest.json +29 -0
- package/templates/starter/playtests/coyote.playtest.json +35 -0
- package/templates/starter/playtests/forward.playtest.json +15 -0
- package/templates/starter/playtests/hot-reload.playtest.json +28 -0
- package/templates/starter/playtests/look.playtest.json +43 -0
- package/templates/starter/playtests/monitoring.playtest.json +41 -0
- package/templates/starter/playtests/pause.playtest.json +33 -0
- package/templates/starter/playtests/play.playtest.json +16 -0
- package/templates/starter/playtests/respawn.playtest.json +28 -0
- package/templates/starter/playtests/restart.playtest.json +36 -0
- package/templates/starter/playtests/seed.playtest.json +18 -0
- package/templates/starter/playtests/survives.playtest.json +32 -0
- package/templates/starter/public/.gitkeep +0 -0
- package/templates/starter/public/favicon.svg +4 -0
- package/templates/starter/public/icon.png +0 -0
- package/templates/starter/public/native-proof.glb +0 -0
- package/templates/starter/public/native-proof.png +0 -0
- package/templates/starter/public/pickup.ogg +0 -0
- package/templates/starter/src/entities/Crate.ts +34 -0
- package/templates/starter/src/entities/Player.ts +80 -0
- package/templates/starter/src/game.ts +30 -0
- package/templates/starter/src/main.ts +15 -0
- package/templates/starter/src/render/camera.ts +57 -0
- package/templates/starter/src/render/lighting.ts +55 -0
- package/templates/starter/src/render/materials.ts +12 -0
- package/templates/starter/src/render/palette.ts +9 -0
- package/templates/starter/src/render/postprocessing.ts +18 -0
- package/templates/starter/src/render/shapes.ts +147 -0
- package/templates/starter/src/render/sky.ts +56 -0
- package/templates/starter/src/scenes/Play.ts +161 -0
- package/templates/starter/src/state.ts +10 -0
- package/templates/starter/src/style.css +45 -0
- package/templates/starter/src/ui/App.tsx +19 -0
- package/templates/starter/src/ui/Hud.tsx +37 -0
- package/templates/starter/src/ui/Menu.tsx +43 -0
- package/templates/starter/tailwind.config.ts +2 -0
- package/templates/starter/threenative.config.ts +31 -0
- package/templates/starter/tsconfig.json +17 -0
- package/templates/starter/vite.config.ts +8 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# AGENTS.md — __PROJECT_NAME__ platformer
|
|
2
|
+
|
|
3
|
+
This project is an editable Three.js platformer starter. The framework owns the loop,
|
|
4
|
+
input, renderer, physics bindings, and playtest bridge; this repository owns the feel,
|
|
5
|
+
level, entities, and look.
|
|
6
|
+
|
|
7
|
+
## Commands
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pnpm dev
|
|
11
|
+
pnpm studio # chat, preview and proof in one page; needs claude or codex
|
|
12
|
+
pnpm build # web build; identical to vite build
|
|
13
|
+
pnpm build --target desktop # native executable; Linux is the only verified host
|
|
14
|
+
pnpm test
|
|
15
|
+
pnpm typecheck
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The normal physics API selects native Rapier on Android. This template's chasers use editable
|
|
19
|
+
steering in `src/entities/Chaser.ts`, not Recast, so the portable game runs on desktop and the
|
|
20
|
+
Android emulator. `@threenative/physics/navigation` remains browser-only because it carries
|
|
21
|
+
Recast WASM. Linux desktop and Android x86_64 emulator runs are source-machine evidence, not
|
|
22
|
+
clean-machine distribution proof; macOS, Windows, iOS, arm64, and physical hardware remain
|
|
23
|
+
OPEN.
|
|
24
|
+
|
|
25
|
+
If you care about the desktop target, keep the game portable: no real DOM there (`document`
|
|
26
|
+
is a Three.js compatibility stub), no dynamic `import()`, and `.raw` on a physics handle is
|
|
27
|
+
a Rapier object on web but opaque on native. Writing against `ctx`, `three`, and the
|
|
28
|
+
Godot-named nodes keeps that correct without thinking about it.
|
|
29
|
+
|
|
30
|
+
## Where to work
|
|
31
|
+
|
|
32
|
+
- `src/entities/Character.ts` contains every movement and feel constant.
|
|
33
|
+
- `src/entities/Patrol.ts` is the ordinary scripted-route enemy; `Chaser.ts` demonstrates a
|
|
34
|
+
two-corner route around this level's blocker plus short-range peer separation. Change its
|
|
35
|
+
route with the level. General navmesh pathfinding is browser-only.
|
|
36
|
+
- `src/entities/Pickup.ts` is an ordinary gameplay class.
|
|
37
|
+
- `src/level/` contains plain level helpers and checkpoint state.
|
|
38
|
+
- `src/render/` is ordinary Three.js source. It has no framework imports. Its baseline
|
|
39
|
+
concerns include palette, camera, sky, lighting, materials, postprocessing, and the
|
|
40
|
+
camera-parented geometry HUD in `hud.ts`.
|
|
41
|
+
- `src/scenes/Level.ts` is the live caller that wires the pieces together.
|
|
42
|
+
- `playtests/survives.playtest.json` is the durable smoke proof: keep it when replacing the
|
|
43
|
+
platformer gameplay. The other `playtests/` scenarios prove movement, collection, stomping,
|
|
44
|
+
respawn, and one-way platforms in this example game.
|
|
45
|
+
|
|
46
|
+
**This template has one HUD, and it is `src/ui/Hud.tsx`.** It previously shipped a
|
|
47
|
+
camera-attached geometry HUD as well, and both drew hearts, coins and the clock on top of each
|
|
48
|
+
other. Gameplay and state transitions live in the portable scene and reach the HUD through
|
|
49
|
+
`ctx.state.set`, so nothing about that is web-only. **This template claims desktop, and a desktop
|
|
50
|
+
build has no HUD until you add one** — write it in your own `src/render/` code, as instanced
|
|
51
|
+
Three.js geometry rather than DOM, if your game needs one there. That is a real gap and it is
|
|
52
|
+
stated rather than hidden. `src/render/touch-controls.ts`
|
|
53
|
+
draws the thumbstick, jump and dash surfaces and maps `ctx.input.raw.pointers` in the scene, so
|
|
54
|
+
the platformer remains playable without a keyboard on a touch target.
|
|
55
|
+
|
|
56
|
+
`threenative.config.ts` is the one game-owned app-shape file. Set the launcher identity and
|
|
57
|
+
icon, mobile orientation and display flags, desktop window, renderer preference, and native
|
|
58
|
+
entry there. `package.json` may retain only `threenative.nativeEntry` as a compatibility
|
|
59
|
+
fallback for older projects.
|
|
60
|
+
|
|
61
|
+
`AnimationPlayer` is exported by `@threenative/core` for clips from a rigged asset. Put a
|
|
62
|
+
`.glb` in `public/`, await `ctx.assets.model("hero.glb")` in `Scene.load()`, then construct
|
|
63
|
+
and update the player beside the entity that owns the loaded model.
|
|
64
|
+
|
|
65
|
+
Use Godot names for physics nodes: `CharacterBody3D`, `Area3D`, `RigidBody3D`, and
|
|
66
|
+
`CollisionShape3D`. Register persistent entities with `ctx.entities`; the framework clears
|
|
67
|
+
registered entities, scene objects, and physics nodes when a scene exits. Dispose a node
|
|
68
|
+
explicitly only when removing it during play. **The id is the name a scenario resolves.** A
|
|
69
|
+
playtest `subject`, and every `movement` or `visibility` assertion, looks the entity up by that
|
|
70
|
+
string — an unregistered player fails `TN_PLAYTEST_VISIBILITY_FAILED` however visible it is on
|
|
71
|
+
screen. Feel belongs in the character, not in `defineGame` options.
|
|
72
|
+
|
|
73
|
+
`input.vector("move").y` is +up; map it to world-space -z for forward with one explicit
|
|
74
|
+
`-move.y` conversion in the character movement code.
|
|
75
|
+
|
|
76
|
+
`Level.static initialState` is the single initial-state value. `defineGame` discovers it from
|
|
77
|
+
the start scene, and gameplay updates use partial patches such as `ctx.state.set({ coins })`.
|
|
78
|
+
`main.ts` calls `acceptHotUpdate(game, import.meta.hot)` in development; seed the player in
|
|
79
|
+
`Level.enter()` from the JSON-shaped state fields you want to preserve. The scene graph,
|
|
80
|
+
physics world, audio, particles, and renderer are rebuilt on every update.
|
|
81
|
+
|
|
82
|
+
Keep the palette to six named colours with exactly one `accent`, and import it from materials
|
|
83
|
+
and sky. Set camera framing, tonemapping and exposure deliberately; keep the rim light,
|
|
84
|
+
soft shadows with `normalBias`, sky-derived fog, and bloom through
|
|
85
|
+
`renderer.setOutputNode()`. These visual decisions belong in this generated project, not in
|
|
86
|
+
the framework packages. Run `pnpm visuals` when changing the render layer.
|
|
87
|
+
|
|
88
|
+
## Finding assets — you have an MCP server for this
|
|
89
|
+
|
|
90
|
+
**Reach for it when the asset is conventional; build anything custom yourself.**
|
|
91
|
+
|
|
92
|
+
- **Textures, materials, HDRIs and sound effects — prefer the tools.** Rusted metal, oak
|
|
93
|
+
planks, a studio HDRI, a UI click: these are well-established and a CC0 one beats what you
|
|
94
|
+
would hand-author.
|
|
95
|
+
- **Models — only when the thing is conventional.** A car, a plane, a crate, a barrel, a
|
|
96
|
+
tree, a chair. If this game's main character is a car, fetching a compatible `.glb` is the
|
|
97
|
+
right call.
|
|
98
|
+
- **Anything specific to this game — write it in `src/render/`.** A downloaded model standing
|
|
99
|
+
in for a bespoke design reads as a weird asset dropped into the scene, and it looks worse
|
|
100
|
+
than a clean composition of primitives. This is the failure the tools make easy.
|
|
101
|
+
|
|
102
|
+
When in doubt, build it programmatically. A fetched asset has to match what the game needs,
|
|
103
|
+
not merely exist.
|
|
104
|
+
|
|
105
|
+
`.mcp.json` in this project launches `threenative-asset-mcp` from `node_modules`, so your host
|
|
106
|
+
lists its tools alongside your own. It advertises 32; these 8 are the loop you will use for
|
|
107
|
+
nearly everything:
|
|
108
|
+
|
|
109
|
+
1. `asset_search_sources` — start here, never at a provider. It returns every catalogued
|
|
110
|
+
source with its license summary, attribution requirement, browse URL, and whether an agent
|
|
111
|
+
can complete a download from it. **That output is the authority on what is reachable** —
|
|
112
|
+
not this file, and not your memory of some other project.
|
|
113
|
+
2. `polyhaven_search_assets` (CC0 models, textures, HDRIs), `ambientcg_search_assets` (CC0
|
|
114
|
+
materials and textures), or `audio_search_assets` (Kenney, Sonniss).
|
|
115
|
+
3. `polyhaven_list_files` / `ambientcg_list_files` — the license, official URL, byte size and
|
|
116
|
+
md5 of every resolution and format. **Read this before downloading, not after**, and pick a
|
|
117
|
+
sane one: Poly Haven lists 16k PNGs over 1 GB beside 8k JPEGs at 28 MB. A game does not
|
|
118
|
+
need the 16k.
|
|
119
|
+
4. `asset_download_file` for textures and models, `audio_download_asset` for audio. Both take
|
|
120
|
+
`acceptLicense: true` — you are asserting you read step 3. **They ignore any path you pass
|
|
121
|
+
and write to the directories `.mcp.json` sets** (`public/assets/<provider>/<sha>/` and
|
|
122
|
+
`public/audio/<source>/<pack>/`); without that config they would write to `~/Downloads` and
|
|
123
|
+
never reach the game.
|
|
124
|
+
5. Append the file, its source, its license and its URL to `CREDITS.md` **before the turn
|
|
125
|
+
ends**. Poly Haven requires a visible Poly Haven credit when its API is used, ambientCG is
|
|
126
|
+
CC0 per asset page, and audio and bundle licenses are per pack.
|
|
127
|
+
|
|
128
|
+
**Never state a license you did not read off a tool result.** If `polyhaven_list_files` or
|
|
129
|
+
`ambientcg_search_assets` did not tell you, you do not know it.
|
|
130
|
+
|
|
131
|
+
**What arrives is usually a ZIP, not a texture.** ambientCG and Kenney ship archives: unpack
|
|
132
|
+
one, keep only the maps you actually use (`_Color`, `_NormalGL`, `_Roughness` — not the
|
|
133
|
+
`.blend`, `.usdc` or displacement), and put those beside your code under `public/`. A 1K JPEG
|
|
134
|
+
set is right for a game; the 8K set of the same material is 200 MB.
|
|
135
|
+
|
|
136
|
+
Two argument shapes that will bite you, both learned the hard way: `ambientcg_search_assets`
|
|
137
|
+
takes lowercase `type` values (`material`, `hdri`, `3d-model`), and the audio catalog is
|
|
138
|
+
**pack-level** — `audio_search_assets` matches pack names, so `query: "pickup coin"` returns
|
|
139
|
+
nothing while `kind: "sfx"` returns the seven packs that exist. Pick a pack, download it,
|
|
140
|
+
unzip it, and choose a file yourself.
|
|
141
|
+
|
|
142
|
+
The other tools are narrower, and the directory spells out the conditions on each. The Fab
|
|
143
|
+
tools talk to a marketplace: the server never purchases anything, and only directly-free files
|
|
144
|
+
download. `smithsonian_search_assets` returns museum scans at scan resolution, which this
|
|
145
|
+
project has no pipeline to decimate — that geometry is the wrong shape for a game. When in
|
|
146
|
+
doubt check `asset_search_sources` first; its `caution` and license fields are the current
|
|
147
|
+
truth for the pinned version, and they change between versions.
|
|
148
|
+
|
|
149
|
+
Load what you downloaded the ordinary way — `ctx.assets.model("crate.glb")`,
|
|
150
|
+
`ctx.assets.texture(...)`, `ctx.assets.audio(...)` — and write your own material and lighting
|
|
151
|
+
around it in `src/render/`. The framework ships no asset and picks none for you.
|
|
152
|
+
|
|
153
|
+
## Building what you cannot download — sculpt from a reference
|
|
154
|
+
|
|
155
|
+
Choose one branch before writing code:
|
|
156
|
+
|
|
157
|
+
- **Conventional and downloadable** — a crate, an oak plank texture, a click. Use the asset
|
|
158
|
+
tools. Sculpting one of these is slower and worse.
|
|
159
|
+
- **Trivial** — a platform, a wall, a pickup ring. Write it. If `BoxGeometry` finishes the
|
|
160
|
+
job in under 20 lines, that is the answer.
|
|
161
|
+
- **Bespoke, with a reference image** — an identity-bearing creature, vehicle, hero prop,
|
|
162
|
+
landmark, scenery composition, or environment set piece whose silhouette must match. Use
|
|
163
|
+
the sculpt tools to turn that reference into editable `src/render/` source.
|
|
164
|
+
- **Bespoke, without a reference image** — ask for one, or write it and accept that it will
|
|
165
|
+
be generic. Do not invent a reference: comparison without evidence is unguided iteration.
|
|
166
|
+
|
|
167
|
+
For a full environment, split the decision: sculpt the signature landmark or bounded scene
|
|
168
|
+
kit that makes the reference recognisable; use the asset tools for interchangeable trees,
|
|
169
|
+
rocks, textures, HDRIs, and sounds around it. Do not sculpt an entire world as one object.
|
|
170
|
+
|
|
171
|
+
`.mcp.json` launches `threenative-sculpt-mcp` beside the asset server. It does not generate
|
|
172
|
+
or ship runtime code; it guides the source you write:
|
|
173
|
+
|
|
174
|
+
1. Call `sculpt_plan` with the image path and a one-line intent, then read the returned
|
|
175
|
+
grimoire resources.
|
|
176
|
+
2. Write the returned object contract and loop on `sculpt_spec_gate` until every named
|
|
177
|
+
region and depth requirement passes. Do not write geometry before this gate is green.
|
|
178
|
+
3. For each ordered pass, write or extend one factory in `src/render/`. Capture the real
|
|
179
|
+
frame with `npx @threenative/playtest`; the sculpt server never launches a browser.
|
|
180
|
+
4. Call `sculpt_compare` with the reference and captured frame, then give that evidence to
|
|
181
|
+
`sculpt_pass_gate`. Advance only when it says advance; ambiguity means retry.
|
|
182
|
+
5. Use `sculpt_grimoire` for a named technique topic. It rejects pages containing concrete
|
|
183
|
+
paste-ready material or shader recipes so the tool never owns this game's look.
|
|
184
|
+
|
|
185
|
+
A missing or blank capture is a failed run, never a finished model. Add the reference image,
|
|
186
|
+
its creator, license, and source URL to `CREDITS.md` before the turn ends.
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
## Budget real time for the look
|
|
190
|
+
|
|
191
|
+
The automated gates are blind to how the game looks. **Budget real time for the look:** boot
|
|
192
|
+
the game, capture a headed screenshot, and inspect the silhouette, contact shadows, motion,
|
|
193
|
+
and HUD before calling a visual change done. Note that headless Chromium usually cannot render WebGPU;
|
|
194
|
+
use a real browser or browser tool, or
|
|
195
|
+
`npx @threenative/playtest <scenario> --browser-recipe webgpu --headed`, whose recipe carries
|
|
196
|
+
the flags a WebGPU capture needs — including `--enable-features=Vulkan`, without which
|
|
197
|
+
Chromium silently serves WebGPU from its CPU rasteriser. On a screenless machine start `Xvfb`
|
|
198
|
+
yourself rather than using `xvfb-run`, which replaces a successful command's exit status with
|
|
199
|
+
a failing one.
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
<!-- Generated mirror of AGENTS.md. Do not edit; edit AGENTS.md. -->
|
|
2
|
+
|
|
3
|
+
# AGENTS.md — __PROJECT_NAME__ platformer
|
|
4
|
+
|
|
5
|
+
This project is an editable Three.js platformer starter. The framework owns the loop,
|
|
6
|
+
input, renderer, physics bindings, and playtest bridge; this repository owns the feel,
|
|
7
|
+
level, entities, and look.
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
pnpm dev
|
|
13
|
+
pnpm studio # chat, preview and proof in one page; needs claude or codex
|
|
14
|
+
pnpm build # web build; identical to vite build
|
|
15
|
+
pnpm build --target desktop # native executable; Linux is the only verified host
|
|
16
|
+
pnpm test
|
|
17
|
+
pnpm typecheck
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The normal physics API selects native Rapier on Android. This template's chasers use editable
|
|
21
|
+
steering in `src/entities/Chaser.ts`, not Recast, so the portable game runs on desktop and the
|
|
22
|
+
Android emulator. `@threenative/physics/navigation` remains browser-only because it carries
|
|
23
|
+
Recast WASM. Linux desktop and Android x86_64 emulator runs are source-machine evidence, not
|
|
24
|
+
clean-machine distribution proof; macOS, Windows, iOS, arm64, and physical hardware remain
|
|
25
|
+
OPEN.
|
|
26
|
+
|
|
27
|
+
If you care about the desktop target, keep the game portable: no real DOM there (`document`
|
|
28
|
+
is a Three.js compatibility stub), no dynamic `import()`, and `.raw` on a physics handle is
|
|
29
|
+
a Rapier object on web but opaque on native. Writing against `ctx`, `three`, and the
|
|
30
|
+
Godot-named nodes keeps that correct without thinking about it.
|
|
31
|
+
|
|
32
|
+
## Where to work
|
|
33
|
+
|
|
34
|
+
- `src/entities/Character.ts` contains every movement and feel constant.
|
|
35
|
+
- `src/entities/Patrol.ts` is the ordinary scripted-route enemy; `Chaser.ts` demonstrates a
|
|
36
|
+
two-corner route around this level's blocker plus short-range peer separation. Change its
|
|
37
|
+
route with the level. General navmesh pathfinding is browser-only.
|
|
38
|
+
- `src/entities/Pickup.ts` is an ordinary gameplay class.
|
|
39
|
+
- `src/level/` contains plain level helpers and checkpoint state.
|
|
40
|
+
- `src/render/` is ordinary Three.js source. It has no framework imports. Its baseline
|
|
41
|
+
concerns include palette, camera, sky, lighting, materials, postprocessing, and the
|
|
42
|
+
camera-parented geometry HUD in `hud.ts`.
|
|
43
|
+
- `src/scenes/Level.ts` is the live caller that wires the pieces together.
|
|
44
|
+
- `playtests/survives.playtest.json` is the durable smoke proof: keep it when replacing the
|
|
45
|
+
platformer gameplay. The other `playtests/` scenarios prove movement, collection, stomping,
|
|
46
|
+
respawn, and one-way platforms in this example game.
|
|
47
|
+
|
|
48
|
+
**This template has one HUD, and it is `src/ui/Hud.tsx`.** It previously shipped a
|
|
49
|
+
camera-attached geometry HUD as well, and both drew hearts, coins and the clock on top of each
|
|
50
|
+
other. Gameplay and state transitions live in the portable scene and reach the HUD through
|
|
51
|
+
`ctx.state.set`, so nothing about that is web-only. **This template claims desktop, and a desktop
|
|
52
|
+
build has no HUD until you add one** — write it in your own `src/render/` code, as instanced
|
|
53
|
+
Three.js geometry rather than DOM, if your game needs one there. That is a real gap and it is
|
|
54
|
+
stated rather than hidden. `src/render/touch-controls.ts`
|
|
55
|
+
draws the thumbstick, jump and dash surfaces and maps `ctx.input.raw.pointers` in the scene, so
|
|
56
|
+
the platformer remains playable without a keyboard on a touch target.
|
|
57
|
+
|
|
58
|
+
`threenative.config.ts` is the one game-owned app-shape file. Set the launcher identity and
|
|
59
|
+
icon, mobile orientation and display flags, desktop window, renderer preference, and native
|
|
60
|
+
entry there. `package.json` may retain only `threenative.nativeEntry` as a compatibility
|
|
61
|
+
fallback for older projects.
|
|
62
|
+
|
|
63
|
+
`AnimationPlayer` is exported by `@threenative/core` for clips from a rigged asset. Put a
|
|
64
|
+
`.glb` in `public/`, await `ctx.assets.model("hero.glb")` in `Scene.load()`, then construct
|
|
65
|
+
and update the player beside the entity that owns the loaded model.
|
|
66
|
+
|
|
67
|
+
Use Godot names for physics nodes: `CharacterBody3D`, `Area3D`, `RigidBody3D`, and
|
|
68
|
+
`CollisionShape3D`. Register persistent entities with `ctx.entities`; the framework clears
|
|
69
|
+
registered entities, scene objects, and physics nodes when a scene exits. Dispose a node
|
|
70
|
+
explicitly only when removing it during play. **The id is the name a scenario resolves.** A
|
|
71
|
+
playtest `subject`, and every `movement` or `visibility` assertion, looks the entity up by that
|
|
72
|
+
string — an unregistered player fails `TN_PLAYTEST_VISIBILITY_FAILED` however visible it is on
|
|
73
|
+
screen. Feel belongs in the character, not in `defineGame` options.
|
|
74
|
+
|
|
75
|
+
`input.vector("move").y` is +up; map it to world-space -z for forward with one explicit
|
|
76
|
+
`-move.y` conversion in the character movement code.
|
|
77
|
+
|
|
78
|
+
`Level.static initialState` is the single initial-state value. `defineGame` discovers it from
|
|
79
|
+
the start scene, and gameplay updates use partial patches such as `ctx.state.set({ coins })`.
|
|
80
|
+
`main.ts` calls `acceptHotUpdate(game, import.meta.hot)` in development; seed the player in
|
|
81
|
+
`Level.enter()` from the JSON-shaped state fields you want to preserve. The scene graph,
|
|
82
|
+
physics world, audio, particles, and renderer are rebuilt on every update.
|
|
83
|
+
|
|
84
|
+
Keep the palette to six named colours with exactly one `accent`, and import it from materials
|
|
85
|
+
and sky. Set camera framing, tonemapping and exposure deliberately; keep the rim light,
|
|
86
|
+
soft shadows with `normalBias`, sky-derived fog, and bloom through
|
|
87
|
+
`renderer.setOutputNode()`. These visual decisions belong in this generated project, not in
|
|
88
|
+
the framework packages. Run `pnpm visuals` when changing the render layer.
|
|
89
|
+
|
|
90
|
+
## Finding assets — you have an MCP server for this
|
|
91
|
+
|
|
92
|
+
**Reach for it when the asset is conventional; build anything custom yourself.**
|
|
93
|
+
|
|
94
|
+
- **Textures, materials, HDRIs and sound effects — prefer the tools.** Rusted metal, oak
|
|
95
|
+
planks, a studio HDRI, a UI click: these are well-established and a CC0 one beats what you
|
|
96
|
+
would hand-author.
|
|
97
|
+
- **Models — only when the thing is conventional.** A car, a plane, a crate, a barrel, a
|
|
98
|
+
tree, a chair. If this game's main character is a car, fetching a compatible `.glb` is the
|
|
99
|
+
right call.
|
|
100
|
+
- **Anything specific to this game — write it in `src/render/`.** A downloaded model standing
|
|
101
|
+
in for a bespoke design reads as a weird asset dropped into the scene, and it looks worse
|
|
102
|
+
than a clean composition of primitives. This is the failure the tools make easy.
|
|
103
|
+
|
|
104
|
+
When in doubt, build it programmatically. A fetched asset has to match what the game needs,
|
|
105
|
+
not merely exist.
|
|
106
|
+
|
|
107
|
+
`.mcp.json` in this project launches `threenative-asset-mcp` from `node_modules`, so your host
|
|
108
|
+
lists its tools alongside your own. It advertises 32; these 8 are the loop you will use for
|
|
109
|
+
nearly everything:
|
|
110
|
+
|
|
111
|
+
1. `asset_search_sources` — start here, never at a provider. It returns every catalogued
|
|
112
|
+
source with its license summary, attribution requirement, browse URL, and whether an agent
|
|
113
|
+
can complete a download from it. **That output is the authority on what is reachable** —
|
|
114
|
+
not this file, and not your memory of some other project.
|
|
115
|
+
2. `polyhaven_search_assets` (CC0 models, textures, HDRIs), `ambientcg_search_assets` (CC0
|
|
116
|
+
materials and textures), or `audio_search_assets` (Kenney, Sonniss).
|
|
117
|
+
3. `polyhaven_list_files` / `ambientcg_list_files` — the license, official URL, byte size and
|
|
118
|
+
md5 of every resolution and format. **Read this before downloading, not after**, and pick a
|
|
119
|
+
sane one: Poly Haven lists 16k PNGs over 1 GB beside 8k JPEGs at 28 MB. A game does not
|
|
120
|
+
need the 16k.
|
|
121
|
+
4. `asset_download_file` for textures and models, `audio_download_asset` for audio. Both take
|
|
122
|
+
`acceptLicense: true` — you are asserting you read step 3. **They ignore any path you pass
|
|
123
|
+
and write to the directories `.mcp.json` sets** (`public/assets/<provider>/<sha>/` and
|
|
124
|
+
`public/audio/<source>/<pack>/`); without that config they would write to `~/Downloads` and
|
|
125
|
+
never reach the game.
|
|
126
|
+
5. Append the file, its source, its license and its URL to `CREDITS.md` **before the turn
|
|
127
|
+
ends**. Poly Haven requires a visible Poly Haven credit when its API is used, ambientCG is
|
|
128
|
+
CC0 per asset page, and audio and bundle licenses are per pack.
|
|
129
|
+
|
|
130
|
+
**Never state a license you did not read off a tool result.** If `polyhaven_list_files` or
|
|
131
|
+
`ambientcg_search_assets` did not tell you, you do not know it.
|
|
132
|
+
|
|
133
|
+
**What arrives is usually a ZIP, not a texture.** ambientCG and Kenney ship archives: unpack
|
|
134
|
+
one, keep only the maps you actually use (`_Color`, `_NormalGL`, `_Roughness` — not the
|
|
135
|
+
`.blend`, `.usdc` or displacement), and put those beside your code under `public/`. A 1K JPEG
|
|
136
|
+
set is right for a game; the 8K set of the same material is 200 MB.
|
|
137
|
+
|
|
138
|
+
Two argument shapes that will bite you, both learned the hard way: `ambientcg_search_assets`
|
|
139
|
+
takes lowercase `type` values (`material`, `hdri`, `3d-model`), and the audio catalog is
|
|
140
|
+
**pack-level** — `audio_search_assets` matches pack names, so `query: "pickup coin"` returns
|
|
141
|
+
nothing while `kind: "sfx"` returns the seven packs that exist. Pick a pack, download it,
|
|
142
|
+
unzip it, and choose a file yourself.
|
|
143
|
+
|
|
144
|
+
The other tools are narrower, and the directory spells out the conditions on each. The Fab
|
|
145
|
+
tools talk to a marketplace: the server never purchases anything, and only directly-free files
|
|
146
|
+
download. `smithsonian_search_assets` returns museum scans at scan resolution, which this
|
|
147
|
+
project has no pipeline to decimate — that geometry is the wrong shape for a game. When in
|
|
148
|
+
doubt check `asset_search_sources` first; its `caution` and license fields are the current
|
|
149
|
+
truth for the pinned version, and they change between versions.
|
|
150
|
+
|
|
151
|
+
Load what you downloaded the ordinary way — `ctx.assets.model("crate.glb")`,
|
|
152
|
+
`ctx.assets.texture(...)`, `ctx.assets.audio(...)` — and write your own material and lighting
|
|
153
|
+
around it in `src/render/`. The framework ships no asset and picks none for you.
|
|
154
|
+
|
|
155
|
+
## Building what you cannot download — sculpt from a reference
|
|
156
|
+
|
|
157
|
+
Choose one branch before writing code:
|
|
158
|
+
|
|
159
|
+
- **Conventional and downloadable** — a crate, an oak plank texture, a click. Use the asset
|
|
160
|
+
tools. Sculpting one of these is slower and worse.
|
|
161
|
+
- **Trivial** — a platform, a wall, a pickup ring. Write it. If `BoxGeometry` finishes the
|
|
162
|
+
job in under 20 lines, that is the answer.
|
|
163
|
+
- **Bespoke, with a reference image** — an identity-bearing creature, vehicle, hero prop,
|
|
164
|
+
landmark, scenery composition, or environment set piece whose silhouette must match. Use
|
|
165
|
+
the sculpt tools to turn that reference into editable `src/render/` source.
|
|
166
|
+
- **Bespoke, without a reference image** — ask for one, or write it and accept that it will
|
|
167
|
+
be generic. Do not invent a reference: comparison without evidence is unguided iteration.
|
|
168
|
+
|
|
169
|
+
For a full environment, split the decision: sculpt the signature landmark or bounded scene
|
|
170
|
+
kit that makes the reference recognisable; use the asset tools for interchangeable trees,
|
|
171
|
+
rocks, textures, HDRIs, and sounds around it. Do not sculpt an entire world as one object.
|
|
172
|
+
|
|
173
|
+
`.mcp.json` launches `threenative-sculpt-mcp` beside the asset server. It does not generate
|
|
174
|
+
or ship runtime code; it guides the source you write:
|
|
175
|
+
|
|
176
|
+
1. Call `sculpt_plan` with the image path and a one-line intent, then read the returned
|
|
177
|
+
grimoire resources.
|
|
178
|
+
2. Write the returned object contract and loop on `sculpt_spec_gate` until every named
|
|
179
|
+
region and depth requirement passes. Do not write geometry before this gate is green.
|
|
180
|
+
3. For each ordered pass, write or extend one factory in `src/render/`. Capture the real
|
|
181
|
+
frame with `npx @threenative/playtest`; the sculpt server never launches a browser.
|
|
182
|
+
4. Call `sculpt_compare` with the reference and captured frame, then give that evidence to
|
|
183
|
+
`sculpt_pass_gate`. Advance only when it says advance; ambiguity means retry.
|
|
184
|
+
5. Use `sculpt_grimoire` for a named technique topic. It rejects pages containing concrete
|
|
185
|
+
paste-ready material or shader recipes so the tool never owns this game's look.
|
|
186
|
+
|
|
187
|
+
A missing or blank capture is a failed run, never a finished model. Add the reference image,
|
|
188
|
+
its creator, license, and source URL to `CREDITS.md` before the turn ends.
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
## Budget real time for the look
|
|
192
|
+
|
|
193
|
+
The automated gates are blind to how the game looks. **Budget real time for the look:** boot
|
|
194
|
+
the game, capture a headed screenshot, and inspect the silhouette, contact shadows, motion,
|
|
195
|
+
and HUD before calling a visual change done. Note that headless Chromium usually cannot render WebGPU;
|
|
196
|
+
use a real browser or browser tool, or
|
|
197
|
+
`npx @threenative/playtest <scenario> --browser-recipe webgpu --headed`, whose recipe carries
|
|
198
|
+
the flags a WebGPU capture needs — including `--enable-features=Vulkan`, without which
|
|
199
|
+
Chromium silently serves WebGPU from its CPU rasteriser. On a screenless machine start `Xvfb`
|
|
200
|
+
yourself rather than using `xvfb-run`, which replaces a successful command's exit status with
|
|
201
|
+
a failing one.
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<link rel="icon" href="/favicon.svg" />
|
|
7
|
+
<title>__PROJECT_NAME__</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="/src/main.ts"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "__PROJECT_NAME__",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "vite",
|
|
7
|
+
"studio": "threenative-studio",
|
|
8
|
+
"build": "threenative build",
|
|
9
|
+
"build:web": "threenative build --target web",
|
|
10
|
+
"build:desktop": "threenative build --target desktop",
|
|
11
|
+
"build:android": "threenative build --target android",
|
|
12
|
+
"build:ios": "threenative build --target ios",
|
|
13
|
+
"pretest": "playwright install chromium",
|
|
14
|
+
"test": "vite build && pnpm run test:playtest && pnpm run test:terminal-loop",
|
|
15
|
+
"test:terminal-loop": "threenative-playtest --scenario playtests/terminal-loop-win.playtest.json --url http://127.0.0.1:4173 --server-command \"pnpm dev --host 127.0.0.1 --port 4173 --strictPort\" --browser-recipe webgpu --headed && threenative-playtest --scenario playtests/terminal-loop-fail.playtest.json --url http://127.0.0.1:4173 --server-command \"pnpm dev --host 127.0.0.1 --port 4173 --strictPort\" --browser-recipe webgpu --headed",
|
|
16
|
+
"test:playtest": "threenative-playtest --scenario playtests/survives.playtest.json --url http://127.0.0.1:4173 --server-command \"pnpm dev --host 127.0.0.1 --port 4173 --strictPort\" --browser-recipe webgpu --headed && threenative-playtest --scenario playtests/jump.playtest.json --url http://127.0.0.1:4173 --server-command \"pnpm dev --host 127.0.0.1 --port 4173 --strictPort\" --browser-recipe webgpu --headed && threenative-playtest --scenario playtests/coyote.playtest.json --url http://127.0.0.1:4173 --server-command \"pnpm dev --host 127.0.0.1 --port 4173 --strictPort\" --browser-recipe webgpu --headed && threenative-playtest --scenario playtests/buffer.playtest.json --url http://127.0.0.1:4173 --server-command \"pnpm dev --host 127.0.0.1 --port 4173 --strictPort\" --browser-recipe webgpu --headed && threenative-playtest --scenario playtests/dash.playtest.json --url http://127.0.0.1:4173 --server-command \"pnpm dev --host 127.0.0.1 --port 4173 --strictPort\" --browser-recipe webgpu --headed && threenative-playtest --scenario playtests/patrol.playtest.json --url http://127.0.0.1:4173 --server-command \"pnpm dev --host 127.0.0.1 --port 4173 --strictPort\" --browser-recipe webgpu --headed && threenative-playtest --scenario playtests/collect.playtest.json --url http://127.0.0.1:4173 --server-command \"pnpm dev --host 127.0.0.1 --port 4173 --strictPort\" --browser-recipe webgpu --headed && threenative-playtest --scenario playtests/damage.playtest.json --url http://127.0.0.1:4173 --server-command \"pnpm dev --host 127.0.0.1 --port 4173 --strictPort\" --browser-recipe webgpu --headed && threenative-playtest --scenario playtests/stomp.playtest.json --url http://127.0.0.1:4173 --server-command \"pnpm dev --host 127.0.0.1 --port 4173 --strictPort\" --browser-recipe webgpu --headed && threenative-playtest --scenario playtests/stomp-rise.playtest.json --url http://127.0.0.1:4173 --server-command \"pnpm dev --host 127.0.0.1 --port 4173 --strictPort\" --browser-recipe webgpu --headed && threenative-playtest --scenario playtests/respawn.playtest.json --url http://127.0.0.1:4173 --server-command \"pnpm dev --host 127.0.0.1 --port 4173 --strictPort\" --browser-recipe webgpu --headed && threenative-playtest --scenario playtests/oneway.playtest.json --url http://127.0.0.1:4173 --server-command \"pnpm dev --host 127.0.0.1 --port 4173 --strictPort\" --browser-recipe webgpu --headed && threenative-playtest --scenario playtests/collision-layers.playtest.json --url http://127.0.0.1:4173 --server-command \"pnpm dev --host 127.0.0.1 --port 4173 --strictPort\" --browser-recipe webgpu --headed && threenative-playtest --scenario playtests/chase.playtest.json --url http://127.0.0.1:4173 --server-command \"pnpm dev --host 127.0.0.1 --port 4173 --strictPort\" --browser-recipe webgpu --headed && threenative-playtest --scenario playtests/avoidance.playtest.json --url http://127.0.0.1:4173 --server-command \"pnpm dev --host 127.0.0.1 --port 4173 --strictPort\" --browser-recipe webgpu --headed && threenative-playtest --scenario playtests/physics.playtest.json --url http://127.0.0.1:4173 --server-command \"pnpm dev --host 127.0.0.1 --port 4173 --strictPort\" --browser-recipe webgpu --headed",
|
|
17
|
+
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@threenative/core": "0.2.0",
|
|
21
|
+
"@threenative/physics": "0.2.0",
|
|
22
|
+
"@threenative/ui": "0.2.0",
|
|
23
|
+
"react": "19.2.0",
|
|
24
|
+
"react-dom": "19.2.0",
|
|
25
|
+
"three": "0.185.1"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@tailwindcss/vite": "4.3.3",
|
|
29
|
+
"@vitejs/plugin-react": "6.0.5",
|
|
30
|
+
"@types/three": "0.185.3",
|
|
31
|
+
"@threenative/playtest": "0.2.0",
|
|
32
|
+
"@threenative/studio": "0.2.0",
|
|
33
|
+
"@types/react": "19.2.0",
|
|
34
|
+
"@types/react-dom": "19.2.0",
|
|
35
|
+
"create-threenative": "0.2.0",
|
|
36
|
+
"esbuild": "0.27.0",
|
|
37
|
+
"playwright": "1.62.1",
|
|
38
|
+
"tailwindcss": "4.3.3",
|
|
39
|
+
"threenative-asset-mcp": "0.4.0",
|
|
40
|
+
"threenative-sculpt-mcp": "0.1.0",
|
|
41
|
+
"typescript": "5.9.3",
|
|
42
|
+
"vite": "8.2.0"
|
|
43
|
+
},
|
|
44
|
+
"optionalDependencies": {
|
|
45
|
+
"@threenative/runtime-native": "0.2.0"
|
|
46
|
+
},
|
|
47
|
+
"pnpm": {
|
|
48
|
+
"onlyBuiltDependencies": ["@threenative/runtime-native"]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "platformer-avoidance",
|
|
3
|
+
"schemaVersion": 1,
|
|
4
|
+
"target": "web",
|
|
5
|
+
"viewport": { "width": 1280, "height": 720 },
|
|
6
|
+
"warmupFrames": 0,
|
|
7
|
+
"subject": "chaser.avoidance",
|
|
8
|
+
"steps": [{ "kind": "wait", "waitTicks": 360, "release": true }],
|
|
9
|
+
"assert": {
|
|
10
|
+
"diagnostics": { "noConsoleErrors": true, "runtimeReady": true },
|
|
11
|
+
"movement": {
|
|
12
|
+
"entity": "chaser.avoidance",
|
|
13
|
+
"reachesPositionWithin": { "position": [0, 0.66, 0], "maxDistance": 1.2 },
|
|
14
|
+
"pathLength": 6.0
|
|
15
|
+
},
|
|
16
|
+
"components": [
|
|
17
|
+
{ "entity": "chaser", "component": "steeringFinished", "equals": true },
|
|
18
|
+
{ "entity": "chaser.avoidance", "component": "steeringFinished", "equals": true },
|
|
19
|
+
{ "entity": "chaser.avoidance", "component": "routeComplete", "equals": true },
|
|
20
|
+
{ "entity": "chaser.avoidance", "component": "separation", "gte": 0.56, "allowTrivial": true }
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "platformer-jump-buffer",
|
|
3
|
+
"schemaVersion": 1,
|
|
4
|
+
"target": "web",
|
|
5
|
+
"viewport": { "width": 1280, "height": 720 },
|
|
6
|
+
"warmupFrames": 10,
|
|
7
|
+
"subject": "player",
|
|
8
|
+
"steps": [
|
|
9
|
+
{ "kind": "input", "press": "ArrowRight", "holdTicks": 68, "release": true },
|
|
10
|
+
{ "kind": "input", "press": "Space", "holdTicks": 2, "release": true },
|
|
11
|
+
{ "kind": "wait", "waitTicks": 30, "release": true }
|
|
12
|
+
],
|
|
13
|
+
"assert": {
|
|
14
|
+
"diagnostics": { "noConsoleErrors": true, "runtimeReady": true },
|
|
15
|
+
"resources": [{ "id": "GameState", "path": "jumps", "gte": 1, "changed": true }]
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "platformer-chase",
|
|
3
|
+
"schemaVersion": 1,
|
|
4
|
+
"target": "web",
|
|
5
|
+
"viewport": { "width": 1280, "height": 720 },
|
|
6
|
+
"warmupFrames": 0,
|
|
7
|
+
"subject": "chaser",
|
|
8
|
+
"steps": [{ "kind": "wait", "waitTicks": 300, "release": true }],
|
|
9
|
+
"assert": {
|
|
10
|
+
"diagnostics": { "noConsoleErrors": true, "runtimeReady": true },
|
|
11
|
+
"movement": {
|
|
12
|
+
"entity": "chaser",
|
|
13
|
+
"reachesPositionWithin": { "position": [0, 0.66, 0], "maxDistance": 1.2 },
|
|
14
|
+
"pathLength": 6.0
|
|
15
|
+
},
|
|
16
|
+
"components": [
|
|
17
|
+
{ "entity": "chaser", "component": "routeComplete", "equals": true },
|
|
18
|
+
{ "entity": "chaser", "component": "steeringFinished", "equals": true }
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "platformer-collect",
|
|
3
|
+
"schemaVersion": 1,
|
|
4
|
+
"target": "web",
|
|
5
|
+
"viewport": { "width": 1280, "height": 720 },
|
|
6
|
+
"warmupFrames": 10,
|
|
7
|
+
"subject": "player",
|
|
8
|
+
"steps": [
|
|
9
|
+
{
|
|
10
|
+
"kind": "input",
|
|
11
|
+
"label": "first-coin",
|
|
12
|
+
"press": "ArrowRight",
|
|
13
|
+
"holdTicks": 16,
|
|
14
|
+
"release": true
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"kind": "wait",
|
|
18
|
+
"label": "score-holds",
|
|
19
|
+
"waitTicks": 1,
|
|
20
|
+
"release": true
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"kind": "input",
|
|
24
|
+
"label": "clear-blocker",
|
|
25
|
+
"press": ["ArrowRight", "Space"],
|
|
26
|
+
"holdTicks": 30,
|
|
27
|
+
"release": true
|
|
28
|
+
},
|
|
29
|
+
{ "kind": "wait", "waitTicks": 16, "release": true },
|
|
30
|
+
{
|
|
31
|
+
"kind": "input",
|
|
32
|
+
"label": "last-coin",
|
|
33
|
+
"press": "ArrowLeft",
|
|
34
|
+
"holdTicks": 20,
|
|
35
|
+
"release": true
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"assert": {
|
|
39
|
+
"diagnostics": { "noConsoleErrors": true, "runtimeReady": true },
|
|
40
|
+
"resources": [
|
|
41
|
+
{
|
|
42
|
+
"id": "GameState",
|
|
43
|
+
"path": "coins",
|
|
44
|
+
"gte": 3,
|
|
45
|
+
"changed": true,
|
|
46
|
+
"atSteps": [
|
|
47
|
+
{ "label": "first-coin", "equals": 1 },
|
|
48
|
+
{ "label": "score-holds", "equals": 1 },
|
|
49
|
+
{ "label": "last-coin", "equals": 3 }
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"signals": [{ "name": "collected", "entity": "player", "minCount": 3 }],
|
|
54
|
+
"tags": [{ "tag": "coin", "count": 4 }]
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "platformer-collision-layers",
|
|
3
|
+
"schemaVersion": 1,
|
|
4
|
+
"target": "web",
|
|
5
|
+
"viewport": { "width": 1280, "height": 720 },
|
|
6
|
+
"warmupFrames": 10,
|
|
7
|
+
"subject": "player",
|
|
8
|
+
"steps": [
|
|
9
|
+
{ "kind": "wait", "label": "debris-filtered", "waitTicks": 50, "release": true },
|
|
10
|
+
{
|
|
11
|
+
"kind": "input",
|
|
12
|
+
"label": "player-pickup",
|
|
13
|
+
"press": "ArrowRight",
|
|
14
|
+
"holdTicks": 16,
|
|
15
|
+
"release": true
|
|
16
|
+
},
|
|
17
|
+
{ "kind": "input", "label": "jump", "press": "Space", "holdTicks": 4, "release": true },
|
|
18
|
+
{ "kind": "wait", "label": "one-way-landing", "waitTicks": 100, "release": true }
|
|
19
|
+
],
|
|
20
|
+
"assert": {
|
|
21
|
+
"diagnostics": { "noConsoleErrors": true, "runtimeReady": true },
|
|
22
|
+
"movement": { "entity": "player", "minAxisDelta": { "axis": "+y", "min": 1.5 } },
|
|
23
|
+
"resources": [
|
|
24
|
+
{
|
|
25
|
+
"id": "GameState",
|
|
26
|
+
"path": "coins",
|
|
27
|
+
"atSteps": [
|
|
28
|
+
{ "label": "debris-filtered", "equals": 0 },
|
|
29
|
+
{ "label": "player-pickup", "equals": 1 }
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
{ "id": "GameState", "path": "peakRise", "gte": 1.5, "changed": true }
|
|
33
|
+
],
|
|
34
|
+
"signals": [{ "name": "collected", "entity": "player", "minCount": 1 }]
|
|
35
|
+
}
|
|
36
|
+
}
|