create-threenative 0.2.3 → 0.2.5
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 +53 -2
- package/agent-docs/references/assertion-reference.md +173 -6
- package/agent-docs/references/capability-reference.md +1303 -99
- package/agent-docs/references/capture-the-frame.md +7 -0
- package/agent-docs/references/creating-creatures.md +215 -0
- package/agent-docs/references/ctx-cookbook.md +69 -0
- package/agent-docs/references/debug-surface.md +8 -3
- package/agent-docs/references/dream-loop.md +150 -0
- package/agent-docs/references/finding-assets.md +70 -2
- package/agent-docs/references/sculpt-from-a-reference.md +3 -2
- package/agent-docs/references/trace-a-slow-frame.md +99 -0
- package/agent-docs/references/visual-baseline.md +41 -0
- package/agent-files/.agents/skills/file-engine-bug/SKILL.md +59 -0
- package/agent-files/.agents/skills/prd-creator/SKILL.md +40 -0
- package/agent-files/.agents/skills/threenative-assets/SKILL.md +45 -0
- package/agent-files/.agents/skills/threenative-builder/SKILL.md +1 -1
- package/agent-files/.agents/skills/threenative-capabilities/SKILL.md +27 -0
- package/agent-files/.agents/skills/threenative-context/SKILL.md +57 -0
- package/agent-files/.agents/skills/threenative-performance/SKILL.md +42 -0
- package/agent-files/.agents/skills/threenative-playtest/SKILL.md +44 -0
- package/agent-files/.agents/skills/threenative-ui/SKILL.md +20 -0
- package/agent-files/.agents/skills/threenative-verifier/SKILL.md +1 -1
- package/agent-files/.agents/skills/threenative-visuals/SKILL.md +41 -0
- package/agent-files/.claude/skills/file-engine-bug/SKILL.md +59 -0
- package/agent-files/.claude/skills/prd-creator/SKILL.md +40 -0
- package/agent-files/.claude/skills/threenative-assets/SKILL.md +45 -0
- package/agent-files/.claude/skills/threenative-capabilities/SKILL.md +27 -0
- package/agent-files/.claude/skills/threenative-context/SKILL.md +57 -0
- package/agent-files/.claude/skills/threenative-performance/SKILL.md +42 -0
- package/agent-files/.claude/skills/threenative-playtest/SKILL.md +44 -0
- package/agent-files/.claude/skills/threenative-ui/SKILL.md +20 -0
- package/agent-files/.claude/skills/threenative-visuals/SKILL.md +41 -0
- package/agent-files/scripts/reference.mjs +705 -0
- package/agent-files/scripts/visual-loop.mjs +382 -0
- package/capabilities.json +1881 -131
- package/dist/index.d.ts +39 -6
- package/dist/index.js +297 -32
- package/dist/threenative.js +822 -105
- package/package.json +30 -5
- package/template-assets/loading.ts +12 -2
- package/template-assets/patches/three@0.185.1.patch +249 -14
- package/template-assets/worldEnvironment.ts +758 -0
- package/templates/action-rpg/.codex/config.toml +4 -0
- package/templates/action-rpg/.cursor/mcp.json +32 -0
- package/templates/action-rpg/.gemini/settings.json +32 -0
- package/templates/action-rpg/.mcp.json +15 -3
- package/templates/action-rpg/.vscode/mcp.json +36 -0
- package/templates/action-rpg/.zed/settings.json +36 -0
- package/templates/action-rpg/AGENTS.md +69 -378
- package/templates/action-rpg/CLAUDE.md +69 -378
- package/templates/action-rpg/opencode.json +41 -0
- package/templates/action-rpg/package.json +7 -7
- package/templates/action-rpg/playtests/combat.playtest.json +9 -0
- package/templates/action-rpg/playtests/performance.playtest.json +24 -7
- package/templates/action-rpg/playtests/survives.playtest.json +27 -0
- package/templates/action-rpg/playtests/touch-controls.playtest.json +42 -0
- package/templates/action-rpg/src/conventions.ts +35 -0
- package/templates/action-rpg/src/entities/Enemy.ts +2 -3
- package/templates/action-rpg/src/entities/Player.ts +20 -3
- package/templates/action-rpg/src/render/camera.ts +7 -2
- package/templates/action-rpg/src/render/lighting.ts +5 -3
- package/templates/action-rpg/src/render/loading.ts +12 -2
- package/templates/action-rpg/src/render/materials.ts +11 -0
- package/templates/action-rpg/src/render/palette.ts +10 -3
- package/templates/action-rpg/src/render/postprocessing.ts +21 -58
- package/templates/action-rpg/src/render/quality.ts +170 -0
- package/templates/action-rpg/src/render/shapes.ts +185 -26
- package/templates/action-rpg/src/render/touch-controls.ts +185 -0
- package/templates/action-rpg/src/render/vfx.ts +257 -0
- package/templates/action-rpg/src/render/worldEnvironment.ts +208 -33
- package/templates/action-rpg/src/scenes/Play.ts +43 -6
- package/templates/action-rpg/src/style.css +20 -0
- package/templates/action-rpg/threenative.config.ts +7 -0
- package/templates/defense/.codex/config.toml +4 -0
- package/templates/defense/.cursor/mcp.json +32 -0
- package/templates/defense/.gemini/settings.json +32 -0
- package/templates/defense/.mcp.json +15 -3
- package/templates/defense/.vscode/mcp.json +36 -0
- package/templates/defense/.zed/settings.json +36 -0
- package/templates/defense/AGENTS.md +62 -385
- package/templates/defense/CLAUDE.md +62 -385
- package/templates/defense/opencode.json +41 -0
- package/templates/defense/package.json +7 -7
- package/templates/defense/playtests/performance.playtest.json +24 -7
- package/templates/defense/playtests/pointer-placement.playtest.json +87 -20
- package/templates/defense/playtests/scan.playtest.json +1 -1
- package/templates/defense/playtests/survive.playtest.json +14 -0
- package/templates/defense/src/attackers/Attacker.ts +4 -4
- package/templates/defense/src/board/Route.ts +22 -8
- package/templates/defense/src/conventions.ts +18 -0
- package/templates/defense/src/entities/Player.ts +11 -3
- package/templates/defense/src/game.ts +2 -3
- package/templates/defense/src/physics.ts +9 -39
- package/templates/defense/src/placement/Buildable.ts +4 -4
- package/templates/defense/src/render/camera.ts +9 -3
- package/templates/defense/src/render/loading.ts +12 -2
- package/templates/defense/src/render/materials.ts +9 -0
- package/templates/defense/src/render/palette.ts +12 -5
- package/templates/defense/src/render/postprocessing.ts +21 -58
- package/templates/defense/src/render/quality.ts +170 -0
- package/templates/defense/src/render/shapes.ts +142 -23
- package/templates/defense/src/render/sky.ts +2 -2
- package/templates/defense/src/render/worldEnvironment.ts +208 -33
- package/templates/defense/src/scenes/Boot.ts +2 -2
- package/templates/defense/src/scenes/Defense.ts +13 -6
- package/templates/defense/src/style.css +20 -0
- package/templates/defense/src/towers/Tower.ts +11 -12
- package/templates/defense/src/towers/targeting.ts +1 -1
- package/templates/defense/src/ui/App.tsx +2 -2
- package/templates/defense/threenative.config.ts +7 -0
- package/templates/minimal/.codex/config.toml +4 -0
- package/templates/minimal/.cursor/mcp.json +32 -0
- package/templates/minimal/.gemini/settings.json +32 -0
- package/templates/minimal/.mcp.json +15 -3
- package/templates/minimal/.vscode/mcp.json +36 -0
- package/templates/minimal/.zed/settings.json +36 -0
- package/templates/minimal/AGENTS.md +76 -485
- package/templates/minimal/CLAUDE.md +76 -485
- package/templates/minimal/opencode.json +41 -0
- package/templates/minimal/package.json +6 -6
- package/templates/minimal/playtests/play.playtest.json +2 -1
- package/templates/minimal/playtests/survives.playtest.json +48 -4
- package/templates/minimal/playtests/touch-controls.playtest.json +42 -0
- package/templates/minimal/src/conventions.ts +18 -0
- package/templates/minimal/src/entities/Player.ts +39 -6
- package/templates/minimal/src/main.ts +14 -4
- package/templates/minimal/src/render/materials.ts +7 -0
- package/templates/minimal/src/render/palette.ts +3 -3
- package/templates/minimal/src/render/postprocessing.ts +17 -56
- package/templates/minimal/src/render/quality.ts +162 -0
- package/templates/minimal/src/render/sky.ts +23 -9
- package/templates/minimal/src/render/touch-controls.ts +165 -0
- package/templates/minimal/src/render/worldEnvironment.ts +208 -33
- package/templates/minimal/src/scenes/Play.ts +47 -11
- package/templates/minimal/src/style.css +20 -0
- package/templates/minimal/threenative.config.ts +7 -0
- package/templates/platformer/.codex/config.toml +4 -0
- package/templates/platformer/.cursor/mcp.json +32 -0
- package/templates/platformer/.gemini/settings.json +32 -0
- package/templates/platformer/.mcp.json +15 -3
- package/templates/platformer/.vscode/mcp.json +36 -0
- package/templates/platformer/.zed/settings.json +36 -0
- package/templates/platformer/AGENTS.md +70 -430
- package/templates/platformer/CLAUDE.md +70 -430
- package/templates/platformer/opencode.json +41 -0
- package/templates/platformer/package.json +7 -7
- package/templates/platformer/playtests/oneway.playtest.json +29 -2
- package/templates/platformer/playtests/performance.playtest.json +2 -1
- package/templates/platformer/playtests/survives.playtest.json +31 -0
- package/templates/platformer/playtests/terminal-loop-fail.playtest.json +3 -0
- package/templates/platformer/playtests/touch-controls-web.playtest.json +15 -4
- package/templates/platformer/src/conventions.ts +18 -0
- package/templates/platformer/src/entities/Character.ts +63 -1
- package/templates/platformer/src/game.ts +3 -1
- package/templates/platformer/src/level/Platform.ts +13 -1
- package/templates/platformer/src/render/lighting.ts +7 -4
- package/templates/platformer/src/render/loading.ts +12 -2
- package/templates/platformer/src/render/palette.ts +4 -1
- package/templates/platformer/src/render/postprocessing.ts +32 -57
- package/templates/platformer/src/render/quality.ts +170 -0
- package/templates/platformer/src/render/worldEnvironment.ts +208 -33
- package/templates/platformer/src/scenes/Level.ts +52 -12
- package/templates/platformer/src/style.css +20 -0
- package/templates/platformer/threenative.config.ts +7 -0
- package/templates/puzzle/.codex/config.toml +19 -0
- package/templates/puzzle/.cursor/mcp.json +32 -0
- package/templates/puzzle/.gemini/settings.json +32 -0
- package/templates/puzzle/.mcp.json +32 -0
- package/templates/puzzle/.vscode/mcp.json +36 -0
- package/templates/puzzle/.zed/settings.json +36 -0
- package/templates/puzzle/AGENTS.md +96 -0
- package/templates/puzzle/CLAUDE.md +98 -0
- package/templates/puzzle/README.md +43 -0
- package/templates/puzzle/index.html +12 -0
- package/templates/puzzle/kit.json +7 -0
- package/templates/puzzle/opencode.json +41 -0
- package/templates/puzzle/package.json +50 -0
- package/templates/puzzle/playtests/carry.playtest.json +71 -0
- package/templates/puzzle/playtests/performance.playtest.json +23 -0
- package/templates/puzzle/playtests/survives.playtest.json +51 -0
- package/templates/puzzle/playtests/swing.playtest.json +38 -0
- package/templates/puzzle/public/favicon.svg +5 -0
- package/templates/puzzle/src/conventions.ts +25 -0
- package/templates/puzzle/src/entities/Ball.ts +70 -0
- package/templates/puzzle/src/entities/Crate.ts +76 -0
- package/templates/puzzle/src/entities/Gripper.ts +69 -0
- package/templates/puzzle/src/entities/Pendulum.ts +89 -0
- package/templates/puzzle/src/game.ts +48 -0
- package/templates/puzzle/src/main.ts +15 -0
- package/templates/puzzle/src/physics.ts +19 -0
- package/templates/puzzle/src/render/camera.ts +37 -0
- package/templates/puzzle/src/render/lighting.ts +55 -0
- package/templates/puzzle/src/render/loading.ts +325 -0
- package/templates/puzzle/src/render/materials.ts +28 -0
- package/templates/puzzle/src/render/palette.ts +31 -0
- package/templates/puzzle/src/render/postprocessing.ts +34 -0
- package/templates/puzzle/src/render/quality.ts +170 -0
- package/templates/puzzle/src/render/shapes.ts +134 -0
- package/templates/puzzle/src/render/sky.ts +16 -0
- package/templates/puzzle/src/render/touch-controls.ts +185 -0
- package/templates/puzzle/src/render/worldEnvironment.ts +758 -0
- package/templates/puzzle/src/room.ts +83 -0
- package/templates/puzzle/src/scenes/Boot.ts +12 -0
- package/templates/puzzle/src/scenes/Puzzle.ts +158 -0
- package/templates/puzzle/src/state.ts +30 -0
- package/templates/puzzle/src/style.css +96 -0
- package/templates/puzzle/src/ui/App.tsx +22 -0
- package/templates/puzzle/src/ui/GameUi.tsx +20 -0
- package/templates/puzzle/src/ui/Hud.tsx +57 -0
- package/templates/puzzle/src/ui/Menu.tsx +7 -0
- package/templates/puzzle/src/ui/main.tsx +14 -0
- package/templates/puzzle/tailwind.config.ts +1 -0
- package/templates/puzzle/threenative.config.ts +49 -0
- package/templates/puzzle/tsconfig.json +17 -0
- package/templates/puzzle/vite.config.ts +38 -0
- package/templates/racing/.codex/config.toml +4 -0
- package/templates/racing/.cursor/mcp.json +32 -0
- package/templates/racing/.gemini/settings.json +32 -0
- package/templates/racing/.mcp.json +15 -3
- package/templates/racing/.vscode/mcp.json +36 -0
- package/templates/racing/.zed/settings.json +36 -0
- package/templates/racing/AGENTS.md +63 -379
- package/templates/racing/CLAUDE.md +63 -379
- package/templates/racing/native-playtests/survives.playtest.json +43 -0
- package/templates/racing/opencode.json +41 -0
- package/templates/racing/package.json +8 -7
- package/templates/racing/playtests/performance.playtest.json +24 -7
- package/templates/racing/playtests/survives.playtest.json +36 -4
- package/templates/racing/playtests/touch-controls.playtest.json +41 -0
- package/templates/racing/src/conventions.ts +6 -0
- package/templates/racing/src/entities/RacingCar.ts +16 -4
- package/templates/racing/src/entities/Rival.ts +5 -2
- package/templates/racing/src/render/camera.ts +7 -4
- package/templates/racing/src/render/lighting.ts +22 -13
- package/templates/racing/src/render/loading.ts +12 -2
- package/templates/racing/src/render/materials.ts +54 -4
- package/templates/racing/src/render/palette.ts +23 -6
- package/templates/racing/src/render/postprocessing.ts +21 -58
- package/templates/racing/src/render/quality.ts +170 -0
- package/templates/racing/src/render/shapes.ts +537 -26
- package/templates/racing/src/render/sky.ts +5 -2
- package/templates/racing/src/render/touch-controls.ts +185 -0
- package/templates/racing/src/render/worldEnvironment.ts +208 -33
- package/templates/racing/src/scenes/Race.ts +17 -2
- package/templates/racing/src/style.css +20 -0
- package/templates/racing/src/track/Track.ts +270 -31
- package/templates/racing/threenative.config.ts +7 -0
- package/templates/runner/.codex/config.toml +19 -0
- package/templates/runner/.cursor/mcp.json +32 -0
- package/templates/runner/.gemini/settings.json +32 -0
- package/templates/runner/.mcp.json +32 -0
- package/templates/runner/.vscode/mcp.json +36 -0
- package/templates/runner/.zed/settings.json +36 -0
- package/templates/runner/AGENTS.md +96 -0
- package/templates/runner/CLAUDE.md +98 -0
- package/templates/runner/README.md +43 -0
- package/templates/runner/index.html +12 -0
- package/templates/runner/kit.json +7 -0
- package/templates/runner/opencode.json +41 -0
- package/templates/runner/package.json +50 -0
- package/templates/runner/playtests/performance.playtest.json +23 -0
- package/templates/runner/playtests/streams.playtest.json +38 -0
- package/templates/runner/playtests/survives.playtest.json +51 -0
- package/templates/runner/public/favicon.svg +5 -0
- package/templates/runner/src/conventions.ts +24 -0
- package/templates/runner/src/entities/Runner.ts +135 -0
- package/templates/runner/src/game.ts +50 -0
- package/templates/runner/src/main.ts +15 -0
- package/templates/runner/src/physics.ts +13 -0
- package/templates/runner/src/render/camera.ts +39 -0
- package/templates/runner/src/render/dust.ts +131 -0
- package/templates/runner/src/render/lighting.ts +57 -0
- package/templates/runner/src/render/loading.ts +325 -0
- package/templates/runner/src/render/materials.ts +27 -0
- package/templates/runner/src/render/palette.ts +30 -0
- package/templates/runner/src/render/postprocessing.ts +34 -0
- package/templates/runner/src/render/quality.ts +170 -0
- package/templates/runner/src/render/shapes.ts +68 -0
- package/templates/runner/src/render/sky.ts +51 -0
- package/templates/runner/src/render/touch-controls.ts +185 -0
- package/templates/runner/src/render/worldEnvironment.ts +758 -0
- package/templates/runner/src/scenes/Boot.ts +12 -0
- package/templates/runner/src/scenes/Run.ts +142 -0
- package/templates/runner/src/state.ts +29 -0
- package/templates/runner/src/style.css +96 -0
- package/templates/runner/src/track.ts +176 -0
- package/templates/runner/src/ui/App.tsx +22 -0
- package/templates/runner/src/ui/GameUi.tsx +20 -0
- package/templates/runner/src/ui/Hud.tsx +55 -0
- package/templates/runner/src/ui/Menu.tsx +7 -0
- package/templates/runner/src/ui/main.tsx +14 -0
- package/templates/runner/tailwind.config.ts +1 -0
- package/templates/runner/threenative.config.ts +49 -0
- package/templates/runner/tsconfig.json +17 -0
- package/templates/runner/vite.config.ts +38 -0
- package/templates/sailing/.codex/config.toml +4 -0
- package/templates/sailing/.cursor/mcp.json +32 -0
- package/templates/sailing/.gemini/settings.json +32 -0
- package/templates/sailing/.mcp.json +15 -3
- package/templates/sailing/.vscode/mcp.json +36 -0
- package/templates/sailing/.zed/settings.json +36 -0
- package/templates/sailing/AGENTS.md +62 -355
- package/templates/sailing/CLAUDE.md +62 -355
- package/templates/sailing/README.md +12 -9
- package/templates/sailing/native-playtests/float.playtest.json +55 -0
- package/templates/sailing/native-playtests/survives.playtest.json +20 -3
- package/templates/sailing/opencode.json +41 -0
- package/templates/sailing/package.json +8 -8
- package/templates/sailing/playtests/float-after-the-run-ends.playtest.json +75 -0
- package/templates/sailing/playtests/float.playtest.json +59 -0
- package/templates/sailing/playtests/performance.playtest.json +21 -6
- package/templates/sailing/playtests/survives.playtest.json +8 -0
- package/templates/sailing/playtests/touch-controls.playtest.json +48 -0
- package/templates/sailing/src/conventions.ts +8 -0
- package/templates/sailing/src/entities/Ship.ts +150 -13
- package/templates/sailing/src/render/camera.ts +15 -8
- package/templates/sailing/src/render/lighting.ts +10 -5
- package/templates/sailing/src/render/loading.ts +12 -2
- package/templates/sailing/src/render/materials.ts +24 -8
- package/templates/sailing/src/render/ocean.ts +179 -0
- package/templates/sailing/src/render/palette.ts +14 -21
- package/templates/sailing/src/render/postprocessing.ts +23 -22
- package/templates/sailing/src/render/props.ts +584 -34
- package/templates/sailing/src/render/quality.ts +140 -0
- package/templates/sailing/src/render/sky.ts +8 -3
- package/templates/sailing/src/render/touch-controls.ts +142 -0
- package/templates/sailing/src/render/worldEnvironment.ts +206 -38
- package/templates/sailing/src/scenes/Sailing.ts +43 -16
- package/templates/sailing/src/style.css +20 -0
- package/templates/sailing/threenative.config.ts +7 -1
- package/templates/shooter/.codex/config.toml +4 -0
- package/templates/shooter/.cursor/mcp.json +32 -0
- package/templates/shooter/.gemini/settings.json +32 -0
- package/templates/shooter/.mcp.json +15 -3
- package/templates/shooter/.vscode/mcp.json +36 -0
- package/templates/shooter/.zed/settings.json +36 -0
- package/templates/shooter/AGENTS.md +76 -415
- package/templates/shooter/CLAUDE.md +76 -415
- package/templates/shooter/kit.json +2 -2
- package/templates/shooter/opencode.json +41 -0
- package/templates/shooter/package.json +7 -7
- package/templates/shooter/playtests/combat.playtest.json +48 -0
- package/templates/shooter/playtests/input-control.playtest.json +165 -35
- package/templates/shooter/playtests/per-item.playtest.json +3 -3
- package/templates/shooter/playtests/performance.playtest.json +24 -7
- package/templates/shooter/playtests/shooter.playtest.json +13 -7
- package/templates/shooter/playtests/survives.playtest.json +27 -0
- package/templates/shooter/playtests/touch-controls.playtest.json +42 -0
- package/templates/shooter/playtests/weapon-cycle.playtest.json +164 -0
- package/templates/shooter/src/combat/damage.ts +1 -2
- package/templates/shooter/src/conventions.ts +51 -0
- package/templates/shooter/src/entities/Player.ts +235 -18
- package/templates/shooter/src/entities/Target.ts +2 -2
- package/templates/shooter/src/game.ts +13 -4
- package/templates/shooter/src/render/camera.ts +49 -39
- package/templates/shooter/src/render/decals.ts +211 -0
- package/templates/shooter/src/render/lighting.ts +7 -3
- package/templates/shooter/src/render/loading.ts +12 -2
- package/templates/shooter/src/render/materials.ts +56 -3
- package/templates/shooter/src/render/palette.ts +6 -3
- package/templates/shooter/src/render/postprocessing.ts +21 -58
- package/templates/shooter/src/render/quality.ts +170 -0
- package/templates/shooter/src/render/scale.ts +22 -0
- package/templates/shooter/src/render/shapes.ts +343 -62
- package/templates/shooter/src/render/sky.ts +5 -1
- package/templates/shooter/src/render/touch-controls.ts +305 -0
- package/templates/shooter/src/render/ui.css +85 -0
- package/templates/shooter/src/render/ui.ts +19 -3
- package/templates/shooter/src/render/vfx.ts +215 -0
- package/templates/shooter/src/render/worldEnvironment.ts +208 -33
- package/templates/shooter/src/scenes/Play.ts +171 -56
- package/templates/shooter/src/state.ts +5 -0
- package/templates/shooter/src/style.css +20 -0
- package/templates/shooter/src/ui/Crosshair.tsx +25 -0
- package/templates/shooter/src/ui/GameUi.tsx +2 -0
- package/templates/shooter/src/ui/Hud.tsx +7 -1
- package/templates/shooter/src/weapons/Hitscan.ts +3 -4
- package/templates/shooter/src/weapons/Projectile.ts +8 -3
- package/templates/shooter/src/weapons/Viewmodel.ts +275 -0
- package/templates/shooter/threenative.config.ts +7 -0
- package/templates/starter/.codex/config.toml +4 -0
- package/templates/starter/.cursor/mcp.json +32 -0
- package/templates/starter/.gemini/settings.json +32 -0
- package/templates/starter/.mcp.json +15 -3
- package/templates/starter/.vscode/mcp.json +36 -0
- package/templates/starter/.zed/settings.json +36 -0
- package/templates/starter/AGENTS.md +70 -527
- package/templates/starter/CLAUDE.md +70 -527
- package/templates/starter/native-playtests/render-chain.playtest.json +73 -4
- package/templates/starter/opencode.json +41 -0
- package/templates/starter/package.json +7 -7
- package/templates/starter/playtests/boot-failure.playtest.json +45 -0
- package/templates/starter/playtests/look.playtest.json +110 -6
- package/templates/starter/playtests/play.playtest.json +3 -2
- package/templates/starter/playtests/survives.playtest.json +21 -0
- package/templates/starter/playtests/touch-controls.playtest.json +42 -0
- package/templates/starter/src/conventions.ts +18 -0
- package/templates/starter/src/entities/Goal.ts +18 -3
- package/templates/starter/src/entities/Player.ts +72 -9
- package/templates/starter/src/game.ts +2 -0
- package/templates/starter/src/render/adaptiveQuality.ts +195 -0
- package/templates/starter/src/render/camera.ts +1 -1
- package/templates/starter/src/render/coast.ts +199 -0
- package/templates/starter/src/render/hero.ts +88 -0
- package/templates/starter/src/render/implicitSurface.ts +199 -0
- package/templates/starter/src/render/kuwahara.ts +174 -0
- package/templates/starter/src/render/lighting.ts +4 -4
- package/templates/starter/src/render/loading.ts +12 -2
- package/templates/starter/src/render/materials.ts +25 -6
- package/templates/starter/src/render/outline.ts +141 -0
- package/templates/starter/src/render/painterly.ts +86 -0
- package/templates/starter/src/render/palette.ts +15 -6
- package/templates/starter/src/render/postprocessing.ts +87 -36
- package/templates/starter/src/render/quality.ts +185 -0
- package/templates/starter/src/render/rockRidge.ts +198 -0
- package/templates/starter/src/render/rockRidge.worker.ts +77 -0
- package/templates/starter/src/render/scenery.ts +16 -59
- package/templates/starter/src/render/textureLifetime.ts +53 -0
- package/templates/starter/src/render/touch-controls.ts +165 -0
- package/templates/starter/src/render/water.ts +38 -0
- package/templates/starter/src/render/watercolor.ts +85 -0
- package/templates/starter/src/render/worldEnvironment.ts +208 -33
- package/templates/starter/src/scenes/Play.ts +103 -16
- package/templates/starter/src/style.css +27 -7
- package/templates/starter/threenative.config.ts +7 -7
- package/agent-docs/asset-mcp-loop.md +0 -33
- package/agent-docs/ctx-surface.md +0 -69
- package/agent-docs/engine-capabilities.md +0 -4
- package/agent-docs/framework-blocks-you.md +0 -60
- package/agent-docs/look-at-it-and-budget-the-look.md +0 -27
- package/agent-docs/performance-default.md +0 -42
- package/agent-docs/pixel-budget.md +0 -20
- package/agent-docs/playtest-fail-closed.md +0 -23
- package/agent-docs/sculpt-loop.md +0 -16
- package/templates/action-rpg/src/physics.ts +0 -40
- package/templates/defense/public/icon.png +0 -0
- package/templates/minimal/public/icon.png +0 -0
- package/templates/platformer/public/icon.png +0 -0
- package/templates/racing/public/icon.png +0 -0
- package/templates/sailing/public/icon.png +0 -0
- package/templates/sailing/src/render/water-material.ts +0 -14
- package/templates/sailing/src/render/water-shaders.ts +0 -12
- package/templates/sailing/src/render/wave-nodes.ts +0 -10
- package/templates/shooter/public/icon.png +0 -0
- package/templates/shooter/src/physics.ts +0 -49
- package/templates/starter/public/icon.png +0 -0
- /package/{templates/action-rpg/public → template-assets}/icon.png +0 -0
|
@@ -1,22 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"acceptanceId": "prd-194-performance-racing",
|
|
3
|
-
"artifacts": {
|
|
3
|
+
"artifacts": {
|
|
4
|
+
"screenshots": "after"
|
|
5
|
+
},
|
|
4
6
|
"assert": {
|
|
5
7
|
"performance": {
|
|
6
|
-
"maxDrawCalls":
|
|
8
|
+
"maxDrawCalls": 330,
|
|
7
9
|
"maxFrameMsP95": 33,
|
|
8
|
-
"maxTriangles":
|
|
10
|
+
"maxTriangles": 105000,
|
|
11
|
+
"minFps": 30
|
|
9
12
|
},
|
|
10
|
-
"renderChain": {
|
|
13
|
+
"renderChain": {
|
|
14
|
+
"tier": "high"
|
|
15
|
+
}
|
|
11
16
|
},
|
|
12
17
|
"name": "production-performance",
|
|
13
18
|
"schemaVersion": 1,
|
|
14
19
|
"steps": [
|
|
15
|
-
{
|
|
16
|
-
|
|
20
|
+
{
|
|
21
|
+
"kind": "input",
|
|
22
|
+
"press": "ArrowUp",
|
|
23
|
+
"holdTicks": 60,
|
|
24
|
+
"release": true
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"kind": "wait",
|
|
28
|
+
"waitTicks": 600,
|
|
29
|
+
"release": true
|
|
30
|
+
}
|
|
17
31
|
],
|
|
18
32
|
"subject": "player",
|
|
19
33
|
"target": "web",
|
|
20
|
-
"viewport": {
|
|
34
|
+
"viewport": {
|
|
35
|
+
"height": 1080,
|
|
36
|
+
"width": 1920
|
|
37
|
+
},
|
|
21
38
|
"warmupFrames": 60
|
|
22
39
|
}
|
|
@@ -2,12 +2,26 @@
|
|
|
2
2
|
"name": "survives",
|
|
3
3
|
"target": "web",
|
|
4
4
|
"schemaVersion": 1,
|
|
5
|
-
"viewport": {
|
|
5
|
+
"viewport": {
|
|
6
|
+
"width": 1280,
|
|
7
|
+
"height": 720
|
|
8
|
+
},
|
|
6
9
|
"warmupFrames": 10,
|
|
7
10
|
"subject": "player",
|
|
8
11
|
"steps": [
|
|
9
|
-
{
|
|
10
|
-
|
|
12
|
+
{
|
|
13
|
+
"kind": "input",
|
|
14
|
+
"label": "move",
|
|
15
|
+
"press": "ArrowUp",
|
|
16
|
+
"holdTicks": 60,
|
|
17
|
+
"release": true
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"kind": "wait",
|
|
21
|
+
"label": "settle",
|
|
22
|
+
"waitTicks": 10,
|
|
23
|
+
"release": true
|
|
24
|
+
}
|
|
11
25
|
],
|
|
12
26
|
"assert": {
|
|
13
27
|
"diagnostics": {
|
|
@@ -16,7 +30,25 @@
|
|
|
16
30
|
"noRuntimeDiagnostics": true,
|
|
17
31
|
"runtimeReady": true
|
|
18
32
|
},
|
|
19
|
-
"
|
|
33
|
+
"components": [
|
|
34
|
+
{
|
|
35
|
+
"allowTrivial": "The vehicle is authored at its real 4.4 m length and normalised down to the conventional 3 m, so the retained factor is below one; either side of one proves normaliseToMetres ran in the generated car.",
|
|
36
|
+
"component": "normaliseFactor",
|
|
37
|
+
"entity": "player",
|
|
38
|
+
"lte": 0.99
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
"movement": {
|
|
42
|
+
"entity": "player",
|
|
43
|
+
"minDistance": 0.5
|
|
44
|
+
},
|
|
45
|
+
"visibility": [
|
|
46
|
+
{
|
|
47
|
+
"entity": "touch-controls",
|
|
48
|
+
"present": false,
|
|
49
|
+
"allowTrivial": "Desktop keyboard lanes intentionally omit touch controls while movement proves the scene is active."
|
|
50
|
+
}
|
|
51
|
+
],
|
|
20
52
|
"visual": [
|
|
21
53
|
{
|
|
22
54
|
"region": {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "racing-touch-controls",
|
|
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": "throttle-anchor",
|
|
12
|
+
"pointers": [{ "id": 7, "x": 0.18, "y": 0.75 }],
|
|
13
|
+
"holdTicks": 2,
|
|
14
|
+
"release": false
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"kind": "input",
|
|
18
|
+
"label": "throttle-forward",
|
|
19
|
+
"pointers": [{ "id": 7, "x": 0.18, "y": 0.55 }],
|
|
20
|
+
"holdTicks": 90,
|
|
21
|
+
"release": true
|
|
22
|
+
},
|
|
23
|
+
{ "kind": "wait", "label": "settled", "waitTicks": 10, "release": true }
|
|
24
|
+
],
|
|
25
|
+
"assert": {
|
|
26
|
+
"diagnostics": {
|
|
27
|
+
"noConsoleErrors": true,
|
|
28
|
+
"noNetworkErrors": true,
|
|
29
|
+
"noRuntimeDiagnostics": true,
|
|
30
|
+
"runtimeReady": true
|
|
31
|
+
},
|
|
32
|
+
"resources": [{ "id": "state", "path": "speed", "gte": 0.1, "changed": true }],
|
|
33
|
+
"visibility": [
|
|
34
|
+
{
|
|
35
|
+
"entity": "touch-controls",
|
|
36
|
+
"present": true,
|
|
37
|
+
"allowTrivial": "Touch-primary lanes keep the authored controls visible while state assertions prove they are live."
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { ICtx } from "@threenative/core";
|
|
2
2
|
import { CharacterBody3D, CollisionShape3D, type IPhysicsContext } from "@threenative/physics";
|
|
3
3
|
import { Group, Vector3 } from "three";
|
|
4
|
+
import { prepareVehicleConventions } from "../conventions.js";
|
|
4
5
|
import { Boost } from "../kart/boost.js";
|
|
5
6
|
import { createMaterials } from "../render/materials.js";
|
|
6
7
|
import { vehicle } from "../render/shapes.js";
|
|
8
|
+
import type { ITouchInput } from "../render/touch-controls.js";
|
|
7
9
|
import type { GameState } from "../state.js";
|
|
8
10
|
|
|
9
11
|
type GameCtx = ICtx<GameState, IPhysicsContext>;
|
|
@@ -26,12 +28,15 @@ export class RacingCar {
|
|
|
26
28
|
readonly boost = new Boost();
|
|
27
29
|
#speed = 0;
|
|
28
30
|
#heading = 0;
|
|
31
|
+
#normaliseFactor: number;
|
|
29
32
|
#topSpeed = 0;
|
|
30
33
|
|
|
31
34
|
constructor(ctx: GameCtx, spawn: Vector3) {
|
|
32
35
|
this.mesh.position.copy(spawn);
|
|
33
36
|
this.mesh.castShadow = true;
|
|
34
|
-
|
|
37
|
+
const visual = vehicle(createMaterials());
|
|
38
|
+
this.#normaliseFactor = prepareVehicleConventions(visual);
|
|
39
|
+
this.mesh.add(visual);
|
|
35
40
|
ctx.add(this.mesh);
|
|
36
41
|
this.body = new CharacterBody3D({
|
|
37
42
|
autostep: { maxHeight: 0.25, minWidth: 0.2 },
|
|
@@ -46,17 +51,23 @@ export class RacingCar {
|
|
|
46
51
|
});
|
|
47
52
|
}
|
|
48
53
|
|
|
49
|
-
update(ctx: GameCtx, dt: number): void {
|
|
54
|
+
update(ctx: GameCtx, dt: number, touch?: ITouchInput): void {
|
|
50
55
|
this.boost.update(dt);
|
|
51
|
-
if (ctx.input.justPressed("boost")) this.boost.activate();
|
|
56
|
+
if (ctx.input.justPressed("boost") || touch?.boostPressed === true) this.boost.activate();
|
|
52
57
|
const move = ctx.input.vector("move");
|
|
58
|
+
if (touch !== undefined) {
|
|
59
|
+
move.x += touch.move.x;
|
|
60
|
+
move.y += touch.move.y;
|
|
61
|
+
move.clampLength(0, 1);
|
|
62
|
+
}
|
|
53
63
|
const throttle = move.y;
|
|
54
64
|
const target =
|
|
55
65
|
throttle * RACING_FEEL.maxSpeed * (this.boost.active ? this.boost.multiplier : 1);
|
|
56
66
|
const rate =
|
|
57
67
|
Math.abs(target) > Math.abs(this.#speed) ? RACING_FEEL.acceleration : RACING_FEEL.drag;
|
|
58
68
|
this.#speed = approach(this.#speed, target, rate * dt);
|
|
59
|
-
if (ctx.input.pressed("brake")
|
|
69
|
+
if (ctx.input.pressed("brake") || touch?.brakePressed === true)
|
|
70
|
+
this.#speed = approach(this.#speed, 0, RACING_FEEL.brake * dt);
|
|
60
71
|
const steering =
|
|
61
72
|
move.x * (Math.min(1, Math.abs(this.#speed) / RACING_FEEL.maxSpeed) * 0.65 + 0.35);
|
|
62
73
|
this.#heading += steering * RACING_FEEL.turnRate * dt * (this.#speed < 0 ? -1 : 1);
|
|
@@ -95,6 +106,7 @@ export class RacingCar {
|
|
|
95
106
|
return {
|
|
96
107
|
boostActive: this.boost.active,
|
|
97
108
|
heading: this.#heading,
|
|
109
|
+
normaliseFactor: this.#normaliseFactor,
|
|
98
110
|
position: this.mesh.position.toArray(),
|
|
99
111
|
speed: this.speed,
|
|
100
112
|
topSpeed: this.#topSpeed,
|
|
@@ -14,8 +14,11 @@ export class Rival {
|
|
|
14
14
|
startDistance: number,
|
|
15
15
|
) {
|
|
16
16
|
this.#distance = startDistance;
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
// Same sculpt, different livery. The rival was indistinguishable from the player in the first
|
|
18
|
+
// frame because both cars asked for the same material set.
|
|
19
|
+
const materials = createMaterials();
|
|
20
|
+
const visual = vehicle({ ...materials, body: materials.rivalBody });
|
|
21
|
+
visual.scale.setScalar(0.96);
|
|
19
22
|
this.mesh.add(visual);
|
|
20
23
|
}
|
|
21
24
|
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { MathUtils, type PerspectiveCamera, Vector3 } from "three";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// Chase height and distance. At 5.8 up and 8.5 back the camera looked down on the roof, which is
|
|
4
|
+
// the one angle from which every car in the world reads as a rectangle; 3.3 and 7.4 put the eye
|
|
5
|
+
// near the rear wing where the wedge, the arches and the flank are all in view.
|
|
6
|
+
const SCRATCH_UP = new Vector3(0, 3.0, 0);
|
|
4
7
|
|
|
5
8
|
export function setupCamera(camera: PerspectiveCamera): void {
|
|
6
9
|
camera.fov = 56;
|
|
7
10
|
camera.near = 0.1;
|
|
8
|
-
camera.far =
|
|
11
|
+
camera.far = 340;
|
|
9
12
|
camera.updateProjectionMatrix();
|
|
10
13
|
}
|
|
11
14
|
|
|
@@ -20,11 +23,11 @@ export function chaseCamera(
|
|
|
20
23
|
heading: Vector3,
|
|
21
24
|
dt: number,
|
|
22
25
|
): void {
|
|
23
|
-
behind.copy(heading).setY(0).normalize().multiplyScalar(-
|
|
26
|
+
behind.copy(heading).setY(0).normalize().multiplyScalar(-6.6);
|
|
24
27
|
desired.copy(target).add(behind).add(SCRATCH_UP);
|
|
25
28
|
if (dt >= 1) camera.position.copy(desired);
|
|
26
29
|
else camera.position.lerp(desired, 1 - Math.exp(-dt / 0.2));
|
|
27
|
-
camera.lookAt(target.x, target.y +
|
|
30
|
+
camera.lookAt(target.x, target.y + 1.15, target.z);
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
export function cameraRoll(camera: PerspectiveCamera, heading: Vector3): void {
|
|
@@ -12,26 +12,35 @@ type ShadowRenderer = { shadowMap: { enabled: boolean; type: number } };
|
|
|
12
12
|
// Returns the key light: `WorldEnvironment`'s godrays stage raymarches against a shadow map, so
|
|
13
13
|
// the scene hands the sun to `setupPost` and a shadowless light is refused by name instead of
|
|
14
14
|
// rendering a black pass.
|
|
15
|
+
//
|
|
16
|
+
// The sun is **near-white**, not the accent colour. Tinting the key light yellow was how the first
|
|
17
|
+
// version of this file made a green infield go olive and a grey road go brown: a strongly coloured
|
|
18
|
+
// key contaminates every surface at once, and no per-material tweak can undo it. Colour belongs in
|
|
19
|
+
// the materials; the sun's job is direction and contrast.
|
|
15
20
|
export function setupLighting(scene: Scene, renderer: ShadowRenderer): DirectionalLight {
|
|
16
21
|
renderer.shadowMap.enabled = true;
|
|
17
22
|
renderer.shadowMap.type = PCFSoftShadowMap;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
key
|
|
23
|
+
// Sky above, grass bounce below. The ground term is what stops undersides going to slate.
|
|
24
|
+
scene.add(new HemisphereLight(palette.skyLow, palette.field, 1.1));
|
|
25
|
+
const key = new DirectionalLight(0xfff4e2, 2.9);
|
|
26
|
+
key.position.set(-16, 26, -12);
|
|
21
27
|
key.castShadow = true;
|
|
22
|
-
key.shadow.mapSize.set(
|
|
28
|
+
key.shadow.mapSize.set(2048, 2048);
|
|
23
29
|
key.shadow.camera.near = 0.5;
|
|
24
|
-
key.shadow.camera.far =
|
|
25
|
-
key.shadow.camera.left = -
|
|
26
|
-
key.shadow.camera.right =
|
|
27
|
-
key.shadow.camera.top =
|
|
28
|
-
key.shadow.camera.bottom = -
|
|
29
|
-
key.shadow.
|
|
30
|
+
key.shadow.camera.far = 120;
|
|
31
|
+
key.shadow.camera.left = -55;
|
|
32
|
+
key.shadow.camera.right = 55;
|
|
33
|
+
key.shadow.camera.top = 55;
|
|
34
|
+
key.shadow.camera.bottom = -55;
|
|
35
|
+
key.shadow.bias = -0.0004;
|
|
36
|
+
key.shadow.normalBias = 0.03;
|
|
30
37
|
scene.add(key);
|
|
31
|
-
|
|
32
|
-
|
|
38
|
+
// A cool fill from the opposite side, so shadow faces separate from each other rather than all
|
|
39
|
+
// collapsing to one flat tone.
|
|
40
|
+
const rim = new DirectionalLight(palette.skyLow, 0.85);
|
|
41
|
+
rim.position.set(18, 9, 22);
|
|
33
42
|
scene.add(rim);
|
|
34
|
-
scene.add(new AmbientLight(palette.shadow, 0.
|
|
43
|
+
scene.add(new AmbientLight(palette.shadow, 0.55));
|
|
35
44
|
|
|
36
45
|
return key;
|
|
37
46
|
}
|
|
@@ -36,7 +36,11 @@ interface ILoadingHost {
|
|
|
36
36
|
};
|
|
37
37
|
readonly renderer: { compileAsync(scene: Scene, camera: Camera): Promise<void> };
|
|
38
38
|
readonly scene: Scene;
|
|
39
|
-
readonly startup: {
|
|
39
|
+
readonly startup: {
|
|
40
|
+
readonly progress: number;
|
|
41
|
+
readonly warmup?: { readonly status: "complete" | "incomplete" | "unavailable" };
|
|
42
|
+
whenReady(): Promise<void>;
|
|
43
|
+
};
|
|
40
44
|
readonly viewport?: {
|
|
41
45
|
readonly safeArea: { height: number; width: number; x: number; y: number };
|
|
42
46
|
};
|
|
@@ -231,7 +235,13 @@ export function createLoadingScreen(host: ILoadingHost): ILoadingController {
|
|
|
231
235
|
};
|
|
232
236
|
|
|
233
237
|
const updateProgress = (value: number): void => {
|
|
234
|
-
|
|
238
|
+
const bounded = Number.isFinite(value) ? Math.max(0, Math.min(1, value)) : 0;
|
|
239
|
+
// A missing or incomplete backend observation cannot prove that all first-use work is done.
|
|
240
|
+
// Keep the bar visibly indeterminate until readiness removes the cover; never turn unknown
|
|
241
|
+
// coverage into a false 100% claim.
|
|
242
|
+
const observationUnknown =
|
|
243
|
+
host.startup.warmup !== undefined && host.startup.warmup.status !== "complete";
|
|
244
|
+
progress = observationUnknown ? Math.min(0.9, bounded) : bounded;
|
|
235
245
|
setFillUv(fill.geometry, progress, fillBaseU);
|
|
236
246
|
status?.update(progress);
|
|
237
247
|
layout();
|
|
@@ -1,15 +1,65 @@
|
|
|
1
|
+
// Generated for you: the car's livery and the circuit's surfaces. ThreeNative does not read this
|
|
2
|
+
// file, and nothing in `shapes.ts` names a colour — it only names these slots. Re-livery the car,
|
|
3
|
+
// or repaint the circuit, entirely from here.
|
|
1
4
|
import { MeshStandardMaterial } from "three";
|
|
2
5
|
import { palette, toon } from "./palette.js";
|
|
3
6
|
|
|
4
7
|
export function createMaterials() {
|
|
5
8
|
return {
|
|
9
|
+
/** Boost chevrons and the kerb's yellow stripe. */
|
|
6
10
|
boost: toon(palette.accent, 0.4),
|
|
7
11
|
curb: toon(0xf3f0dc, 0.55),
|
|
12
|
+
/** The kerb's red stripe, and the paint on the pit wall. */
|
|
13
|
+
kerbAlt: toon(0xe8443a, 0.55),
|
|
8
14
|
field: toon(palette.field, 0.95),
|
|
9
|
-
|
|
15
|
+
/** Dry grass on the run-off, so the two greens read as two surfaces. */
|
|
16
|
+
runoff: toon(0x8a9b52, 0.98),
|
|
17
|
+
road: toon(palette.road, 0.86),
|
|
10
18
|
shadow: new MeshStandardMaterial({ color: palette.shadow, roughness: 1 }),
|
|
11
|
-
tire: new MeshStandardMaterial({ color:
|
|
12
|
-
|
|
13
|
-
|
|
19
|
+
tire: new MeshStandardMaterial({ color: 0x1a1d22, roughness: 0.94 }),
|
|
20
|
+
|
|
21
|
+
/** The car. `body` is the one a game is most likely to change. */
|
|
22
|
+
body: new MeshStandardMaterial({ color: 0xd93a3a, metalness: 0.18, roughness: 0.3 }),
|
|
23
|
+
/** Kept as an alias so a game that already referred to the old slot still compiles. */
|
|
24
|
+
vehicle: new MeshStandardMaterial({ color: 0xd93a3a, metalness: 0.18, roughness: 0.3 }),
|
|
25
|
+
rivalBody: new MeshStandardMaterial({ color: 0x2f6fd0, metalness: 0.18, roughness: 0.3 }),
|
|
26
|
+
glass: new MeshStandardMaterial({
|
|
27
|
+
color: 0x3f5a70,
|
|
28
|
+
metalness: 0.55,
|
|
29
|
+
roughness: 0.1,
|
|
30
|
+
}),
|
|
31
|
+
// Not black. At 0x23262b every aero part on the car went to the same void and the tail read as a
|
|
32
|
+
// hole; a lit dark grey still says "carbon" and keeps its own form.
|
|
33
|
+
carbon: new MeshStandardMaterial({ color: 0x3a3f47, metalness: 0.24, roughness: 0.46 }),
|
|
34
|
+
wing: new MeshStandardMaterial({ color: 0x2b2f36, metalness: 0.3, roughness: 0.4 }),
|
|
35
|
+
alloy: new MeshStandardMaterial({ color: 0xb9c0c8, metalness: 0.86, roughness: 0.26 }),
|
|
36
|
+
livery: new MeshStandardMaterial({ color: 0xf6f3ea, metalness: 0.05, roughness: 0.42 }),
|
|
37
|
+
/** A shade darker than the body, so the arch lip is a line and not more bodywork. */
|
|
38
|
+
archLip: new MeshStandardMaterial({ color: 0x7d2323, metalness: 0.3, roughness: 0.4 }),
|
|
39
|
+
/** Spoke gaps: what the eye reads as the hole between spokes. */
|
|
40
|
+
hubDark: new MeshStandardMaterial({ color: 0x30343a, metalness: 0.5, roughness: 0.4 }),
|
|
41
|
+
headlamp: new MeshStandardMaterial({
|
|
42
|
+
color: 0xfff6de,
|
|
43
|
+
emissive: 0xfff0c8,
|
|
44
|
+
emissiveIntensity: 0.9,
|
|
45
|
+
roughness: 0.3,
|
|
46
|
+
}),
|
|
47
|
+
// Dim on purpose. At 2.2 the bar plus the bloom stage flared over the whole tail and the car's
|
|
48
|
+
// rear became one orange smear — the emissive was brighter than the sun.
|
|
49
|
+
taillamp: new MeshStandardMaterial({
|
|
50
|
+
color: 0xd93a34,
|
|
51
|
+
emissive: 0xff2a1c,
|
|
52
|
+
emissiveIntensity: 0.75,
|
|
53
|
+
roughness: 0.34,
|
|
54
|
+
}),
|
|
55
|
+
|
|
56
|
+
/** Trackside furniture. */
|
|
57
|
+
structure: toon(0xd8dbe0, 0.7),
|
|
58
|
+
crowd: toon(0x3d4a63, 0.9),
|
|
59
|
+
trunk: toon(0x6b4a33, 0.9),
|
|
60
|
+
canopy: toon(0x3f7a44, 0.92),
|
|
61
|
+
/** The hills past the treeline. */
|
|
62
|
+
distant: toon(0x4a6f57, 0.98),
|
|
63
|
+
hoardingBoard: toon(0x2f6fd0, 0.6),
|
|
14
64
|
};
|
|
15
65
|
}
|
|
@@ -1,14 +1,31 @@
|
|
|
1
|
+
// Generated for you: every colour the race uses, in one place. ThreeNative does not read this file.
|
|
2
|
+
//
|
|
3
|
+
// These are afternoon-daylight values on purpose. The first version of this palette used a
|
|
4
|
+
// near-black road (`0x202936`) lit by a strongly yellow key light, and the blind score of the first
|
|
5
|
+
// frame called it a black strip in a swamp: the tarmac never came up off the shadow floor and the
|
|
6
|
+
// grass went olive. Tarmac is a *mid* grey — brighter than intuition says — and grass only reads as
|
|
7
|
+
// grass when the sun on it is close to white.
|
|
1
8
|
import { BoxGeometry, Group, Mesh, MeshStandardMaterial } from "three";
|
|
2
9
|
|
|
3
10
|
export const palette = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
/** Zenith. Deep enough to give the dome a gradient worth having. */
|
|
12
|
+
skyHigh: 0x2c6cae,
|
|
13
|
+
/** Horizon haze, and the fog colour, so distance dissolves into the sky instead of into grey. */
|
|
14
|
+
skyLow: 0xbcd6e4,
|
|
15
|
+
/** Tarmac. Mid grey with a blue cast; anything darker eats the car's own shadow. */
|
|
16
|
+
road: 0x51565f,
|
|
17
|
+
/** Freshly cut infield. */
|
|
18
|
+
field: 0x5c8f45,
|
|
19
|
+
/** Kerbing, race numbers, boost chevrons. */
|
|
20
|
+
accent: 0xffc233,
|
|
21
|
+
/** Ambient fill and the underside of everything. Not black — black flattens. */
|
|
22
|
+
shadow: 0x35414f,
|
|
10
23
|
} as const;
|
|
11
24
|
|
|
25
|
+
// The circuit's other surfaces are shades of the six roles above rather than roles of their own:
|
|
26
|
+
// the palette stays six named colours, and anything derived belongs beside the material that uses
|
|
27
|
+
// it. `materials.ts` owns them.
|
|
28
|
+
|
|
12
29
|
const materials = new Map<string, MeshStandardMaterial>();
|
|
13
30
|
|
|
14
31
|
export function toon(color: number, roughness = 0.72): MeshStandardMaterial {
|
|
@@ -1,71 +1,34 @@
|
|
|
1
|
-
// Generated for you
|
|
2
|
-
// ThreeNative does not read this file.
|
|
1
|
+
// Generated for you: ordinary Three.js; ThreeNative does not read this file.
|
|
3
2
|
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
3
|
+
// This file wires two things together and decides nothing itself. `quality.ts`, in this folder,
|
|
4
|
+
// owns which stages run at which tier and records what each one measured. `WorldEnvironment`,
|
|
5
|
+
// also in this folder, builds them and prints `TN_WORLD_ENVIRONMENT` naming every stage as
|
|
6
|
+
// applied or refused **with a reason**, so a stage that silently no-op'd is never mistaken for
|
|
7
|
+
// one you turned off.
|
|
9
8
|
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
// `
|
|
13
|
-
//
|
|
14
|
-
// vignette), is in `agent-docs/visual-baseline.md`.
|
|
9
|
+
// To make the game cheaper or prettier everywhere, edit `quality.ts`. To force one tier for one
|
|
10
|
+
// run — a desktop that is dropping frames, a capture you want to compare — pass it:
|
|
11
|
+
// `setupPost(renderer, scene, camera, { tier: "low" })`. Overriding does not silence the report:
|
|
12
|
+
// `TN_QUALITY_TIER` names the tier that ran either way.
|
|
15
13
|
import type { Camera, DirectionalLight, Scene } from "three";
|
|
14
|
+
import { type QualityTier, qualityPreset, resolveQualityTier } from "./quality.js";
|
|
16
15
|
import type { OutputRenderer } from "./worldEnvironment.js";
|
|
17
16
|
import { WorldEnvironment } from "./worldEnvironment.js";
|
|
18
17
|
|
|
19
|
-
// Scene-referred exposure: multiplied into the pass before the tone curve, so the gather, the
|
|
20
|
-
// reflections and the bloom threshold all see the same exposed image.
|
|
21
|
-
const exposure = 1.18;
|
|
22
|
-
|
|
23
|
-
// Unchanged from this template's previous chain — strength, radius and threshold are a look
|
|
24
|
-
// decision that was already tuned to this scene's palette.
|
|
25
|
-
const glow = {
|
|
26
|
-
bloomEnabled: true,
|
|
27
|
-
bloomRadius: 0.5,
|
|
28
|
-
bloomStrength: 0.35,
|
|
29
|
-
bloomThreshold: 0.2,
|
|
30
|
-
} as const;
|
|
31
|
-
|
|
32
|
-
const desktopPreset = {
|
|
33
|
-
...glow,
|
|
34
|
-
denoiseEnabled: true,
|
|
35
|
-
exposure,
|
|
36
|
-
ssgiEnabled: true,
|
|
37
|
-
// Room scale, not contact scale: about two thirds of the 45-unit shadow extent
|
|
38
|
-
// `lighting.ts` lights — a long track: the gather radius is wide because the scene is, and the road is the one surface worth reflecting.
|
|
39
|
-
ssgiRadius: 30,
|
|
40
|
-
ssgiQuality: "medium",
|
|
41
|
-
ssrEnabled: true,
|
|
42
|
-
// `SSRNode` defaults this to **1 world unit**, which on a scene this size reads as
|
|
43
|
-
// "reflections are on and do nothing" — the ray dies a metre from where it started.
|
|
44
|
-
ssrMaxDistance: 75,
|
|
45
|
-
// A reflection carries almost no high-frequency detail, so half resolution costs a quarter
|
|
46
|
-
// of the rays and is very hard to see in the result.
|
|
47
|
-
ssrResolutionScale: 0.5,
|
|
48
|
-
// RCAS puts back the micro-detail the half-resolution reflection and the denoiser take out.
|
|
49
|
-
// The same cause everywhere, so the same value everywhere: **0 is maximum sharpening and 2
|
|
50
|
-
// is none** — it is a radius, not a gain.
|
|
51
|
-
sharpenEnabled: true,
|
|
52
|
-
sharpenStrength: 0.3,
|
|
53
|
-
tonemapMode: "aces",
|
|
54
|
-
} as const;
|
|
55
|
-
|
|
56
|
-
// No SSGI, no SSR, and therefore nothing for the sharpener to put back.
|
|
57
|
-
const mobilePreset = {
|
|
58
|
-
...glow,
|
|
59
|
-
exposure,
|
|
60
|
-
tonemapMode: "aces",
|
|
61
|
-
} as const;
|
|
62
|
-
|
|
63
18
|
export function setupPost(
|
|
64
19
|
renderer: OutputRenderer,
|
|
65
20
|
scene: Scene,
|
|
66
21
|
camera: Camera,
|
|
67
|
-
environment: {
|
|
22
|
+
environment: {
|
|
23
|
+
godraysLight?: DirectionalLight;
|
|
24
|
+
mobile?: boolean;
|
|
25
|
+
/** Forces a tier, ignoring `mobile`. An unknown name throws rather than falling back. */
|
|
26
|
+
tier?: QualityTier;
|
|
27
|
+
} = {},
|
|
68
28
|
): void {
|
|
69
|
-
const
|
|
29
|
+
const tier = resolveQualityTier({ mobile: environment.mobile, tier: environment.tier });
|
|
30
|
+
const source = environment.tier === undefined ? "platform" : "override";
|
|
31
|
+
console.info(`TN_QUALITY_TIER ${tier} mobile=${environment.mobile === true} source=${source}`);
|
|
32
|
+
const world = new WorldEnvironment(qualityPreset(tier));
|
|
70
33
|
world.apply(renderer, scene, camera, { godraysLight: environment.godraysLight });
|
|
71
34
|
}
|