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,77 @@
|
|
|
1
|
+
import type { PathFollow3D } from "@threenative/core";
|
|
2
|
+
import { Vector3 } from "three";
|
|
3
|
+
import { type IRescueTarget, rescueToLastValid } from "./rescue.js";
|
|
4
|
+
|
|
5
|
+
export interface IRayHit {
|
|
6
|
+
readonly distance: number;
|
|
7
|
+
readonly normalY?: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type IntersectRay = (
|
|
11
|
+
origin: Vector3,
|
|
12
|
+
direction: Vector3,
|
|
13
|
+
maxDistance: number,
|
|
14
|
+
) => IRayHit | undefined;
|
|
15
|
+
|
|
16
|
+
export type ITrackSectorTarget = IRescueTarget;
|
|
17
|
+
|
|
18
|
+
export interface ITrackSectorOptions {
|
|
19
|
+
readonly route: PathFollow3D;
|
|
20
|
+
readonly intersectRay: IntersectRay;
|
|
21
|
+
readonly rescueDelay?: number;
|
|
22
|
+
readonly rayHeight?: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Records a grounded transform and returns a racer to it after leaving the road. */
|
|
26
|
+
export class TrackSector {
|
|
27
|
+
readonly lastOnRoadPosition = new Vector3();
|
|
28
|
+
readonly lastOnRoadHeading = new Vector3(1, 0, 0);
|
|
29
|
+
currentSector = 0;
|
|
30
|
+
#offRoadTime = 0;
|
|
31
|
+
#hasOnRoadSample = false;
|
|
32
|
+
readonly #route: PathFollow3D;
|
|
33
|
+
readonly #intersectRay: IntersectRay;
|
|
34
|
+
readonly #rescueDelay: number;
|
|
35
|
+
readonly #rayHeight: number;
|
|
36
|
+
|
|
37
|
+
constructor(options: ITrackSectorOptions) {
|
|
38
|
+
this.#route = options.route;
|
|
39
|
+
this.#intersectRay = options.intersectRay;
|
|
40
|
+
this.#rescueDelay = options.rescueDelay ?? 0.65;
|
|
41
|
+
this.#rayHeight = options.rayHeight ?? 3;
|
|
42
|
+
if (!(this.#rescueDelay > 0)) throw new Error("TrackSector rescueDelay must be positive.");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
update(position: Vector3, heading: Vector3, dt: number): boolean {
|
|
46
|
+
if (!Number.isFinite(dt) || dt < 0)
|
|
47
|
+
throw new Error("TrackSector.update requires a finite non-negative dt.");
|
|
48
|
+
const origin = position.clone().add(new Vector3(0, this.#rayHeight, 0));
|
|
49
|
+
const hit = this.#intersectRay(origin, new Vector3(0, -1, 0), this.#rayHeight + 2);
|
|
50
|
+
const onRoad = hit !== undefined && hit.distance >= 0 && hit.distance <= this.#rayHeight + 2;
|
|
51
|
+
if (onRoad) {
|
|
52
|
+
this.lastOnRoadPosition.copy(position);
|
|
53
|
+
this.lastOnRoadHeading.copy(heading).setY(0).normalize();
|
|
54
|
+
this.currentSector = this.#route.project(position).segment;
|
|
55
|
+
this.#hasOnRoadSample = true;
|
|
56
|
+
this.#offRoadTime = 0;
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
this.#offRoadTime += dt;
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
get offRoadTime(): number {
|
|
64
|
+
return this.#offRoadTime;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
get shouldRescue(): boolean {
|
|
68
|
+
return this.#hasOnRoadSample && this.#offRoadTime >= this.#rescueDelay;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
rescue(target: ITrackSectorTarget): boolean {
|
|
72
|
+
if (!this.shouldRescue) return false;
|
|
73
|
+
rescueToLastValid(target, this.lastOnRoadPosition, this.lastOnRoadHeading);
|
|
74
|
+
this.#offRoadTime = 0;
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type Object3D, Quaternion, Vector3 } from "three";
|
|
2
|
+
|
|
3
|
+
export interface IRescueTarget {
|
|
4
|
+
readonly body: { teleport(position: Pick<Vector3, "x" | "y" | "z">): void };
|
|
5
|
+
readonly mesh: Object3D;
|
|
6
|
+
setHeading?(heading: Vector3): void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function rescueToLastValid(
|
|
10
|
+
target: IRescueTarget,
|
|
11
|
+
position: Vector3,
|
|
12
|
+
heading: Vector3,
|
|
13
|
+
): void {
|
|
14
|
+
target.body.teleport(position);
|
|
15
|
+
if (target.setHeading !== undefined) {
|
|
16
|
+
target.setHeading(heading);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const rotation = new Quaternion().setFromUnitVectors(new Vector3(1, 0, 0), heading);
|
|
20
|
+
target.mesh.quaternion.copy(rotation);
|
|
21
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IGame } from "@threenative/core";
|
|
2
|
+
import type { IPhysicsContext } from "@threenative/physics";
|
|
3
|
+
import { DebugOverlay, GameCanvas } from "@threenative/ui";
|
|
4
|
+
import type { GameState } from "../state.js";
|
|
5
|
+
import { Hud } from "./Hud.js";
|
|
6
|
+
import { Menu } from "./Menu.js";
|
|
7
|
+
|
|
8
|
+
export function App({ game }: { game: IGame<GameState, IPhysicsContext> }) {
|
|
9
|
+
return (
|
|
10
|
+
<main className="relative h-screen w-screen overflow-hidden bg-ink">
|
|
11
|
+
<GameCanvas className="absolute inset-0" game={game} />
|
|
12
|
+
<Hud game={game} />
|
|
13
|
+
<Menu />
|
|
14
|
+
<DebugOverlay />
|
|
15
|
+
</main>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { IGame } from "@threenative/core";
|
|
2
|
+
import type { IPhysicsContext } from "@threenative/physics";
|
|
3
|
+
import { useGameState } from "@threenative/ui";
|
|
4
|
+
import type { GameState } from "../state.js";
|
|
5
|
+
|
|
6
|
+
function clock(seconds: number): string {
|
|
7
|
+
return `${String(Math.floor(seconds / 60)).padStart(2, "0")}:${String(Math.floor(seconds % 60)).padStart(2, "0")}.${String(Math.floor((seconds % 1) * 10))}`;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function Hud({ game }: { game: IGame<GameState, IPhysicsContext> }) {
|
|
11
|
+
const state = useGameState(game, (value) => value);
|
|
12
|
+
const statusClass =
|
|
13
|
+
state.raceStatus === "WON"
|
|
14
|
+
? "text-win"
|
|
15
|
+
: state.raceStatus === "DNF"
|
|
16
|
+
? "text-danger"
|
|
17
|
+
: "text-accent";
|
|
18
|
+
return (
|
|
19
|
+
<div className="pointer-events-none absolute inset-0 p-6 text-[11px] uppercase tracking-[0.16em] text-text">
|
|
20
|
+
<div className="flex items-start justify-between">
|
|
21
|
+
<div>
|
|
22
|
+
<div className="text-[10px] text-muted">circuit / northern loop</div>
|
|
23
|
+
<div className="mt-2 flex items-baseline gap-5 text-[18px] text-white">
|
|
24
|
+
<span>
|
|
25
|
+
lap <b id="lap">{Math.min(state.totalLaps, state.completedLaps + 1)}</b>/
|
|
26
|
+
<b>{state.totalLaps}</b>
|
|
27
|
+
</span>
|
|
28
|
+
<span className={statusClass} id="race-status">
|
|
29
|
+
{state.raceStatus}
|
|
30
|
+
</span>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
<div className="text-right">
|
|
34
|
+
<div className="text-[10px] text-muted">position</div>
|
|
35
|
+
<div className="mt-2 text-[22px] text-white" id="position">
|
|
36
|
+
P{state.place}
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
<div className="absolute bottom-6 left-6 flex items-end gap-8">
|
|
41
|
+
<div>
|
|
42
|
+
<div className="text-[10px] text-muted">speed</div>
|
|
43
|
+
<div className="mt-1 text-[26px] leading-none text-white">
|
|
44
|
+
<span id="speed">{Math.round(state.speed * 10)}</span>
|
|
45
|
+
<span className="text-[11px] text-muted"> km/h</span>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
<div>
|
|
49
|
+
<div className="text-[10px] text-muted">time</div>
|
|
50
|
+
<div className="mt-1 text-[18px] leading-none text-white" id="time">
|
|
51
|
+
{clock(state.elapsed)}
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
<div className={state.boostActive ? "text-accent" : "text-muted"}>
|
|
55
|
+
<div className="text-[10px]">boost</div>
|
|
56
|
+
<div className="mt-1 text-[18px] leading-none" id="boost">
|
|
57
|
+
{state.boostActive ? "ACTIVE" : `${state.boostUses} READY`}
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
{state.raceStatus !== "RACING" && (
|
|
62
|
+
<div
|
|
63
|
+
className={`absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 border px-8 py-5 text-center ${state.raceStatus === "WON" ? "border-win/70 bg-win/10" : "border-danger/70 bg-danger/10"}`}
|
|
64
|
+
>
|
|
65
|
+
<div className={`text-[28px] tracking-[0.28em] ${statusClass}`}>{state.raceStatus}</div>
|
|
66
|
+
<div className="mt-2 text-[10px] text-muted">press R to restart</div>
|
|
67
|
+
</div>
|
|
68
|
+
)}
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { IThreeNativeConfig } from "@threenative/core";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
app: {
|
|
5
|
+
id: "com.threenative.__PROJECT_ID__",
|
|
6
|
+
name: "__PROJECT_NAME__",
|
|
7
|
+
version: "1.0.0",
|
|
8
|
+
build: 1,
|
|
9
|
+
},
|
|
10
|
+
display: {
|
|
11
|
+
orientation: "landscape",
|
|
12
|
+
fullscreen: true,
|
|
13
|
+
keepScreenOn: true,
|
|
14
|
+
},
|
|
15
|
+
window: {
|
|
16
|
+
title: "__PROJECT_NAME__",
|
|
17
|
+
width: 1280,
|
|
18
|
+
height: 720,
|
|
19
|
+
resizable: true,
|
|
20
|
+
},
|
|
21
|
+
loading: {
|
|
22
|
+
backdropColor: "#07111d",
|
|
23
|
+
trackColor: "#16324a",
|
|
24
|
+
progressColor: "#ffcf4a",
|
|
25
|
+
showProgressBar: true,
|
|
26
|
+
},
|
|
27
|
+
nativeEntry: "src/game.ts",
|
|
28
|
+
renderer: { preferWebGPU: true },
|
|
29
|
+
} satisfies IThreeNativeConfig;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "bundler",
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"types": ["vite/client"],
|
|
9
|
+
"strict": true,
|
|
10
|
+
"noUncheckedIndexedAccess": true,
|
|
11
|
+
"noEmit": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"verbatimModuleSyntax": true,
|
|
14
|
+
"isolatedModules": true
|
|
15
|
+
},
|
|
16
|
+
"include": ["src/**/*.ts", "src/**/*.tsx", "*.ts"]
|
|
17
|
+
}
|
|
@@ -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,69 @@
|
|
|
1
|
+
# AGENTS.md — __PROJECT_NAME__ arena shooter
|
|
2
|
+
|
|
3
|
+
This project is a playable ThreeNative arena shooter. The framework owns the loop, renderer,
|
|
4
|
+
input, physics binding, and React bridge. This generated repository owns the arena, weapons,
|
|
5
|
+
targets, waves, and every visual decision.
|
|
6
|
+
|
|
7
|
+
## Commands
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pnpm dev
|
|
11
|
+
pnpm build
|
|
12
|
+
pnpm build --target desktop
|
|
13
|
+
pnpm test
|
|
14
|
+
pnpm typecheck
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The portable entry is `src/game.ts`; `src/main.ts` is the web-only React mount. The native
|
|
18
|
+
bundle does not run React, access the DOM, or load WASM. Keep gameplay in `src/`, and keep
|
|
19
|
+
the look in `src/render/`.
|
|
20
|
+
|
|
21
|
+
## Game contract
|
|
22
|
+
|
|
23
|
+
- Clear five waves to win.
|
|
24
|
+
- Reach zero lives to fail.
|
|
25
|
+
- `F` fires the hitscan weapon; `G` fires the projectile weapon.
|
|
26
|
+
- `E` tests the radius blast; `C` tests the wall probe.
|
|
27
|
+
- `H` takes damage and `X` takes a lethal hit so the loop is easy to playtest.
|
|
28
|
+
- `WASD` or the arrow keys move; `R` restarts the arena.
|
|
29
|
+
|
|
30
|
+
Hitscan, radius damage, and target scans use `ctx.physics.directSpaceState` from
|
|
31
|
+
`@threenative/physics`. Do not replace it with `ctx.raycast()`, a mesh raycaster, or a JavaScript
|
|
32
|
+
distance scan. `CharacterBody3D.moveAndSlide()` owns movement and gravity.
|
|
33
|
+
|
|
34
|
+
**This template has one HUD, and it is `src/ui/Hud.tsx`.** It previously shipped a
|
|
35
|
+
camera-attached geometry HUD as well, and both drew the same numbers on top of each other: a blind
|
|
36
|
+
score of the first frame found the upper-left quarter unreadable, with the two sets of glyphs
|
|
37
|
+
interleaved letter by letter. Gameplay and state transitions live in the portable scene and reach
|
|
38
|
+
the HUD through `ctx.state.set`, so nothing about that is web-only. **A native build therefore has
|
|
39
|
+
no HUD until you add one** — write it in your own `src/render/` code, in Three.js rather than DOM,
|
|
40
|
+
if your game needs one there.
|
|
41
|
+
|
|
42
|
+
## Layout
|
|
43
|
+
|
|
44
|
+
```mermaid
|
|
45
|
+
flowchart TD
|
|
46
|
+
game["src/game.ts"] --> play["scenes/Play.ts"]
|
|
47
|
+
play --> weapons["weapons/"]
|
|
48
|
+
play --> entities["entities/"]
|
|
49
|
+
play --> loop["waves.ts + state.ts"]
|
|
50
|
+
play --> render["render/"]
|
|
51
|
+
main["src/main.ts"] --> ui["ui/"]
|
|
52
|
+
ui --> game
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Edit `src/weapons/` first when changing how the game already plays. Edit `src/render/` when
|
|
56
|
+
changing what the screenshot shows. Keep `playtests/` honest: every scenario must observe a
|
|
57
|
+
quantity or transition produced by the game.
|
|
58
|
+
|
|
59
|
+
`playtests/survives.playtest.json` is the durable smoke proof. Keep it when replacing the
|
|
60
|
+
shooter gameplay; `shooter.playtest.json` and `fail.playtest.json` are examples for this arena's
|
|
61
|
+
combat and terminal behavior.
|
|
62
|
+
|
|
63
|
+
The asset MCP loop is:
|
|
64
|
+
|
|
65
|
+
1. `asset_search_sources`
|
|
66
|
+
2. `ambientcg_search_assets` / `polyhaven_search_assets` / `audio_search_assets`
|
|
67
|
+
3. `ambientcg_list_files` / `polyhaven_list_files`
|
|
68
|
+
4. `asset_download_file` / `audio_download_asset`
|
|
69
|
+
5. Check returned license and attribution fields before committing an asset.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<!-- Generated mirror of AGENTS.md. Do not edit; edit AGENTS.md. -->
|
|
2
|
+
|
|
3
|
+
# AGENTS.md — __PROJECT_NAME__ arena shooter
|
|
4
|
+
|
|
5
|
+
This project is a playable ThreeNative arena shooter. The framework owns the loop, renderer,
|
|
6
|
+
input, physics binding, and React bridge. This generated repository owns the arena, weapons,
|
|
7
|
+
targets, waves, and every visual decision.
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
pnpm dev
|
|
13
|
+
pnpm build
|
|
14
|
+
pnpm build --target desktop
|
|
15
|
+
pnpm test
|
|
16
|
+
pnpm typecheck
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The portable entry is `src/game.ts`; `src/main.ts` is the web-only React mount. The native
|
|
20
|
+
bundle does not run React, access the DOM, or load WASM. Keep gameplay in `src/`, and keep
|
|
21
|
+
the look in `src/render/`.
|
|
22
|
+
|
|
23
|
+
## Game contract
|
|
24
|
+
|
|
25
|
+
- Clear five waves to win.
|
|
26
|
+
- Reach zero lives to fail.
|
|
27
|
+
- `F` fires the hitscan weapon; `G` fires the projectile weapon.
|
|
28
|
+
- `E` tests the radius blast; `C` tests the wall probe.
|
|
29
|
+
- `H` takes damage and `X` takes a lethal hit so the loop is easy to playtest.
|
|
30
|
+
- `WASD` or the arrow keys move; `R` restarts the arena.
|
|
31
|
+
|
|
32
|
+
Hitscan, radius damage, and target scans use `ctx.physics.directSpaceState` from
|
|
33
|
+
`@threenative/physics`. Do not replace it with `ctx.raycast()`, a mesh raycaster, or a JavaScript
|
|
34
|
+
distance scan. `CharacterBody3D.moveAndSlide()` owns movement and gravity.
|
|
35
|
+
|
|
36
|
+
**This template has one HUD, and it is `src/ui/Hud.tsx`.** It previously shipped a
|
|
37
|
+
camera-attached geometry HUD as well, and both drew the same numbers on top of each other: a blind
|
|
38
|
+
score of the first frame found the upper-left quarter unreadable, with the two sets of glyphs
|
|
39
|
+
interleaved letter by letter. Gameplay and state transitions live in the portable scene and reach
|
|
40
|
+
the HUD through `ctx.state.set`, so nothing about that is web-only. **A native build therefore has
|
|
41
|
+
no HUD until you add one** — write it in your own `src/render/` code, in Three.js rather than DOM,
|
|
42
|
+
if your game needs one there.
|
|
43
|
+
|
|
44
|
+
## Layout
|
|
45
|
+
|
|
46
|
+
```mermaid
|
|
47
|
+
flowchart TD
|
|
48
|
+
game["src/game.ts"] --> play["scenes/Play.ts"]
|
|
49
|
+
play --> weapons["weapons/"]
|
|
50
|
+
play --> entities["entities/"]
|
|
51
|
+
play --> loop["waves.ts + state.ts"]
|
|
52
|
+
play --> render["render/"]
|
|
53
|
+
main["src/main.ts"] --> ui["ui/"]
|
|
54
|
+
ui --> game
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Edit `src/weapons/` first when changing how the game already plays. Edit `src/render/` when
|
|
58
|
+
changing what the screenshot shows. Keep `playtests/` honest: every scenario must observe a
|
|
59
|
+
quantity or transition produced by the game.
|
|
60
|
+
|
|
61
|
+
`playtests/survives.playtest.json` is the durable smoke proof. Keep it when replacing the
|
|
62
|
+
shooter gameplay; `shooter.playtest.json` and `fail.playtest.json` are examples for this arena's
|
|
63
|
+
combat and terminal behavior.
|
|
64
|
+
|
|
65
|
+
The asset MCP loop is:
|
|
66
|
+
|
|
67
|
+
1. `asset_search_sources`
|
|
68
|
+
2. `ambientcg_search_assets` / `polyhaven_search_assets` / `audio_search_assets`
|
|
69
|
+
3. `ambientcg_list_files` / `polyhaven_list_files`
|
|
70
|
+
4. `asset_download_file` / `audio_download_asset`
|
|
71
|
+
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,46 @@
|
|
|
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 && 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\" && threenative-playtest --scenario playtests/shooter.playtest.json --url http://127.0.0.1:4173 --server-command \"pnpm dev --host 127.0.0.1 --port 4173 --strictPort\" --browser-recipe webgpu && 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",
|
|
15
|
+
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@threenative/core": "0.2.0",
|
|
19
|
+
"@threenative/physics": "0.2.0",
|
|
20
|
+
"@threenative/ui": "0.2.0",
|
|
21
|
+
"react": "19.2.0",
|
|
22
|
+
"react-dom": "19.2.0",
|
|
23
|
+
"three": "0.185.1"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@tailwindcss/vite": "4.3.3",
|
|
27
|
+
"@types/three": "0.185.3",
|
|
28
|
+
"@vitejs/plugin-react": "6.0.5",
|
|
29
|
+
"@threenative/playtest": "0.2.0",
|
|
30
|
+
"@types/react": "19.2.0",
|
|
31
|
+
"@types/react-dom": "19.2.0",
|
|
32
|
+
"playwright": "1.62.1",
|
|
33
|
+
"create-threenative": "0.2.0",
|
|
34
|
+
"tailwindcss": "4.3.3",
|
|
35
|
+
"threenative-asset-mcp": "0.4.0",
|
|
36
|
+
"threenative-sculpt-mcp": "0.1.0",
|
|
37
|
+
"typescript": "5.9.3",
|
|
38
|
+
"vite": "8.2.0"
|
|
39
|
+
},
|
|
40
|
+
"optionalDependencies": {
|
|
41
|
+
"@threenative/runtime-native": "0.2.0"
|
|
42
|
+
},
|
|
43
|
+
"pnpm": {
|
|
44
|
+
"onlyBuiltDependencies": ["@threenative/runtime-native"]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "shooter-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": "first-hit", "press": "KeyX", "holdTicks": 1, "release": true },
|
|
10
|
+
{ "kind": "wait", "label": "first-respawn", "waitTicks": 45, "release": true },
|
|
11
|
+
{ "kind": "input", "label": "second-hit", "press": "KeyX", "holdTicks": 1, "release": true },
|
|
12
|
+
{ "kind": "wait", "label": "second-respawn", "waitTicks": 45, "release": true },
|
|
13
|
+
{ "kind": "input", "label": "third-hit", "press": "KeyX", "holdTicks": 1, "release": true },
|
|
14
|
+
{ "kind": "wait", "label": "failed", "waitTicks": 10, "release": true }
|
|
15
|
+
],
|
|
16
|
+
"assert": {
|
|
17
|
+
"diagnostics": {
|
|
18
|
+
"noRuntimeDiagnostics": false,
|
|
19
|
+
"runtimeDiagnosticsOptOutReason": "Headless Linux Chromium emits the known WebGPU buffer diagnostic; fail-condition assertions remain authoritative.",
|
|
20
|
+
"runtimeReady": true
|
|
21
|
+
},
|
|
22
|
+
"resources": [
|
|
23
|
+
{ "id": "GameState", "path": "deaths", "equals": 3, "changed": true },
|
|
24
|
+
{ "id": "GameState", "path": "lives", "equals": 0, "changed": true },
|
|
25
|
+
{ "id": "GameState", "path": "gameOver", "equals": 1, "changed": true },
|
|
26
|
+
{ "id": "GameState", "path": "phase", "textIncludes": "lost", "changed": true }
|
|
27
|
+
],
|
|
28
|
+
"signals": [{ "name": "died", "entity": "player", "minCount": 3 }]
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "shooter-contract-and-loop",
|
|
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": "geometry-and-layer-filter",
|
|
12
|
+
"press": "KeyF",
|
|
13
|
+
"holdTicks": 1,
|
|
14
|
+
"release": true
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"kind": "input",
|
|
18
|
+
"label": "wall-layer-filter",
|
|
19
|
+
"press": "KeyC",
|
|
20
|
+
"holdTicks": 1,
|
|
21
|
+
"release": true
|
|
22
|
+
},
|
|
23
|
+
{ "kind": "input", "label": "radius-set", "press": "KeyE", "holdTicks": 1, "release": true },
|
|
24
|
+
{ "kind": "wait", "label": "scan-window", "waitTicks": 300, "release": true },
|
|
25
|
+
{ "kind": "input", "label": "damage", "press": "KeyH", "holdTicks": 1, "release": true },
|
|
26
|
+
{ "kind": "input", "label": "death", "press": "KeyX", "holdTicks": 1, "release": true },
|
|
27
|
+
{ "kind": "wait", "label": "respawn", "waitTicks": 35, "release": true },
|
|
28
|
+
{ "kind": "input", "label": "pickup", "press": "KeyA", "holdTicks": 8, "release": true },
|
|
29
|
+
{ "kind": "input", "label": "pickup-return", "press": "KeyD", "holdTicks": 8, "release": true },
|
|
30
|
+
{ "kind": "input", "label": "wave-1-shot", "press": "KeyF", "holdTicks": 1, "release": true },
|
|
31
|
+
{ "kind": "wait", "label": "wave-2-ready", "waitTicks": 45, "release": true },
|
|
32
|
+
{ "kind": "input", "label": "wave-2-shot", "press": "KeyF", "holdTicks": 1, "release": true },
|
|
33
|
+
{ "kind": "wait", "label": "wave-3-ready", "waitTicks": 45, "release": true },
|
|
34
|
+
{ "kind": "input", "label": "wave-3-shot", "press": "KeyF", "holdTicks": 1, "release": true },
|
|
35
|
+
{ "kind": "wait", "label": "wave-4-ready", "waitTicks": 45, "release": true },
|
|
36
|
+
{ "kind": "input", "label": "wave-4-shot", "press": "KeyF", "holdTicks": 1, "release": true },
|
|
37
|
+
{ "kind": "wait", "label": "wave-5-ready", "waitTicks": 45, "release": true },
|
|
38
|
+
{ "kind": "input", "label": "wave-5-shot", "press": "KeyF", "holdTicks": 1, "release": true },
|
|
39
|
+
{ "kind": "wait", "label": "win-settled", "waitTicks": 45, "release": true }
|
|
40
|
+
],
|
|
41
|
+
"assert": {
|
|
42
|
+
"diagnostics": {
|
|
43
|
+
"noNetworkErrors": true,
|
|
44
|
+
"noRuntimeDiagnostics": false,
|
|
45
|
+
"runtimeDiagnosticsOptOutReason": "Headless Linux Chromium emits the known WebGPU buffer diagnostic; gameplay and visibility assertions remain authoritative.",
|
|
46
|
+
"runtimeReady": true
|
|
47
|
+
},
|
|
48
|
+
"resources": [
|
|
49
|
+
{ "id": "GameState", "path": "hitDistanceTenths", "equals": 78, "changed": true },
|
|
50
|
+
{ "id": "GameState", "path": "hitNormalXPercent", "equals": 0, "changed": true },
|
|
51
|
+
{ "id": "GameState", "path": "hitNormalYPercent", "equals": 0, "changed": true },
|
|
52
|
+
{ "id": "GameState", "path": "hitNormalZPercent", "equals": 100, "changed": true },
|
|
53
|
+
{ "id": "GameState", "path": "friendlyPassed", "equals": 1, "changed": true },
|
|
54
|
+
{ "id": "GameState", "path": "wallBlocked", "equals": 1, "changed": true },
|
|
55
|
+
{ "id": "GameState", "path": "radiusInsideDeaths", "equals": 2, "changed": true },
|
|
56
|
+
{ "id": "GameState", "path": "radiusNearAlive", "equals": 0, "changed": true },
|
|
57
|
+
{ "id": "GameState", "path": "radiusMidAlive", "equals": 0, "changed": true },
|
|
58
|
+
{ "id": "GameState", "path": "radiusOutsideAlive", "equals": 1 },
|
|
59
|
+
{ "id": "GameState", "path": "scanCount", "gte": 100, "changed": true },
|
|
60
|
+
{ "id": "GameState", "path": "health", "atSteps": [{ "label": "damage", "equals": 65 }] },
|
|
61
|
+
{ "id": "GameState", "path": "deaths", "atSteps": [{ "label": "death", "equals": 1 }] },
|
|
62
|
+
{ "id": "GameState", "path": "respawns", "atSteps": [{ "label": "respawn", "equals": 1 }] },
|
|
63
|
+
{ "id": "GameState", "path": "pickups", "atSteps": [{ "label": "pickup", "equals": 1 }] },
|
|
64
|
+
{ "id": "GameState", "path": "wavesCleared", "equals": 5, "changed": true },
|
|
65
|
+
{ "id": "GameState", "path": "gameWon", "equals": 1, "changed": true }
|
|
66
|
+
],
|
|
67
|
+
"components": [
|
|
68
|
+
{
|
|
69
|
+
"entity": "scan-target",
|
|
70
|
+
"component": "selected",
|
|
71
|
+
"atSteps": [{ "label": "scan-window", "equals": 1 }]
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"signals": [
|
|
75
|
+
{ "name": "hit", "entity": "player", "minCount": 1, "atStep": "geometry-and-layer-filter" },
|
|
76
|
+
{ "name": "wall-blocked", "entity": "player", "minCount": 1, "atStep": "wall-layer-filter" },
|
|
77
|
+
{ "name": "radius-damage", "entity": "player", "minCount": 1, "atStep": "radius-set" },
|
|
78
|
+
{ "name": "damaged", "entity": "player", "minCount": 1, "atStep": "damage" },
|
|
79
|
+
{ "name": "died", "entity": "player", "minCount": 1, "atStep": "death" },
|
|
80
|
+
{ "name": "respawned", "entity": "player", "minCount": 1, "atStep": "respawn" },
|
|
81
|
+
{ "name": "collected", "entity": "player", "minCount": 1, "atStep": "pickup" },
|
|
82
|
+
{ "name": "cleared", "entity": "wave", "minCount": 5 }
|
|
83
|
+
],
|
|
84
|
+
"visibility": [
|
|
85
|
+
{ "entity": "player", "minProjectedPixels": 20 },
|
|
86
|
+
{ "entity": "demo-target", "present": false }
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -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
|
+
}
|