create-threenative 0.2.15 → 0.2.18
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/kit-mcp.md +10 -0
- package/agent-docs/kit-router.md +14 -0
- package/agent-docs/kit-stuck.md +7 -0
- package/agent-docs/references/assertion-reference.md +54 -110
- package/agent-docs/references/capability-reference.md +1740 -254
- package/agent-docs/references/conventions.md +299 -0
- package/agent-docs/references/kit-action-rpg.md +40 -0
- package/agent-docs/references/kit-adventure.md +40 -0
- package/agent-docs/references/kit-collectathon.md +38 -0
- package/agent-docs/references/kit-kart.md +31 -0
- package/agent-docs/references/kit-minimal.md +29 -0
- package/agent-docs/references/kit-platformer.md +34 -0
- package/agent-docs/references/kit-puzzle.md +22 -0
- package/agent-docs/references/kit-racing.md +26 -0
- package/agent-docs/references/kit-rain.md +31 -0
- package/agent-docs/references/kit-rts.md +34 -0
- package/agent-docs/references/kit-runner.md +32 -0
- package/agent-docs/references/kit-sailing.md +41 -0
- package/agent-docs/references/kit-shooter.md +33 -0
- package/agent-docs/references/kit-snow.md +33 -0
- package/agent-docs/references/kit-starter.md +55 -0
- package/agent-docs/references/kit-tower-defense.md +27 -0
- package/agent-docs/references/performance-basics.md +8 -4
- package/agent-docs/references/terrain-authoring.md +2 -1
- package/agent-files/.agents/skills/ponytail/SKILL.md +1 -1
- package/agent-files/.agents/skills/prd-creator/SKILL.md +3 -2
- package/agent-files/.agents/skills/threenative-capabilities/SKILL.md +84 -59
- package/agent-files/.claude/hooks/discovery-gate.mjs +125 -0
- package/agent-files/.claude/hooks/ponytail-context.mjs +1 -1
- package/agent-files/.claude/settings.json +25 -0
- package/agent-files/.codex/hooks.json +18 -1
- package/dist/index.d.ts +97 -6
- package/dist/index.js +899 -271
- package/dist/terrain-kit.d.ts +7 -0
- package/dist/terrain-kit.js +82 -0
- package/dist/threenative.js +114 -16
- package/dist/web-engine-ccd-ik-solver.js +127 -0
- package/dist/web-engine-gltf-loader.js +71 -20
- package/dist/web-engine-post-effects.js +39 -14
- package/dist/web-engine-runtime.js +10011 -4101
- package/package.json +15 -9
- package/template-assets/clearwater/README.md +1 -1
- package/template-assets/patches/manifest.json +18 -0
- package/template-assets/patches/three@0.187.0.patch +2004 -407
- package/template-assets/terrain/alpine/assets.json +12 -0
- package/template-assets/terrain/alpine/bake.mjs +6 -0
- package/template-assets/terrain/alpine/credits.json +164 -0
- package/template-assets/terrain/alpine/heightmap.r16 +0 -0
- package/template-assets/terrain/alpine/recipe.json +119 -0
- package/template-assets/terrain/alpine/surface.json +53 -0
- package/template-assets/terrain/coastal/assets.json +11 -0
- package/template-assets/terrain/coastal/bake.mjs +6 -0
- package/template-assets/terrain/coastal/credits.json +117 -0
- package/template-assets/terrain/coastal/heightmap.r16 +0 -0
- package/template-assets/terrain/coastal/recipe.json +113 -0
- package/template-assets/terrain/coastal/surface.json +41 -0
- package/template-assets/terrain/desert/assets.json +12 -0
- package/template-assets/terrain/desert/bake.mjs +6 -0
- package/template-assets/terrain/desert/credits.json +164 -0
- package/template-assets/terrain/desert/heightmap.r16 +0 -0
- package/template-assets/terrain/desert/recipe.json +108 -0
- package/template-assets/terrain/desert/surface.json +54 -0
- package/template-assets/terrain/forest/assets.json +65 -0
- package/template-assets/terrain/forest/bake.mjs +8 -0
- package/template-assets/terrain/forest/credits.json +225 -0
- package/template-assets/terrain/forest/heightmap.r16 +0 -0
- package/template-assets/terrain/forest/recipe.json +350 -0
- package/template-assets/terrain/forest/surface.json +79 -0
- package/template-assets/terrain/tundra/assets.json +12 -0
- package/template-assets/terrain/tundra/bake.mjs +6 -0
- package/template-assets/terrain/tundra/credits.json +164 -0
- package/template-assets/terrain/tundra/heightmap.r16 +0 -0
- package/template-assets/terrain/tundra/recipe.json +277 -0
- package/template-assets/terrain/tundra/surface.json +54 -0
- package/templates/action-rpg/AGENTS.md +103 -84
- package/templates/action-rpg/CLAUDE.md +103 -84
- package/templates/action-rpg/kit.json +1 -0
- package/templates/action-rpg/package.json +7 -7
- package/templates/action-rpg/playtests/spells.playtest.json +20 -0
- package/templates/action-rpg/src/game.ts +2 -1
- package/templates/action-rpg/src/render/atmosphere.ts +11 -16
- package/templates/action-rpg/src/render/backlightControls.ts +10 -0
- package/templates/action-rpg/src/render/backlightMaterial.ts +4 -4
- package/templates/action-rpg/src/render/clouds.ts +13 -0
- package/templates/action-rpg/src/render/gpuSky.ts +4 -7
- package/templates/action-rpg/src/render/materialLighting.ts +5 -5
- package/templates/action-rpg/src/render/quality.ts +10 -33
- package/templates/action-rpg/src/scenes/Play.ts +30 -1
- package/templates/action-rpg/src/style.css +4 -0
- package/templates/action-rpg/src/ui/AbilityBar.tsx +1 -1
- package/templates/action-rpg/threenative.config.ts +0 -3
- package/templates/action-rpg/vite.config.ts +2 -0
- package/templates/adventure/AGENTS.md +92 -44
- package/templates/adventure/CLAUDE.md +92 -44
- package/templates/adventure/kit.json +5 -1
- package/templates/adventure/package.json +7 -7
- package/templates/adventure/src/game.ts +1 -1
- package/templates/adventure/src/style.css +4 -0
- package/templates/adventure/tsconfig.json +1 -1
- package/templates/adventure/vite.config.ts +2 -0
- package/templates/collectathon/AGENTS.md +93 -42
- package/templates/collectathon/CLAUDE.md +93 -42
- package/templates/collectathon/package.json +7 -7
- package/templates/collectathon/src/game.ts +1 -1
- package/templates/collectathon/src/level/Course.ts +55 -9
- package/templates/collectathon/src/level/terrain.ts +27 -6
- package/templates/collectathon/src/main.ts +1 -0
- package/templates/collectathon/src/render/foliage.ts +359 -98
- package/templates/collectathon/src/render/sky.ts +76 -12
- package/templates/collectathon/src/render/water.ts +32 -10
- package/templates/collectathon/src/scenes/Play.ts +18 -5
- package/templates/collectathon/src/style.css +4 -0
- package/templates/collectathon/tsconfig.json +1 -1
- package/templates/collectathon/vite.config.ts +2 -0
- package/templates/kart/AGENTS.md +87 -42
- package/templates/kart/CLAUDE.md +87 -42
- package/templates/kart/package.json +6 -6
- package/templates/kart/src/game.ts +1 -1
- package/templates/kart/src/main.ts +1 -0
- package/templates/kart/src/style.css +4 -0
- package/templates/kart/tsconfig.json +1 -1
- package/templates/kart/vite.config.ts +2 -0
- package/templates/minimal/AGENTS.md +105 -84
- package/templates/minimal/CLAUDE.md +105 -84
- package/templates/minimal/package.json +6 -6
- package/templates/minimal/playtests/stands-still.playtest.json +30 -0
- package/templates/minimal/src/game.ts +1 -1
- package/templates/minimal/src/render/atmosphere.ts +11 -16
- package/templates/minimal/src/render/backlightControls.ts +10 -0
- package/templates/minimal/src/render/backlightMaterial.ts +4 -4
- package/templates/minimal/src/render/camera.ts +13 -2
- package/templates/minimal/src/render/clouds.ts +13 -0
- package/templates/minimal/src/render/gpuSky.ts +4 -7
- package/templates/minimal/src/render/lighting.ts +4 -2
- package/templates/minimal/src/render/materialLighting.ts +5 -5
- package/templates/minimal/src/render/materials.ts +10 -0
- package/templates/minimal/src/render/quality.ts +7 -32
- package/templates/minimal/src/scenes/Play.ts +4 -1
- package/templates/minimal/vite.config.ts +7 -1
- package/templates/platformer/AGENTS.md +95 -46
- package/templates/platformer/CLAUDE.md +95 -46
- package/templates/platformer/index.html +1 -1
- package/templates/platformer/main.html +12 -0
- package/templates/platformer/package.json +7 -7
- package/templates/platformer/playtests/gamepad-idle.playtest.json +21 -0
- package/templates/platformer/playtests/gamepad.playtest.json +30 -0
- package/templates/platformer/src/entities/Fox.ts +21 -6
- package/templates/platformer/src/game.ts +1 -1
- package/templates/platformer/src/main.ts +1 -0
- package/templates/platformer/src/render/backlightControls.ts +10 -0
- package/templates/platformer/src/render/backlightMaterial.ts +4 -4
- package/templates/platformer/src/render/materialLighting.ts +5 -5
- package/templates/platformer/src/render/quality.ts +7 -32
- package/templates/platformer/src/scenes/Play.ts +2 -1
- package/templates/platformer/src/style.css +4 -0
- package/templates/platformer/src/worker-page.ts +29 -0
- package/templates/platformer/src/worker.ts +5 -0
- package/templates/platformer/tsconfig.json +1 -1
- package/templates/platformer/vite.config.ts +4 -0
- package/templates/puzzle/AGENTS.md +97 -80
- package/templates/puzzle/CLAUDE.md +97 -80
- package/templates/puzzle/package.json +7 -7
- package/templates/puzzle/src/game.ts +1 -1
- package/templates/puzzle/src/render/backlightControls.ts +10 -0
- package/templates/puzzle/src/render/backlightMaterial.ts +4 -4
- package/templates/puzzle/src/render/materialLighting.ts +5 -5
- package/templates/puzzle/src/render/quality.ts +7 -32
- package/templates/puzzle/src/scenes/Play.ts +1 -1
- package/templates/puzzle/src/style.css +4 -0
- package/templates/puzzle/tsconfig.json +1 -1
- package/templates/puzzle/vite.config.ts +2 -0
- package/templates/racing/AGENTS.md +100 -82
- package/templates/racing/CLAUDE.md +100 -82
- package/templates/racing/package.json +7 -7
- package/templates/racing/src/game.ts +1 -1
- package/templates/racing/src/render/atmosphere.ts +11 -16
- package/templates/racing/src/render/backlightControls.ts +10 -0
- package/templates/racing/src/render/backlightMaterial.ts +4 -4
- package/templates/racing/src/render/clouds.ts +13 -0
- package/templates/racing/src/render/gpuSky.ts +4 -7
- package/templates/racing/src/render/materialLighting.ts +5 -5
- package/templates/racing/src/render/quality.ts +7 -32
- package/templates/racing/src/scenes/Race.ts +4 -1
- package/templates/racing/src/style.css +4 -0
- package/templates/racing/tsconfig.json +1 -1
- package/templates/racing/vite.config.ts +2 -0
- package/templates/rain/AGENTS.md +96 -84
- package/templates/rain/CLAUDE.md +96 -84
- package/templates/rain/native-playtests/lightning.playtest.json +85 -10
- package/templates/rain/package.json +6 -6
- package/templates/rain/playtests/reduced-motion.playtest.json +6 -0
- package/templates/rain/src/game.ts +1 -1
- package/templates/rain/src/scenes/Boot.ts +1 -0
- package/templates/rain/src/state.ts +7 -0
- package/templates/rain/src/ui/GameUi.tsx +7 -1
- package/templates/rain/vite.config.ts +6 -0
- package/templates/rts/AGENTS.md +100 -85
- package/templates/rts/CLAUDE.md +100 -85
- package/templates/rts/package.json +6 -6
- package/templates/rts/src/game.ts +1 -1
- package/templates/rts/src/render/backlightControls.ts +10 -0
- package/templates/rts/src/render/backlightMaterial.ts +4 -4
- package/templates/rts/src/render/materialLighting.ts +5 -5
- package/templates/rts/src/render/quality.ts +7 -31
- package/templates/rts/src/scenes/Play.ts +1 -1
- package/templates/rts/src/style.css +4 -0
- package/templates/rts/vite.config.ts +2 -0
- package/templates/runner/AGENTS.md +97 -80
- package/templates/runner/CLAUDE.md +97 -80
- package/templates/runner/package.json +7 -7
- package/templates/runner/playtests/performance.playtest.json +1 -1
- package/templates/runner/src/game.ts +1 -1
- package/templates/runner/src/render/atmosphere.ts +11 -16
- package/templates/runner/src/render/backlightControls.ts +10 -0
- package/templates/runner/src/render/backlightMaterial.ts +4 -4
- package/templates/runner/src/render/clouds.ts +13 -0
- package/templates/runner/src/render/gpuSky.ts +4 -7
- package/templates/runner/src/render/lighting.ts +53 -11
- package/templates/runner/src/render/materialLighting.ts +5 -5
- package/templates/runner/src/render/quality.ts +7 -32
- package/templates/runner/src/scenes/Run.ts +8 -4
- package/templates/runner/src/style.css +4 -0
- package/templates/runner/threenative.config.ts +0 -3
- package/templates/runner/tsconfig.json +1 -1
- package/templates/runner/vite.config.ts +2 -0
- package/templates/sailing/AGENTS.md +96 -79
- package/templates/sailing/CLAUDE.md +96 -79
- package/templates/sailing/package.json +7 -7
- package/templates/sailing/playtests/sails.playtest.json +1 -0
- package/templates/sailing/src/game.ts +1 -1
- package/templates/sailing/src/render/backlightControls.ts +10 -0
- package/templates/sailing/src/render/backlightMaterial.ts +4 -4
- package/templates/sailing/src/render/environmentSetup.ts +1 -1
- package/templates/sailing/src/render/materialLighting.ts +5 -5
- package/templates/sailing/src/render/quality.ts +7 -32
- package/templates/sailing/src/render/sky.ts +4 -0
- package/templates/sailing/src/style.css +5 -0
- package/templates/sailing/threenative.config.ts +0 -3
- package/templates/sailing/vite.config.ts +6 -0
- package/templates/shooter/AGENTS.md +97 -68
- package/templates/shooter/CLAUDE.md +97 -68
- package/templates/shooter/package.json +7 -7
- package/templates/shooter/src/game.ts +3 -2
- package/templates/shooter/src/render/atmosphere.ts +11 -16
- package/templates/shooter/src/render/backlightControls.ts +10 -0
- package/templates/shooter/src/render/backlightMaterial.ts +4 -4
- package/templates/shooter/src/render/clouds.ts +13 -0
- package/templates/shooter/src/render/gpuSky.ts +4 -7
- package/templates/shooter/src/render/materialLighting.ts +5 -5
- package/templates/shooter/src/render/quality.ts +10 -33
- package/templates/shooter/src/scenes/Play.ts +4 -1
- package/templates/shooter/src/style.css +4 -0
- package/templates/shooter/vite.config.ts +2 -0
- package/templates/snow/AGENTS.md +95 -76
- package/templates/snow/CLAUDE.md +95 -76
- package/templates/snow/package.json +7 -7
- package/templates/snow/src/game.ts +1 -1
- package/templates/snow/src/render/backlightControls.ts +10 -0
- package/templates/snow/src/render/backlightMaterial.ts +4 -4
- package/templates/snow/src/render/materialLighting.ts +5 -5
- package/templates/snow/src/render/quality.ts +7 -32
- package/templates/snow/src/style.css +5 -0
- package/templates/snow/threenative.config.ts +0 -3
- package/templates/snow/vite.config.ts +6 -0
- package/templates/starter/AGENTS.md +109 -88
- package/templates/starter/CLAUDE.md +109 -88
- package/templates/starter/native-playtests/render-chain.playtest.json +24 -24
- package/templates/starter/native-playtests/smooth-motion.playtest.json +3 -3
- package/templates/starter/package.json +7 -7
- package/templates/starter/src/entities/Crate.ts +5 -2
- package/templates/starter/src/entities/Player.ts +10 -22
- package/templates/starter/src/game.ts +4 -3
- package/templates/starter/src/render/adaptiveQuality.ts +17 -0
- package/templates/starter/src/render/atmosphere.ts +11 -16
- package/templates/starter/src/render/backlightControls.ts +10 -0
- package/templates/starter/src/render/backlightMaterial.ts +4 -4
- package/templates/starter/src/render/clouds.ts +13 -0
- package/templates/starter/src/render/contactShadow.ts +1 -1
- package/templates/starter/src/render/gpuSky.ts +4 -7
- package/templates/starter/src/render/lighting.ts +54 -4
- package/templates/starter/src/render/materialLighting.ts +5 -5
- package/templates/starter/src/render/postprocessing.ts +11 -10
- package/templates/starter/src/render/quality.ts +14 -1
- package/templates/starter/src/render/temporalAA.ts +8 -7
- package/templates/starter/src/render/temporalAAFrame.ts +30 -9
- package/templates/starter/src/render/temporalAAResolve.ts +15 -1
- package/templates/starter/src/render/temporalClampRelease.ts +183 -0
- package/templates/starter/src/render/temporalHistoryResolve.ts +90 -0
- package/templates/starter/src/render/temporalMoire.ts +190 -0
- package/templates/starter/src/render/temporalResolve.ts +75 -16
- package/templates/starter/src/render/temporalResolveDepth.ts +2 -0
- package/templates/starter/src/scenes/Play.ts +53 -32
- package/templates/starter/src/state.ts +2 -0
- package/templates/starter/src/style.css +4 -0
- package/templates/starter/src/ui/Menu.tsx +5 -1
- package/templates/starter/vite.config.ts +2 -0
- package/templates/tower-defense/AGENTS.md +97 -81
- package/templates/tower-defense/CLAUDE.md +97 -81
- package/templates/tower-defense/package.json +7 -7
- package/templates/tower-defense/src/game.ts +1 -1
- package/templates/tower-defense/src/render/backlightControls.ts +10 -0
- package/templates/tower-defense/src/render/backlightMaterial.ts +4 -4
- package/templates/tower-defense/src/render/materialLighting.ts +5 -5
- package/templates/tower-defense/src/render/quality.ts +7 -32
- package/templates/tower-defense/src/scenes/Battle.ts +1 -1
- package/templates/tower-defense/src/style.css +4 -0
- package/templates/tower-defense/tsconfig.json +1 -1
- package/templates/tower-defense/vite.config.ts +2 -0
- package/capabilities.json +0 -9197
- package/templates/AGENTS.md +0 -21
- package/templates/CLAUDE.md +0 -23
- package/templates/action-rpg/.codex/config.toml +0 -23
- package/templates/action-rpg/.cursor/mcp.json +0 -38
- package/templates/action-rpg/.gemini/settings.json +0 -38
- package/templates/action-rpg/.mcp.json +0 -38
- package/templates/action-rpg/.vscode/mcp.json +0 -43
- package/templates/action-rpg/.zed/settings.json +0 -43
- package/templates/action-rpg/opencode.json +0 -49
- package/templates/action-rpg/src/render/environmentContribution.ts +0 -188
- package/templates/action-rpg/src/render/environmentRadiance.ts +0 -36
- package/templates/action-rpg/src/render/environmentSampleCache.ts +0 -43
- package/templates/action-rpg/src/render/environmentSampling.ts +0 -193
- package/templates/action-rpg/src/render/environmentSnapshot.ts +0 -53
- package/templates/adventure/.codex/config.toml +0 -23
- package/templates/adventure/.cursor/mcp.json +0 -38
- package/templates/adventure/.gemini/settings.json +0 -38
- package/templates/adventure/.mcp.json +0 -38
- package/templates/adventure/.vscode/mcp.json +0 -43
- package/templates/adventure/.zed/settings.json +0 -43
- package/templates/adventure/opencode.json +0 -49
- package/templates/collectathon/.codex/config.toml +0 -23
- package/templates/collectathon/.cursor/mcp.json +0 -38
- package/templates/collectathon/.gemini/settings.json +0 -38
- package/templates/collectathon/.mcp.json +0 -38
- package/templates/collectathon/.vscode/mcp.json +0 -43
- package/templates/collectathon/.zed/settings.json +0 -43
- package/templates/collectathon/opencode.json +0 -49
- package/templates/kart/.codex/config.toml +0 -23
- package/templates/kart/.cursor/mcp.json +0 -38
- package/templates/kart/.gemini/settings.json +0 -38
- package/templates/kart/.mcp.json +0 -38
- package/templates/kart/.vscode/mcp.json +0 -43
- package/templates/kart/.zed/settings.json +0 -43
- package/templates/kart/opencode.json +0 -49
- package/templates/minimal/.codex/config.toml +0 -23
- package/templates/minimal/.cursor/mcp.json +0 -38
- package/templates/minimal/.gemini/settings.json +0 -38
- package/templates/minimal/.mcp.json +0 -38
- package/templates/minimal/.vscode/mcp.json +0 -43
- package/templates/minimal/.zed/settings.json +0 -43
- package/templates/minimal/opencode.json +0 -49
- package/templates/minimal/src/render/environmentContribution.ts +0 -188
- package/templates/minimal/src/render/environmentRadiance.ts +0 -36
- package/templates/minimal/src/render/environmentSampleCache.ts +0 -43
- package/templates/minimal/src/render/environmentSampling.ts +0 -193
- package/templates/minimal/src/render/environmentSnapshot.ts +0 -53
- package/templates/platformer/.codex/config.toml +0 -23
- package/templates/platformer/.cursor/mcp.json +0 -38
- package/templates/platformer/.gemini/settings.json +0 -38
- package/templates/platformer/.mcp.json +0 -38
- package/templates/platformer/.vscode/mcp.json +0 -43
- package/templates/platformer/.zed/settings.json +0 -43
- package/templates/platformer/opencode.json +0 -49
- package/templates/platformer/src/render/environmentContribution.ts +0 -188
- package/templates/platformer/src/render/environmentRadiance.ts +0 -36
- package/templates/platformer/src/render/environmentSampleCache.ts +0 -43
- package/templates/platformer/src/render/environmentSampling.ts +0 -193
- package/templates/platformer/src/render/environmentSnapshot.ts +0 -53
- package/templates/puzzle/.codex/config.toml +0 -23
- package/templates/puzzle/.cursor/mcp.json +0 -38
- package/templates/puzzle/.gemini/settings.json +0 -38
- package/templates/puzzle/.mcp.json +0 -38
- package/templates/puzzle/.vscode/mcp.json +0 -43
- package/templates/puzzle/.zed/settings.json +0 -43
- package/templates/puzzle/opencode.json +0 -49
- package/templates/puzzle/src/render/environmentContribution.ts +0 -188
- package/templates/puzzle/src/render/environmentRadiance.ts +0 -36
- package/templates/puzzle/src/render/environmentSampleCache.ts +0 -43
- package/templates/puzzle/src/render/environmentSampling.ts +0 -193
- package/templates/puzzle/src/render/environmentSnapshot.ts +0 -53
- package/templates/racing/.codex/config.toml +0 -23
- package/templates/racing/.cursor/mcp.json +0 -38
- package/templates/racing/.gemini/settings.json +0 -38
- package/templates/racing/.mcp.json +0 -38
- package/templates/racing/.vscode/mcp.json +0 -43
- package/templates/racing/.zed/settings.json +0 -43
- package/templates/racing/opencode.json +0 -49
- package/templates/racing/src/render/environmentContribution.ts +0 -188
- package/templates/racing/src/render/environmentRadiance.ts +0 -36
- package/templates/racing/src/render/environmentSampleCache.ts +0 -43
- package/templates/racing/src/render/environmentSampling.ts +0 -193
- package/templates/racing/src/render/environmentSnapshot.ts +0 -53
- package/templates/rain/.codex/config.toml +0 -23
- package/templates/rain/.cursor/mcp.json +0 -38
- package/templates/rain/.gemini/settings.json +0 -38
- package/templates/rain/.mcp.json +0 -38
- package/templates/rain/.vscode/mcp.json +0 -43
- package/templates/rain/.zed/settings.json +0 -43
- package/templates/rain/opencode.json +0 -49
- package/templates/rts/.codex/config.toml +0 -23
- package/templates/rts/.cursor/mcp.json +0 -38
- package/templates/rts/.gemini/settings.json +0 -38
- package/templates/rts/.mcp.json +0 -38
- package/templates/rts/.vscode/mcp.json +0 -43
- package/templates/rts/.zed/settings.json +0 -43
- package/templates/rts/opencode.json +0 -49
- package/templates/rts/src/render/environmentContribution.ts +0 -188
- package/templates/rts/src/render/environmentRadiance.ts +0 -36
- package/templates/rts/src/render/environmentSampleCache.ts +0 -43
- package/templates/rts/src/render/environmentSampling.ts +0 -193
- package/templates/rts/src/render/environmentSnapshot.ts +0 -53
- package/templates/runner/.codex/config.toml +0 -23
- package/templates/runner/.cursor/mcp.json +0 -38
- package/templates/runner/.gemini/settings.json +0 -38
- package/templates/runner/.mcp.json +0 -38
- package/templates/runner/.vscode/mcp.json +0 -43
- package/templates/runner/.zed/settings.json +0 -43
- package/templates/runner/README.md +0 -43
- package/templates/runner/opencode.json +0 -49
- package/templates/runner/src/render/environmentContribution.ts +0 -188
- package/templates/runner/src/render/environmentRadiance.ts +0 -36
- package/templates/runner/src/render/environmentSampleCache.ts +0 -43
- package/templates/runner/src/render/environmentSampling.ts +0 -193
- package/templates/runner/src/render/environmentSnapshot.ts +0 -53
- package/templates/sailing/.codex/config.toml +0 -23
- package/templates/sailing/.cursor/mcp.json +0 -38
- package/templates/sailing/.gemini/settings.json +0 -38
- package/templates/sailing/.mcp.json +0 -38
- package/templates/sailing/.vscode/mcp.json +0 -43
- package/templates/sailing/.zed/settings.json +0 -43
- package/templates/sailing/README.md +0 -28
- package/templates/sailing/opencode.json +0 -49
- package/templates/sailing/src/render/environmentContribution.ts +0 -188
- package/templates/sailing/src/render/environmentRadiance.ts +0 -36
- package/templates/sailing/src/render/environmentSampleCache.ts +0 -43
- package/templates/sailing/src/render/environmentSampling.ts +0 -193
- package/templates/sailing/src/render/environmentSnapshot.ts +0 -53
- package/templates/shooter/.codex/config.toml +0 -23
- package/templates/shooter/.cursor/mcp.json +0 -38
- package/templates/shooter/.gemini/settings.json +0 -38
- package/templates/shooter/.mcp.json +0 -38
- package/templates/shooter/.vscode/mcp.json +0 -43
- package/templates/shooter/.zed/settings.json +0 -43
- package/templates/shooter/opencode.json +0 -49
- package/templates/shooter/src/render/environmentContribution.ts +0 -188
- package/templates/shooter/src/render/environmentRadiance.ts +0 -36
- package/templates/shooter/src/render/environmentSampleCache.ts +0 -43
- package/templates/shooter/src/render/environmentSampling.ts +0 -193
- package/templates/shooter/src/render/environmentSnapshot.ts +0 -53
- package/templates/snow/.codex/config.toml +0 -23
- package/templates/snow/.cursor/mcp.json +0 -38
- package/templates/snow/.gemini/settings.json +0 -38
- package/templates/snow/.mcp.json +0 -38
- package/templates/snow/.vscode/mcp.json +0 -43
- package/templates/snow/.zed/settings.json +0 -43
- package/templates/snow/README.md +0 -26
- package/templates/snow/opencode.json +0 -49
- package/templates/snow/src/render/environmentContribution.ts +0 -188
- package/templates/snow/src/render/environmentRadiance.ts +0 -36
- package/templates/snow/src/render/environmentSampleCache.ts +0 -43
- package/templates/snow/src/render/environmentSampling.ts +0 -193
- package/templates/snow/src/render/environmentSnapshot.ts +0 -53
- package/templates/starter/.codex/config.toml +0 -23
- package/templates/starter/.cursor/mcp.json +0 -38
- package/templates/starter/.gemini/settings.json +0 -38
- package/templates/starter/.mcp.json +0 -38
- package/templates/starter/.vscode/mcp.json +0 -43
- package/templates/starter/.zed/settings.json +0 -43
- package/templates/starter/opencode.json +0 -49
- package/templates/starter/src/render/environmentContribution.ts +0 -188
- package/templates/starter/src/render/environmentRadiance.ts +0 -36
- package/templates/starter/src/render/environmentSampleCache.ts +0 -43
- package/templates/starter/src/render/environmentSampling.ts +0 -193
- package/templates/starter/src/render/environmentSnapshot.ts +0 -53
- package/templates/starter/src/render/rendererGate.ts +0 -36
- package/templates/tower-defense/.codex/config.toml +0 -23
- package/templates/tower-defense/.cursor/mcp.json +0 -38
- package/templates/tower-defense/.gemini/settings.json +0 -38
- package/templates/tower-defense/.mcp.json +0 -38
- package/templates/tower-defense/.vscode/mcp.json +0 -43
- package/templates/tower-defense/.zed/settings.json +0 -43
- package/templates/tower-defense/README.md +0 -16
- package/templates/tower-defense/opencode.json +0 -49
- package/templates/tower-defense/src/render/environmentContribution.ts +0 -188
- package/templates/tower-defense/src/render/environmentRadiance.ts +0 -36
- package/templates/tower-defense/src/render/environmentSampleCache.ts +0 -43
- package/templates/tower-defense/src/render/environmentSampling.ts +0 -193
- package/templates/tower-defense/src/render/environmentSnapshot.ts +0 -53
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copies one packaged terrain kit into a new game-owned folder.
|
|
3
|
+
* It checks the name, the packaged inputs and the target before it writes.
|
|
4
|
+
*/
|
|
5
|
+
declare function copyTerrainKit(kit: string, targetPath: string, templatesRoot?: string): Promise<void>;
|
|
6
|
+
|
|
7
|
+
export { copyTerrainKit };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import { lstat, readFile, mkdir, writeFile } from 'fs/promises';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
|
|
6
|
+
createRequire(import.meta.url);
|
|
7
|
+
var KITS = ["alpine", "coastal", "desert", "forest", "tundra"];
|
|
8
|
+
var COPIED = [
|
|
9
|
+
"assets.json",
|
|
10
|
+
"bake.mjs",
|
|
11
|
+
"credits.json",
|
|
12
|
+
"heightmap.r16",
|
|
13
|
+
"recipe.json",
|
|
14
|
+
"surface.json"
|
|
15
|
+
];
|
|
16
|
+
var DEFAULT_TEMPLATES_ROOT = path.resolve(
|
|
17
|
+
path.dirname(fileURLToPath(import.meta.url)),
|
|
18
|
+
"../templates"
|
|
19
|
+
);
|
|
20
|
+
async function assertNoSymlinkAncestor(target) {
|
|
21
|
+
let dir = path.dirname(path.resolve(target));
|
|
22
|
+
for (; ; ) {
|
|
23
|
+
const info = await lstat(dir).catch((error) => {
|
|
24
|
+
if (error.code === "ENOENT") return null;
|
|
25
|
+
throw error;
|
|
26
|
+
});
|
|
27
|
+
if (info?.isSymbolicLink()) {
|
|
28
|
+
throw new Error(
|
|
29
|
+
`TN_TERRAIN_KIT_SYMLINK: A parent folder is a symlink: ${dir}. Choose a target path with real parent folders.`
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
if (info !== null) return;
|
|
33
|
+
const parent = path.dirname(dir);
|
|
34
|
+
if (parent === dir) return;
|
|
35
|
+
dir = parent;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async function copyTerrainKit(kit, targetPath, templatesRoot = DEFAULT_TEMPLATES_ROOT) {
|
|
39
|
+
const target = path.resolve(targetPath);
|
|
40
|
+
if (!KITS.includes(kit)) {
|
|
41
|
+
throw new Error(
|
|
42
|
+
`TN_TERRAIN_KIT_NAME: "${kit}" is not a packaged terrain kit. Use one of: ${KITS.join(", ")}.`
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
const sourceDir = path.join(path.resolve(templatesRoot, "..", "template-assets", "terrain"), kit);
|
|
46
|
+
const sourceStat = await lstat(sourceDir).catch(() => null);
|
|
47
|
+
if (!sourceStat)
|
|
48
|
+
throw new Error(
|
|
49
|
+
`TN_TERRAIN_KIT_UNKNOWN: The packaged folder for "${kit}" is missing: ${sourceDir}.`
|
|
50
|
+
);
|
|
51
|
+
if (!sourceStat.isDirectory()) {
|
|
52
|
+
throw new Error(
|
|
53
|
+
`TN_TERRAIN_KIT_SOURCE: The packaged folder is not a real directory: ${sourceDir}.`
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
const bytes = /* @__PURE__ */ new Map();
|
|
57
|
+
for (const file of COPIED) {
|
|
58
|
+
const source = path.join(sourceDir, file);
|
|
59
|
+
if (!(await lstat(source).catch(() => null))?.isFile()) {
|
|
60
|
+
throw new Error(
|
|
61
|
+
`TN_TERRAIN_KIT_SOURCE: The packaged input is missing or not a regular file: ${source}.`
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
bytes.set(file, await readFile(source));
|
|
65
|
+
}
|
|
66
|
+
const targetStat = await lstat(target).catch(() => null);
|
|
67
|
+
if (targetStat?.isSymbolicLink()) {
|
|
68
|
+
throw new Error(
|
|
69
|
+
`TN_TERRAIN_KIT_SYMLINK: The target is a symlink. Choose a real folder: ${target}.`
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
if (targetStat)
|
|
73
|
+
throw new Error(
|
|
74
|
+
`TN_TERRAIN_KIT_EXISTS: The target already exists. Choose a new folder: ${target}.`
|
|
75
|
+
);
|
|
76
|
+
await assertNoSymlinkAncestor(target);
|
|
77
|
+
await mkdir(path.dirname(target), { recursive: true });
|
|
78
|
+
await mkdir(target);
|
|
79
|
+
for (const [file, data] of bytes) await writeFile(path.join(target, file), data, { flag: "wx" });
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export { copyTerrainKit };
|
package/dist/threenative.js
CHANGED
|
@@ -13,6 +13,7 @@ import { compileAssets, parsePng, parseAudioConfig } from '@threenative/assets';
|
|
|
13
13
|
import { read, VK_FORMAT_ASTC_4x4_UNORM_BLOCK, VK_FORMAT_ASTC_4x4_SRGB_BLOCK, KHR_SUPERCOMPRESSION_NONE, KHR_DF_MODEL_ASTC, KHR_DF_TRANSFER_SRGB, KHR_DF_TRANSFER_LINEAR } from 'ktx-parse';
|
|
14
14
|
import { brotliCompressSync, constants as constants$1, gzipSync } from 'zlib';
|
|
15
15
|
import { platform, homedir } from 'os';
|
|
16
|
+
import { fixAuthoringLayer, authoringLayerStatus } from './index.js';
|
|
16
17
|
|
|
17
18
|
createRequire(import.meta.url);
|
|
18
19
|
var BUILD_REPORT_SUFFIX = ".build-report.json";
|
|
@@ -184,6 +185,13 @@ function positiveInteger(value, fallback, code, label) {
|
|
|
184
185
|
}
|
|
185
186
|
return value;
|
|
186
187
|
}
|
|
188
|
+
function priorityValue(value) {
|
|
189
|
+
if (value === void 0) return "game";
|
|
190
|
+
if (value !== "game" && value !== "normal") {
|
|
191
|
+
fail("TN_CONFIG_PRIORITY_INVALID", 'display.priority must be "game" or "normal".');
|
|
192
|
+
}
|
|
193
|
+
return value;
|
|
194
|
+
}
|
|
187
195
|
function maxFpsValue(value) {
|
|
188
196
|
if (value === void 0) return 60;
|
|
189
197
|
if (!Number.isSafeInteger(value) || value < 0 || value > 1e3) {
|
|
@@ -285,6 +293,10 @@ function resolveEsbuild(cwd) {
|
|
|
285
293
|
}
|
|
286
294
|
}
|
|
287
295
|
}
|
|
296
|
+
var configLoadSequence = 0;
|
|
297
|
+
function configTempName(cwd, pid, now, sequence) {
|
|
298
|
+
return path5.join(cwd, `.threenative.config.${pid}.${now}.${sequence}.mjs`);
|
|
299
|
+
}
|
|
288
300
|
async function importConfig(cwd) {
|
|
289
301
|
const sourcePath = path5.join(cwd, CONFIG_FILE);
|
|
290
302
|
try {
|
|
@@ -347,7 +359,8 @@ async function importConfig(cwd) {
|
|
|
347
359
|
error instanceof Error ? error.message : String(error)
|
|
348
360
|
);
|
|
349
361
|
}
|
|
350
|
-
|
|
362
|
+
configLoadSequence += 1;
|
|
363
|
+
const compiledPath = configTempName(cwd, process.pid, Date.now(), configLoadSequence);
|
|
351
364
|
try {
|
|
352
365
|
await writeFile(compiledPath, code, "utf8");
|
|
353
366
|
} catch (error) {
|
|
@@ -622,7 +635,13 @@ async function validateIconVariants(raw, cwd) {
|
|
|
622
635
|
}
|
|
623
636
|
function validateDisplay(raw) {
|
|
624
637
|
const display = assertRecord(raw, "display");
|
|
625
|
-
assertKeys(display, "display", [
|
|
638
|
+
assertKeys(display, "display", [
|
|
639
|
+
"orientation",
|
|
640
|
+
"fullscreen",
|
|
641
|
+
"keepScreenOn",
|
|
642
|
+
"priority",
|
|
643
|
+
"maxFps"
|
|
644
|
+
]);
|
|
626
645
|
const orientation = display.orientation === void 0 ? "landscape" : display.orientation;
|
|
627
646
|
if (typeof orientation !== "string" || !ORIENTATIONS.includes(orientation)) {
|
|
628
647
|
fail(
|
|
@@ -644,6 +663,7 @@ function validateDisplay(raw) {
|
|
|
644
663
|
"TN_CONFIG_KEEP_SCREEN_ON_INVALID",
|
|
645
664
|
"display.keepScreenOn"
|
|
646
665
|
),
|
|
666
|
+
priority: priorityValue(display.priority),
|
|
647
667
|
maxFps: maxFpsValue(display.maxFps)
|
|
648
668
|
};
|
|
649
669
|
}
|
|
@@ -1713,8 +1733,8 @@ function describeNativeCssFindings(findings) {
|
|
|
1713
1733
|
(f) => ` ${f.file}:${f.line}:${f.column}${f.authored === void 0 ? "" : ` authored ${f.authored}`} ${f.what} \u2014 ${f.why}`
|
|
1714
1734
|
).join("\n");
|
|
1715
1735
|
}
|
|
1716
|
-
function webRuntimeDecoders(
|
|
1717
|
-
return
|
|
1736
|
+
function webRuntimeDecoders(_config) {
|
|
1737
|
+
return { ktx2: true, meshopt: true };
|
|
1718
1738
|
}
|
|
1719
1739
|
|
|
1720
1740
|
// src/build.ts
|
|
@@ -2371,7 +2391,7 @@ async function buildWeb(cwd, viteArgs = [], profile) {
|
|
|
2371
2391
|
config: config.assets,
|
|
2372
2392
|
cwd,
|
|
2373
2393
|
platform: "web",
|
|
2374
|
-
runtimeDecoders: webRuntimeDecoders(
|
|
2394
|
+
runtimeDecoders: webRuntimeDecoders(),
|
|
2375
2395
|
...config.engine !== "threejs" && { runtimeIdentity: "web:native-engine" }
|
|
2376
2396
|
});
|
|
2377
2397
|
const assets = assetRoot(cwd, config);
|
|
@@ -2686,6 +2706,8 @@ async function buildEngineDesktop(cwd, config, entry) {
|
|
|
2686
2706
|
String(config.window.height),
|
|
2687
2707
|
"--title",
|
|
2688
2708
|
config.window.title,
|
|
2709
|
+
"--priority",
|
|
2710
|
+
config.display.priority,
|
|
2689
2711
|
"--output",
|
|
2690
2712
|
output
|
|
2691
2713
|
]);
|
|
@@ -3223,6 +3245,12 @@ var MCP_SERVERS = Object.freeze({
|
|
|
3223
3245
|
command: "node",
|
|
3224
3246
|
args: Object.freeze(["./node_modules/@threenative/core/mcp/engine.mjs"])
|
|
3225
3247
|
}),
|
|
3248
|
+
// Cooks a starter terrain kit into a world.glb. The server lives in the optional
|
|
3249
|
+
// `@threenative/terrain` package, which the shim resolves from the project at launch.
|
|
3250
|
+
"threenative-terrain": Object.freeze({
|
|
3251
|
+
command: "node",
|
|
3252
|
+
args: Object.freeze(["./node_modules/@threenative/core/mcp/terrain.mjs"])
|
|
3253
|
+
}),
|
|
3226
3254
|
// Inspects, attaches, edits and verifies character animation. Every operation is a build-time
|
|
3227
3255
|
// edit of one GLB, so a game that animates nothing pays for nothing.
|
|
3228
3256
|
"threenative-animation": Object.freeze({
|
|
@@ -3239,10 +3267,11 @@ var MCP_SERVERS = Object.freeze({
|
|
|
3239
3267
|
})
|
|
3240
3268
|
});
|
|
3241
3269
|
var MCP_PACKAGES = Object.freeze({
|
|
3242
|
-
assets: Object.freeze({ name: "threenative-asset-mcp", version: "0.
|
|
3270
|
+
assets: Object.freeze({ name: "threenative-asset-mcp", version: "0.16.0" }),
|
|
3271
|
+
terrain: Object.freeze({ name: "@threenative/terrain", version: "0.1.9" }),
|
|
3243
3272
|
sculpt: Object.freeze({ name: "threenative-sculpt-mcp", version: "0.2.2" }),
|
|
3244
|
-
engine: Object.freeze({ name: "threenative-engine-mcp", version: "0.2.
|
|
3245
|
-
animation: Object.freeze({ name: "threenative-animation-mcp", version: "0.1.
|
|
3273
|
+
engine: Object.freeze({ name: "threenative-engine-mcp", version: "0.2.13" }),
|
|
3274
|
+
animation: Object.freeze({ name: "threenative-animation-mcp", version: "0.1.10" }),
|
|
3246
3275
|
// `args` fixes the launch for every host. The Chrome flags are `WEBGPU_BROWSER_ARGS` from
|
|
3247
3276
|
// `@threenative/playtest`, so a DevTools trace profiles the same adapter a playtest does and not
|
|
3248
3277
|
// SwiftShader. An isolated profile keeps the user's own Chrome profile out, and the two opt-outs
|
|
@@ -3355,7 +3384,12 @@ var MCP_HOSTS = Object.freeze([
|
|
|
3355
3384
|
Object.freeze({ id: "zed", label: "Zed", file: ".zed/settings.json", format: "zed" })
|
|
3356
3385
|
]);
|
|
3357
3386
|
|
|
3387
|
+
// ../core/src/version.ts
|
|
3388
|
+
var CORE_VERSION = "0.3.13";
|
|
3389
|
+
|
|
3358
3390
|
// src/mcp-servers.ts
|
|
3391
|
+
var CORE_PACKAGE_NAME = "@threenative/core";
|
|
3392
|
+
var CORE_PACKAGE_VERSION = CORE_VERSION;
|
|
3359
3393
|
function serverEntryPath(server) {
|
|
3360
3394
|
const entry = server.args[0];
|
|
3361
3395
|
if (entry === void 0) {
|
|
@@ -3401,12 +3435,11 @@ function requiredAndroidSdkFromRoot(root) {
|
|
|
3401
3435
|
return DEFAULT_ANDROID_COMPILE_SDK;
|
|
3402
3436
|
}
|
|
3403
3437
|
}
|
|
3404
|
-
var CORE_PACKAGE_NAME = "@threenative/core";
|
|
3405
|
-
var CORE_PACKAGE_VERSION = "0.3.11";
|
|
3406
3438
|
var CORE_RESOLVED_SERVERS = /* @__PURE__ */ new Set([
|
|
3407
3439
|
"threenative-engine",
|
|
3408
3440
|
"threenative-animation"
|
|
3409
3441
|
]);
|
|
3442
|
+
var OPTIONAL_ADDON_SERVERS = /* @__PURE__ */ new Set(["threenative-terrain"]);
|
|
3410
3443
|
var MCP_SERVER_SPECS = Object.entries(MCP_SERVERS).map(
|
|
3411
3444
|
([configName, server]) => {
|
|
3412
3445
|
const resolvesToCore = CORE_RESOLVED_SERVERS.has(configName);
|
|
@@ -3420,6 +3453,7 @@ var MCP_SERVER_SPECS = Object.entries(MCP_SERVERS).map(
|
|
|
3420
3453
|
return {
|
|
3421
3454
|
configName,
|
|
3422
3455
|
expectedArgs: serverEntryPath(server),
|
|
3456
|
+
optional: OPTIONAL_ADDON_SERVERS.has(configName),
|
|
3423
3457
|
packageName: resolvesToCore ? CORE_PACKAGE_NAME : declared.name,
|
|
3424
3458
|
version: resolvesToCore ? CORE_PACKAGE_VERSION : declared.version
|
|
3425
3459
|
};
|
|
@@ -3679,6 +3713,14 @@ function mcpServerCheck(snapshot, spec, value, file) {
|
|
|
3679
3713
|
};
|
|
3680
3714
|
}
|
|
3681
3715
|
const packageDirectory = resolvePackageDirectory(snapshot, spec.packageName);
|
|
3716
|
+
if (packageDirectory === void 0 && spec.optional) {
|
|
3717
|
+
return {
|
|
3718
|
+
detail: `${spec.configName} is optional and ${spec.packageName} is not installed in this project`,
|
|
3719
|
+
fix: `Run: npm i -D ${spec.packageName}`,
|
|
3720
|
+
name,
|
|
3721
|
+
status: "warn"
|
|
3722
|
+
};
|
|
3723
|
+
}
|
|
3682
3724
|
if (packageDirectory === void 0) {
|
|
3683
3725
|
return {
|
|
3684
3726
|
detail: `${spec.configName} is reachable by npx only: ${spec.packageName}@${spec.version} is not installed (npx --yes ${spec.packageName}@${spec.version})`,
|
|
@@ -3718,7 +3760,7 @@ function probeMcpServer(projectRoot, spec) {
|
|
|
3718
3760
|
method: "initialize",
|
|
3719
3761
|
params: {
|
|
3720
3762
|
capabilities: {},
|
|
3721
|
-
clientInfo: { name: "threenative-doctor", version:
|
|
3763
|
+
clientInfo: { name: "threenative-doctor", version: CORE_PACKAGE_VERSION },
|
|
3722
3764
|
protocolVersion: "2025-06-18"
|
|
3723
3765
|
}
|
|
3724
3766
|
});
|
|
@@ -4727,6 +4769,7 @@ function diagnoseProject(snapshot, options = {}) {
|
|
|
4727
4769
|
},
|
|
4728
4770
|
sceneShapeCheck(snapshot),
|
|
4729
4771
|
...capabilitySearchChecks(snapshot),
|
|
4772
|
+
...snapshot.authoringLayer === void 0 ? [] : [authoringLayerCheck(snapshot.authoringLayer)],
|
|
4730
4773
|
editorActivationCheck(snapshot),
|
|
4731
4774
|
...blender === void 0 ? [] : [blender]
|
|
4732
4775
|
];
|
|
@@ -4736,6 +4779,22 @@ function diagnoseProject(snapshot, options = {}) {
|
|
|
4736
4779
|
});
|
|
4737
4780
|
return { checks: scoped, pass: scoped.every(({ status }) => status !== "fail") };
|
|
4738
4781
|
}
|
|
4782
|
+
var AUTHORING_LAYER_FIX = "After 'pnpm up --latest create-threenative', run 'pnpm exec threenative doctor --fix'; add --force to overwrite files this game edited.";
|
|
4783
|
+
function authoringLayerCheck(layer) {
|
|
4784
|
+
const name = "authoring layer";
|
|
4785
|
+
if (layer.problem !== void 0)
|
|
4786
|
+
return { detail: layer.problem, fix: AUTHORING_LAYER_FIX, name, status: "warn" };
|
|
4787
|
+
const where = `installed create-threenative ${layer.installed} (${layer.kit} kit)`;
|
|
4788
|
+
if (layer.stamped === layer.installed && layer.stale.length === 0)
|
|
4789
|
+
return { detail: `stamp matches ${where}`, name, status: "ok" };
|
|
4790
|
+
const count = `${layer.stale.length} stale file${layer.stale.length === 1 ? "" : "s"}`;
|
|
4791
|
+
return {
|
|
4792
|
+
detail: `stamp ${layer.stamped ?? "absent"}, ${where}: ${count}`,
|
|
4793
|
+
fix: AUTHORING_LAYER_FIX,
|
|
4794
|
+
name,
|
|
4795
|
+
status: "warn"
|
|
4796
|
+
};
|
|
4797
|
+
}
|
|
4739
4798
|
async function collectFiles(root, relative = "", depth = 0) {
|
|
4740
4799
|
if (depth > 3) return [];
|
|
4741
4800
|
const absolute = path5.join(root, relative);
|
|
@@ -4791,15 +4850,25 @@ async function readProject(root) {
|
|
|
4791
4850
|
const runtimeVersion = installedVersions.get(RUNTIME_PACKAGE);
|
|
4792
4851
|
const runtimeManifestUrl = runtimeRoot === void 0 || runtimeVersion === void 0 ? void 0 : await runtimeReleaseManifestUrl(runtimeRoot, runtimeVersion);
|
|
4793
4852
|
const playtestRunnerPath = resolveBinaryFrom(projectRoot, PLAYTEST_BINARY);
|
|
4853
|
+
const authoringLayer = await authoringLayerStatus(projectRoot).catch(
|
|
4854
|
+
(error) => ({
|
|
4855
|
+
installed: "unknown",
|
|
4856
|
+
problem: error instanceof Error ? error.message : String(error),
|
|
4857
|
+
stale: []
|
|
4858
|
+
})
|
|
4859
|
+
);
|
|
4794
4860
|
const mcpServerHealth = /* @__PURE__ */ new Map();
|
|
4795
4861
|
if (SHAPE_VERIFIABLE_HOSTS.some(({ file }) => files.has(file))) {
|
|
4796
4862
|
for (const spec of MCP_SERVER_SPECS) {
|
|
4863
|
+
if (spec.optional && resolvePackageDirectoryFrom(projectRoot, spec.packageName) === void 0)
|
|
4864
|
+
continue;
|
|
4797
4865
|
if (existsSync(path5.resolve(projectRoot, spec.expectedArgs))) {
|
|
4798
4866
|
mcpServerHealth.set(spec.configName, probeMcpServer(projectRoot, spec));
|
|
4799
4867
|
}
|
|
4800
4868
|
}
|
|
4801
4869
|
}
|
|
4802
4870
|
return {
|
|
4871
|
+
authoringLayer,
|
|
4803
4872
|
config,
|
|
4804
4873
|
files,
|
|
4805
4874
|
installedVersions,
|
|
@@ -4857,7 +4926,7 @@ async function readTypeScriptConfig(root) {
|
|
|
4857
4926
|
function formatDoctorReport(report) {
|
|
4858
4927
|
const symbols = { fail: "\u2717", ok: "\u2713", warn: "!" };
|
|
4859
4928
|
const isBaseline = (name) => ["package.json", "dependencies", "versions"].includes(name);
|
|
4860
|
-
const isCraft = (name) => name.startsWith("capability search");
|
|
4929
|
+
const isCraft = (name) => name.startsWith("capability search") || name === "authoring layer";
|
|
4861
4930
|
const isTest = (name) => name === "playtest" || name === "playtests";
|
|
4862
4931
|
const groups = [
|
|
4863
4932
|
["Baseline", isBaseline],
|
|
@@ -4881,8 +4950,6 @@ function formatDoctorReport(report) {
|
|
|
4881
4950
|
return `${lines.join("\n")}
|
|
4882
4951
|
`;
|
|
4883
4952
|
}
|
|
4884
|
-
|
|
4885
|
-
// src/threenative.ts
|
|
4886
4953
|
var DOCTOR_TARGETS = ["web", "desktop", "android", "ios"];
|
|
4887
4954
|
var DOCTOR_MODES = ["debug", "release"];
|
|
4888
4955
|
function cliHelp(command) {
|
|
@@ -4890,7 +4957,7 @@ function cliHelp(command) {
|
|
|
4890
4957
|
if (command === "doctor") {
|
|
4891
4958
|
return `${[
|
|
4892
4959
|
"Usage: threenative doctor [--target web|desktop|android|ios] [--mode debug|release]",
|
|
4893
|
-
" [--text] [--capture <path>]",
|
|
4960
|
+
" [--text] [--capture <path>] [--fix [--force]]",
|
|
4894
4961
|
"",
|
|
4895
4962
|
"Checks this project against what the build and the native host assume about it:",
|
|
4896
4963
|
"installed and version-matched @threenative packages, a portable entry that",
|
|
@@ -4907,6 +4974,11 @@ function cliHelp(command) {
|
|
|
4907
4974
|
" need once PRD-212 ships it, so a green report here is a forecast, not a release.",
|
|
4908
4975
|
"Prints JSON by default; --text prints the same report for a person.",
|
|
4909
4976
|
"--capture forwards a browser census JSON or native TN_PIPELINE_EVENT log to the playtest doctor.",
|
|
4977
|
+
"--fix rewrites this game's authoring layer (AGENTS.md, CLAUDE.md, skills, hooks, MCP configs)",
|
|
4978
|
+
" from the installed create-threenative, then checks again. To update an existing game:",
|
|
4979
|
+
" 'pnpm up --latest create-threenative @threenative/*', then 'pnpm exec threenative doctor --fix'.",
|
|
4980
|
+
" A file this game edited is kept and listed, and the run exits 1 (TN_AUTHORING_LAYER_EDITED);",
|
|
4981
|
+
" --force overwrites it. Git is the undo. .threenative/agent-files.json records what was written.",
|
|
4910
4982
|
"Exits 0 when nothing failed, 1 when a check failed."
|
|
4911
4983
|
].join("\n")}
|
|
4912
4984
|
`;
|
|
@@ -4931,6 +5003,8 @@ ${cliHelp()}`);
|
|
|
4931
5003
|
}
|
|
4932
5004
|
async function runDoctorCommand(argv, cwd = process.cwd()) {
|
|
4933
5005
|
let capturePath;
|
|
5006
|
+
let fix = false;
|
|
5007
|
+
let force = false;
|
|
4934
5008
|
let mode;
|
|
4935
5009
|
let target;
|
|
4936
5010
|
const valueFor = (flag, value) => {
|
|
@@ -4941,6 +5015,11 @@ async function runDoctorCommand(argv, cwd = process.cwd()) {
|
|
|
4941
5015
|
for (let index = 0; index < argv.length; index += 1) {
|
|
4942
5016
|
const flag = argv[index];
|
|
4943
5017
|
if (flag === "--text") continue;
|
|
5018
|
+
if (flag === "--fix" || flag === "--force") {
|
|
5019
|
+
if (flag === "--fix") fix = true;
|
|
5020
|
+
else force = true;
|
|
5021
|
+
continue;
|
|
5022
|
+
}
|
|
4944
5023
|
if (flag === "--capture") {
|
|
4945
5024
|
capturePath = valueFor(flag, argv[index + 1]);
|
|
4946
5025
|
index += 1;
|
|
@@ -4966,12 +5045,31 @@ async function runDoctorCommand(argv, cwd = process.cwd()) {
|
|
|
4966
5045
|
}
|
|
4967
5046
|
if (mode !== void 0 && target === void 0)
|
|
4968
5047
|
throw new Error("doctor: '--mode' requires '--target'.");
|
|
5048
|
+
if (force && !fix) throw new Error("doctor: '--force' requires '--fix'.");
|
|
5049
|
+
let kept = 0;
|
|
5050
|
+
if (fix) {
|
|
5051
|
+
const result = await fixAuthoringLayer(cwd, { force });
|
|
5052
|
+
const lines = [
|
|
5053
|
+
...result.written.map((file) => `wrote ${file}`),
|
|
5054
|
+
...result.deleted.map((file) => `deleted ${file}`),
|
|
5055
|
+
...result.kept.map((file) => `kept ${file}`)
|
|
5056
|
+
];
|
|
5057
|
+
kept = result.kept.length;
|
|
5058
|
+
if (kept > 0)
|
|
5059
|
+
lines.push(
|
|
5060
|
+
`TN_AUTHORING_LAYER_EDITED: kept ${kept} file${kept === 1 ? "" : "s"} this game edited; rerun with --force to overwrite (git is the undo).`
|
|
5061
|
+
);
|
|
5062
|
+
process.stderr.write(
|
|
5063
|
+
lines.length === 0 ? "authoring layer already current\n" : `${lines.join("\n")}
|
|
5064
|
+
`
|
|
5065
|
+
);
|
|
5066
|
+
}
|
|
4969
5067
|
const report = diagnoseProject(await readProject(cwd), { capturePath, mode, target });
|
|
4970
5068
|
process.stdout.write(
|
|
4971
5069
|
argv.includes("--text") ? formatDoctorReport(report) : `${JSON.stringify(report, null, 2)}
|
|
4972
5070
|
`
|
|
4973
5071
|
);
|
|
4974
|
-
return report.pass ? 0 : 1;
|
|
5072
|
+
return report.pass && kept === 0 ? 0 : 1;
|
|
4975
5073
|
}
|
|
4976
5074
|
async function main(argv = process.argv.slice(2)) {
|
|
4977
5075
|
if (argv.includes("--help") || argv.includes("-h")) {
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { Quaternion, Vector3 } from 'three';
|
|
2
|
+
|
|
3
|
+
// ../three-native/src/addons/ccd-ik-solver.ts
|
|
4
|
+
var modulo = (n, m) => (n % m + m) % m;
|
|
5
|
+
var CCDIKSolver = class {
|
|
6
|
+
constructor(mesh, iks = []) {
|
|
7
|
+
this.mesh = mesh;
|
|
8
|
+
this.iks = iks;
|
|
9
|
+
this.#initialQuaternions = iks.map((ik) => ik.links.map(() => new Quaternion()));
|
|
10
|
+
this.#valid();
|
|
11
|
+
}
|
|
12
|
+
mesh;
|
|
13
|
+
iks;
|
|
14
|
+
#quaternion = new Quaternion();
|
|
15
|
+
#targetPos = new Vector3();
|
|
16
|
+
#targetVec = new Vector3();
|
|
17
|
+
#effectorPos = new Vector3();
|
|
18
|
+
#effectorVec = new Vector3();
|
|
19
|
+
#linkPos = new Vector3();
|
|
20
|
+
#invLinkQ = new Quaternion();
|
|
21
|
+
#linkScale = new Vector3();
|
|
22
|
+
#axis = new Vector3();
|
|
23
|
+
#vector = new Vector3();
|
|
24
|
+
#center = new Vector3();
|
|
25
|
+
#workingQuaternion = new Quaternion();
|
|
26
|
+
#initialQuaternions;
|
|
27
|
+
update(globalBlendFactor = 1) {
|
|
28
|
+
for (const ik of this.iks) this.updateOne(ik, globalBlendFactor);
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
updateOne(ik, overrideBlend = 1) {
|
|
32
|
+
const chainBlend = ik.blendFactor ?? overrideBlend;
|
|
33
|
+
const bones = this.mesh.skeleton.bones;
|
|
34
|
+
const initialQuaternions = this.#initialQuaternions[this.iks.indexOf(ik)] ?? [];
|
|
35
|
+
const effector = bones[ik.effector];
|
|
36
|
+
const target = bones[ik.target];
|
|
37
|
+
this.#targetPos.setFromMatrixPosition(target.matrixWorld);
|
|
38
|
+
const links = ik.links;
|
|
39
|
+
if (chainBlend < 1)
|
|
40
|
+
for (const [j, link] of links.entries())
|
|
41
|
+
initialQuaternions[j]?.copy(bones[link.index].quaternion);
|
|
42
|
+
for (let i = 0; i < (ik.iteration ?? 1); i++) if (!this.#iterate(ik, bones, effector)) break;
|
|
43
|
+
if (chainBlend < 1) this.#blend(links, bones, initialQuaternions, chainBlend);
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
createHelper() {
|
|
47
|
+
throw new Error(
|
|
48
|
+
"TN_NATIVE_UNSUPPORTED_CCDIKHELPER: CCDIKSolver.createHelper needs three's CCDIKHelper, which the engine does not bind; draw the chain from skeleton.bones instead."
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
// One pass over the chain; false when no link turned, which ends the solve.
|
|
52
|
+
#iterate(ik, bones, effector) {
|
|
53
|
+
let rotated = false;
|
|
54
|
+
for (const entry of ik.links) {
|
|
55
|
+
if (entry.enabled === false) break;
|
|
56
|
+
if (this.#rotateLink(ik, entry, bones[entry.index], effector)) rotated = true;
|
|
57
|
+
}
|
|
58
|
+
return rotated;
|
|
59
|
+
}
|
|
60
|
+
// A chain blend under 1 slerps each link from its pose before the solve toward the solved pose.
|
|
61
|
+
#blend(links, bones, initial, chainBlend) {
|
|
62
|
+
for (const [j, entry] of links.entries()) {
|
|
63
|
+
const link = bones[entry.index];
|
|
64
|
+
this.#workingQuaternion.copy(initial[j]).slerp(link.quaternion, chainBlend);
|
|
65
|
+
link.quaternion.copy(this.#workingQuaternion);
|
|
66
|
+
link.updateMatrixWorld(true);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// One CCD step on one link: rotate it so the effector points at the target. False when the angle
|
|
70
|
+
// is too small to turn, which three skips to prevent bone vibration.
|
|
71
|
+
#rotateLink(ik, entry, link, effector) {
|
|
72
|
+
link.matrixWorld.decompose(this.#linkPos, this.#invLinkQ, this.#linkScale);
|
|
73
|
+
this.#invLinkQ.invert();
|
|
74
|
+
this.#effectorPos.setFromMatrixPosition(effector.matrixWorld);
|
|
75
|
+
this.#effectorVec.subVectors(this.#effectorPos, this.#linkPos).applyQuaternion(this.#invLinkQ).normalize();
|
|
76
|
+
this.#targetVec.subVectors(this.#targetPos, this.#linkPos).applyQuaternion(this.#invLinkQ).normalize();
|
|
77
|
+
let angle = Math.acos(Math.min(1, Math.max(-1, this.#targetVec.dot(this.#effectorVec))));
|
|
78
|
+
if (angle < 1e-5) return false;
|
|
79
|
+
if (ik.minAngle !== void 0 && angle < ik.minAngle) angle = ik.minAngle;
|
|
80
|
+
if (ik.maxAngle !== void 0 && angle > ik.maxAngle) angle = ik.maxAngle;
|
|
81
|
+
this.#axis.crossVectors(this.#effectorVec, this.#targetVec).normalize();
|
|
82
|
+
this.#quaternion.setFromAxisAngle(this.#axis, angle);
|
|
83
|
+
link.quaternion.multiply(this.#quaternion);
|
|
84
|
+
this.#limit(entry, link);
|
|
85
|
+
link.updateMatrixWorld(true);
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
// three's link limits: a hinge axis, then Euler angle bounds.
|
|
89
|
+
#limit(entry, link) {
|
|
90
|
+
const { limitation, rotationMin, rotationMax } = entry;
|
|
91
|
+
if (limitation !== void 0) {
|
|
92
|
+
const q = link.quaternion;
|
|
93
|
+
const c = Math.min(q.w, 1);
|
|
94
|
+
const dot = q.x * limitation.x + q.y * limitation.y + q.z * limitation.z;
|
|
95
|
+
const c2 = (dot < 0 ? -1 : 1) * Math.sqrt(1 - c * c);
|
|
96
|
+
q.set(limitation.x * c2, limitation.y * c2, limitation.z * c2, c);
|
|
97
|
+
}
|
|
98
|
+
if (rotationMin !== void 0 || rotationMax !== void 0) {
|
|
99
|
+
const v = this.#vector.setFromEuler(link.rotation);
|
|
100
|
+
if (rotationMin !== void 0 && rotationMax !== void 0) {
|
|
101
|
+
const c = this.#center.addVectors(rotationMin, rotationMax).multiplyScalar(0.5);
|
|
102
|
+
v.x = c.x + modulo(v.x - c.x + Math.PI, 2 * Math.PI) - Math.PI;
|
|
103
|
+
v.y = c.y + modulo(v.y - c.y + Math.PI, 2 * Math.PI) - Math.PI;
|
|
104
|
+
v.z = c.z + modulo(v.z - c.z + Math.PI, 2 * Math.PI) - Math.PI;
|
|
105
|
+
}
|
|
106
|
+
if (rotationMin !== void 0) v.max(rotationMin);
|
|
107
|
+
if (rotationMax !== void 0) v.min(rotationMax);
|
|
108
|
+
link.rotation.setFromVector3(v);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
#valid() {
|
|
112
|
+
const bones = this.mesh.skeleton.bones;
|
|
113
|
+
for (const ik of this.iks) {
|
|
114
|
+
let child = bones[ik.effector];
|
|
115
|
+
for (const entry of ik.links) {
|
|
116
|
+
const parent = bones[entry.index];
|
|
117
|
+
if (child.parent !== parent)
|
|
118
|
+
console.warn(
|
|
119
|
+
`THREE.CCDIKSolver: bone ${child.name} is not the child of bone ${parent.name}`
|
|
120
|
+
);
|
|
121
|
+
child = parent;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export { CCDIKSolver };
|