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
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-threenative",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Scaffold a readable ThreeNative game project.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist",
|
|
8
|
+
"templates"
|
|
9
|
+
],
|
|
10
|
+
"bin": {
|
|
11
|
+
"create-threenative": "./dist/index.js",
|
|
12
|
+
"threenative": "./dist/threenative.js"
|
|
13
|
+
},
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"module": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./package.json": "./package.json"
|
|
23
|
+
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"sideEffects": false,
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/node": "20.19.43",
|
|
30
|
+
"@types/three": "0.185.3",
|
|
31
|
+
"esbuild": "0.27.0",
|
|
32
|
+
"publint": "0.3.22",
|
|
33
|
+
"three": "0.185.1",
|
|
34
|
+
"tsup": "8.5.1",
|
|
35
|
+
"typescript": "5.9.3",
|
|
36
|
+
"@threenative/core": "0.2.0",
|
|
37
|
+
"@threenative/physics": "0.2.0"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsup --config tsup.config.ts && publint",
|
|
41
|
+
"typecheck": "tsc --noEmit",
|
|
42
|
+
"test": "pnpm run build"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mcpServers": {
|
|
3
|
+
"threenative-assets": {
|
|
4
|
+
"command": "node",
|
|
5
|
+
"args": ["./node_modules/threenative-asset-mcp/dist/index.js"],
|
|
6
|
+
"env": {
|
|
7
|
+
"ASSET_DOWNLOAD_DIR": "./public/assets",
|
|
8
|
+
"AUDIO_DOWNLOAD_DIR": "./public/audio"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"threenative-sculpt": {
|
|
12
|
+
"command": "node",
|
|
13
|
+
"args": ["./node_modules/threenative-sculpt-mcp/dist/server.js"]
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# AGENTS.md — __PROJECT_NAME__ action RPG
|
|
2
|
+
|
|
3
|
+
This is a playable ThreeNative action-RPG starter. The framework owns the loop, renderer,
|
|
4
|
+
input, physics binding, and React bridge. This generated project owns the dungeon, combat,
|
|
5
|
+
stats, inventory, persistence, and every visual decision.
|
|
6
|
+
|
|
7
|
+
The portable entry is src/game.ts. The web-only React mount is src/main.ts. Keep all
|
|
8
|
+
gameplay and render source portable: native never imports src/ui or the DOM.
|
|
9
|
+
|
|
10
|
+
Controls:
|
|
11
|
+
|
|
12
|
+
- WASD / arrows move.
|
|
13
|
+
- Space or F attacks; E casts Arcane Surge.
|
|
14
|
+
- Q equips the found blade; U unequips it.
|
|
15
|
+
- P fills the bag; L tests a full-bag loot refusal; T defeats the visible enemy through the real
|
|
16
|
+
drop callback and proves seeded drops.
|
|
17
|
+
- C checkpoints; R restores the last checkpoint; H damages the player; X forces defeat.
|
|
18
|
+
|
|
19
|
+
The dungeon has three rooms. Defeat the room-three boss to win; reach zero health to fail.
|
|
20
|
+
Enemy acquisition uses intersectShape for range and intersectRay for line of sight. Do not
|
|
21
|
+
replace those queries with a distance scan or @threenative/physics/navigation.
|
|
22
|
+
|
|
23
|
+
`playtests/survives.playtest.json` is the durable smoke proof. Keep it when replacing the
|
|
24
|
+
action-RPG gameplay; the other `playtests/` scenarios are examples for combat, inventory,
|
|
25
|
+
progress, win, and fail behavior.
|
|
26
|
+
|
|
27
|
+
StatBlock.ts and Inventory.ts are deliberately game-owned source. Delete or reshape them
|
|
28
|
+
when changing this game's design; they are not framework APIs. React reads the JSON-safe
|
|
29
|
+
projection in state.ts and never imports entities.
|
|
30
|
+
|
|
31
|
+
Interior lighting is intentional: sky.ts provides a dark ambient/fog envelope while the
|
|
32
|
+
key, rim, and fill lights illuminate the dungeon. It is not a visible skybox.
|
|
33
|
+
|
|
34
|
+
The asset MCP loop is:
|
|
35
|
+
|
|
36
|
+
1. `asset_search_sources`
|
|
37
|
+
2. `ambientcg_search_assets` / `polyhaven_search_assets` / `audio_search_assets`
|
|
38
|
+
3. `ambientcg_list_files` / `polyhaven_list_files`
|
|
39
|
+
4. `asset_download_file` / `audio_download_asset`
|
|
40
|
+
5. Check returned license and attribution fields before committing an asset.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<!-- Generated mirror of AGENTS.md. Do not edit; edit AGENTS.md. -->
|
|
2
|
+
|
|
3
|
+
# AGENTS.md — __PROJECT_NAME__ action RPG
|
|
4
|
+
|
|
5
|
+
This is a playable ThreeNative action-RPG starter. The framework owns the loop, renderer,
|
|
6
|
+
input, physics binding, and React bridge. This generated project owns the dungeon, combat,
|
|
7
|
+
stats, inventory, persistence, and every visual decision.
|
|
8
|
+
|
|
9
|
+
The portable entry is src/game.ts. The web-only React mount is src/main.ts. Keep all
|
|
10
|
+
gameplay and render source portable: native never imports src/ui or the DOM.
|
|
11
|
+
|
|
12
|
+
Controls:
|
|
13
|
+
|
|
14
|
+
- WASD / arrows move.
|
|
15
|
+
- Space or F attacks; E casts Arcane Surge.
|
|
16
|
+
- Q equips the found blade; U unequips it.
|
|
17
|
+
- P fills the bag; L tests a full-bag loot refusal; T defeats the visible enemy through the real
|
|
18
|
+
drop callback and proves seeded drops.
|
|
19
|
+
- C checkpoints; R restores the last checkpoint; H damages the player; X forces defeat.
|
|
20
|
+
|
|
21
|
+
The dungeon has three rooms. Defeat the room-three boss to win; reach zero health to fail.
|
|
22
|
+
Enemy acquisition uses intersectShape for range and intersectRay for line of sight. Do not
|
|
23
|
+
replace those queries with a distance scan or @threenative/physics/navigation.
|
|
24
|
+
|
|
25
|
+
`playtests/survives.playtest.json` is the durable smoke proof. Keep it when replacing the
|
|
26
|
+
action-RPG gameplay; the other `playtests/` scenarios are examples for combat, inventory,
|
|
27
|
+
progress, win, and fail behavior.
|
|
28
|
+
|
|
29
|
+
StatBlock.ts and Inventory.ts are deliberately game-owned source. Delete or reshape them
|
|
30
|
+
when changing this game's design; they are not framework APIs. React reads the JSON-safe
|
|
31
|
+
projection in state.ts and never imports entities.
|
|
32
|
+
|
|
33
|
+
Interior lighting is intentional: sky.ts provides a dark ambient/fog envelope while the
|
|
34
|
+
key, rim, and fill lights illuminate the dungeon. It is not a visible skybox.
|
|
35
|
+
|
|
36
|
+
The asset MCP loop is:
|
|
37
|
+
|
|
38
|
+
1. `asset_search_sources`
|
|
39
|
+
2. `ambientcg_search_assets` / `polyhaven_search_assets` / `audio_search_assets`
|
|
40
|
+
3. `ambientcg_list_files` / `polyhaven_list_files`
|
|
41
|
+
4. `asset_download_file` / `audio_download_asset`
|
|
42
|
+
5. Check returned license and attribution fields before committing an asset.
|
|
@@ -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,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "__PROJECT_NAME__",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "vite",
|
|
7
|
+
"build": "threenative build",
|
|
8
|
+
"build:web": "threenative build --target web",
|
|
9
|
+
"build:desktop": "threenative build --target desktop",
|
|
10
|
+
"build:android": "threenative build --target android",
|
|
11
|
+
"build:ios": "threenative build --target ios",
|
|
12
|
+
"test:native": "pnpm build:desktop && node node_modules/@threenative/runtime-native/scripts/verify-starter-desktop.mjs",
|
|
13
|
+
"pretest": "playwright install chromium",
|
|
14
|
+
"test": "vite build && pnpm run test:playtest",
|
|
15
|
+
"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/combat.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/inventory.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/progress.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/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/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
|
+
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@threenative/core": "0.2.0",
|
|
20
|
+
"@threenative/physics": "0.2.0",
|
|
21
|
+
"@threenative/ui": "0.2.0",
|
|
22
|
+
"react": "19.2.0",
|
|
23
|
+
"react-dom": "19.2.0",
|
|
24
|
+
"three": "0.185.1"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@tailwindcss/vite": "4.3.3",
|
|
28
|
+
"@threenative/playtest": "0.2.0",
|
|
29
|
+
"@types/react": "19.2.0",
|
|
30
|
+
"@types/react-dom": "19.2.0",
|
|
31
|
+
"@types/three": "0.185.3",
|
|
32
|
+
"@vitejs/plugin-react": "6.0.5",
|
|
33
|
+
"create-threenative": "0.2.0",
|
|
34
|
+
"playwright": "1.62.1",
|
|
35
|
+
"tailwindcss": "4.3.3",
|
|
36
|
+
"threenative-asset-mcp": "0.4.0",
|
|
37
|
+
"threenative-sculpt-mcp": "0.1.0",
|
|
38
|
+
"typescript": "5.9.3",
|
|
39
|
+
"vite": "8.2.0"
|
|
40
|
+
},
|
|
41
|
+
"optionalDependencies": {
|
|
42
|
+
"@threenative/runtime-native": "0.2.0"
|
|
43
|
+
},
|
|
44
|
+
"pnpm": {
|
|
45
|
+
"onlyBuiltDependencies": ["@threenative/runtime-native"]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "action-rpg-combat-and-line-of-sight",
|
|
3
|
+
"target": "web",
|
|
4
|
+
"schemaVersion": 1,
|
|
5
|
+
"viewport": { "width": 1280, "height": 720 },
|
|
6
|
+
"warmupFrames": 10,
|
|
7
|
+
"subject": "player",
|
|
8
|
+
"steps": [
|
|
9
|
+
{ "kind": "wait", "label": "line-of-sight", "waitTicks": 8, "release": true },
|
|
10
|
+
{ "kind": "input", "label": "attack", "press": "KeyF", "holdTicks": 1, "release": true },
|
|
11
|
+
{ "kind": "input", "label": "surge", "press": "KeyE", "holdTicks": 1, "release": true },
|
|
12
|
+
{ "kind": "wait", "label": "surge-active", "waitTicks": 5, "release": true },
|
|
13
|
+
{ "kind": "wait", "label": "surge-expired", "waitTicks": 90, "release": true }
|
|
14
|
+
],
|
|
15
|
+
"assert": {
|
|
16
|
+
"diagnostics": { "noConsoleErrors": true, "noNetworkErrors": true, "runtimeReady": true },
|
|
17
|
+
"resources": [
|
|
18
|
+
{
|
|
19
|
+
"id": "GameState",
|
|
20
|
+
"path": "lineOfSightBlocked",
|
|
21
|
+
"atSteps": [{ "label": "line-of-sight", "equals": 1 }]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"id": "GameState",
|
|
25
|
+
"path": "wallEnemyAggro",
|
|
26
|
+
"atSteps": [{ "label": "line-of-sight", "equals": 0 }]
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"id": "GameState",
|
|
30
|
+
"path": "visibleEnemyAggro",
|
|
31
|
+
"atSteps": [{ "label": "line-of-sight", "equals": 1 }]
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"id": "GameState",
|
|
35
|
+
"path": "damage",
|
|
36
|
+
"atSteps": [
|
|
37
|
+
{ "label": "surge-active", "equals": 18 },
|
|
38
|
+
{ "label": "surge-expired", "equals": 12 }
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"id": "GameState",
|
|
43
|
+
"path": "modifierActive",
|
|
44
|
+
"atSteps": [
|
|
45
|
+
{ "label": "surge-active", "equals": 1 },
|
|
46
|
+
{ "label": "surge-expired", "equals": 0 }
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"signals": [
|
|
51
|
+
{ "name": "attack", "entity": "player", "minCount": 1 },
|
|
52
|
+
{ "name": "ability", "entity": "player", "minCount": 1 },
|
|
53
|
+
{ "name": "ability-expired", "entity": "player", "minCount": 1, "atStep": "surge-expired" }
|
|
54
|
+
],
|
|
55
|
+
"components": [{ "entity": "player", "component": "health", "equals": 90, "changed": true }],
|
|
56
|
+
"visibility": [
|
|
57
|
+
{ "entity": "player", "minProjectedPixels": 20 },
|
|
58
|
+
{ "entity": "enemy.visible", "minProjectedPixels": 1 }
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "action-rpg-fail-condition",
|
|
3
|
+
"target": "web",
|
|
4
|
+
"schemaVersion": 1,
|
|
5
|
+
"viewport": { "width": 1280, "height": 720 },
|
|
6
|
+
"warmupFrames": 10,
|
|
7
|
+
"subject": "player",
|
|
8
|
+
"steps": [
|
|
9
|
+
{ "kind": "input", "label": "forced-death", "press": "KeyX", "holdTicks": 1, "release": true },
|
|
10
|
+
{ "kind": "wait", "label": "failed", "waitTicks": 8, "release": true }
|
|
11
|
+
],
|
|
12
|
+
"assert": {
|
|
13
|
+
"diagnostics": { "noConsoleErrors": true, "noNetworkErrors": true, "runtimeReady": true },
|
|
14
|
+
"resources": [
|
|
15
|
+
{ "id": "GameState", "path": "gameOver", "equals": 1, "changed": true },
|
|
16
|
+
{ "id": "GameState", "path": "phase", "equals": "lost", "changed": true },
|
|
17
|
+
{ "id": "GameState", "path": "health", "equals": 0, "changed": true }
|
|
18
|
+
],
|
|
19
|
+
"signals": [{ "name": "died", "entity": "player", "minCount": 1, "atStep": "forced-death" }]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "action-rpg-loot-inventory-equipment",
|
|
3
|
+
"target": "web",
|
|
4
|
+
"schemaVersion": 1,
|
|
5
|
+
"viewport": { "width": 1280, "height": 720 },
|
|
6
|
+
"warmupFrames": 10,
|
|
7
|
+
"subject": "player",
|
|
8
|
+
"steps": [
|
|
9
|
+
{ "kind": "input", "label": "equip", "press": "KeyQ", "holdTicks": 1, "release": true },
|
|
10
|
+
{ "kind": "wait", "label": "equipped", "waitTicks": 4, "release": true },
|
|
11
|
+
{ "kind": "input", "label": "unequip", "press": "KeyU", "holdTicks": 1, "release": true },
|
|
12
|
+
{ "kind": "wait", "label": "unequipped", "waitTicks": 2, "release": true },
|
|
13
|
+
{
|
|
14
|
+
"kind": "input",
|
|
15
|
+
"label": "equip-before-fill",
|
|
16
|
+
"press": "KeyQ",
|
|
17
|
+
"holdTicks": 1,
|
|
18
|
+
"release": true
|
|
19
|
+
},
|
|
20
|
+
{ "kind": "wait", "label": "re-equipped", "waitTicks": 2, "release": true },
|
|
21
|
+
{ "kind": "input", "label": "fill", "press": "KeyP", "holdTicks": 1, "release": true },
|
|
22
|
+
{ "kind": "input", "label": "full-refusal", "press": "KeyL", "holdTicks": 1, "release": true },
|
|
23
|
+
{ "kind": "input", "label": "swap-retrieve", "press": "KeyL", "holdTicks": 1, "release": true },
|
|
24
|
+
{ "kind": "input", "label": "seeded-drops", "press": "KeyT", "holdTicks": 1, "release": true }
|
|
25
|
+
],
|
|
26
|
+
"assert": {
|
|
27
|
+
"diagnostics": { "noConsoleErrors": true, "noNetworkErrors": true, "runtimeReady": true },
|
|
28
|
+
"resources": [
|
|
29
|
+
{
|
|
30
|
+
"id": "GameState",
|
|
31
|
+
"path": "damage",
|
|
32
|
+
"atSteps": [
|
|
33
|
+
{ "label": "equipped", "equals": 18 },
|
|
34
|
+
{ "label": "unequipped", "equals": 12 },
|
|
35
|
+
{ "label": "re-equipped", "equals": 18 }
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"id": "GameState",
|
|
40
|
+
"path": "equippedItem",
|
|
41
|
+
"atSteps": [
|
|
42
|
+
{ "label": "equipped", "equals": "ember-blade" },
|
|
43
|
+
{ "label": "unequipped", "equals": "" },
|
|
44
|
+
{ "label": "re-equipped", "equals": "ember-blade" },
|
|
45
|
+
{ "label": "swap-retrieve", "equals": "ember-blade" }
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"id": "GameState",
|
|
50
|
+
"path": "inventoryFullRefused",
|
|
51
|
+
"atSteps": [
|
|
52
|
+
{ "label": "full-refusal", "equals": 1 },
|
|
53
|
+
{ "label": "swap-retrieve", "equals": 1 }
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"id": "GameState",
|
|
58
|
+
"path": "pendingLootItem",
|
|
59
|
+
"atSteps": [
|
|
60
|
+
{ "label": "full-refusal", "equals": "ember-blade" },
|
|
61
|
+
{ "label": "swap-retrieve", "equals": "rusted-blade" }
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"id": "GameState",
|
|
66
|
+
"path": "pendingLootQuantity",
|
|
67
|
+
"atSteps": [
|
|
68
|
+
{ "label": "full-refusal", "equals": 1 },
|
|
69
|
+
{ "label": "swap-retrieve", "equals": 1 }
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"id": "GameState",
|
|
74
|
+
"path": "inventorySlots",
|
|
75
|
+
"atSteps": [
|
|
76
|
+
{
|
|
77
|
+
"label": "swap-retrieve",
|
|
78
|
+
"equals": [
|
|
79
|
+
{ "itemId": "ember-blade", "quantity": 1 },
|
|
80
|
+
{ "itemId": "potion", "quantity": 3 },
|
|
81
|
+
{ "itemId": "potion", "quantity": 3 },
|
|
82
|
+
{ "itemId": "potion", "quantity": 3 },
|
|
83
|
+
{ "itemId": "potion", "quantity": 3 },
|
|
84
|
+
{ "itemId": "potion", "quantity": 1 }
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
{ "id": "GameState", "path": "dropProof", "equals": 1, "changed": true },
|
|
90
|
+
{
|
|
91
|
+
"id": "GameState",
|
|
92
|
+
"path": "enemiesDefeated",
|
|
93
|
+
"atSteps": [{ "label": "seeded-drops", "equals": 1 }]
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"id": "GameState",
|
|
97
|
+
"path": "lastDrop",
|
|
98
|
+
"atSteps": [{ "label": "seeded-drops", "equals": "potion x1, potion x1" }]
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
"signals": [
|
|
102
|
+
{ "name": "equipped", "entity": "player", "minCount": 1 },
|
|
103
|
+
{ "name": "unequipped", "entity": "player", "minCount": 1 },
|
|
104
|
+
{ "name": "loot-refused", "entity": "player", "minCount": 1 },
|
|
105
|
+
{ "name": "loot-collected", "entity": "loot", "minCount": 1 },
|
|
106
|
+
{ "name": "defeated", "entity": "enemy", "minCount": 1, "atStep": "seeded-drops" },
|
|
107
|
+
{ "name": "seeded", "entity": "loot", "minCount": 1 }
|
|
108
|
+
],
|
|
109
|
+
"visibility": [{ "entity": "player", "minProjectedPixels": 20 }]
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "action-rpg-progress-restore-through-game",
|
|
3
|
+
"target": "web",
|
|
4
|
+
"schemaVersion": 1,
|
|
5
|
+
"viewport": { "width": 1280, "height": 720 },
|
|
6
|
+
"warmupFrames": 10,
|
|
7
|
+
"subject": "player",
|
|
8
|
+
"steps": [
|
|
9
|
+
{
|
|
10
|
+
"kind": "input",
|
|
11
|
+
"label": "equip-before-save",
|
|
12
|
+
"press": "KeyQ",
|
|
13
|
+
"holdTicks": 1,
|
|
14
|
+
"release": true
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"kind": "input",
|
|
18
|
+
"label": "move-to-checkpoint",
|
|
19
|
+
"press": "KeyD",
|
|
20
|
+
"holdTicks": 32,
|
|
21
|
+
"release": true
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"kind": "input",
|
|
25
|
+
"label": "damage-before-save",
|
|
26
|
+
"press": "KeyH",
|
|
27
|
+
"holdTicks": 1,
|
|
28
|
+
"release": true
|
|
29
|
+
},
|
|
30
|
+
{ "kind": "input", "label": "checkpoint", "press": "KeyC", "holdTicks": 1, "release": true },
|
|
31
|
+
{ "kind": "wait", "label": "saved", "waitTicks": 5, "release": true },
|
|
32
|
+
{ "kind": "input", "label": "reload-game", "press": "KeyR", "holdTicks": 1, "release": true },
|
|
33
|
+
{ "kind": "wait", "label": "restored", "waitTicks": 12, "release": true }
|
|
34
|
+
],
|
|
35
|
+
"assert": {
|
|
36
|
+
"diagnostics": { "noConsoleErrors": true, "noNetworkErrors": true, "runtimeReady": true },
|
|
37
|
+
"resources": [
|
|
38
|
+
{
|
|
39
|
+
"id": "GameState",
|
|
40
|
+
"path": "saveCount",
|
|
41
|
+
"atSteps": [{ "label": "checkpoint", "equals": 2 }, { "label": "restored", "equals": 2 }]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"id": "GameState",
|
|
45
|
+
"path": "health",
|
|
46
|
+
"atSteps": [
|
|
47
|
+
{ "label": "damage-before-save", "equals": 77 },
|
|
48
|
+
{ "label": "restored", "equals": 77 }
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"id": "GameState",
|
|
53
|
+
"path": "equippedItem",
|
|
54
|
+
"atSteps": [{ "label": "restored", "equals": "ember-blade" }]
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"id": "GameState",
|
|
58
|
+
"path": "damage",
|
|
59
|
+
"atSteps": [{ "label": "checkpoint", "equals": 18 }, { "label": "restored", "equals": 18 }]
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"id": "GameState",
|
|
63
|
+
"path": "playerX",
|
|
64
|
+
"atSteps": [
|
|
65
|
+
{ "label": "checkpoint", "equals": -5.44 },
|
|
66
|
+
{ "label": "restored", "equals": -5.44 }
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"id": "GameState",
|
|
71
|
+
"path": "playerY",
|
|
72
|
+
"atSteps": [
|
|
73
|
+
{ "label": "checkpoint", "equals": 0.78 },
|
|
74
|
+
{ "label": "restored", "equals": 0.78 }
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"id": "GameState",
|
|
79
|
+
"path": "playerZ",
|
|
80
|
+
"atSteps": [{ "label": "checkpoint", "equals": 0 }, { "label": "restored", "equals": 0 }]
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
"components": [
|
|
84
|
+
{ "entity": "player", "component": "health", "equals": 77, "changed": true },
|
|
85
|
+
{ "entity": "player", "component": "equippedItem", "equals": "ember-blade", "changed": true },
|
|
86
|
+
{ "entity": "player", "component": "position", "changed": true }
|
|
87
|
+
],
|
|
88
|
+
"movement": {
|
|
89
|
+
"entity": "player",
|
|
90
|
+
"minDistance": 0.5,
|
|
91
|
+
"reachesPositionWithin": {
|
|
92
|
+
"atStep": "restored",
|
|
93
|
+
"position": [-5.44, 0.78, 0],
|
|
94
|
+
"maxDistance": 0.01
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"visibility": [{ "entity": "player", "minProjectedPixels": 20 }]
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "survives",
|
|
3
|
+
"target": "web",
|
|
4
|
+
"schemaVersion": 1,
|
|
5
|
+
"viewport": { "width": 1280, "height": 720 },
|
|
6
|
+
"warmupFrames": 10,
|
|
7
|
+
"subject": "player",
|
|
8
|
+
"steps": [
|
|
9
|
+
{ "kind": "input", "label": "move", "press": "ArrowUp", "holdTicks": 60, "release": true },
|
|
10
|
+
{ "kind": "wait", "label": "settle", "waitTicks": 10, "release": true }
|
|
11
|
+
],
|
|
12
|
+
"assert": {
|
|
13
|
+
"diagnostics": {
|
|
14
|
+
"noConsoleErrors": true,
|
|
15
|
+
"noNetworkErrors": true,
|
|
16
|
+
"noRuntimeDiagnostics": true,
|
|
17
|
+
"runtimeReady": true
|
|
18
|
+
},
|
|
19
|
+
"movement": { "entity": "player", "minDistance": 0.5 },
|
|
20
|
+
"visual": [
|
|
21
|
+
{
|
|
22
|
+
"region": {
|
|
23
|
+
"x": 0,
|
|
24
|
+
"y": 0,
|
|
25
|
+
"width": 1280,
|
|
26
|
+
"height": 720,
|
|
27
|
+
"minNonblankPixelRatio": 0.01
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "action-rpg-boss-win",
|
|
3
|
+
"target": "web",
|
|
4
|
+
"schemaVersion": 1,
|
|
5
|
+
"viewport": { "width": 1280, "height": 720 },
|
|
6
|
+
"warmupFrames": 10,
|
|
7
|
+
"subject": "player",
|
|
8
|
+
"steps": [
|
|
9
|
+
{ "kind": "input", "label": "cross-rooms", "press": "KeyD", "holdTicks": 285, "release": true },
|
|
10
|
+
{ "kind": "input", "label": "surge", "press": "KeyE", "holdTicks": 1, "release": true },
|
|
11
|
+
{ "kind": "input", "label": "boss-hit-1", "press": "KeyF", "holdTicks": 1, "release": true },
|
|
12
|
+
{ "kind": "wait", "label": "boss-ready-2", "waitTicks": 8, "release": true },
|
|
13
|
+
{ "kind": "input", "label": "boss-hit-2", "press": "KeyF", "holdTicks": 1, "release": true },
|
|
14
|
+
{ "kind": "wait", "label": "boss-ready-3", "waitTicks": 8, "release": true },
|
|
15
|
+
{ "kind": "input", "label": "boss-hit-3", "press": "KeyF", "holdTicks": 1, "release": true },
|
|
16
|
+
{ "kind": "wait", "label": "boss-ready-4", "waitTicks": 8, "release": true },
|
|
17
|
+
{ "kind": "input", "label": "boss-hit-4", "press": "KeyF", "holdTicks": 1, "release": true },
|
|
18
|
+
{ "kind": "wait", "label": "win-settled", "waitTicks": 30, "release": true }
|
|
19
|
+
],
|
|
20
|
+
"assert": {
|
|
21
|
+
"diagnostics": { "noConsoleErrors": true, "noNetworkErrors": true, "runtimeReady": true },
|
|
22
|
+
"resources": [
|
|
23
|
+
{ "id": "GameState", "path": "gameWon", "equals": 1, "changed": true },
|
|
24
|
+
{ "id": "GameState", "path": "phase", "equals": "won", "changed": true },
|
|
25
|
+
{ "id": "GameState", "path": "enemiesDefeated", "gte": 1, "changed": true }
|
|
26
|
+
],
|
|
27
|
+
"signals": [{ "name": "defeated", "entity": "boss", "minCount": 1, "atStep": "boss-hit-3" }],
|
|
28
|
+
"visibility": [{ "entity": "player", "minProjectedPixels": 20 }]
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export interface IAbilityOptions {
|
|
2
|
+
readonly cooldown: number;
|
|
3
|
+
readonly duration: number;
|
|
4
|
+
readonly onExpire: () => void;
|
|
5
|
+
readonly onStart: () => void;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export class Ability {
|
|
9
|
+
readonly cooldown: number;
|
|
10
|
+
readonly duration: number;
|
|
11
|
+
#cooldownRemaining = 0;
|
|
12
|
+
#effectRemaining = 0;
|
|
13
|
+
#onExpire: () => void;
|
|
14
|
+
#onStart: () => void;
|
|
15
|
+
|
|
16
|
+
constructor(options: IAbilityOptions) {
|
|
17
|
+
this.cooldown = options.cooldown;
|
|
18
|
+
this.duration = options.duration;
|
|
19
|
+
this.#onExpire = options.onExpire;
|
|
20
|
+
this.#onStart = options.onStart;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
cast(): boolean {
|
|
24
|
+
if (this.#cooldownRemaining > 0 || this.#effectRemaining > 0) return false;
|
|
25
|
+
this.#cooldownRemaining = this.cooldown;
|
|
26
|
+
this.#effectRemaining = this.duration;
|
|
27
|
+
this.#onStart();
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
update(dt: number): void {
|
|
32
|
+
this.#cooldownRemaining = Math.max(0, this.#cooldownRemaining - dt);
|
|
33
|
+
if (this.#effectRemaining <= 0) return;
|
|
34
|
+
this.#effectRemaining = Math.max(0, this.#effectRemaining - dt);
|
|
35
|
+
if (this.#effectRemaining === 0) this.#onExpire();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
get active(): boolean {
|
|
39
|
+
return this.#effectRemaining > 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
get cooldownRemaining(): number {
|
|
43
|
+
return this.#cooldownRemaining;
|
|
44
|
+
}
|
|
45
|
+
}
|