create-threenative 0.2.9 → 0.2.12
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/agent-docs/references/assertion-reference.md +109 -3
- package/agent-docs/references/auto-exposure.md +28 -45
- package/agent-docs/references/build-profiles.md +1 -1
- package/agent-docs/references/capability-reference.md +527 -44
- package/agent-docs/references/debug-surface.md +64 -0
- package/agent-docs/references/finding-assets.md +11 -12
- package/agent-docs/references/performance-basics.md +19 -0
- package/agent-docs/references/trace-a-slow-frame.md +21 -0
- package/agent-docs/references/visual-baseline.md +23 -4
- package/agent-files/.agents/skills/ponytail/SKILL.md +1 -1
- package/agent-files/.agents/skills/prd-creator/SKILL.md +17 -6
- package/agent-files/.agents/skills/threenative-capabilities/SKILL.md +87 -23
- package/agent-files/.agents/skills/threenative-performance/SKILL.md +12 -11
- package/agent-files/.claude/hooks/ponytail-context.mjs +1 -1
- package/agent-files/scripts/reference.mjs +9 -4
- package/capabilities.json +739 -50
- package/dist/index.d.ts +40 -6
- package/dist/index.js +229 -36
- package/dist/quality.d.ts +12 -0
- package/dist/quality.js +166747 -0
- package/dist/threenative.js +60 -44
- package/dist/web-engine-gltf-loader.js +2 -0
- package/dist/web-engine-mesh-bvh-webgpu.js +1 -1
- package/dist/web-engine-mesh-bvh.js +7 -0
- package/dist/web-engine-post-effects.js +645 -19
- package/dist/web-engine-runtime.js +3528 -343
- package/package.json +19 -9
- package/template-assets/assets/bay-PROVENANCE.md +21 -0
- package/template-assets/assets/bay-ground.webp +0 -0
- package/template-assets/assets/bay-metal.webp +0 -0
- package/template-assets/assets/bay-pavement-normal.webp +0 -0
- package/template-assets/assets/bay-pavement.webp +0 -0
- package/template-assets/assets/bay-plaster-normal.webp +0 -0
- package/template-assets/assets/bay-plaster.webp +0 -0
- package/template-assets/assets/bay-wood-normal.webp +0 -0
- package/template-assets/assets/bay-wood.webp +0 -0
- package/template-assets/assets/tex-PROVENANCE.md +25 -0
- package/template-assets/assets/tex-bark-normal.webp +0 -0
- package/template-assets/assets/tex-bark.webp +0 -0
- package/template-assets/assets/tex-birch-bark.webp +0 -0
- package/template-assets/assets/tex-grass.webp +0 -0
- package/template-assets/assets/tex-planks-normal.webp +0 -0
- package/template-assets/assets/tex-planks.webp +0 -0
- package/template-assets/assets/tex-rock-normal.webp +0 -0
- package/template-assets/assets/tex-rock.webp +0 -0
- package/template-assets/assets/tex-roof-tiles-normal.webp +0 -0
- package/template-assets/assets/tex-roof-tiles.webp +0 -0
- package/template-assets/assets/tex-sand-normal.webp +0 -0
- package/template-assets/assets/tex-sand.webp +0 -0
- package/template-assets/assets/tex-stone-wall-normal.webp +0 -0
- package/template-assets/assets/tex-stone-wall.webp +0 -0
- package/template-assets/kitExposure.ts +20 -0
- package/template-assets/patches/three@0.185.1.patch +481 -272
- package/template-assets/quality/biome.json +7 -0
- package/template-assets/quality/eslint.config.js +3 -0
- package/template-assets/realistic-ocean/README.md +113 -0
- package/template-assets/realistic-ocean/install.mjs +56 -0
- package/template-assets/realistic-ocean/src/realisticOcean.ts +151 -0
- package/template-assets/realistic-ocean/src/realisticOceanLifetime.ts +29 -0
- package/template-assets/realistic-ocean/src/render/REALISTIC-OCEAN-LICENSE.txt +25 -0
- package/template-assets/realistic-ocean/src/render/realisticSea.ts +642 -0
- package/template-assets/realistic-ocean/src/render/realisticSeaMaps.ts +311 -0
- package/template-assets/realistic-ocean/src/render/realisticSpectrum.ts +289 -0
- package/templates/AGENTS.md +21 -0
- package/templates/CLAUDE.md +23 -0
- package/templates/action-rpg/.codex/config.toml +6 -2
- package/templates/action-rpg/.cursor/mcp.json +8 -2
- package/templates/action-rpg/.gemini/settings.json +8 -2
- package/templates/action-rpg/.mcp.json +8 -2
- package/templates/action-rpg/.vscode/mcp.json +9 -2
- package/templates/action-rpg/.zed/settings.json +9 -2
- package/templates/action-rpg/AGENTS.md +11 -11
- package/templates/action-rpg/CLAUDE.md +11 -11
- package/templates/action-rpg/opencode.json +10 -2
- package/templates/action-rpg/package.json +17 -11
- package/templates/action-rpg/playtests/combat.playtest.json +6 -0
- package/templates/action-rpg/playtests/inventory.playtest.json +22 -0
- package/templates/action-rpg/playtests/performance.playtest.json +1 -1
- package/templates/action-rpg/playtests/roll.playtest.json +112 -0
- package/templates/action-rpg/playtests/swing.playtest.json +55 -0
- package/templates/action-rpg/playtests/win.playtest.json +4 -4
- package/templates/action-rpg/src/entities/Fighter.ts +44 -4
- package/templates/action-rpg/src/entities/Player.ts +64 -12
- package/templates/action-rpg/src/render/atmosphere.ts +444 -0
- package/templates/action-rpg/src/render/backlightMaterial.ts +49 -18
- package/templates/action-rpg/src/render/clouds.ts +605 -0
- package/templates/action-rpg/src/render/dungeon.ts +8 -6
- package/templates/action-rpg/src/render/exposure.ts +11 -109
- package/templates/action-rpg/src/render/gpuSky.ts +752 -0
- package/templates/action-rpg/src/render/lighting.ts +27 -4
- package/templates/action-rpg/src/render/materialLighting.ts +2 -11
- package/templates/action-rpg/src/render/palette.ts +1 -0
- package/templates/action-rpg/src/render/postprocessing.ts +4 -4
- package/templates/action-rpg/src/render/props.ts +10 -8
- package/templates/action-rpg/src/render/quality.ts +56 -108
- package/templates/action-rpg/src/render/sky.ts +74 -1
- package/templates/action-rpg/src/scenes/Play.ts +16 -12
- package/templates/action-rpg/src/ui/CharacterPanel.tsx +7 -2
- package/templates/action-rpg/src/ui/Hud.tsx +5 -7
- package/templates/action-rpg/src/ui/InventoryPanel.tsx +14 -14
- package/templates/action-rpg/threenative.config.ts +3 -0
- package/templates/adventure/.codex/config.toml +23 -0
- package/templates/adventure/.cursor/mcp.json +38 -0
- package/templates/adventure/.gemini/settings.json +38 -0
- package/templates/adventure/.mcp.json +38 -0
- package/templates/adventure/.vscode/mcp.json +43 -0
- package/templates/adventure/.zed/settings.json +43 -0
- package/templates/adventure/AGENTS.md +60 -0
- package/templates/adventure/CLAUDE.md +62 -0
- package/templates/adventure/index.html +14 -0
- package/templates/adventure/kit.json +8 -0
- package/templates/adventure/native-playtests/survives.playtest.json +52 -0
- package/templates/adventure/opencode.json +49 -0
- package/templates/adventure/package.json +65 -0
- package/templates/adventure/playtests/boss.playtest.json +406 -0
- package/templates/adventure/playtests/combat.playtest.json +342 -0
- package/templates/adventure/playtests/controls.playtest.json +142 -0
- package/templates/adventure/playtests/explore.playtest.json +45 -0
- package/templates/adventure/playtests/flicker.playtest.json +206 -0
- package/templates/adventure/playtests/hearts.playtest.json +171 -0
- package/templates/adventure/playtests/lockon.playtest.json +256 -0
- package/templates/adventure/playtests/look.playtest.json +72 -0
- package/templates/adventure/playtests/move-hollow.playtest.json +106 -0
- package/templates/adventure/playtests/move.playtest.json +84 -0
- package/templates/adventure/playtests/performance.playtest.json +55 -0
- package/templates/adventure/playtests/puzzle.playtest.json +250 -0
- package/templates/adventure/playtests/stride.playtest.json +67 -0
- package/templates/adventure/playtests/survives.playtest.json +171 -0
- package/templates/adventure/playtests/thornback.playtest.json +267 -0
- package/templates/adventure/public/favicon.svg +4 -0
- package/templates/adventure/src/entities/Block.ts +114 -0
- package/templates/adventure/src/entities/Chest.ts +69 -0
- package/templates/adventure/src/entities/Door.ts +81 -0
- package/templates/adventure/src/entities/Dummy.ts +69 -0
- package/templates/adventure/src/entities/Flicker.ts +239 -0
- package/templates/adventure/src/entities/Hero.ts +561 -0
- package/templates/adventure/src/entities/LockOn.ts +180 -0
- package/templates/adventure/src/entities/Mossling.ts +249 -0
- package/templates/adventure/src/entities/Switch.ts +49 -0
- package/templates/adventure/src/entities/Thornback.ts +238 -0
- package/templates/adventure/src/entities/Warden.ts +196 -0
- package/templates/adventure/src/game.ts +65 -0
- package/templates/adventure/src/interact.ts +63 -0
- package/templates/adventure/src/level/Hollow.ts +240 -0
- package/templates/adventure/src/level/Vale.ts +383 -0
- package/templates/adventure/src/main.ts +18 -0
- package/templates/adventure/src/render/camera.ts +416 -0
- package/templates/adventure/src/render/creatures.ts +405 -0
- package/templates/adventure/src/render/effects.ts +333 -0
- package/templates/adventure/src/render/foliage.ts +1072 -0
- package/templates/adventure/src/render/hero.ts +1447 -0
- package/templates/adventure/src/render/kitExposure.ts +20 -0
- package/templates/adventure/src/render/lighting.ts +74 -0
- package/templates/adventure/src/render/loading.ts +332 -0
- package/templates/adventure/src/render/materials.ts +179 -0
- package/templates/adventure/src/render/palette.ts +137 -0
- package/templates/adventure/src/render/postprocessing.ts +70 -0
- package/templates/adventure/src/render/props.ts +383 -0
- package/templates/adventure/src/render/quality.ts +46 -0
- package/templates/adventure/src/render/sky.ts +271 -0
- package/templates/adventure/src/render/surface.ts +259 -0
- package/templates/adventure/src/render/touch-controls.ts +137 -0
- package/templates/adventure/src/scenes/Play.ts +959 -0
- package/templates/adventure/src/state.ts +113 -0
- package/templates/adventure/src/style.css +98 -0
- package/templates/adventure/src/ui/App.tsx +22 -0
- package/templates/adventure/src/ui/GameUi.tsx +20 -0
- package/templates/adventure/src/ui/Hud.tsx +70 -0
- package/templates/adventure/src/ui/Menu.tsx +15 -0
- package/templates/adventure/src/ui/main.tsx +14 -0
- package/templates/adventure/tailwind.config.ts +2 -0
- package/templates/adventure/threenative.config.ts +62 -0
- package/templates/adventure/tsconfig.json +17 -0
- package/templates/adventure/vite.config.ts +49 -0
- package/templates/collectathon/.codex/config.toml +23 -0
- package/templates/collectathon/.cursor/mcp.json +38 -0
- package/templates/collectathon/.gemini/settings.json +38 -0
- package/templates/collectathon/.mcp.json +38 -0
- package/templates/collectathon/.vscode/mcp.json +43 -0
- package/templates/collectathon/.zed/settings.json +43 -0
- package/templates/collectathon/AGENTS.md +58 -0
- package/templates/collectathon/CLAUDE.md +60 -0
- package/templates/collectathon/index.html +14 -0
- package/templates/collectathon/kit.json +8 -0
- package/templates/collectathon/native-playtests/survives.playtest.json +52 -0
- package/templates/collectathon/opencode.json +49 -0
- package/templates/collectathon/package.json +65 -0
- package/templates/collectathon/playtests/acrobatics.playtest.json +238 -0
- package/templates/collectathon/playtests/camera.playtest.json +80 -0
- package/templates/collectathon/playtests/clipped-probe.playtest.json +101 -0
- package/templates/collectathon/playtests/collect.playtest.json +196 -0
- package/templates/collectathon/playtests/combat.playtest.json +246 -0
- package/templates/collectathon/playtests/double-tap-air.playtest.json +198 -0
- package/templates/collectathon/playtests/double-tap.playtest.json +136 -0
- package/templates/collectathon/playtests/effects.playtest.json +124 -0
- package/templates/collectathon/playtests/enemies.playtest.json +295 -0
- package/templates/collectathon/playtests/explore.playtest.json +45 -0
- package/templates/collectathon/playtests/hop-reach.playtest.json +117 -0
- package/templates/collectathon/playtests/jump-chain.playtest.json +274 -0
- package/templates/collectathon/playtests/ledge-angle.playtest.json +107 -0
- package/templates/collectathon/playtests/ledge-too-high.playtest.json +115 -0
- package/templates/collectathon/playtests/ledge.playtest.json +100 -0
- package/templates/collectathon/playtests/look.playtest.json +64 -0
- package/templates/collectathon/playtests/performance.playtest.json +55 -0
- package/templates/collectathon/playtests/stride.playtest.json +111 -0
- package/templates/collectathon/playtests/survives.playtest.json +123 -0
- package/templates/collectathon/playtests/telegraphs.playtest.json +132 -0
- package/templates/collectathon/playtests/thornback.playtest.json +157 -0
- package/templates/collectathon/playtests/wall-kick.playtest.json +206 -0
- package/templates/collectathon/playtests/win.playtest.json +166 -0
- package/templates/collectathon/public/favicon.svg +4 -0
- package/templates/collectathon/src/entities/Hero.ts +915 -0
- package/templates/collectathon/src/entities/Pickup.ts +63 -0
- package/templates/collectathon/src/entities/Walker.ts +248 -0
- package/templates/collectathon/src/game.ts +51 -0
- package/templates/collectathon/src/level/Course.ts +590 -0
- package/templates/collectathon/src/level/terrain.ts +144 -0
- package/templates/collectathon/src/main.ts +14 -0
- package/templates/collectathon/src/playtest-events.ts +15 -0
- package/templates/collectathon/src/render/camera.ts +163 -0
- package/templates/collectathon/src/render/castle.ts +408 -0
- package/templates/collectathon/src/render/effects.ts +284 -0
- package/templates/collectathon/src/render/foliage.ts +744 -0
- package/templates/collectathon/src/render/ground.ts +139 -0
- package/templates/collectathon/src/render/hero.ts +452 -0
- package/templates/collectathon/src/render/kitExposure.ts +20 -0
- package/templates/collectathon/src/render/lighting.ts +65 -0
- package/templates/collectathon/src/render/loading.ts +332 -0
- package/templates/collectathon/src/render/materials.ts +196 -0
- package/templates/collectathon/src/render/palette.ts +82 -0
- package/templates/collectathon/src/render/postprocessing.ts +79 -0
- package/templates/collectathon/src/render/props.ts +218 -0
- package/templates/collectathon/src/render/quality.ts +54 -0
- package/templates/collectathon/src/render/sky.ts +262 -0
- package/templates/collectathon/src/render/surface.ts +269 -0
- package/templates/collectathon/src/render/touch-controls.ts +179 -0
- package/templates/collectathon/src/render/touch-layout.ts +48 -0
- package/templates/collectathon/src/render/water.ts +191 -0
- package/templates/collectathon/src/scenes/Play.ts +481 -0
- package/templates/collectathon/src/state.ts +38 -0
- package/templates/collectathon/src/style.css +106 -0
- package/templates/collectathon/src/ui/App.tsx +22 -0
- package/templates/collectathon/src/ui/GameUi.tsx +20 -0
- package/templates/collectathon/src/ui/Hud.tsx +77 -0
- package/templates/collectathon/src/ui/Menu.tsx +13 -0
- package/templates/collectathon/src/ui/main.tsx +14 -0
- package/templates/collectathon/tailwind.config.ts +2 -0
- package/templates/collectathon/threenative.config.ts +62 -0
- package/templates/collectathon/tsconfig.json +17 -0
- package/templates/collectathon/vite.config.ts +49 -0
- package/templates/kart/.codex/config.toml +23 -0
- package/templates/kart/.cursor/mcp.json +38 -0
- package/templates/kart/.gemini/settings.json +38 -0
- package/templates/kart/.mcp.json +38 -0
- package/templates/kart/.vscode/mcp.json +43 -0
- package/templates/kart/.zed/settings.json +43 -0
- package/templates/kart/AGENTS.md +58 -0
- package/templates/kart/CLAUDE.md +60 -0
- package/templates/kart/index.html +14 -0
- package/templates/kart/kit.json +8 -0
- package/templates/kart/native-playtests/survives.playtest.json +65 -0
- package/templates/kart/opencode.json +49 -0
- package/templates/kart/package.json +64 -0
- package/templates/kart/playtests/drift.playtest.json +226 -0
- package/templates/kart/playtests/explore.playtest.json +45 -0
- package/templates/kart/playtests/hit-stays-above-road.playtest.json +92 -0
- package/templates/kart/playtests/item-key.playtest.json +108 -0
- package/templates/kart/playtests/items.playtest.json +143 -0
- package/templates/kart/playtests/lap-times.playtest.json +138 -0
- package/templates/kart/playtests/laps.playtest.json +149 -0
- package/templates/kart/playtests/performance.playtest.json +57 -0
- package/templates/kart/playtests/race.playtest.json +294 -0
- package/templates/kart/playtests/restart.playtest.json +87 -0
- package/templates/kart/playtests/rocket-start.playtest.json +56 -0
- package/templates/kart/playtests/smooth-drive.playtest.json +101 -0
- package/templates/kart/playtests/surfaces.playtest.json +113 -0
- package/templates/kart/playtests/survives.playtest.json +116 -0
- package/templates/kart/playtests/wall.playtest.json +118 -0
- package/templates/kart/public/favicon.svg +4 -0
- package/templates/kart/src/entities/Driver.ts +123 -0
- package/templates/kart/src/entities/Items.ts +194 -0
- package/templates/kart/src/entities/Kart.ts +517 -0
- package/templates/kart/src/game.ts +45 -0
- package/templates/kart/src/main.ts +14 -0
- package/templates/kart/src/playtest-events.ts +15 -0
- package/templates/kart/src/render/camera.ts +83 -0
- package/templates/kart/src/render/course.ts +579 -0
- package/templates/kart/src/render/effects.ts +266 -0
- package/templates/kart/src/render/items.ts +163 -0
- package/templates/kart/src/render/kart.ts +256 -0
- package/templates/kart/src/render/kitExposure.ts +20 -0
- package/templates/kart/src/render/lighting.ts +58 -0
- package/templates/kart/src/render/loading.ts +332 -0
- package/templates/kart/src/render/materials.ts +119 -0
- package/templates/kart/src/render/palette.ts +74 -0
- package/templates/kart/src/render/postprocessing.ts +79 -0
- package/templates/kart/src/render/quality.ts +54 -0
- package/templates/kart/src/render/skids.ts +86 -0
- package/templates/kart/src/render/sky.ts +105 -0
- package/templates/kart/src/render/touch-controls.ts +168 -0
- package/templates/kart/src/render/touch-layout.ts +48 -0
- package/templates/kart/src/scenes/Race.ts +850 -0
- package/templates/kart/src/state.ts +53 -0
- package/templates/kart/src/style.css +106 -0
- package/templates/kart/src/track/Course.ts +276 -0
- package/templates/kart/src/track/Race.ts +133 -0
- package/templates/kart/src/ui/App.tsx +21 -0
- package/templates/kart/src/ui/GameUi.tsx +20 -0
- package/templates/kart/src/ui/Hud.tsx +172 -0
- package/templates/kart/src/ui/Menu.tsx +13 -0
- package/templates/kart/src/ui/main.tsx +14 -0
- package/templates/kart/tailwind.config.ts +2 -0
- package/templates/kart/threenative.config.ts +62 -0
- package/templates/kart/tsconfig.json +17 -0
- package/templates/kart/vite.config.ts +49 -0
- package/templates/minimal/.codex/config.toml +6 -2
- package/templates/minimal/.cursor/mcp.json +8 -2
- package/templates/minimal/.gemini/settings.json +8 -2
- package/templates/minimal/.mcp.json +8 -2
- package/templates/minimal/.vscode/mcp.json +9 -2
- package/templates/minimal/.zed/settings.json +9 -2
- package/templates/minimal/AGENTS.md +11 -13
- package/templates/minimal/CLAUDE.md +11 -13
- package/templates/minimal/opencode.json +10 -2
- package/templates/minimal/package.json +16 -10
- package/templates/minimal/playtests/camera-wall.playtest.json +36 -0
- package/templates/minimal/playtests/jump.playtest.json +45 -0
- package/templates/minimal/playtests/play.playtest.json +1 -1
- package/templates/minimal/src/game.ts +2 -0
- package/templates/minimal/src/render/atmosphere.ts +444 -0
- package/templates/minimal/src/render/backlightMaterial.ts +49 -18
- package/templates/minimal/src/render/camera.ts +35 -4
- package/templates/minimal/src/render/clouds.ts +605 -0
- package/templates/minimal/src/render/exposure.ts +7 -111
- package/templates/minimal/src/render/gpuSky.ts +752 -0
- package/templates/minimal/src/render/lighting.ts +26 -4
- package/templates/minimal/src/render/materialLighting.ts +2 -10
- package/templates/minimal/src/render/postprocessing.ts +4 -4
- package/templates/minimal/src/render/quality.ts +10 -116
- package/templates/minimal/src/render/sky.ts +73 -1
- package/templates/minimal/src/scenes/Play.ts +18 -7
- package/templates/platformer/.codex/config.toml +6 -2
- package/templates/platformer/.cursor/mcp.json +8 -2
- package/templates/platformer/.gemini/settings.json +8 -2
- package/templates/platformer/.mcp.json +8 -2
- package/templates/platformer/.vscode/mcp.json +9 -2
- package/templates/platformer/.zed/settings.json +9 -2
- package/templates/platformer/AGENTS.md +13 -9
- package/templates/platformer/CLAUDE.md +13 -9
- package/templates/platformer/opencode.json +10 -2
- package/templates/platformer/package.json +17 -11
- package/templates/platformer/playtests/dash-jump.playtest.json +34 -0
- package/templates/platformer/playtests/finish.playtest.json +58 -0
- package/templates/platformer/playtests/idle.playtest.json +44 -0
- package/templates/platformer/playtests/performance.playtest.json +1 -1
- package/templates/platformer/src/entities/Fox.ts +19 -6
- package/templates/platformer/src/game.ts +1 -0
- package/templates/platformer/src/level/Stage.ts +4 -1
- package/templates/platformer/src/render/backlightMaterial.ts +49 -18
- package/templates/platformer/src/render/camera.ts +30 -1
- package/templates/platformer/src/render/exposure.ts +6 -111
- package/templates/platformer/src/render/fox.ts +5 -2
- package/templates/platformer/src/render/kitExposure.ts +20 -0
- package/templates/platformer/src/render/materialLighting.ts +2 -11
- package/templates/platformer/src/render/postprocessing.ts +4 -4
- package/templates/platformer/src/render/props.ts +1 -2
- package/templates/platformer/src/render/quality.ts +10 -118
- package/templates/platformer/src/scenes/Play.ts +31 -15
- package/templates/platformer/src/ui/Menu.tsx +1 -1
- package/templates/puzzle/.codex/config.toml +6 -2
- package/templates/puzzle/.cursor/mcp.json +8 -2
- package/templates/puzzle/.gemini/settings.json +8 -2
- package/templates/puzzle/.mcp.json +8 -2
- package/templates/puzzle/.vscode/mcp.json +9 -2
- package/templates/puzzle/.zed/settings.json +9 -2
- package/templates/puzzle/AGENTS.md +14 -17
- package/templates/puzzle/CLAUDE.md +14 -17
- package/templates/puzzle/opencode.json +10 -2
- package/templates/puzzle/package.json +17 -11
- package/templates/puzzle/playtests/performance.playtest.json +1 -1
- package/templates/puzzle/playtests/replay-keeps-progress.playtest.json +78 -0
- package/templates/puzzle/src/render/backlightMaterial.ts +49 -18
- package/templates/puzzle/src/render/exposure.ts +11 -109
- package/templates/puzzle/src/render/lighting.ts +3 -3
- package/templates/puzzle/src/render/materialLighting.ts +2 -11
- package/templates/puzzle/src/render/palette.ts +1 -1
- package/templates/puzzle/src/render/postprocessing.ts +4 -4
- package/templates/puzzle/src/render/quality.ts +44 -153
- package/templates/puzzle/src/render/vault.ts +18 -6
- package/templates/puzzle/src/scenes/Play.ts +6 -1
- package/templates/puzzle/src/ui/Hud.tsx +8 -43
- package/templates/racing/.codex/config.toml +6 -2
- package/templates/racing/.cursor/mcp.json +8 -2
- package/templates/racing/.gemini/settings.json +8 -2
- package/templates/racing/.mcp.json +8 -2
- package/templates/racing/.vscode/mcp.json +9 -2
- package/templates/racing/.zed/settings.json +9 -2
- package/templates/racing/AGENTS.md +10 -12
- package/templates/racing/CLAUDE.md +10 -12
- package/templates/racing/opencode.json +10 -2
- package/templates/racing/package.json +17 -11
- package/templates/racing/playtests/brake.playtest.json +54 -0
- package/templates/racing/playtests/outcome.playtest.json +19 -0
- package/templates/racing/playtests/performance.playtest.json +1 -1
- package/templates/racing/playtests/stopped-car-is-not-rescued.playtest.json +59 -0
- package/templates/racing/src/entities/RacingCar.ts +12 -3
- package/templates/racing/src/entities/Rival.ts +11 -2
- package/templates/racing/src/render/atmosphere.ts +444 -0
- package/templates/racing/src/render/backlightMaterial.ts +49 -18
- package/templates/racing/src/render/clouds.ts +605 -0
- package/templates/racing/src/render/exposure.ts +6 -111
- package/templates/racing/src/render/gpuSky.ts +752 -0
- package/templates/racing/src/render/kitExposure.ts +20 -0
- package/templates/racing/src/render/lighting.ts +26 -4
- package/templates/racing/src/render/materialLighting.ts +2 -11
- package/templates/racing/src/render/materials.ts +2 -1
- package/templates/racing/src/render/postprocessing.ts +4 -4
- package/templates/racing/src/render/quality.ts +27 -115
- package/templates/racing/src/render/sky.ts +76 -5
- package/templates/racing/src/scenes/Race.ts +53 -42
- package/templates/racing/src/track/TrackSector.ts +5 -2
- package/templates/racing/src/ui/Hud.tsx +12 -7
- package/templates/rain/.codex/config.toml +6 -2
- package/templates/rain/.cursor/mcp.json +8 -2
- package/templates/rain/.gemini/settings.json +8 -2
- package/templates/rain/.mcp.json +8 -2
- package/templates/rain/.vscode/mcp.json +9 -2
- package/templates/rain/.zed/settings.json +9 -2
- package/templates/rain/AGENTS.md +12 -12
- package/templates/rain/CLAUDE.md +12 -12
- package/templates/rain/opencode.json +10 -2
- package/templates/rain/package.json +16 -10
- package/templates/rain/playtests/performance.playtest.json +1 -1
- package/templates/rain/src/game.ts +1 -1
- package/templates/rain/src/render/bloom-shader.ts +1 -1
- package/templates/rain/src/render/clouds-shader.ts +2 -2
- package/templates/rain/src/render/clouds.ts +2 -1
- package/templates/rain/src/render/exposure.ts +11 -109
- package/templates/rain/src/render/post-shader.ts +7 -11
- package/templates/rain/src/render/postprocessing.ts +8 -24
- package/templates/rain/src/render/quality.ts +44 -98
- package/templates/rain/src/render/world-shader.ts +281 -97
- package/templates/rain/src/render/world.ts +82 -2
- package/templates/rain/src/style.css +1 -1
- package/templates/rain/src/ui/GameUi.tsx +6 -2
- package/templates/rain/src/ui/Hud.tsx +1 -1
- package/templates/rain/tools/generate-shaders.mjs +2 -2
- package/templates/rain/tools/tempest-post.frag +4 -6
- package/templates/rain/tools/tempest-world.frag +80 -12
- package/templates/rts/.codex/config.toml +6 -2
- package/templates/rts/.cursor/mcp.json +8 -2
- package/templates/rts/.gemini/settings.json +8 -2
- package/templates/rts/.mcp.json +8 -2
- package/templates/rts/.vscode/mcp.json +9 -2
- package/templates/rts/.zed/settings.json +9 -2
- package/templates/rts/AGENTS.md +15 -16
- package/templates/rts/CLAUDE.md +15 -16
- package/templates/rts/opencode.json +10 -2
- package/templates/rts/package.json +16 -10
- package/templates/rts/playtests/performance.playtest.json +1 -1
- package/templates/rts/playtests/rts-attack.playtest.json +5 -0
- package/templates/rts/playtests/rts-build.playtest.json +20 -1
- package/templates/rts/playtests/rts-orders.playtest.json +1 -1
- package/templates/rts/playtests/rts-pause.playtest.json +112 -0
- package/templates/rts/playtests/rts-train.playtest.json +1 -1
- package/templates/rts/playtests/rts-zoom.playtest.json +81 -0
- package/templates/rts/src/game.ts +29 -7
- package/templates/rts/src/render/army.ts +181 -49
- package/templates/rts/src/render/backlightMaterial.ts +49 -18
- package/templates/rts/src/render/environment.ts +276 -0
- package/templates/rts/src/render/exposure.ts +3 -65
- package/templates/rts/src/render/ground.ts +478 -0
- package/templates/rts/src/render/lighting.ts +62 -11
- package/templates/rts/src/render/materialLighting.ts +2 -11
- package/templates/rts/src/render/materials.ts +47 -118
- package/templates/rts/src/render/palette.ts +30 -13
- package/templates/rts/src/render/picking.ts +18 -0
- package/templates/rts/src/render/postprocessing.ts +4 -4
- package/templates/rts/src/render/quality.ts +64 -85
- package/templates/rts/src/render/resources.ts +21 -22
- package/templates/rts/src/render/sky.ts +9 -12
- package/templates/rts/src/render/terrain.ts +36 -11
- package/templates/rts/src/scenes/Play.ts +373 -38
- package/templates/rts/src/sim/ai.ts +0 -11
- package/templates/rts/src/state.ts +46 -0
- package/templates/rts/src/style.css +1543 -0
- package/templates/rts/src/ui/Commands.tsx +204 -107
- package/templates/rts/src/ui/GameUi.tsx +12 -5
- package/templates/rts/src/ui/Hud.tsx +611 -116
- package/templates/rts/src/ui/Minimap.tsx +103 -37
- package/templates/rts/src/ui/icons.tsx +116 -0
- package/templates/rts/src/ui/labels.ts +73 -0
- package/templates/rts/src/ui/minimapPoint.ts +30 -0
- package/templates/rts/threenative.config.ts +1 -1
- package/templates/runner/.codex/config.toml +6 -2
- package/templates/runner/.cursor/mcp.json +8 -2
- package/templates/runner/.gemini/settings.json +8 -2
- package/templates/runner/.mcp.json +8 -2
- package/templates/runner/.vscode/mcp.json +9 -2
- package/templates/runner/.zed/settings.json +9 -2
- package/templates/runner/AGENTS.md +12 -12
- package/templates/runner/CLAUDE.md +12 -12
- package/templates/runner/opencode.json +10 -2
- package/templates/runner/package.json +17 -11
- package/templates/runner/playtests/near-miss.playtest.json +48 -0
- package/templates/runner/playtests/performance.playtest.json +2 -2
- package/templates/runner/playtests/stride.playtest.json +27 -0
- package/templates/runner/playtests/survives.playtest.json +2 -2
- package/templates/runner/src/conventions.ts +3 -1
- package/templates/runner/src/entities/Runner.ts +11 -5
- package/templates/runner/src/render/atmosphere.ts +444 -0
- package/templates/runner/src/render/backlightMaterial.ts +49 -18
- package/templates/runner/src/render/clouds.ts +605 -0
- package/templates/runner/src/render/exposure.ts +6 -111
- package/templates/runner/src/render/gpuSky.ts +752 -0
- package/templates/runner/src/render/kitExposure.ts +20 -0
- package/templates/runner/src/render/lighting.ts +26 -4
- package/templates/runner/src/render/materialLighting.ts +2 -11
- package/templates/runner/src/render/postprocessing.ts +4 -4
- package/templates/runner/src/render/quality.ts +26 -114
- package/templates/runner/src/render/sky.ts +73 -1
- package/templates/runner/src/scenes/Run.ts +19 -15
- package/templates/runner/src/track.ts +12 -3
- package/templates/sailing/.codex/config.toml +6 -2
- package/templates/sailing/.cursor/mcp.json +8 -2
- package/templates/sailing/.gemini/settings.json +8 -2
- package/templates/sailing/.mcp.json +8 -2
- package/templates/sailing/.vscode/mcp.json +9 -2
- package/templates/sailing/.zed/settings.json +9 -2
- package/templates/sailing/AGENTS.md +10 -11
- package/templates/sailing/CLAUDE.md +10 -11
- package/templates/sailing/opencode.json +10 -2
- package/templates/sailing/package.json +17 -11
- package/templates/sailing/playtests/fail.playtest.json +46 -5
- package/templates/sailing/playtests/float-after-the-run-ends.playtest.json +7 -0
- package/templates/sailing/playtests/performance.playtest.json +1 -1
- package/templates/sailing/src/game.ts +1 -0
- package/templates/sailing/src/render/backlightMaterial.ts +49 -18
- package/templates/sailing/src/render/exposure.ts +6 -111
- package/templates/sailing/src/render/kitExposure.ts +20 -0
- package/templates/sailing/src/render/materialLighting.ts +2 -11
- package/templates/sailing/src/render/ocean.ts +0 -1
- package/templates/sailing/src/render/postprocessing.ts +4 -4
- package/templates/sailing/src/render/quality.ts +31 -138
- package/templates/sailing/src/scenes/Sailing.ts +12 -4
- package/templates/sailing/src/ui/Hud.tsx +6 -2
- package/templates/sailing/src/ui/Menu.tsx +1 -1
- package/templates/shooter/.codex/config.toml +6 -2
- package/templates/shooter/.cursor/mcp.json +8 -2
- package/templates/shooter/.gemini/settings.json +8 -2
- package/templates/shooter/.mcp.json +8 -2
- package/templates/shooter/.vscode/mcp.json +9 -2
- package/templates/shooter/.zed/settings.json +9 -2
- package/templates/shooter/AGENTS.md +13 -12
- package/templates/shooter/CLAUDE.md +13 -12
- package/templates/shooter/index.html +1 -1
- package/templates/shooter/main.html +13 -0
- package/templates/shooter/opencode.json +10 -2
- package/templates/shooter/package.json +17 -11
- package/templates/shooter/playtests/breakable-shatters.playtest.json +6 -0
- package/templates/shooter/playtests/enemy-body-is-a-body.playtest.json +6 -0
- package/templates/shooter/playtests/hands-authored-rate.playtest.json +54 -0
- package/templates/shooter/playtests/movement-eases.playtest.json +53 -0
- package/templates/shooter/playtests/performance.playtest.json +3 -3
- package/templates/shooter/playtests/stairs-smooth-the-eye.playtest.json +56 -0
- package/templates/shooter/playtests/weapon-sharp-while-turning.playtest.json +206 -0
- package/templates/shooter/src/entities/Breakables.ts +34 -10
- package/templates/shooter/src/entities/Enemy.ts +176 -54
- package/templates/shooter/src/entities/FpsPlayer.ts +55 -16
- package/templates/shooter/src/entities/Rifle.ts +83 -9
- package/templates/shooter/src/entities/movement.ts +96 -0
- package/templates/shooter/src/render/atmosphere.ts +444 -0
- package/templates/shooter/src/render/backlightMaterial.ts +49 -18
- package/templates/shooter/src/render/camera.ts +3 -1
- package/templates/shooter/src/render/clouds.ts +605 -0
- package/templates/shooter/src/render/exposure.ts +10 -109
- package/templates/shooter/src/render/facade.ts +26 -68
- package/templates/shooter/src/render/gpuSky.ts +752 -0
- package/templates/shooter/src/render/lighting.ts +27 -4
- package/templates/shooter/src/render/materialAssignments.ts +9 -1
- package/templates/shooter/src/render/materialLighting.ts +2 -11
- package/templates/shooter/src/render/occlusion.ts +13 -4
- package/templates/shooter/src/render/palette.ts +1 -0
- package/templates/shooter/src/render/postprocessing.ts +4 -4
- package/templates/shooter/src/render/quality.ts +50 -108
- package/templates/shooter/src/render/scale.ts +0 -11
- package/templates/shooter/src/render/sky.ts +103 -2
- package/templates/shooter/src/render/surface.ts +140 -0
- package/templates/shooter/src/render/town.ts +3 -6
- package/templates/shooter/src/render/townMaterials.ts +95 -42
- package/templates/shooter/src/render/vehicles.ts +2 -0
- package/templates/shooter/src/scenes/Play.ts +83 -23
- package/templates/shooter/src/ui/Hud.tsx +268 -193
- package/templates/shooter/src/worker-page.ts +29 -0
- package/templates/shooter/src/worker.ts +5 -0
- package/templates/shooter/threenative.config.ts +3 -0
- package/templates/shooter/vite.config.ts +2 -0
- package/templates/snow/.codex/config.toml +6 -2
- package/templates/snow/.cursor/mcp.json +8 -2
- package/templates/snow/.gemini/settings.json +8 -2
- package/templates/snow/.mcp.json +8 -2
- package/templates/snow/.vscode/mcp.json +9 -2
- package/templates/snow/.zed/settings.json +9 -2
- package/templates/snow/AGENTS.md +12 -10
- package/templates/snow/CLAUDE.md +12 -10
- package/templates/snow/opencode.json +10 -2
- package/templates/snow/package.json +17 -11
- package/templates/snow/playtests/performance.playtest.json +1 -1
- package/templates/snow/src/render/backlightMaterial.ts +49 -18
- package/templates/snow/src/render/exposure.ts +17 -106
- package/templates/snow/src/render/materialLighting.ts +2 -11
- package/templates/snow/src/render/postprocessing.ts +11 -5
- package/templates/snow/src/render/quality.ts +46 -126
- package/templates/snow/src/render/snowSurface.ts +32 -15
- package/templates/snow/src/scenes/Snow.ts +2 -1
- package/templates/starter/.codex/config.toml +6 -2
- package/templates/starter/.cursor/mcp.json +8 -2
- package/templates/starter/.gemini/settings.json +8 -2
- package/templates/starter/.mcp.json +8 -2
- package/templates/starter/.vscode/mcp.json +9 -2
- package/templates/starter/.zed/settings.json +9 -2
- package/templates/starter/AGENTS.md +18 -14
- package/templates/starter/CLAUDE.md +18 -14
- package/templates/starter/index.html +1 -1
- package/templates/starter/main.html +12 -0
- package/templates/starter/native-playtests/react-hud.playtest.json +1 -0
- package/templates/starter/native-playtests/render-chain.playtest.json +34 -21
- package/templates/starter/opencode.json +10 -2
- package/templates/starter/package.json +17 -11
- package/templates/starter/playtests/play.playtest.json +22 -2
- package/templates/starter/playtests/production-readiness.playtest.json +56 -0
- package/templates/starter/src/entities/Crate.ts +19 -1
- package/templates/starter/src/render/arena.ts +2 -2
- package/templates/starter/src/render/atmosphere.ts +444 -0
- package/templates/starter/src/render/backlightMaterial.ts +49 -18
- package/templates/starter/src/render/camera.ts +28 -0
- package/templates/starter/src/render/clouds.ts +605 -0
- package/templates/starter/src/render/contactShadow.ts +50 -0
- package/templates/starter/src/render/exposure.ts +9 -111
- package/templates/starter/src/render/gpuSky.ts +752 -0
- package/templates/starter/src/render/grade.ts +1 -1
- package/templates/starter/src/render/lighting.ts +34 -6
- package/templates/starter/src/render/materialLighting.ts +2 -11
- package/templates/starter/src/render/postprocessing.ts +53 -34
- package/templates/starter/src/render/quality.ts +18 -147
- package/templates/starter/src/render/sky.ts +90 -40
- package/templates/starter/src/render/temporalAA.ts +1 -1
- package/templates/starter/src/render/temporalAAStage.ts +1 -1
- package/templates/starter/src/render/temporalCurrentFootprint.ts +0 -1
- package/templates/starter/src/render/temporalDetailStage.ts +106 -0
- package/templates/starter/src/render/temporalRejectionCounter.ts +2 -2
- package/templates/starter/src/render/volumetricFogCamera.ts +32 -0
- package/templates/starter/src/render/volumetricFogOptions.ts +7 -0
- package/templates/starter/src/render/volumetricFogTransport.ts +27 -19
- package/templates/starter/src/render/volumetricFogVolume.ts +31 -7
- package/templates/starter/src/scenes/Play.ts +11 -8
- package/templates/starter/src/ui/Hud.tsx +1 -1
- package/templates/starter/src/worker-page.ts +29 -0
- package/templates/starter/src/worker.ts +5 -0
- package/templates/starter/vite.config.ts +2 -0
- package/templates/tower-defense/.codex/config.toml +6 -2
- package/templates/tower-defense/.cursor/mcp.json +8 -2
- package/templates/tower-defense/.gemini/settings.json +8 -2
- package/templates/tower-defense/.mcp.json +8 -2
- package/templates/tower-defense/.vscode/mcp.json +9 -2
- package/templates/tower-defense/.zed/settings.json +9 -2
- package/templates/tower-defense/AGENTS.md +10 -12
- package/templates/tower-defense/CLAUDE.md +10 -12
- package/templates/tower-defense/opencode.json +10 -2
- package/templates/tower-defense/package.json +17 -11
- package/templates/tower-defense/playtests/chill-tint.playtest.json +387 -0
- package/templates/tower-defense/playtests/performance.playtest.json +1 -1
- package/templates/tower-defense/src/enemies/Enemy.ts +9 -0
- package/templates/tower-defense/src/render/backlightMaterial.ts +49 -18
- package/templates/tower-defense/src/render/exposure.ts +11 -109
- package/templates/tower-defense/src/render/lighting.ts +4 -2
- package/templates/tower-defense/src/render/materialLighting.ts +2 -11
- package/templates/tower-defense/src/render/postprocessing.ts +4 -4
- package/templates/tower-defense/src/render/quality.ts +10 -116
- package/templates/tower-defense/src/render/sky.ts +2 -2
- package/templates/tower-defense/src/scenes/Battle.ts +4 -0
- package/template-assets/autoExposure.ts +0 -225
- package/template-assets/exposureGraph.ts +0 -178
- package/template-assets/exposureReadback.ts +0 -79
- package/template-assets/worldEnvironment.ts +0 -1212
- package/templates/action-rpg/src/render/autoExposure.ts +0 -225
- package/templates/action-rpg/src/render/exposureGraph.ts +0 -178
- package/templates/action-rpg/src/render/exposureReadback.ts +0 -79
- package/templates/action-rpg/src/render/worldEnvironment.ts +0 -1212
- package/templates/minimal/src/render/autoExposure.ts +0 -225
- package/templates/minimal/src/render/exposureGraph.ts +0 -178
- package/templates/minimal/src/render/exposureReadback.ts +0 -79
- package/templates/minimal/src/render/worldEnvironment.ts +0 -1212
- package/templates/platformer/src/render/autoExposure.ts +0 -225
- package/templates/platformer/src/render/exposureGraph.ts +0 -178
- package/templates/platformer/src/render/exposureReadback.ts +0 -79
- package/templates/platformer/src/render/worldEnvironment.ts +0 -1212
- package/templates/puzzle/src/render/autoExposure.ts +0 -225
- package/templates/puzzle/src/render/exposureGraph.ts +0 -178
- package/templates/puzzle/src/render/exposureReadback.ts +0 -79
- package/templates/puzzle/src/render/worldEnvironment.ts +0 -1212
- package/templates/racing/src/render/autoExposure.ts +0 -225
- package/templates/racing/src/render/exposureGraph.ts +0 -178
- package/templates/racing/src/render/exposureReadback.ts +0 -79
- package/templates/racing/src/render/worldEnvironment.ts +0 -1212
- package/templates/rain/src/render/autoExposure.ts +0 -225
- package/templates/rain/src/render/exposureGraph.ts +0 -178
- package/templates/rain/src/render/exposureReadback.ts +0 -79
- package/templates/rain/src/render/worldEnvironment.ts +0 -1212
- package/templates/rts/src/render/autoExposure.ts +0 -225
- package/templates/rts/src/render/exposureGraph.ts +0 -178
- package/templates/rts/src/render/exposureReadback.ts +0 -79
- package/templates/rts/src/render/worldEnvironment.ts +0 -1212
- package/templates/runner/src/render/autoExposure.ts +0 -225
- package/templates/runner/src/render/exposureGraph.ts +0 -178
- package/templates/runner/src/render/exposureReadback.ts +0 -79
- package/templates/runner/src/render/worldEnvironment.ts +0 -1212
- package/templates/sailing/src/render/autoExposure.ts +0 -225
- package/templates/sailing/src/render/exposureGraph.ts +0 -178
- package/templates/sailing/src/render/exposureReadback.ts +0 -79
- package/templates/sailing/src/render/worldEnvironment.ts +0 -1212
- package/templates/shooter/src/render/autoExposure.ts +0 -225
- package/templates/shooter/src/render/exposureGraph.ts +0 -178
- package/templates/shooter/src/render/exposureReadback.ts +0 -79
- package/templates/shooter/src/render/worldEnvironment.ts +0 -1212
- package/templates/snow/src/render/autoExposure.ts +0 -225
- package/templates/snow/src/render/exposureGraph.ts +0 -178
- package/templates/snow/src/render/exposureReadback.ts +0 -79
- package/templates/snow/src/render/worldEnvironment.ts +0 -1212
- package/templates/starter/src/render/autoExposure.ts +0 -225
- package/templates/starter/src/render/exposureGraph.ts +0 -178
- package/templates/starter/src/render/exposureReadback.ts +0 -79
- package/templates/starter/src/render/worldEnvironment.ts +0 -1212
- package/templates/tower-defense/src/render/autoExposure.ts +0 -225
- package/templates/tower-defense/src/render/exposureGraph.ts +0 -178
- package/templates/tower-defense/src/render/exposureReadback.ts +0 -79
- package/templates/tower-defense/src/render/worldEnvironment.ts +0 -1212
package/dist/index.d.ts
CHANGED
|
@@ -120,6 +120,8 @@ interface IThreeNativeModelPassesConfig {
|
|
|
120
120
|
readonly prune?: boolean;
|
|
121
121
|
readonly quantize?: boolean;
|
|
122
122
|
readonly reorder?: boolean;
|
|
123
|
+
/** Drop animation tracks that only hold the pose their node already has. */
|
|
124
|
+
readonly restTracks?: boolean;
|
|
123
125
|
}
|
|
124
126
|
interface IThreeNativeModelsConfig {
|
|
125
127
|
/**
|
|
@@ -208,12 +210,14 @@ interface IWebBrandVitePlugin {
|
|
|
208
210
|
exclude: string[];
|
|
209
211
|
};
|
|
210
212
|
} | undefined>;
|
|
211
|
-
resolveId(source: string): string | null;
|
|
213
|
+
resolveId(source: string, importer?: string): string | null;
|
|
212
214
|
load(id: string): Promise<string | null>;
|
|
213
215
|
configResolved(config: {
|
|
214
216
|
readonly root: string;
|
|
215
217
|
}): Promise<void>;
|
|
216
218
|
transformIndexHtml(html: string): string;
|
|
219
|
+
configureServer(server: IMiddlewareServer): void;
|
|
220
|
+
configurePreviewServer(server: IMiddlewareServer): void;
|
|
217
221
|
generateBundle(this: {
|
|
218
222
|
emitFile(asset: {
|
|
219
223
|
fileName: string;
|
|
@@ -222,6 +226,17 @@ interface IWebBrandVitePlugin {
|
|
|
222
226
|
}): void;
|
|
223
227
|
}): void;
|
|
224
228
|
}
|
|
229
|
+
type Middleware = (req: {
|
|
230
|
+
url?: string;
|
|
231
|
+
}, res: {
|
|
232
|
+
setHeader(key: string, value: string): void;
|
|
233
|
+
end(body: string): void;
|
|
234
|
+
}, next: () => void) => void;
|
|
235
|
+
interface IMiddlewareServer {
|
|
236
|
+
readonly middlewares: {
|
|
237
|
+
use(handler: Middleware): void;
|
|
238
|
+
};
|
|
239
|
+
}
|
|
225
240
|
declare function renderWebManifest(root: string, config: IResolvedThreeNativeConfig): string;
|
|
226
241
|
declare function createWebBrandPlugin(): IWebBrandVitePlugin;
|
|
227
242
|
|
|
@@ -245,7 +260,6 @@ declare const PACKAGE_SOURCE_FLAGS: {
|
|
|
245
260
|
readonly "@threenative/playtest": "--playtest-package";
|
|
246
261
|
readonly "@threenative/runtime-native": "--runtime-native-package";
|
|
247
262
|
readonly "@threenative/ui": "--ui-package";
|
|
248
|
-
readonly "threenative-blender-mcp": "--blender-mcp-package";
|
|
249
263
|
readonly "threenative-engine-mcp": "--engine-mcp-package";
|
|
250
264
|
readonly "create-threenative": "--cli-package";
|
|
251
265
|
};
|
|
@@ -254,6 +268,8 @@ type PackageSources = Partial<Record<PackageSourceName, string>> & {
|
|
|
254
268
|
readonly [packageName: string]: string | undefined;
|
|
255
269
|
};
|
|
256
270
|
interface IKitManifest {
|
|
271
|
+
/** Extra exact words `--genre` resolves to this kit, e.g. "mario". Optional in kit.json. */
|
|
272
|
+
readonly aliases: readonly string[];
|
|
257
273
|
readonly blurb: string;
|
|
258
274
|
readonly genre: string;
|
|
259
275
|
readonly kit: boolean;
|
|
@@ -265,6 +281,8 @@ interface IScaffoldOptions {
|
|
|
265
281
|
packageSources?: PackageSources;
|
|
266
282
|
target: string;
|
|
267
283
|
template?: ScaffoldTemplate;
|
|
284
|
+
/** The `--genre` word the user asked with; the next-steps line searches references for it. */
|
|
285
|
+
genre?: string;
|
|
268
286
|
}
|
|
269
287
|
interface IScaffoldResult {
|
|
270
288
|
installed: boolean;
|
|
@@ -290,7 +308,7 @@ declare function stampLoadingSource(canonical: string, template: string): string
|
|
|
290
308
|
* hand let one fall a revision behind without anything failing. A file belongs here only when a
|
|
291
309
|
* kit editing it would be a mistake rather than a choice.
|
|
292
310
|
*/
|
|
293
|
-
declare const SHARED_RENDER_SOURCES: readonly [
|
|
311
|
+
declare const SHARED_RENDER_SOURCES: readonly string[];
|
|
294
312
|
declare function canonicalRenderSourcePath(relativePath: string, root?: string): string;
|
|
295
313
|
/** Re-copies every shared render source into each kit that ships it. */
|
|
296
314
|
declare function restampSharedRenderCopies(root?: string): Promise<readonly string[]>;
|
|
@@ -300,10 +318,26 @@ declare function restampTemplateLoadingCopies(root?: string): Promise<readonly s
|
|
|
300
318
|
declare function discoverKitManifests(root?: string): readonly IKitManifest[];
|
|
301
319
|
declare function discoverTemplateNames(root?: string): readonly ScaffoldTemplate[];
|
|
302
320
|
declare function kitManifest(template: ScaffoldTemplate, root?: string): IKitManifest;
|
|
303
|
-
/** Resolve an exact public genre
|
|
304
|
-
* genre words are authoring input, not an
|
|
321
|
+
/** Resolve an exact public genre, or an alias a kit declares in its own kit.json, to its kit.
|
|
322
|
+
* Unknown words deliberately start from minimal: genre words are authoring input, not an
|
|
323
|
+
* invitation to guess the closest preset. Two kits claiming one word is a manifest bug. */
|
|
305
324
|
declare function templateForGenre(genre: string, root?: string): ScaffoldTemplate;
|
|
306
325
|
declare function scaffoldCompletionMessage(manifests: readonly IKitManifest[], defaultTemplate?: string): string;
|
|
326
|
+
/**
|
|
327
|
+
* The scaffold's last line. A host loads the MCP servers in `.mcp.json` only for a session started
|
|
328
|
+
* in the game folder, and an agent that scaffolds mid-session never gets them (PRD-750: five cold
|
|
329
|
+
* builds, zero engine calls). `mcp/call.mjs` starts any of them the way the host would.
|
|
330
|
+
*/
|
|
331
|
+
declare function scaffoldNextSteps(target: string, installed: boolean, servers?: readonly string[]): string;
|
|
332
|
+
/** The server names in the game's `.mcp.json`, or none when the install has not written it. */
|
|
333
|
+
declare function projectMcpServers(target: string): string[];
|
|
334
|
+
/**
|
|
335
|
+
* The mechanics references for the game the user named with `--genre`, printed by the scaffold.
|
|
336
|
+
* Cold agents skipped the search even when the next-steps line gave the command (PRD-750
|
|
337
|
+
* sandboxes 4 and 5), and read a title list without opening one (sandbox 6), so the scaffold runs
|
|
338
|
+
* the search through the installed engine and prints the top hits' pinned sources and constants.
|
|
339
|
+
*/
|
|
340
|
+
declare function referenceDigest(target: string, genre: string, run?: (args: string[]) => string): string;
|
|
307
341
|
declare function cliHelp(): string;
|
|
308
342
|
declare function createProject(options: IScaffoldOptions, cwd?: string, root?: string): Promise<IScaffoldResult>;
|
|
309
343
|
/** The inverse of `scripts/workspace-packages.ts`'s `workspacePackageSourceFlag`; exported so
|
|
@@ -311,4 +345,4 @@ declare function createProject(options: IScaffoldOptions, cwd?: string, root?: s
|
|
|
311
345
|
declare function packageNameFromFlag(flag: string): string | undefined;
|
|
312
346
|
declare function parseArgs(argv: readonly string[]): IScaffoldOptions;
|
|
313
347
|
|
|
314
|
-
export { type IKitManifest, type IScaffoldOptions, type IScaffoldResult, SHARED_RENDER_SOURCES, type ScaffoldTemplate, canonicalLoadingPath, canonicalRenderSourcePath, cliHelp, createEngineFreshnessPlugin, createProject, createWebBrandPlugin, discoverKitManifests, discoverStampedTemplates, discoverTemplateNames, hashEngineDist, kitManifest, packageNameFromFlag, parseArgs, renderWebManifest, restampSharedRenderCopies, restampTemplateLoadingCopies, scaffoldCompletionMessage, stampLoadingSource, templateForGenre, templateRoot, webRuntimeDecoders };
|
|
348
|
+
export { type IKitManifest, type IScaffoldOptions, type IScaffoldResult, SHARED_RENDER_SOURCES, type ScaffoldTemplate, canonicalLoadingPath, canonicalRenderSourcePath, cliHelp, createEngineFreshnessPlugin, createProject, createWebBrandPlugin, discoverKitManifests, discoverStampedTemplates, discoverTemplateNames, hashEngineDist, kitManifest, packageNameFromFlag, parseArgs, projectMcpServers, referenceDigest, renderWebManifest, restampSharedRenderCopies, restampTemplateLoadingCopies, scaffoldCompletionMessage, scaffoldNextSteps, stampLoadingSource, templateForGenre, templateRoot, webRuntimeDecoders };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { spawn } from 'child_process';
|
|
3
|
+
import { execFileSync, spawn } from 'child_process';
|
|
4
4
|
import { existsSync, realpathSync, readdirSync, readFileSync, rmSync, mkdirSync, writeFileSync } from 'fs';
|
|
5
5
|
import { mkdir, cp, rename, readFile, readdir, writeFile, rm, symlink, access, unlink, stat } from 'fs/promises';
|
|
6
6
|
import path6 from 'path';
|
|
@@ -311,12 +311,19 @@ var MCP_SERVERS = Object.freeze({
|
|
|
311
311
|
command: "node",
|
|
312
312
|
args: Object.freeze(["./node_modules/@threenative/core/mcp/engine.mjs"])
|
|
313
313
|
}),
|
|
314
|
-
//
|
|
315
|
-
//
|
|
316
|
-
|
|
317
|
-
"threenative-blender": Object.freeze({
|
|
314
|
+
// Inspects, attaches, edits and verifies character animation. Every operation is a build-time
|
|
315
|
+
// edit of one GLB, so a game that animates nothing pays for nothing.
|
|
316
|
+
"threenative-animation": Object.freeze({
|
|
318
317
|
command: "node",
|
|
319
|
-
args: Object.freeze(["./node_modules/@threenative/core/mcp/
|
|
318
|
+
args: Object.freeze(["./node_modules/@threenative/core/mcp/animation.mjs"])
|
|
319
|
+
}),
|
|
320
|
+
// Google's Chrome DevTools server: performance traces, GPU timing, network, heap and console of
|
|
321
|
+
// the running game. It starts Chrome only on its first tool call, so a project that never
|
|
322
|
+
// inspects a page pays nothing. Its async stack capture inflates CPU time several times, so
|
|
323
|
+
// `trace-a-slow-frame.md` sends absolute CPU questions to `playtest trace` first.
|
|
324
|
+
"threenative-devtools": Object.freeze({
|
|
325
|
+
command: "node",
|
|
326
|
+
args: Object.freeze(["./node_modules/@threenative/core/mcp/devtools.mjs"])
|
|
320
327
|
})
|
|
321
328
|
});
|
|
322
329
|
var SERVER_FORMATS = Object.freeze({
|
|
@@ -1303,7 +1310,8 @@ var MODEL_PASS_KEYS = [
|
|
|
1303
1310
|
"meshopt",
|
|
1304
1311
|
"prune",
|
|
1305
1312
|
"quantize",
|
|
1306
|
-
"reorder"
|
|
1313
|
+
"reorder",
|
|
1314
|
+
"restTracks"
|
|
1307
1315
|
];
|
|
1308
1316
|
var MODEL_QUANTIZE_KEYS = ["normalBits", "positionBits", "uvBits"];
|
|
1309
1317
|
var MODEL_VIRTUAL_KEYS = [
|
|
@@ -1646,6 +1654,7 @@ var ARTIFACT_BUDGET_SEVERITIES = ["error", "warn"];
|
|
|
1646
1654
|
var PERFORMANCE_BUDGET_KEYS = [
|
|
1647
1655
|
"maxDrawCalls",
|
|
1648
1656
|
"maxFrameMsP95",
|
|
1657
|
+
"maxFrameMsReason",
|
|
1649
1658
|
"maxPassDrawCalls",
|
|
1650
1659
|
"maxPassTriangles",
|
|
1651
1660
|
"maxPhaseMsP95",
|
|
@@ -1693,6 +1702,16 @@ function validatePerformanceBudget(raw, label) {
|
|
|
1693
1702
|
);
|
|
1694
1703
|
}
|
|
1695
1704
|
const out = {};
|
|
1705
|
+
const frameReason = budget.maxFrameMsReason;
|
|
1706
|
+
if (frameReason !== void 0) {
|
|
1707
|
+
if (typeof frameReason !== "string" || frameReason.trim() === "") {
|
|
1708
|
+
fail(
|
|
1709
|
+
"TN_CONFIG_PROFILE_INVALID",
|
|
1710
|
+
`${label}.performanceBudget.maxFrameMsReason must be a non-empty string.`
|
|
1711
|
+
);
|
|
1712
|
+
}
|
|
1713
|
+
out.maxFrameMsReason = frameReason;
|
|
1714
|
+
}
|
|
1696
1715
|
for (const key of ["maxDrawCalls", "maxFrameMsP95", "maxTriangles", "minFps"]) {
|
|
1697
1716
|
const value = budget[key];
|
|
1698
1717
|
if (value === void 0) continue;
|
|
@@ -1944,6 +1963,22 @@ var ENGINE_ADDON_CLASSES = {
|
|
|
1944
1963
|
var ENGINE_ADDON_PREFIX = "\0threenative:web-engine-addon:";
|
|
1945
1964
|
var SKELETON_UTILS_ID = "\0threenative:web-engine-skeleton-utils";
|
|
1946
1965
|
var WASM_ENGINE_ENTRY = "build/web/tn-native-engine-web.mjs";
|
|
1966
|
+
var WASM_THREADS_ENTRY = "build/web/tn-native-engine-web-threads.mjs";
|
|
1967
|
+
var THREADS_OFF = "TN_WEB_THREADS_OFF";
|
|
1968
|
+
var ENGINE_MATH_MODULES = /* @__PURE__ */ new Set([
|
|
1969
|
+
"three/src/math/Box3.js",
|
|
1970
|
+
"three/src/math/Color.js",
|
|
1971
|
+
"three/src/math/ColorManagement.js",
|
|
1972
|
+
"three/src/math/Euler.js",
|
|
1973
|
+
"three/src/math/Matrix3.js",
|
|
1974
|
+
"three/src/math/Matrix4.js",
|
|
1975
|
+
"three/src/math/Quaternion.js",
|
|
1976
|
+
"three/src/math/Sphere.js",
|
|
1977
|
+
"three/src/math/Vector2.js",
|
|
1978
|
+
"three/src/math/Vector3.js",
|
|
1979
|
+
"three/src/math/Vector4.js"
|
|
1980
|
+
]);
|
|
1981
|
+
var ENGINE_MATH_IMPORTER = /[\\/](?:browser-math\.ts|web-engine-runtime\.js)(?:\?.*)?$/u;
|
|
1947
1982
|
function browserModule(built, source) {
|
|
1948
1983
|
const bundled = fileURLToPath(new URL(`./${built}`, import.meta.url));
|
|
1949
1984
|
if (existsSync(bundled)) return bundled;
|
|
@@ -1952,6 +1987,7 @@ function browserModule(built, source) {
|
|
|
1952
1987
|
throw new Error(`TN_WEB_ENGINE_RUNTIME_MISSING: neither ${bundled} nor ${workspace} exists.`);
|
|
1953
1988
|
}
|
|
1954
1989
|
var runtimeModule = () => browserModule("web-engine-runtime.js", "browser-entry.ts");
|
|
1990
|
+
var OPT_OUT = 'engine: "threejs" in threenative.config.ts switches to upstream three only when the user asks for it.';
|
|
1955
1991
|
function wasmModule(root, explicit) {
|
|
1956
1992
|
if (explicit !== void 0) {
|
|
1957
1993
|
if (!existsSync(explicit))
|
|
@@ -1969,12 +2005,12 @@ function wasmModule(root, explicit) {
|
|
|
1969
2005
|
);
|
|
1970
2006
|
} catch {
|
|
1971
2007
|
throw new Error(
|
|
1972
|
-
`TN_WASM_ENGINE_MISSING: engine "threenative" needs @threenative/runtime-native installed in ${root}
|
|
2008
|
+
`TN_WASM_ENGINE_MISSING: engine "threenative" needs @threenative/runtime-native installed in ${root}; install it (its npm package ships the Wasm engine). ${OPT_OUT}`
|
|
1973
2009
|
);
|
|
1974
2010
|
}
|
|
1975
2011
|
if (!existsSync(entry))
|
|
1976
2012
|
throw new Error(
|
|
1977
|
-
`TN_WASM_ENGINE_MISSING: engine "threenative" needs the Wasm engine at ${entry}; build it with \`cmake --build build/wasm --target tn-native-engine-web\` in packages/runtime-native
|
|
2013
|
+
`TN_WASM_ENGINE_MISSING: engine "threenative" needs the Wasm engine at ${entry}; reinstall @threenative/runtime-native, or in a ThreeNative checkout run \`pnpm wasm:build\` from the repository root (it fetches stb, cgltf and webp-source, then builds), or build it with \`cmake --build build/wasm --target tn-native-engine-web\` in packages/runtime-native. ${OPT_OUT}`
|
|
1978
2014
|
);
|
|
1979
2015
|
return entry;
|
|
1980
2016
|
}
|
|
@@ -1983,7 +2019,7 @@ async function upstreamNames(root) {
|
|
|
1983
2019
|
const modules = await Promise.all(
|
|
1984
2020
|
UPSTREAM.map((id) => import(pathToFileURL(require2.resolve(id)).href))
|
|
1985
2021
|
);
|
|
1986
|
-
return [...new Set(modules.flatMap((module) => Object.keys(module)))].filter((name) => name !== "default").sort();
|
|
2022
|
+
return [...new Set(modules.flatMap((module) => Object.keys(module)))].filter((name) => name !== "default" && name !== "module.exports").sort();
|
|
1987
2023
|
}
|
|
1988
2024
|
function createWebEnginePlugin(options = {}) {
|
|
1989
2025
|
let root = options.root;
|
|
@@ -1999,7 +2035,7 @@ function createWebEnginePlugin(options = {}) {
|
|
|
1999
2035
|
configResolved(config) {
|
|
2000
2036
|
root ??= config.root;
|
|
2001
2037
|
},
|
|
2002
|
-
resolveId(specifier) {
|
|
2038
|
+
resolveId(specifier, importer = "") {
|
|
2003
2039
|
if (!native) return null;
|
|
2004
2040
|
const source = specifier.replace(/^three\/examples\/jsm\//u, "three/addons/");
|
|
2005
2041
|
if (UPSTREAM.includes(source)) return WEB_ENGINE_ID;
|
|
@@ -2025,7 +2061,7 @@ function createWebEnginePlugin(options = {}) {
|
|
|
2025
2061
|
return browserModule("web-engine-lut-cube-loader.js", "addons/lut-cube-loader-web.ts");
|
|
2026
2062
|
if (POST_EFFECT_ADDONS.includes(source))
|
|
2027
2063
|
return browserModule("web-engine-post-effects.js", "addons/post-effects-web.ts");
|
|
2028
|
-
if (/^three\/(?:src|build)\//u.test(source))
|
|
2064
|
+
if (/^three\/(?:src|build)\//u.test(source) && !(ENGINE_MATH_MODULES.has(source) && ENGINE_MATH_IMPORTER.test(importer)))
|
|
2029
2065
|
throw new Error(
|
|
2030
2066
|
`TN_NATIVE_UPSTREAM_IMPORT: ${source} would bundle upstream three under engine "threenative"; import from three, three/webgpu or three/tsl.`
|
|
2031
2067
|
);
|
|
@@ -2045,10 +2081,20 @@ function createWebEnginePlugin(options = {}) {
|
|
|
2045
2081
|
"__tnTsl",
|
|
2046
2082
|
"__tnLoadGltf"
|
|
2047
2083
|
];
|
|
2084
|
+
const single = wasmModule(projectRoot(), options.wasm);
|
|
2085
|
+
const threads = path6.join(path6.dirname(single), path6.basename(WASM_THREADS_ENTRY));
|
|
2086
|
+
if (!existsSync(threads))
|
|
2087
|
+
throw new Error(
|
|
2088
|
+
`TN_WASM_THREADS_MISSING: engine "threenative" needs the threaded Wasm engine at ${threads}; reinstall @threenative/runtime-native, or in a ThreeNative checkout run \`pnpm wasm:build\` (presets wasm and wasm-threads). ${OPT_OUT}`
|
|
2089
|
+
);
|
|
2048
2090
|
return [
|
|
2049
2091
|
`import { bindWebEngine } from ${JSON.stringify(runtimeModule())};`,
|
|
2050
|
-
|
|
2092
|
+
"if (globalThis.crossOriginIsolated !== true)",
|
|
2093
|
+
` throw new Error("${THREADS_OFF}: this page is not cross-origin isolated, so the engine cannot start its worker threads; serve it with the headers Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Embedder-Policy: require-corp.");`,
|
|
2094
|
+
`const createModule = (await import(${JSON.stringify(threads)})).default;`,
|
|
2051
2095
|
`const engine = await bindWebEngine(createModule, ${JSON.stringify(names)});`,
|
|
2096
|
+
'if (!String(globalThis.__tnWebThreads).startsWith("on"))',
|
|
2097
|
+
` throw new Error(\`${THREADS_OFF}: the engine's job pool started no worker thread (\${globalThis.__tnWebThreads}).\`);`,
|
|
2052
2098
|
`export const { ${names.join(", ")} } = engine;`,
|
|
2053
2099
|
""
|
|
2054
2100
|
].join("\n");
|
|
@@ -2057,6 +2103,20 @@ function createWebEnginePlugin(options = {}) {
|
|
|
2057
2103
|
}
|
|
2058
2104
|
|
|
2059
2105
|
// src/web-brand.ts
|
|
2106
|
+
var ISOLATION_HEADERS = {
|
|
2107
|
+
"Cross-Origin-Embedder-Policy": "require-corp",
|
|
2108
|
+
"Cross-Origin-Opener-Policy": "same-origin"
|
|
2109
|
+
};
|
|
2110
|
+
var isolationMiddleware = (req, res, next) => {
|
|
2111
|
+
if (!/[?&]tnIsolation=0(?:&|$)/u.test(req.url ?? ""))
|
|
2112
|
+
for (const [key, value] of Object.entries(ISOLATION_HEADERS)) res.setHeader(key, value);
|
|
2113
|
+
next();
|
|
2114
|
+
};
|
|
2115
|
+
function renderIsolationHeaders() {
|
|
2116
|
+
return `/*
|
|
2117
|
+
${Object.entries(ISOLATION_HEADERS).map(([key, value]) => ` ${key}: ${value}
|
|
2118
|
+
`).join("")}`;
|
|
2119
|
+
}
|
|
2060
2120
|
function htmlAttribute(value) {
|
|
2061
2121
|
return value.replaceAll("&", "&").replaceAll('"', """).replaceAll("<", "<");
|
|
2062
2122
|
}
|
|
@@ -2141,14 +2201,27 @@ function createWebBrandPlugin() {
|
|
|
2141
2201
|
enforce: "pre",
|
|
2142
2202
|
async config(vite) {
|
|
2143
2203
|
const loaded = await loadConfig(path6.resolve(vite.root ?? process.cwd()));
|
|
2144
|
-
if (loaded.engine === "threenative")
|
|
2204
|
+
if (loaded.engine === "threenative" && process.env.THREENATIVE_NATIVE_BUNDLE === void 0)
|
|
2145
2205
|
return {
|
|
2146
|
-
optimizeDeps: { exclude: ["three", "three/webgpu", "three/tsl", "three-mesh-bvh"] }
|
|
2206
|
+
optimizeDeps: { exclude: ["three", "three/webgpu", "three/tsl", "three-mesh-bvh"] },
|
|
2207
|
+
// Vite runs only `worker.plugins` on a worker bundle, so a game booted in a worker
|
|
2208
|
+
// (PRD-752) needs the same resolver, as ES output for the engine's top-level await.
|
|
2209
|
+
worker: {
|
|
2210
|
+
format: "es",
|
|
2211
|
+
plugins: () => [
|
|
2212
|
+
{
|
|
2213
|
+
name: "threenative-web-engine-worker",
|
|
2214
|
+
enforce: "pre",
|
|
2215
|
+
resolveId: (source, importer) => engine?.resolveId(source, importer) ?? null,
|
|
2216
|
+
load: async (id) => engine?.load(id) ?? null
|
|
2217
|
+
}
|
|
2218
|
+
]
|
|
2219
|
+
}
|
|
2147
2220
|
};
|
|
2148
2221
|
return void 0;
|
|
2149
2222
|
},
|
|
2150
|
-
resolveId(source) {
|
|
2151
|
-
return engine?.resolveId(source) ?? null;
|
|
2223
|
+
resolveId(source, importer) {
|
|
2224
|
+
return engine?.resolveId(source, importer) ?? null;
|
|
2152
2225
|
},
|
|
2153
2226
|
async load(id) {
|
|
2154
2227
|
return engine?.load(id) ?? null;
|
|
@@ -2156,13 +2229,27 @@ function createWebBrandPlugin() {
|
|
|
2156
2229
|
async configResolved(resolved) {
|
|
2157
2230
|
root = resolved.root;
|
|
2158
2231
|
config = await loadConfig(root);
|
|
2159
|
-
if (config.engine === "threenative")
|
|
2232
|
+
if (config.engine === "threenative" && process.env.THREENATIVE_NATIVE_BUNDLE === void 0)
|
|
2160
2233
|
engine = createWebEnginePlugin({ root, engine: config.engine });
|
|
2161
2234
|
},
|
|
2162
2235
|
transformIndexHtml(html) {
|
|
2163
2236
|
if (config === void 0) throw new Error("TN_WEB_BRAND_CONFIG_MISSING");
|
|
2164
2237
|
return updateLaunchMarkup(root, config, html);
|
|
2165
2238
|
},
|
|
2239
|
+
// Every page links the manifest, and only a build emits it: in dev Vite would answer the link
|
|
2240
|
+
// with index.html, which the browser reports as a manifest syntax error on each load.
|
|
2241
|
+
configureServer(server) {
|
|
2242
|
+
if (config?.engine === "threenative") server.middlewares.use(isolationMiddleware);
|
|
2243
|
+
server.middlewares.use((req, res, next) => {
|
|
2244
|
+
if (req.url?.split("?")[0] !== "/manifest.webmanifest" || config === void 0)
|
|
2245
|
+
return next();
|
|
2246
|
+
res.setHeader("Content-Type", "application/manifest+json");
|
|
2247
|
+
res.end(renderWebManifest(root, config));
|
|
2248
|
+
});
|
|
2249
|
+
},
|
|
2250
|
+
configurePreviewServer(server) {
|
|
2251
|
+
if (config?.engine === "threenative") server.middlewares.use(isolationMiddleware);
|
|
2252
|
+
},
|
|
2166
2253
|
generateBundle() {
|
|
2167
2254
|
if (config === void 0) throw new Error("TN_WEB_BRAND_CONFIG_MISSING");
|
|
2168
2255
|
this.emitFile({
|
|
@@ -2170,6 +2257,8 @@ function createWebBrandPlugin() {
|
|
|
2170
2257
|
source: renderWebManifest(root, config),
|
|
2171
2258
|
type: "asset"
|
|
2172
2259
|
});
|
|
2260
|
+
if (config.engine === "threenative")
|
|
2261
|
+
this.emitFile({ fileName: "_headers", source: renderIsolationHeaders(), type: "asset" });
|
|
2173
2262
|
}
|
|
2174
2263
|
};
|
|
2175
2264
|
}
|
|
@@ -2182,12 +2271,11 @@ var PACKAGE_SOURCE_FLAGS = {
|
|
|
2182
2271
|
"@threenative/playtest": "--playtest-package",
|
|
2183
2272
|
"@threenative/runtime-native": "--runtime-native-package",
|
|
2184
2273
|
"@threenative/ui": "--ui-package",
|
|
2185
|
-
"threenative-blender-mcp": "--blender-mcp-package",
|
|
2186
2274
|
"threenative-engine-mcp": "--engine-mcp-package",
|
|
2187
2275
|
"create-threenative": "--cli-package"
|
|
2188
2276
|
};
|
|
2189
2277
|
var UNSCOPED_PACKAGE_FLAG_ALIASES = {
|
|
2190
|
-
"
|
|
2278
|
+
"animation-mcp": "threenative-animation-mcp",
|
|
2191
2279
|
cli: "create-threenative",
|
|
2192
2280
|
"engine-mcp": "threenative-engine-mcp"
|
|
2193
2281
|
};
|
|
@@ -2228,16 +2316,18 @@ function stampLoadingSource(canonical, template) {
|
|
|
2228
2316
|
return canonical.replace(canonicalBlock, templateBlock);
|
|
2229
2317
|
}
|
|
2230
2318
|
var SHARED_RENDER_SOURCES = [
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
path6.join("src", "render", "exposureGraph.ts"),
|
|
2234
|
-
path6.join("src", "render", "exposureReadback.ts")
|
|
2319
|
+
"src/render/kitExposure.ts",
|
|
2320
|
+
"src/render/temporalDetailStage.ts"
|
|
2235
2321
|
];
|
|
2236
2322
|
function canonicalRenderSourcePath(relativePath, root = templateRoot()) {
|
|
2237
2323
|
const name = path6.basename(relativePath);
|
|
2238
2324
|
const local = path6.resolve(root, "..", "template-assets", name);
|
|
2239
2325
|
if (existsSync(local)) return local;
|
|
2240
|
-
|
|
2326
|
+
const starter = path6.resolve(root, "starter", relativePath);
|
|
2327
|
+
if (existsSync(starter)) return starter;
|
|
2328
|
+
const shared = path6.resolve(templateRoot(), "..", "template-assets", name);
|
|
2329
|
+
if (existsSync(shared)) return shared;
|
|
2330
|
+
return path6.resolve(templateRoot(), "starter", relativePath);
|
|
2241
2331
|
}
|
|
2242
2332
|
async function restampSharedRenderCopies(root = templateRoot()) {
|
|
2243
2333
|
const stamped = [];
|
|
@@ -2302,13 +2392,28 @@ async function copySharedAssets(target, templateRootDirectory) {
|
|
|
2302
2392
|
}
|
|
2303
2393
|
};
|
|
2304
2394
|
if (existsSync(source)) await walk(source);
|
|
2305
|
-
|
|
2306
|
-
|
|
2395
|
+
const names = readdirSync(shared);
|
|
2396
|
+
const named = (name) => texts.some((text) => text.includes(`"${name}"`));
|
|
2397
|
+
const copied = (name) => {
|
|
2398
|
+
const record = /^(.+-)PROVENANCE\.md$/u.exec(name);
|
|
2399
|
+
if (record)
|
|
2400
|
+
return names.some(
|
|
2401
|
+
(other) => other.startsWith(record[1]) && other !== name && named(other)
|
|
2402
|
+
);
|
|
2403
|
+
return named(name);
|
|
2404
|
+
};
|
|
2405
|
+
for (const name of names) {
|
|
2406
|
+
if (!copied(name)) continue;
|
|
2307
2407
|
const destination = path6.join(target, "assets", name);
|
|
2308
2408
|
await mkdir(path6.dirname(destination), { recursive: true });
|
|
2309
2409
|
await cp(path6.join(shared, name), destination, { errorOnExist: true, force: false });
|
|
2310
2410
|
}
|
|
2311
2411
|
}
|
|
2412
|
+
async function copyQualityConfig(target, templateRootDirectory) {
|
|
2413
|
+
const shared = path6.join(path6.dirname(templateRootDirectory), "template-assets", "quality");
|
|
2414
|
+
if (!existsSync(shared)) throw new Error(`TN_QUALITY_CONFIG_MISSING: ${shared}`);
|
|
2415
|
+
await cp(shared, target, { errorOnExist: true, recursive: true });
|
|
2416
|
+
}
|
|
2312
2417
|
function invalidManifest(file, reason) {
|
|
2313
2418
|
throw new Error(`TN_KIT_MANIFEST_INVALID: ${file}: ${reason}`);
|
|
2314
2419
|
}
|
|
@@ -2344,7 +2449,10 @@ function loadManifest(directory) {
|
|
|
2344
2449
|
return invalidManifest(file, `name '${name}' must match directory '${directoryName}'`);
|
|
2345
2450
|
const kit = record.kit;
|
|
2346
2451
|
if (typeof kit !== "boolean") return invalidManifest(file, "kit must be a boolean");
|
|
2452
|
+
const rawAliases = record.aliases ?? [];
|
|
2453
|
+
if (!Array.isArray(rawAliases)) return invalidManifest(file, "aliases must be an array");
|
|
2347
2454
|
return {
|
|
2455
|
+
aliases: rawAliases.map((alias) => nonEmptyString2(alias, "aliases[]", file).toLowerCase()),
|
|
2348
2456
|
blurb: nonEmptyString2(record.blurb, "blurb", file),
|
|
2349
2457
|
genre: nonEmptyString2(record.genre, "genre", file),
|
|
2350
2458
|
kit,
|
|
@@ -2369,17 +2477,94 @@ function kitManifest(template, root = templateRoot()) {
|
|
|
2369
2477
|
function templateForGenre(genre, root = templateRoot()) {
|
|
2370
2478
|
const normalized = genre.trim().toLowerCase();
|
|
2371
2479
|
if (normalized.length === 0) throw new Error("Genre must not be empty.");
|
|
2372
|
-
|
|
2480
|
+
const matches = discoverKitManifests(root).filter(
|
|
2481
|
+
(manifest) => manifest.genre.toLowerCase() === normalized || manifest.aliases.includes(normalized)
|
|
2482
|
+
);
|
|
2483
|
+
if (matches.length > 1)
|
|
2484
|
+
throw new Error(
|
|
2485
|
+
`TN_KIT_GENRE_AMBIGUOUS: '${normalized}' names ${matches.map(({ name }) => name).join(", ")}.`
|
|
2486
|
+
);
|
|
2487
|
+
return matches[0]?.name ?? "minimal";
|
|
2373
2488
|
}
|
|
2374
2489
|
function templateHelp(manifests) {
|
|
2375
2490
|
const width = Math.max(...manifests.map(({ name }) => name.length), 0);
|
|
2376
|
-
return manifests.map(
|
|
2491
|
+
return manifests.map(
|
|
2492
|
+
({ aliases, blurb, name, title }) => ` ${name.padEnd(width)} ${title}: ${blurb}${aliases.length > 0 ? ` (also: ${aliases.join(", ")})` : ""}`
|
|
2493
|
+
).join("\n");
|
|
2377
2494
|
}
|
|
2378
2495
|
function scaffoldCompletionMessage(manifests, defaultTemplate = DEFAULT_TEMPLATE) {
|
|
2379
2496
|
const names = manifests.map(({ name }) => name === defaultTemplate ? `${name} (default)` : name).join(", ");
|
|
2380
2497
|
return `Templates: ${names}. Choose with --template <name>.
|
|
2381
2498
|
`;
|
|
2382
2499
|
}
|
|
2500
|
+
function scaffoldNextSteps(target, installed, servers = []) {
|
|
2501
|
+
const call = `node ${target}/node_modules/@threenative/core/mcp/call.mjs`;
|
|
2502
|
+
const agent = `start your coding agent in ${target} so it loads the MCP servers in .mcp.json${servers.length > 0 ? ` (${servers.join(", ")})` : ""}. This session, started elsewhere, has them all through ${call}: \`${call} <server>\` lists its tools, \`${call} <server> <tool> '<json>'\` calls one, e.g. ${call} threenative-engine engine_search_capabilities '{"situation":"<words>"}'`;
|
|
2503
|
+
return installed ? `Next: ${agent}. Read AGENTS.md once; CLAUDE.md is its copy, and the skills it names are .claude/skills/<name>/SKILL.md. pnpm dev plays the game; pnpm test proves it.
|
|
2504
|
+
` : `Skipped install (--no-install). Run pnpm install in ${target}, then ${agent}.
|
|
2505
|
+
`;
|
|
2506
|
+
}
|
|
2507
|
+
function projectMcpServers(target) {
|
|
2508
|
+
try {
|
|
2509
|
+
return Object.keys(
|
|
2510
|
+
JSON.parse(readFileSync(path6.join(target, ".mcp.json"), "utf8")).mcpServers ?? {}
|
|
2511
|
+
);
|
|
2512
|
+
} catch {
|
|
2513
|
+
return [];
|
|
2514
|
+
}
|
|
2515
|
+
}
|
|
2516
|
+
var REFERENCE_DIGEST_SIZE = 5;
|
|
2517
|
+
var REFERENCE_DETAIL_SIZE = 3;
|
|
2518
|
+
function referenceLines(detail) {
|
|
2519
|
+
const pin = `${detail.repo}@${detail.sha.slice(0, 7)}`;
|
|
2520
|
+
if (detail.card !== void 0) {
|
|
2521
|
+
const { behavior, constants = [], sources = [] } = detail.card;
|
|
2522
|
+
return [
|
|
2523
|
+
` ${pin}: ${behavior}`,
|
|
2524
|
+
...constants.slice(0, 4).map((c) => ` ${c.name} = ${String(c.value)} ${c.unit} (${c.source})`),
|
|
2525
|
+
` sources: ${sources.map((source) => `${source.path}:${source.line}`).join(", ")}`
|
|
2526
|
+
];
|
|
2527
|
+
}
|
|
2528
|
+
const { functions = [], purpose = "" } = detail.node ?? {};
|
|
2529
|
+
const children = (detail.children ?? []).slice(0, 6).map(({ id }) => id);
|
|
2530
|
+
return [
|
|
2531
|
+
` ${pin}: ${purpose}`,
|
|
2532
|
+
...functions.slice(0, 4).map((f) => ` ${f.name} ${f.path}:${f.lines[0]}`),
|
|
2533
|
+
...children.length > 0 ? [` children: ${children.join(", ")}`] : []
|
|
2534
|
+
];
|
|
2535
|
+
}
|
|
2536
|
+
function referenceDigest(target, genre, run = (args) => execFileSync(process.execPath, args, { encoding: "utf8", timeout: 6e4 })) {
|
|
2537
|
+
const engine = `${target}/node_modules/@threenative/core/mcp/engine.mjs`;
|
|
2538
|
+
let results;
|
|
2539
|
+
try {
|
|
2540
|
+
results = JSON.parse(
|
|
2541
|
+
run([engine, "engine_search_references", JSON.stringify({ situation: genre })])
|
|
2542
|
+
).results;
|
|
2543
|
+
} catch (error) {
|
|
2544
|
+
return `References unavailable: ${String(error.message).split("\n")[0]}
|
|
2545
|
+
`;
|
|
2546
|
+
}
|
|
2547
|
+
if (results.length === 0) return `No mechanics references match ${JSON.stringify(genre)}.
|
|
2548
|
+
`;
|
|
2549
|
+
const lines = results.slice(0, REFERENCE_DIGEST_SIZE).flatMap((hit, index) => {
|
|
2550
|
+
const head = `- ${hit.title} / ${hit.name}: ${hit.summary}`;
|
|
2551
|
+
if (index >= REFERENCE_DETAIL_SIZE) return [head];
|
|
2552
|
+
try {
|
|
2553
|
+
const { game, id, kind } = hit;
|
|
2554
|
+
const detail = run([engine, "engine_reference_detail", JSON.stringify({ game, id, kind })]);
|
|
2555
|
+
return [head, ...referenceLines(JSON.parse(detail))];
|
|
2556
|
+
} catch {
|
|
2557
|
+
return [head];
|
|
2558
|
+
}
|
|
2559
|
+
});
|
|
2560
|
+
const call = `node ${target}/node_modules/@threenative/core/mcp/call.mjs threenative-engine`;
|
|
2561
|
+
return [
|
|
2562
|
+
`Mechanics references for ${JSON.stringify(genre)} (borrow the mechanics, not code, layouts or art):`,
|
|
2563
|
+
...lines,
|
|
2564
|
+
`Each mechanic you add: ${call} engine_search_references '{"situation":"<mechanic>"}', then engine_reference_detail '{"game":"<game>","id":"<id>","kind":"card|node"}'.`,
|
|
2565
|
+
""
|
|
2566
|
+
].join("\n");
|
|
2567
|
+
}
|
|
2383
2568
|
function cliHelp() {
|
|
2384
2569
|
const manifests = discoverKitManifests();
|
|
2385
2570
|
return `${[
|
|
@@ -2391,7 +2576,7 @@ function cliHelp() {
|
|
|
2391
2576
|
"",
|
|
2392
2577
|
"Options:",
|
|
2393
2578
|
" --template <name> Choose a template.",
|
|
2394
|
-
" --genre <name> Choose
|
|
2579
|
+
" --genre <name> Choose a kit by its genre or a word its kit.json lists (mario, zelda); unknown words use minimal.",
|
|
2395
2580
|
" --no-install Copy the project without running pnpm install.",
|
|
2396
2581
|
" --help Show this help.",
|
|
2397
2582
|
"",
|
|
@@ -2697,8 +2882,12 @@ async function createProject(options, cwd = process.cwd(), root = templateRoot()
|
|
|
2697
2882
|
try {
|
|
2698
2883
|
const source = path6.join(root, template);
|
|
2699
2884
|
await cp(source, target, { recursive: true, errorOnExist: true });
|
|
2885
|
+
if (["starter", "collectathon", "adventure", "kart"].includes(template))
|
|
2886
|
+
for (const relative of SHARED_RENDER_SOURCES)
|
|
2887
|
+
await cp(canonicalRenderSourcePath(relative, root), path6.join(target, relative));
|
|
2700
2888
|
await copyTemplateIcon(target, root);
|
|
2701
2889
|
await copySharedAssets(target, root);
|
|
2890
|
+
await copyQualityConfig(target, root);
|
|
2702
2891
|
if (existsSync(path6.join(target, "gitignore"))) {
|
|
2703
2892
|
await rename(path6.join(target, "gitignore"), path6.join(target, ".gitignore"));
|
|
2704
2893
|
}
|
|
@@ -2805,7 +2994,8 @@ function parseArgs(argv) {
|
|
|
2805
2994
|
install: !booleans.has("--no-install"),
|
|
2806
2995
|
target,
|
|
2807
2996
|
...Object.keys(packageSources).length === 0 ? {} : { packageSources },
|
|
2808
|
-
...resolvedTemplate === void 0 ? {} : { template: resolvedTemplate }
|
|
2997
|
+
...resolvedTemplate === void 0 ? {} : { template: resolvedTemplate },
|
|
2998
|
+
...genre === void 0 ? {} : { genre }
|
|
2809
2999
|
};
|
|
2810
3000
|
}
|
|
2811
3001
|
async function main() {
|
|
@@ -2822,13 +3012,16 @@ async function main() {
|
|
|
2822
3012
|
process.stdout.write(cliHelp());
|
|
2823
3013
|
return;
|
|
2824
3014
|
}
|
|
2825
|
-
const
|
|
3015
|
+
const options = parseArgs(argv);
|
|
3016
|
+
const result = await createProject(options);
|
|
2826
3017
|
process.stdout.write(`Created ${result.template} project at ${result.target}
|
|
2827
3018
|
`);
|
|
2828
3019
|
process.stdout.write(scaffoldCompletionMessage(discoverKitManifests()));
|
|
2829
|
-
if (
|
|
2830
|
-
process.stdout.write(
|
|
2831
|
-
|
|
3020
|
+
if (options.genre !== void 0 && result.installed)
|
|
3021
|
+
process.stdout.write(referenceDigest(result.target, options.genre));
|
|
3022
|
+
process.stdout.write(
|
|
3023
|
+
scaffoldNextSteps(result.target, result.installed, projectMcpServers(result.target))
|
|
3024
|
+
);
|
|
2832
3025
|
}
|
|
2833
3026
|
var entryPath = process.argv[1];
|
|
2834
3027
|
if (entryPath !== void 0 && existsSync(entryPath) && realpathSync(path6.resolve(entryPath)) === realpathSync(fileURLToPath(import.meta.url))) {
|
|
@@ -2839,4 +3032,4 @@ if (entryPath !== void 0 && existsSync(entryPath) && realpathSync(path6.resolve(
|
|
|
2839
3032
|
});
|
|
2840
3033
|
}
|
|
2841
3034
|
|
|
2842
|
-
export { SHARED_RENDER_SOURCES, canonicalLoadingPath, canonicalRenderSourcePath, cliHelp, createEngineFreshnessPlugin, createProject, createWebBrandPlugin, discoverKitManifests, discoverStampedTemplates, discoverTemplateNames, hashEngineDist, kitManifest, packageNameFromFlag, parseArgs, renderWebManifest, restampSharedRenderCopies, restampTemplateLoadingCopies, scaffoldCompletionMessage, stampLoadingSource, templateForGenre, templateRoot, webRuntimeDecoders };
|
|
3035
|
+
export { SHARED_RENDER_SOURCES, canonicalLoadingPath, canonicalRenderSourcePath, cliHelp, createEngineFreshnessPlugin, createProject, createWebBrandPlugin, discoverKitManifests, discoverStampedTemplates, discoverTemplateNames, hashEngineDist, kitManifest, packageNameFromFlag, parseArgs, projectMcpServers, referenceDigest, renderWebManifest, restampSharedRenderCopies, restampTemplateLoadingCopies, scaffoldCompletionMessage, scaffoldNextSteps, stampLoadingSource, templateForGenre, templateRoot, webRuntimeDecoders };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Linter } from 'eslint';
|
|
2
|
+
|
|
3
|
+
interface IQualityOptions {
|
|
4
|
+
/** The project root: where `tsconfig.json` lives and the typed rules resolve from. */
|
|
5
|
+
readonly root: string;
|
|
6
|
+
}
|
|
7
|
+
/** The default correctness gate for a generated game: TypeScript-aware async rules, React hook
|
|
8
|
+
* rules when React is installed, scoped suppressions, and the ThreeNative game rules (`threenative/*`: frame-callback cost, UI state use).
|
|
9
|
+
* Formatting is Biome's job, not this config's. */
|
|
10
|
+
declare function qualityConfig({ root }: IQualityOptions): Linter.Config[];
|
|
11
|
+
|
|
12
|
+
export { type IQualityOptions, qualityConfig };
|