@opengamehq/skills 1.4.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/README.md +12 -4
- package/dist/.claude-plugin/marketplace.json +26 -0
- package/dist/skills/manifest.json +1407 -143
- package/dist/skills/opengame-accessibility/CHANGELOG.md +4 -0
- package/dist/skills/opengame-accessibility/SKILL.md +48 -32
- package/dist/skills/opengame-all-in-one/CHANGELOG.md +25 -0
- package/dist/skills/opengame-all-in-one/SKILL.md +195 -0
- package/dist/skills/opengame-all-in-one/references/opengame-accessibility/README.md +102 -0
- package/dist/skills/opengame-all-in-one/references/opengame-api/README.md +108 -0
- package/dist/skills/opengame-all-in-one/references/opengame-assets/README.md +168 -0
- package/dist/skills/opengame-all-in-one/references/opengame-assets/references/pipeline.md +164 -0
- package/dist/skills/opengame-all-in-one/references/opengame-audio/README.md +238 -0
- package/dist/skills/opengame-all-in-one/references/opengame-audio/helpers/audio-chain.js +325 -0
- package/dist/skills/opengame-all-in-one/references/opengame-audio/references/mix-notes.md +125 -0
- package/dist/skills/opengame-all-in-one/references/opengame-audio/references/qa-without-ears.md +177 -0
- package/dist/skills/opengame-all-in-one/references/opengame-capture/README.md +128 -0
- package/dist/skills/opengame-all-in-one/references/opengame-capture/references/pipeline.md +114 -0
- package/dist/skills/opengame-all-in-one/references/opengame-capture/references/threejs.md +161 -0
- package/dist/skills/opengame-all-in-one/references/opengame-characters/README.md +180 -0
- package/dist/skills/opengame-all-in-one/references/opengame-characters/references/first-person-body.md +108 -0
- package/dist/skills/opengame-all-in-one/references/opengame-characters/references/integration.md +144 -0
- package/dist/skills/opengame-all-in-one/references/opengame-characters/references/player-og.md +160 -0
- package/dist/skills/opengame-all-in-one/references/opengame-cli/README.md +190 -0
- package/dist/skills/opengame-all-in-one/references/opengame-deploy/README.md +229 -0
- package/dist/skills/opengame-all-in-one/references/opengame-deploy/references/json-events.md +63 -0
- package/dist/skills/opengame-all-in-one/references/opengame-deploy/references/manifest.md +90 -0
- package/dist/skills/opengame-all-in-one/references/opengame-deploy/references/packaging.md +120 -0
- package/dist/skills/opengame-all-in-one/references/opengame-depth/README.md +154 -0
- package/dist/skills/opengame-all-in-one/references/opengame-enemies/README.md +155 -0
- package/dist/skills/opengame-all-in-one/references/opengame-enemies/references/pacing-and-bots.md +108 -0
- package/dist/skills/opengame-all-in-one/references/opengame-enemies/references/threejs.md +193 -0
- package/dist/skills/opengame-all-in-one/references/opengame-front-end/README.md +185 -0
- package/dist/skills/opengame-all-in-one/references/opengame-front-end/references/launch.md +50 -0
- package/dist/skills/opengame-all-in-one/references/opengame-front-end/references/menus.md +81 -0
- package/dist/skills/opengame-all-in-one/references/opengame-game-feel/README.md +181 -0
- package/dist/skills/opengame-all-in-one/references/opengame-game-feel/helpers/spring.js +146 -0
- package/dist/skills/opengame-all-in-one/references/opengame-game-feel/references/feel-numbers.md +142 -0
- package/dist/skills/opengame-all-in-one/references/opengame-game-feel/references/killcam.md +88 -0
- package/dist/skills/opengame-all-in-one/references/opengame-jam/README.md +121 -0
- package/dist/skills/opengame-all-in-one/references/opengame-lighting/README.md +141 -0
- package/dist/skills/opengame-all-in-one/references/opengame-lighting/helpers/light-pool.js +185 -0
- package/dist/skills/opengame-all-in-one/references/opengame-loading/README.md +135 -0
- package/dist/skills/opengame-all-in-one/references/opengame-loading/helpers/loading-count.mjs +115 -0
- package/dist/skills/opengame-all-in-one/references/opengame-loading/references/threejs.md +141 -0
- package/dist/skills/opengame-all-in-one/references/opengame-look/README.md +181 -0
- package/dist/skills/opengame-all-in-one/references/opengame-look/references/matching-a-reference.md +73 -0
- package/dist/skills/opengame-all-in-one/references/opengame-look/references/painterly.md +69 -0
- package/dist/skills/opengame-all-in-one/references/opengame-look/references/post-and-lens.md +73 -0
- package/dist/skills/opengame-all-in-one/references/opengame-maps/README.md +74 -0
- package/dist/skills/opengame-all-in-one/references/opengame-maps/references/map-spec.md +77 -0
- package/dist/skills/opengame-all-in-one/references/opengame-mobile/README.md +86 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-make/README.md +183 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-make/references/briefs.md +293 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-make/references/day-one-questions.md +46 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-make/references/edge-cases.md +27 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-make/references/filmable.md +244 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-make/references/finishing.md +126 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-make/references/measure.md +282 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-make/references/montage-capture.md +151 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-make/references/montage-gates.md +84 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-make/references/montage-genres.md +198 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-make/references/montage-grammar.md +320 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-make/references/montage-ops.md +127 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-make/references/og-snipers-record.md +110 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-make/references/owner-eye.md +214 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-make/references/reference-study.md +293 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-make/references/song.md +64 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-plan/README.md +193 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-plan/references/briefs.md +293 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-plan/references/day-one-questions.md +46 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-plan/references/filmable.md +244 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-plan/references/measure.md +282 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-plan/references/montage-capture.md +151 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-plan/references/montage-gates.md +84 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-plan/references/montage-genres.md +198 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-plan/references/montage-grammar.md +320 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-plan/references/montage-ops.md +127 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-plan/references/og-snipers-record.md +110 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-plan/references/owner-eye.md +214 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-plan/references/reference-study.md +293 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-plan/references/song.md +64 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-review-and-improve/README.md +174 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-review-and-improve/references/briefs.md +293 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-review-and-improve/references/day-one-questions.md +46 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-review-and-improve/references/filmable.md +244 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-review-and-improve/references/finishing.md +126 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-review-and-improve/references/measure.md +282 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-review-and-improve/references/montage-capture.md +151 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-review-and-improve/references/montage-gates.md +84 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-review-and-improve/references/montage-genres.md +198 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-review-and-improve/references/montage-grammar.md +320 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-review-and-improve/references/montage-ops.md +127 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-review-and-improve/references/og-snipers-record.md +110 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-review-and-improve/references/owner-eye.md +214 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-review-and-improve/references/reference-study.md +293 -0
- package/dist/skills/opengame-all-in-one/references/opengame-montage-review-and-improve/references/song.md +64 -0
- package/dist/skills/opengame-all-in-one/references/opengame-multiplayer/README.md +139 -0
- package/dist/skills/opengame-all-in-one/references/opengame-multiplayer/references/bot-lobbies.md +71 -0
- package/dist/skills/opengame-all-in-one/references/opengame-multiplayer/references/netcode.md +165 -0
- package/dist/skills/opengame-all-in-one/references/opengame-performance/README.md +177 -0
- package/dist/skills/opengame-all-in-one/references/opengame-performance/helpers/landing-pacer.mjs +86 -0
- package/dist/skills/opengame-all-in-one/references/opengame-performance/references/measuring.md +123 -0
- package/dist/skills/opengame-all-in-one/references/opengame-performance/references/webgpu.md +86 -0
- package/dist/skills/opengame-all-in-one/references/opengame-production/README.md +192 -0
- package/dist/skills/opengame-all-in-one/references/opengame-production/references/team.md +107 -0
- package/dist/skills/opengame-all-in-one/references/opengame-production/references/templates.md +153 -0
- package/dist/skills/opengame-all-in-one/references/opengame-quality-bar/README.md +170 -0
- package/dist/skills/opengame-all-in-one/references/opengame-quality-bar/references/cheap-tells.md +43 -0
- package/dist/skills/opengame-all-in-one/references/opengame-quality-bar/references/judges.md +95 -0
- package/dist/skills/opengame-all-in-one/references/opengame-quality-bar/references/review-prompt.md +32 -0
- package/dist/skills/opengame-all-in-one/references/opengame-rhythm/README.md +134 -0
- package/dist/skills/opengame-all-in-one/references/opengame-rhythm/references/charting.md +109 -0
- package/dist/skills/opengame-all-in-one/references/opengame-rhythm/references/timing.md +92 -0
- package/dist/skills/opengame-all-in-one/references/opengame-router/README.md +54 -0
- package/dist/skills/opengame-all-in-one/references/opengame-router/references/process.md +38 -0
- package/dist/skills/opengame-all-in-one/references/opengame-scene-audit/README.md +136 -0
- package/dist/skills/opengame-all-in-one/references/opengame-scene-audit/helpers/scene-audit.js +677 -0
- package/dist/skills/opengame-all-in-one/references/opengame-sdk/README.md +283 -0
- package/dist/skills/opengame-all-in-one/references/opengame-sdk/references/engines.md +93 -0
- package/dist/skills/opengame-all-in-one/references/opengame-sdk/references/frame.md +107 -0
- package/dist/skills/opengame-all-in-one/references/opengame-sdk/references/identity.md +111 -0
- package/dist/skills/opengame-all-in-one/references/opengame-sdk/references/leaderboards.md +115 -0
- package/dist/skills/opengame-all-in-one/references/opengame-sdk/references/radio.md +71 -0
- package/dist/skills/opengame-all-in-one/references/opengame-stability/README.md +112 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-make/README.md +160 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-make/references/archetypes.md +113 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-make/references/briefs.md +273 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-make/references/core.md +129 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-make/references/craft.md +299 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-make/references/edge-cases.md +27 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-make/references/filmable.md +244 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-make/references/finishing.md +126 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-make/references/gates.md +184 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-make/references/measure.md +282 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-make/references/music.md +148 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-make/references/og-clash-record.md +133 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-make/references/ops.md +154 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-make/references/owner-eye.md +214 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-make/references/review.md +141 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-make/references/title.md +92 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-plan/README.md +172 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-plan/references/archetypes.md +113 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-plan/references/briefs.md +273 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-plan/references/core.md +129 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-plan/references/craft.md +299 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-plan/references/edge-cases.md +27 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-plan/references/filmable.md +244 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-plan/references/finishing.md +126 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-plan/references/gates.md +184 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-plan/references/measure.md +282 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-plan/references/music.md +148 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-plan/references/og-clash-record.md +133 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-plan/references/ops.md +154 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-plan/references/owner-eye.md +214 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-plan/references/reference-set.md +92 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-plan/references/review.md +141 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-plan/references/title.md +92 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-review-and-improve/README.md +141 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-review-and-improve/references/archetypes.md +113 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-review-and-improve/references/briefs.md +273 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-review-and-improve/references/core.md +129 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-review-and-improve/references/craft.md +299 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-review-and-improve/references/edge-cases.md +27 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-review-and-improve/references/filmable.md +244 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-review-and-improve/references/finishing.md +126 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-review-and-improve/references/gates.md +184 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-review-and-improve/references/measure.md +282 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-review-and-improve/references/music.md +148 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-review-and-improve/references/og-clash-record.md +133 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-review-and-improve/references/ops.md +154 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-review-and-improve/references/owner-eye.md +214 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-review-and-improve/references/review.md +141 -0
- package/dist/skills/opengame-all-in-one/references/opengame-trailer-review-and-improve/references/title.md +92 -0
- package/dist/skills/opengame-all-in-one/references/opengame-verification/README.md +197 -0
- package/dist/skills/opengame-all-in-one/references/opengame-verification/helpers/browser-evidence.mjs +74 -0
- package/dist/skills/opengame-all-in-one/references/opengame-weapons/README.md +179 -0
- package/dist/skills/opengame-all-in-one/references/opengame-weapons/references/handling-numbers.md +114 -0
- package/dist/skills/opengame-all-in-one/references/opengame-weapons/references/reloads-and-hands.md +96 -0
- package/dist/skills/opengame-all-in-one/references/opengame-weapons/references/sights-and-scopes.md +98 -0
- package/dist/skills/opengame-all-in-one/references/opengame-weapons/references/threejs.md +240 -0
- package/dist/skills/opengame-all-in-one/references/opengame-world-physics/README.md +141 -0
- package/dist/skills/opengame-all-in-one/references/opengame-world-physics/references/measured-failures.md +79 -0
- package/dist/skills/opengame-api/CHANGELOG.md +12 -0
- package/dist/skills/opengame-api/SKILL.md +40 -13
- package/dist/skills/opengame-assets/CHANGELOG.md +11 -0
- package/dist/skills/opengame-assets/SKILL.md +79 -31
- package/dist/skills/opengame-assets/references/pipeline.md +67 -0
- package/dist/skills/opengame-audio/CHANGELOG.md +11 -0
- package/dist/skills/opengame-audio/SKILL.md +129 -41
- package/dist/skills/opengame-audio/references/mix-notes.md +44 -1
- package/dist/skills/opengame-audio/references/qa-without-ears.md +177 -0
- package/dist/skills/opengame-capture/CHANGELOG.md +10 -0
- package/dist/skills/opengame-capture/SKILL.md +44 -20
- package/dist/skills/opengame-capture/references/pipeline.md +33 -1
- package/dist/skills/opengame-capture/references/threejs.md +17 -1
- package/dist/skills/opengame-characters/CHANGELOG.md +15 -0
- package/dist/skills/opengame-characters/SKILL.md +94 -39
- package/dist/skills/opengame-characters/references/first-person-body.md +108 -0
- package/dist/skills/opengame-characters/references/player-og.md +1 -1
- package/dist/skills/opengame-cli/CHANGELOG.md +16 -0
- package/dist/skills/opengame-cli/SKILL.md +13 -11
- package/dist/skills/opengame-deploy/CHANGELOG.md +24 -0
- package/dist/skills/opengame-deploy/SKILL.md +47 -21
- package/dist/skills/opengame-deploy/references/json-events.md +6 -5
- package/dist/skills/opengame-deploy/references/manifest.md +3 -2
- package/dist/skills/opengame-deploy/references/packaging.md +29 -26
- package/dist/skills/opengame-depth/CHANGELOG.md +8 -0
- package/dist/skills/opengame-depth/SKILL.md +61 -33
- package/dist/skills/opengame-enemies/CHANGELOG.md +10 -0
- package/dist/skills/opengame-enemies/SKILL.md +96 -40
- package/dist/skills/opengame-enemies/references/pacing-and-bots.md +108 -0
- package/dist/skills/opengame-enemies/references/threejs.md +59 -0
- package/dist/skills/opengame-front-end/CHANGELOG.md +4 -0
- package/dist/skills/opengame-front-end/SKILL.md +85 -39
- package/dist/skills/opengame-front-end/references/menus.md +42 -8
- package/dist/skills/opengame-game-feel/CHANGELOG.md +11 -0
- package/dist/skills/opengame-game-feel/SKILL.md +95 -47
- package/dist/skills/opengame-game-feel/references/feel-numbers.md +59 -0
- package/dist/skills/opengame-game-feel/references/killcam.md +88 -0
- package/dist/skills/opengame-jam/CHANGELOG.md +12 -0
- package/dist/skills/opengame-jam/SKILL.md +59 -37
- package/dist/skills/opengame-lighting/CHANGELOG.md +9 -0
- package/dist/skills/opengame-lighting/SKILL.md +85 -34
- package/dist/skills/opengame-loading/CHANGELOG.md +4 -0
- package/dist/skills/opengame-loading/SKILL.md +78 -38
- package/dist/skills/opengame-loading/helpers/loading-count.mjs +115 -0
- package/dist/skills/opengame-loading/references/threejs.md +32 -7
- package/dist/skills/opengame-look/CHANGELOG.md +9 -0
- package/dist/skills/opengame-look/SKILL.md +122 -51
- package/dist/skills/opengame-look/references/matching-a-reference.md +73 -0
- package/dist/skills/opengame-look/references/painterly.md +69 -0
- package/dist/skills/opengame-look/references/post-and-lens.md +10 -3
- package/dist/skills/opengame-maps/CHANGELOG.md +9 -0
- package/dist/skills/opengame-maps/SKILL.md +78 -0
- package/dist/skills/opengame-maps/references/map-spec.md +77 -0
- package/dist/skills/opengame-mobile/CHANGELOG.md +4 -0
- package/dist/skills/opengame-mobile/SKILL.md +18 -18
- package/dist/skills/opengame-montage-make/CHANGELOG.md +5 -0
- package/dist/skills/opengame-montage-make/SKILL.md +187 -0
- package/dist/skills/opengame-montage-make/references/briefs.md +293 -0
- package/dist/skills/opengame-montage-make/references/day-one-questions.md +46 -0
- package/dist/skills/opengame-montage-make/references/edge-cases.md +27 -0
- package/dist/skills/opengame-montage-make/references/filmable.md +244 -0
- package/dist/skills/opengame-montage-make/references/finishing.md +126 -0
- package/dist/skills/opengame-montage-make/references/measure.md +282 -0
- package/dist/skills/opengame-montage-make/references/montage-capture.md +151 -0
- package/dist/skills/opengame-montage-make/references/montage-gates.md +84 -0
- package/dist/skills/opengame-montage-make/references/montage-genres.md +198 -0
- package/dist/skills/opengame-montage-make/references/montage-grammar.md +320 -0
- package/dist/skills/opengame-montage-make/references/montage-ops.md +127 -0
- package/dist/skills/opengame-montage-make/references/og-snipers-record.md +110 -0
- package/dist/skills/opengame-montage-make/references/owner-eye.md +214 -0
- package/dist/skills/opengame-montage-make/references/reference-study.md +293 -0
- package/dist/skills/opengame-montage-make/references/song.md +64 -0
- package/dist/skills/opengame-montage-plan/CHANGELOG.md +5 -0
- package/dist/skills/opengame-montage-plan/SKILL.md +197 -0
- package/dist/skills/opengame-montage-plan/references/briefs.md +293 -0
- package/dist/skills/opengame-montage-plan/references/day-one-questions.md +46 -0
- package/dist/skills/opengame-montage-plan/references/filmable.md +244 -0
- package/dist/skills/opengame-montage-plan/references/measure.md +282 -0
- package/dist/skills/opengame-montage-plan/references/montage-capture.md +151 -0
- package/dist/skills/opengame-montage-plan/references/montage-gates.md +84 -0
- package/dist/skills/opengame-montage-plan/references/montage-genres.md +198 -0
- package/dist/skills/opengame-montage-plan/references/montage-grammar.md +320 -0
- package/dist/skills/opengame-montage-plan/references/montage-ops.md +127 -0
- package/dist/skills/opengame-montage-plan/references/og-snipers-record.md +110 -0
- package/dist/skills/opengame-montage-plan/references/owner-eye.md +214 -0
- package/dist/skills/opengame-montage-plan/references/reference-study.md +293 -0
- package/dist/skills/opengame-montage-plan/references/song.md +64 -0
- package/dist/skills/opengame-montage-review-and-improve/CHANGELOG.md +5 -0
- package/dist/skills/opengame-montage-review-and-improve/SKILL.md +178 -0
- package/dist/skills/opengame-montage-review-and-improve/references/briefs.md +293 -0
- package/dist/skills/opengame-montage-review-and-improve/references/day-one-questions.md +46 -0
- package/dist/skills/opengame-montage-review-and-improve/references/filmable.md +244 -0
- package/dist/skills/opengame-montage-review-and-improve/references/finishing.md +126 -0
- package/dist/skills/opengame-montage-review-and-improve/references/measure.md +282 -0
- package/dist/skills/opengame-montage-review-and-improve/references/montage-capture.md +151 -0
- package/dist/skills/opengame-montage-review-and-improve/references/montage-gates.md +84 -0
- package/dist/skills/opengame-montage-review-and-improve/references/montage-genres.md +198 -0
- package/dist/skills/opengame-montage-review-and-improve/references/montage-grammar.md +320 -0
- package/dist/skills/opengame-montage-review-and-improve/references/montage-ops.md +127 -0
- package/dist/skills/opengame-montage-review-and-improve/references/og-snipers-record.md +110 -0
- package/dist/skills/opengame-montage-review-and-improve/references/owner-eye.md +214 -0
- package/dist/skills/opengame-montage-review-and-improve/references/reference-study.md +293 -0
- package/dist/skills/opengame-montage-review-and-improve/references/song.md +64 -0
- package/dist/skills/opengame-multiplayer/CHANGELOG.md +15 -0
- package/dist/skills/opengame-multiplayer/SKILL.md +143 -0
- package/dist/skills/opengame-multiplayer/references/bot-lobbies.md +71 -0
- package/dist/skills/opengame-multiplayer/references/netcode.md +165 -0
- package/dist/skills/opengame-performance/CHANGELOG.md +8 -0
- package/dist/skills/opengame-performance/SKILL.md +106 -65
- package/dist/skills/opengame-performance/helpers/landing-pacer.mjs +86 -0
- package/dist/skills/opengame-performance/references/measuring.md +51 -0
- package/dist/skills/opengame-performance/references/webgpu.md +86 -0
- package/dist/skills/opengame-production/CHANGELOG.md +13 -0
- package/dist/skills/opengame-production/SKILL.md +119 -54
- package/dist/skills/opengame-production/references/team.md +107 -0
- package/dist/skills/opengame-production/references/templates.md +106 -16
- package/dist/skills/opengame-quality-bar/CHANGELOG.md +10 -0
- package/dist/skills/opengame-quality-bar/SKILL.md +94 -42
- package/dist/skills/opengame-quality-bar/references/cheap-tells.md +14 -7
- package/dist/skills/opengame-quality-bar/references/judges.md +95 -0
- package/dist/skills/opengame-quality-bar/references/review-prompt.md +10 -5
- package/dist/skills/opengame-rhythm/CHANGELOG.md +5 -0
- package/dist/skills/opengame-rhythm/SKILL.md +138 -0
- package/dist/skills/opengame-rhythm/references/charting.md +109 -0
- package/dist/skills/opengame-rhythm/references/timing.md +92 -0
- package/dist/skills/opengame-router/CHANGELOG.md +8 -0
- package/dist/skills/opengame-router/SKILL.md +14 -7
- package/dist/skills/opengame-scene-audit/CHANGELOG.md +15 -0
- package/dist/skills/opengame-scene-audit/SKILL.md +64 -47
- package/dist/skills/opengame-scene-audit/helpers/scene-audit.js +97 -19
- package/dist/skills/opengame-sdk/CHANGELOG.md +12 -0
- package/dist/skills/opengame-sdk/SKILL.md +26 -9
- package/dist/skills/opengame-sdk/references/engines.md +2 -2
- package/dist/skills/opengame-sdk/references/identity.md +10 -11
- package/dist/skills/opengame-stability/CHANGELOG.md +4 -0
- package/dist/skills/opengame-stability/SKILL.md +59 -27
- package/dist/skills/opengame-trailer-make/CHANGELOG.md +5 -0
- package/dist/skills/opengame-trailer-make/SKILL.md +164 -0
- package/dist/skills/opengame-trailer-make/references/archetypes.md +113 -0
- package/dist/skills/opengame-trailer-make/references/briefs.md +273 -0
- package/dist/skills/opengame-trailer-make/references/core.md +129 -0
- package/dist/skills/opengame-trailer-make/references/craft.md +299 -0
- package/dist/skills/opengame-trailer-make/references/edge-cases.md +27 -0
- package/dist/skills/opengame-trailer-make/references/filmable.md +244 -0
- package/dist/skills/opengame-trailer-make/references/finishing.md +126 -0
- package/dist/skills/opengame-trailer-make/references/gates.md +184 -0
- package/dist/skills/opengame-trailer-make/references/measure.md +282 -0
- package/dist/skills/opengame-trailer-make/references/music.md +148 -0
- package/dist/skills/opengame-trailer-make/references/og-clash-record.md +133 -0
- package/dist/skills/opengame-trailer-make/references/ops.md +154 -0
- package/dist/skills/opengame-trailer-make/references/owner-eye.md +214 -0
- package/dist/skills/opengame-trailer-make/references/review.md +141 -0
- package/dist/skills/opengame-trailer-make/references/title.md +92 -0
- package/dist/skills/opengame-trailer-plan/CHANGELOG.md +5 -0
- package/dist/skills/opengame-trailer-plan/SKILL.md +176 -0
- package/dist/skills/opengame-trailer-plan/references/archetypes.md +113 -0
- package/dist/skills/opengame-trailer-plan/references/briefs.md +273 -0
- package/dist/skills/opengame-trailer-plan/references/core.md +129 -0
- package/dist/skills/opengame-trailer-plan/references/craft.md +299 -0
- package/dist/skills/opengame-trailer-plan/references/edge-cases.md +27 -0
- package/dist/skills/opengame-trailer-plan/references/filmable.md +244 -0
- package/dist/skills/opengame-trailer-plan/references/finishing.md +126 -0
- package/dist/skills/opengame-trailer-plan/references/gates.md +184 -0
- package/dist/skills/opengame-trailer-plan/references/measure.md +282 -0
- package/dist/skills/opengame-trailer-plan/references/music.md +148 -0
- package/dist/skills/opengame-trailer-plan/references/og-clash-record.md +133 -0
- package/dist/skills/opengame-trailer-plan/references/ops.md +154 -0
- package/dist/skills/opengame-trailer-plan/references/owner-eye.md +214 -0
- package/dist/skills/opengame-trailer-plan/references/reference-set.md +92 -0
- package/dist/skills/opengame-trailer-plan/references/review.md +141 -0
- package/dist/skills/opengame-trailer-plan/references/title.md +92 -0
- package/dist/skills/opengame-trailer-review-and-improve/CHANGELOG.md +5 -0
- package/dist/skills/opengame-trailer-review-and-improve/SKILL.md +145 -0
- package/dist/skills/opengame-trailer-review-and-improve/references/archetypes.md +113 -0
- package/dist/skills/opengame-trailer-review-and-improve/references/briefs.md +273 -0
- package/dist/skills/opengame-trailer-review-and-improve/references/core.md +129 -0
- package/dist/skills/opengame-trailer-review-and-improve/references/craft.md +299 -0
- package/dist/skills/opengame-trailer-review-and-improve/references/edge-cases.md +27 -0
- package/dist/skills/opengame-trailer-review-and-improve/references/filmable.md +244 -0
- package/dist/skills/opengame-trailer-review-and-improve/references/finishing.md +126 -0
- package/dist/skills/opengame-trailer-review-and-improve/references/gates.md +184 -0
- package/dist/skills/opengame-trailer-review-and-improve/references/measure.md +282 -0
- package/dist/skills/opengame-trailer-review-and-improve/references/music.md +148 -0
- package/dist/skills/opengame-trailer-review-and-improve/references/og-clash-record.md +133 -0
- package/dist/skills/opengame-trailer-review-and-improve/references/ops.md +154 -0
- package/dist/skills/opengame-trailer-review-and-improve/references/owner-eye.md +214 -0
- package/dist/skills/opengame-trailer-review-and-improve/references/review.md +141 -0
- package/dist/skills/opengame-trailer-review-and-improve/references/title.md +92 -0
- package/dist/skills/opengame-verification/CHANGELOG.md +11 -0
- package/dist/skills/opengame-verification/SKILL.md +113 -48
- package/dist/skills/opengame-weapons/CHANGELOG.md +11 -0
- package/dist/skills/opengame-weapons/SKILL.md +129 -55
- package/dist/skills/opengame-weapons/references/handling-numbers.md +42 -0
- package/dist/skills/opengame-weapons/references/reloads-and-hands.md +96 -0
- package/dist/skills/opengame-weapons/references/sights-and-scopes.md +98 -0
- package/dist/skills/opengame-weapons/references/threejs.md +71 -0
- package/dist/skills/opengame-world-physics/CHANGELOG.md +9 -0
- package/dist/skills/opengame-world-physics/SKILL.md +55 -24
- package/dist/skills/opengame-world-physics/references/measured-failures.md +28 -1
- package/package.json +1 -1
package/dist/skills/opengame-all-in-one/references/opengame-scene-audit/helpers/scene-audit.js
ADDED
|
@@ -0,0 +1,677 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A geometry audit for a 3D game scene: floating props, buried props, solids driven
|
|
3
|
+
* through each other, coplanar faces that z-fight, visible solids with no collider,
|
|
4
|
+
* colliders with nothing drawn (invisible walls), and a walk bot that climbs every
|
|
5
|
+
* staircase holding forward only. No GPU, no browser.
|
|
6
|
+
*
|
|
7
|
+
* Copy this file into the game and feed it the scene the game actually builds:
|
|
8
|
+
*
|
|
9
|
+
* import { runSceneAudit, fromThreeScene } from "./scene-audit.js";
|
|
10
|
+
* const scene = fromThreeScene(THREE, world, { colliders: collisionBoxes });
|
|
11
|
+
* scene.routes = [{ name: "west stairs", from: [2, 0, 8], to: [2, 3, -4] }];
|
|
12
|
+
* const report = runSceneAudit(scene);
|
|
13
|
+
* console.log(formatReport(report));
|
|
14
|
+
* if (!report.ok) process.exitCode = 1;
|
|
15
|
+
*
|
|
16
|
+
* Or describe the scene directly. A part is an axis-aligned box in world metres:
|
|
17
|
+
* { id, min: [x, y, z], max: [x, y, z], solid, collider, nocollide, hangs, group, prop }
|
|
18
|
+
* solid opaque volume a body should not pass through (default true)
|
|
19
|
+
* collider true when the game's collision layer blocks it
|
|
20
|
+
* nocollide a reason it is deliberately walk-through ("foliage", "decal")
|
|
21
|
+
* hangs a reason it is held up by design ("lamp on a wire")
|
|
22
|
+
* group parts emitted together as one object; they may touch and overlap
|
|
23
|
+
* triangles optional [[ax,ay,az, bx,by,bz, cx,cy,cz], ...] for the coplanar check;
|
|
24
|
+
* boxes without triangles contribute their six faces
|
|
25
|
+
* gridStep the step of the vertex grid this part is shipped on, in metres, when the
|
|
26
|
+
* format quantises positions; faces within two steps of one plane tie
|
|
27
|
+
* plus `colliders` (boxes the controller collides with, each optionally carrying
|
|
28
|
+
* `nodraw`: a reason the player can see why it stops them, such as "fence line"),
|
|
29
|
+
* `ramps` (invisible stair ramps), `groundY` (a number or a function of x and z),
|
|
30
|
+
* `floors` (walkable heights) and `routes` for the walk bot.
|
|
31
|
+
*
|
|
32
|
+
* EVERY CHECK PLANTS A DEFECT FIRST. Before measuring the real scene, each check runs on
|
|
33
|
+
* a copy with a known defect placed at a site it chooses from the real scene, and the
|
|
34
|
+
* audit fails if the defect is not found. A check that examined nothing also fails.
|
|
35
|
+
* Both rules exist because an audit that cannot fail reports the same clean zero as a
|
|
36
|
+
* clean scene: one coplanar audit in our own games clipped triangles with inverted
|
|
37
|
+
* winding and measured 0 m² on every prop, including one with 0.4 m² of z-fighting.
|
|
38
|
+
*
|
|
39
|
+
* Default tolerances are World at War's map-coherence reference configuration, measured
|
|
40
|
+
* for a human-scale shooter in metres. Pass `tolerances` to change them for your scale.
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
export const TOLERANCES = Object.freeze({
|
|
44
|
+
floatTol: 0.12, // a base this far above its support is floating
|
|
45
|
+
contactTol: 0.08, // parts this close are touching
|
|
46
|
+
sinkTol: 0.25, // a prop's base this far below the ground is buried
|
|
47
|
+
propScale: 2.5, // larger than this in plan or height is structure, not a prop
|
|
48
|
+
penVolume: 0.02, // overlaps smaller than this many cubic metres are rounding
|
|
49
|
+
penFraction: 0.2, // a fifth of the smaller part inside the other
|
|
50
|
+
penSlack: 0.05, // slack on "deeper than the thinner part"
|
|
51
|
+
zEps: 0.002, // faces closer than this to one plane have no depth winner
|
|
52
|
+
gridStep: 0, // shipped vertex grid for every part; two steps widen zEps
|
|
53
|
+
zArea: 0.02, // overlap smaller than this many square metres is not visible
|
|
54
|
+
invisibleShare: 0.25, // a quarter of a collider with nothing drawn in it is a wall
|
|
55
|
+
bodyRadius: 0.35, bodyHeight: 1.8, stepHeight: 0.42, walkSpeed: 4.9,
|
|
56
|
+
stuckSeconds: 1.0, routeSeconds: 30,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
/* ----------------------------------------------------------------- geometry basics */
|
|
60
|
+
|
|
61
|
+
const sizeOf = (p, axis) => p.max[axis] - p.min[axis];
|
|
62
|
+
const volumeOf = (p) => sizeOf(p, 0) * sizeOf(p, 1) * sizeOf(p, 2);
|
|
63
|
+
const centre = (p) => [0, 1, 2].map((a) => (p.min[a] + p.max[a]) / 2);
|
|
64
|
+
function overlap1(a, b, axis) { return Math.min(a.max[axis], b.max[axis]) - Math.max(a.min[axis], b.min[axis]); }
|
|
65
|
+
function boxGap(a, b) {
|
|
66
|
+
let d2 = 0;
|
|
67
|
+
for (let axis = 0; axis < 3; axis++) { const gap = -overlap1(a, b, axis); if (gap > 0) d2 += gap * gap; }
|
|
68
|
+
return Math.sqrt(d2);
|
|
69
|
+
}
|
|
70
|
+
const footprintsOverlap = (a, b) => overlap1(a, b, 0) > 0 && overlap1(a, b, 2) > 0;
|
|
71
|
+
const isSolid = (p) => p.solid !== false;
|
|
72
|
+
const lowestBase = new WeakMap();
|
|
73
|
+
/**
|
|
74
|
+
* The ground under a point: `scene.groundY` as a number or a function of x and z. A
|
|
75
|
+
* scene that gives neither is grounded at its lowest solid base, which is the world's
|
|
76
|
+
* own floor in any scene built on one.
|
|
77
|
+
*/
|
|
78
|
+
function groundAt(scene, x, z) {
|
|
79
|
+
if (typeof scene.groundY === "function") return scene.groundY(x, z);
|
|
80
|
+
if (typeof scene.groundY === "number") return scene.groundY;
|
|
81
|
+
if (!lowestBase.has(scene)) {
|
|
82
|
+
const bases = scene.parts.filter((p) => p.visible !== false && p.solid !== false).map((p) => p.min[1]);
|
|
83
|
+
lowestBase.set(scene, bases.length ? Math.min(...bases) : null);
|
|
84
|
+
}
|
|
85
|
+
return lowestBase.get(scene);
|
|
86
|
+
}
|
|
87
|
+
const site = (p) => centre(p).map((v) => Math.round(v * 100) / 100);
|
|
88
|
+
|
|
89
|
+
/** The six faces of a box as twelve triangles, outward facing. */
|
|
90
|
+
export function boxTriangles(p) {
|
|
91
|
+
const [x0, y0, z0] = p.min, [x1, y1, z1] = p.max;
|
|
92
|
+
const quads = [
|
|
93
|
+
[[x1, y0, z0], [x1, y1, z0], [x1, y1, z1], [x1, y0, z1]], [[x0, y0, z1], [x0, y1, z1], [x0, y1, z0], [x0, y0, z0]],
|
|
94
|
+
[[x0, y1, z0], [x0, y1, z1], [x1, y1, z1], [x1, y1, z0]], [[x0, y0, z1], [x0, y0, z0], [x1, y0, z0], [x1, y0, z1]],
|
|
95
|
+
[[x1, y0, z1], [x1, y1, z1], [x0, y1, z1], [x0, y0, z1]], [[x0, y0, z0], [x0, y1, z0], [x1, y1, z0], [x1, y0, z0]],
|
|
96
|
+
];
|
|
97
|
+
return quads.flatMap(([a, b, c, d]) => [[...a, ...b, ...c], [...a, ...c, ...d]]);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* ------------------------------------------------------------------ the checks */
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* float: a part whose base hangs above whatever is under it and which is not, through
|
|
104
|
+
* any chain of contact, standing on the ground. "Attached" is derived from contact, not
|
|
105
|
+
* named, and contact only counts when it leads to the ground: two crates touching each
|
|
106
|
+
* other in mid-air do not hold each other up.
|
|
107
|
+
*/
|
|
108
|
+
export function checkFloat(scene, tol = TOLERANCES) {
|
|
109
|
+
const parts = scene.parts.filter((p) => p.visible !== false);
|
|
110
|
+
const judged = parts.filter((p) => !p.hangs);
|
|
111
|
+
const surfaceUnder = (p) => {
|
|
112
|
+
const [cx, , cz] = centre(p);
|
|
113
|
+
let best = groundAt(scene, cx, cz);
|
|
114
|
+
for (const floor of scene.floors ?? []) if (floor <= p.min[1] + tol.floatTol && (best === null || floor > best)) best = floor;
|
|
115
|
+
for (const q of parts) {
|
|
116
|
+
if (q === p || !footprintsOverlap(p, q) || q.max[1] > p.min[1] + tol.contactTol) continue;
|
|
117
|
+
if (best === null || q.max[1] > best) best = q.max[1];
|
|
118
|
+
}
|
|
119
|
+
return best;
|
|
120
|
+
};
|
|
121
|
+
// Seed only from the ground and published floors. Seeding from "the top of whatever
|
|
122
|
+
// is under me" lets two crates in mid-air hold each other up for ever.
|
|
123
|
+
const grounded = new Set(parts.filter((p) => p.hangs));
|
|
124
|
+
for (const p of judged) {
|
|
125
|
+
const [cx, , cz] = centre(p);
|
|
126
|
+
const levels = [groundAt(scene, cx, cz), ...(scene.floors ?? [])].filter((y) => y !== null);
|
|
127
|
+
if (levels.some((y) => Math.abs(p.min[1] - y) <= tol.floatTol || (p.min[1] < y && p.max[1] > y))) grounded.add(p);
|
|
128
|
+
}
|
|
129
|
+
// Spread support through contact until nothing changes.
|
|
130
|
+
let changed = true;
|
|
131
|
+
while (changed) {
|
|
132
|
+
changed = false;
|
|
133
|
+
for (const p of judged) {
|
|
134
|
+
if (grounded.has(p)) continue;
|
|
135
|
+
for (const q of grounded) if (boxGap(p, q) <= tol.contactTol) { grounded.add(p); changed = true; break; }
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
const findings = judged.filter((p) => !grounded.has(p)).map((p) => {
|
|
139
|
+
const under = surfaceUnder(p);
|
|
140
|
+
const gap = under === null ? null : p.min[1] - under;
|
|
141
|
+
return { id: p.id, at: site(p), why: gap === null ? "nothing under it and touching nothing that reaches the ground" : `base is ${gap.toFixed(3)} m above the surface under it and nothing holds it up` };
|
|
142
|
+
});
|
|
143
|
+
return { name: "float", examined: judged.length, findings };
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const isProp = (p, tol) => p.prop ?? (Math.max(sizeOf(p, 0), sizeOf(p, 1), sizeOf(p, 2)) <= tol.propScale);
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* buried: a prop whose base sits well under the floor it stands on while its top still
|
|
150
|
+
* stands proud. The floor is the ground, or the highest structure (anything larger than
|
|
151
|
+
* a prop) under the prop's centre whose top is below the prop's top. A part sunk deeper
|
|
152
|
+
* than it is tall, or a large one, is a footing or a foundation, which is what those
|
|
153
|
+
* are for, and is not judged.
|
|
154
|
+
*/
|
|
155
|
+
export function checkBuried(scene, tol = TOLERANCES) {
|
|
156
|
+
const solids = scene.parts.filter((p) => p.visible !== false && isSolid(p));
|
|
157
|
+
const structure = solids.filter((p) => !isProp(p, tol));
|
|
158
|
+
const findings = [];
|
|
159
|
+
let examined = 0;
|
|
160
|
+
for (const p of solids) {
|
|
161
|
+
if (!isProp(p, tol)) continue;
|
|
162
|
+
const [cx, , cz] = centre(p);
|
|
163
|
+
let floor = groundAt(scene, cx, cz);
|
|
164
|
+
if (floor !== null && floor > p.max[1]) floor = null;
|
|
165
|
+
for (const q of structure) {
|
|
166
|
+
if (q === p || cx < q.min[0] || cx > q.max[0] || cz < q.min[2] || cz > q.max[2] || q.max[1] > p.max[1]) continue;
|
|
167
|
+
if (floor === null || q.max[1] > floor) floor = q.max[1];
|
|
168
|
+
}
|
|
169
|
+
if (floor === null) continue;
|
|
170
|
+
examined++;
|
|
171
|
+
const depth = floor - p.min[1];
|
|
172
|
+
if (depth > tol.sinkTol && depth < sizeOf(p, 1)) findings.push({ id: p.id, at: site(p), why: `base is ${depth.toFixed(3)} m under the floor it stands on` });
|
|
173
|
+
}
|
|
174
|
+
return { name: "buried", examined, findings };
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* interpenetration: two solids sharing volume, judged two ways because each misses
|
|
179
|
+
* what the other sees. Depth past the thinner part's own thickness catches a wall
|
|
180
|
+
* through a wall; a fraction of the smaller part catches two equal crates inside each
|
|
181
|
+
* other, which depth alone never can.
|
|
182
|
+
*/
|
|
183
|
+
export function checkInterpenetration(scene, tol = TOLERANCES) {
|
|
184
|
+
const solids = scene.parts.filter((p) => p.visible !== false && isSolid(p) && volumeOf(p) > 0).sort((a, b) => a.min[0] - b.min[0]);
|
|
185
|
+
const findings = [];
|
|
186
|
+
let examined = 0;
|
|
187
|
+
for (let i = 0; i < solids.length; i++) {
|
|
188
|
+
const a = solids[i];
|
|
189
|
+
for (let j = i + 1; j < solids.length && solids[j].min[0] < a.max[0]; j++) {
|
|
190
|
+
const b = solids[j];
|
|
191
|
+
if (a.group !== undefined && a.group === b.group) continue;
|
|
192
|
+
examined++;
|
|
193
|
+
// A prop entering a structure through its top surface is standing in it, which is
|
|
194
|
+
// the buried check's question, not this one's.
|
|
195
|
+
const [big, small] = volumeOf(a) >= volumeOf(b) ? [a, b] : [b, a];
|
|
196
|
+
if (!isProp(big, tol) && small.max[1] > big.max[1] && small.min[1] >= big.min[1]) continue;
|
|
197
|
+
const ox = overlap1(a, b, 0), oy = overlap1(a, b, 1), oz = overlap1(a, b, 2);
|
|
198
|
+
if (ox <= 0 || oy <= 0 || oz <= 0) continue;
|
|
199
|
+
const shared = ox * oy * oz;
|
|
200
|
+
if (shared < tol.penVolume) continue;
|
|
201
|
+
const smaller = Math.min(volumeOf(a), volumeOf(b));
|
|
202
|
+
const thinner = Math.min(...[0, 1, 2].map((axis) => Math.min(sizeOf(a, axis), sizeOf(b, axis))));
|
|
203
|
+
const depth = Math.min(ox, oy, oz);
|
|
204
|
+
const fraction = shared / smaller;
|
|
205
|
+
if (fraction > tol.penFraction || depth > thinner + tol.penSlack) {
|
|
206
|
+
findings.push({ id: `${a.id} + ${b.id}`, at: site({ min: [0, 1, 2].map((k) => Math.max(a.min[k], b.min[k])), max: [0, 1, 2].map((k) => Math.min(a.max[k], b.max[k])) }),
|
|
207
|
+
why: `${shared.toFixed(3)} m³ shared, ${(fraction * 100).toFixed(0)}% of the smaller part` });
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return { name: "interpenetration", examined, findings };
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/* coplanar faces --------------------------------------------------------------- */
|
|
215
|
+
|
|
216
|
+
function triNormal(t) {
|
|
217
|
+
const ux = t[3] - t[0], uy = t[4] - t[1], uz = t[5] - t[2], vx = t[6] - t[0], vy = t[7] - t[1], vz = t[8] - t[2];
|
|
218
|
+
const nx = uy * vz - uz * vy, ny = uz * vx - ux * vz, nz = ux * vy - uy * vx;
|
|
219
|
+
const len = Math.hypot(nx, ny, nz);
|
|
220
|
+
return len < 1e-12 ? null : [nx / len, ny / len, nz / len, len / 2];
|
|
221
|
+
}
|
|
222
|
+
/** Projects a triangle onto the plane's two largest axes, wound counter-clockwise. */
|
|
223
|
+
function project(t, n) {
|
|
224
|
+
const drop = Math.abs(n[0]) > Math.abs(n[1]) ? (Math.abs(n[0]) > Math.abs(n[2]) ? 0 : 2) : (Math.abs(n[1]) > Math.abs(n[2]) ? 1 : 2);
|
|
225
|
+
const [u, v] = [0, 1, 2].filter((a) => a !== drop);
|
|
226
|
+
const pts = [[t[u], t[v]], [t[3 + u], t[3 + v]], [t[6 + u], t[6 + v]]];
|
|
227
|
+
return area2(pts) < 0 ? pts.reverse() : pts;
|
|
228
|
+
}
|
|
229
|
+
function area2(poly) { let s = 0; for (let i = 0; i < poly.length; i++) { const [x0, y0] = poly[i], [x1, y1] = poly[(i + 1) % poly.length]; s += x0 * y1 - x1 * y0; } return s / 2; }
|
|
230
|
+
/** Sutherland-Hodgman: the part of `subject` inside the convex counter-clockwise `clip`. */
|
|
231
|
+
function clipPolygon(subject, clip) {
|
|
232
|
+
let output = subject;
|
|
233
|
+
for (let i = 0; i < clip.length && output.length; i++) {
|
|
234
|
+
const [ax, ay] = clip[i], [bx, by] = clip[(i + 1) % clip.length];
|
|
235
|
+
const inside = ([x, y]) => (bx - ax) * (y - ay) - (by - ay) * (x - ax) >= 0;
|
|
236
|
+
const input = output; output = [];
|
|
237
|
+
for (let j = 0; j < input.length; j++) {
|
|
238
|
+
const p = input[j], q = input[(j + 1) % input.length];
|
|
239
|
+
const pin = inside(p), qin = inside(q);
|
|
240
|
+
if (pin) output.push(p);
|
|
241
|
+
if (pin !== qin) {
|
|
242
|
+
const [px, py] = p, [qx, qy] = q;
|
|
243
|
+
const den = (bx - ax) * (qy - py) - (by - ay) * (qx - px);
|
|
244
|
+
if (Math.abs(den) > 1e-15) {
|
|
245
|
+
const s = ((bx - ax) * (ay - py) - (by - ay) * (ax - px)) / den;
|
|
246
|
+
output.push([px + s * (qx - px), py + s * (qy - py)]);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return output;
|
|
252
|
+
}
|
|
253
|
+
export function overlapArea(t1, t2, n) {
|
|
254
|
+
const poly = clipPolygon(project(t1, n), project(t2, n));
|
|
255
|
+
if (poly.length < 3) return 0;
|
|
256
|
+
// Projection onto an axis plane shrinks area by |n . axis|; undo it.
|
|
257
|
+
const scale = Math.max(Math.abs(n[0]), Math.abs(n[1]), Math.abs(n[2]));
|
|
258
|
+
return Math.abs(area2(poly)) / scale;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* coplanar: two opaque faces in one plane, facing the same way, overlapping. Neither
|
|
263
|
+
* wins the depth test, so the seam crawls as the camera moves. Opposite-facing pairs
|
|
264
|
+
* are ignored (only one can face the camera) and so is a down-facing face lying on a
|
|
265
|
+
* floor (an underside nobody sees). Faces of one part are compared with faces of other
|
|
266
|
+
* parts only: inside one mesh, a quad's two triangles share an edge and overlap by zero.
|
|
267
|
+
*/
|
|
268
|
+
export function checkCoplanar(scene, tol = TOLERANCES) {
|
|
269
|
+
const faces = [];
|
|
270
|
+
// A format that stores positions on a grid rounds faces closer than a step or two
|
|
271
|
+
// into one plane, so "within 2 mm" passes real ties on a coarse grid. The pair's
|
|
272
|
+
// tolerance is two steps of the coarser of its two grids, or zEps if that is larger.
|
|
273
|
+
const stepOf = (p) => Math.max(tol.gridStep ?? 0, p.gridStep ?? 0);
|
|
274
|
+
let eps = tol.zEps;
|
|
275
|
+
for (const p of scene.parts) eps = Math.max(eps, 2 * stepOf(p));
|
|
276
|
+
const pairEps = (f, g) => Math.max(tol.zEps, 2 * Math.max(f.step, g.step));
|
|
277
|
+
for (const p of scene.parts) {
|
|
278
|
+
if (p.visible === false || !isSolid(p) || p.decal) continue;
|
|
279
|
+
for (const t of p.triangles ?? boxTriangles(p)) {
|
|
280
|
+
const n = triNormal(t);
|
|
281
|
+
if (!n) continue;
|
|
282
|
+
const d = n[0] * t[0] + n[1] * t[1] + n[2] * t[2];
|
|
283
|
+
if (n[1] < -0.999 && (scene.floors ?? [groundAt(scene, t[0], t[2])]).some((f) => f !== null && Math.abs(-d - f) < Math.max(tol.zEps, 2 * stepOf(p)))) continue;
|
|
284
|
+
faces.push({ part: p.id, group: p.group, step: stepOf(p), t, n, d, min: [0, 1, 2].map((a) => Math.min(t[a], t[3 + a], t[6 + a])), max: [0, 1, 2].map((a) => Math.max(t[a], t[3 + a], t[6 + a])) });
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
const bins = new Map();
|
|
288
|
+
const keyOf = (f, slot) => `${Math.round(f.n[0] * 1000)},${Math.round(f.n[1] * 1000)},${Math.round(f.n[2] * 1000)},${slot}`;
|
|
289
|
+
for (const f of faces) {
|
|
290
|
+
const slot = Math.floor(f.d / eps);
|
|
291
|
+
const key = keyOf(f, slot);
|
|
292
|
+
if (!bins.has(key)) bins.set(key, []);
|
|
293
|
+
bins.get(key).push(f);
|
|
294
|
+
}
|
|
295
|
+
const pairs = new Map();
|
|
296
|
+
let examined = 0;
|
|
297
|
+
for (const f of faces) {
|
|
298
|
+
const slot = Math.floor(f.d / eps);
|
|
299
|
+
for (const s of [slot, slot + 1]) {
|
|
300
|
+
for (const g of bins.get(keyOf(f, s)) ?? []) {
|
|
301
|
+
if (g === f || g.part === f.part || (f.group !== undefined && f.group === g.group)) continue;
|
|
302
|
+
if (s === slot && g.part < f.part) continue; // count each cross-part pair once
|
|
303
|
+
const within = pairEps(f, g);
|
|
304
|
+
if (f.n[0] * g.n[0] + f.n[1] * g.n[1] + f.n[2] * g.n[2] < 0.9999 || Math.abs(f.d - g.d) > within) continue;
|
|
305
|
+
let apart = false;
|
|
306
|
+
for (let a = 0; a < 3; a++) if (f.min[a] > g.max[a] + within || g.min[a] > f.max[a] + within) { apart = true; break; }
|
|
307
|
+
if (apart) continue;
|
|
308
|
+
examined++;
|
|
309
|
+
const area = overlapArea(f.t, g.t, f.n);
|
|
310
|
+
if (area <= 0) continue;
|
|
311
|
+
const key = [f.part, g.part].sort().join(" + ");
|
|
312
|
+
const entry = pairs.get(key) ?? { area: 0, at: f.t.slice(0, 3) };
|
|
313
|
+
entry.area += area;
|
|
314
|
+
pairs.set(key, entry);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
const findings = [...pairs].filter(([, e]) => e.area > tol.zArea).map(([id, e]) => ({ id, at: e.at.map((v) => Math.round(v * 100) / 100), area: e.area, why: `${e.area.toFixed(3)} m² of same-facing faces in one plane` }));
|
|
319
|
+
return { name: "coplanar", examined: faces.length, pairsCompared: examined, findings, area: findings.reduce((sum, f) => sum + f.area, 0) };
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/** Visible solids that no collider covers and that give no reason for it. */
|
|
323
|
+
export function uncollided(scene) {
|
|
324
|
+
const colliders = scene.colliders ?? scene.parts.filter((p) => p.collider);
|
|
325
|
+
const ramps = scene.ramps ?? [];
|
|
326
|
+
const covered = (p) => p.collider === true
|
|
327
|
+
|| colliders.some((c) => [0, 1, 2].every((a) => c.min[a] <= p.min[a] + 0.05 && c.max[a] >= p.max[a] - 0.05))
|
|
328
|
+
|| ramps.some((r) => r.min[0] <= p.min[0] + 0.05 && r.max[0] >= p.max[0] - 0.05 && r.min[2] <= p.min[2] + 0.05 && r.max[2] >= p.max[2] - 0.05);
|
|
329
|
+
return scene.parts.filter((p) => p.visible !== false && isSolid(p) && !p.nocollide && !covered(p));
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/** colliders: every visible solid either blocks a body or says why it does not. */
|
|
333
|
+
export function checkColliders(scene) {
|
|
334
|
+
const examined = scene.parts.filter((p) => p.visible !== false && isSolid(p)).length;
|
|
335
|
+
const findings = uncollided(scene).map((p) => ({ id: p.id, at: site(p), why: "drawn solid with no collider and no nocollide reason: a body walks through it" }));
|
|
336
|
+
return { name: "colliders", examined, findings };
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* invisible: the other direction. A collider with nothing drawn where it blocks is an
|
|
341
|
+
* invisible wall, and in our games it was the more repeated complaint of the two: one
|
|
342
|
+
* shooter's owner reported invisible walls in at least sixteen messages over ten days,
|
|
343
|
+
* one of them two hours after a removal was reported done. A collider counts as drawn where it
|
|
344
|
+
* lies inside a visible part that is neither walk-through (`nocollide`) nor a decal, so
|
|
345
|
+
* a collider over nothing but foliage is reported too. Collision under the ground is
|
|
346
|
+
* not judged: the share is of the part above ground, which is the part a body meets. A
|
|
347
|
+
* blocker the player can see the reason for (a fence line, a cliff edge) says so with
|
|
348
|
+
* `nodraw`. A flat collider (an invisible lid over a roof) is judged as if it had a thin
|
|
349
|
+
* thickness, so a sheet with no volume is still reported.
|
|
350
|
+
*
|
|
351
|
+
* Box level only: each part is its bounding box. An L-shaped mesh's box hides a collider
|
|
352
|
+
* in its empty corner, and a whole-map merged mesh or a terrain mesh read as one box
|
|
353
|
+
* hides every collider under its top, so split those into chunks (or leave terrain to
|
|
354
|
+
* `groundY`) before trusting a zero here. Run a ray sweep in the engine for the rest.
|
|
355
|
+
*/
|
|
356
|
+
export function checkInvisible(scene, tol = TOLERANCES) {
|
|
357
|
+
const colliders = scene.colliders ?? scene.parts.filter((p) => p.collider);
|
|
358
|
+
const drawn = scene.parts.filter((p) => p.visible !== false && !p.nocollide && !p.decal);
|
|
359
|
+
const m = tol.contactTol, n = 4, thin = 0.05;
|
|
360
|
+
const inside = (p, x, y, z) => x >= p.min[0] - m && x <= p.max[0] + m && y >= p.min[1] - m && y <= p.max[1] + m && z >= p.min[2] - m && z <= p.max[2] + m;
|
|
361
|
+
const findings = [];
|
|
362
|
+
colliders.forEach((c, i) => {
|
|
363
|
+
if (typeof c.nodraw === "string" && c.nodraw.trim()) return;
|
|
364
|
+
let empty = 0, above = 0;
|
|
365
|
+
for (let ix = 0; ix < n; ix++) for (let iy = 0; iy < n; iy++) for (let iz = 0; iz < n; iz++) {
|
|
366
|
+
const x = c.min[0] + ((ix + 0.5) / n) * sizeOf(c, 0), y = c.min[1] + ((iy + 0.5) / n) * sizeOf(c, 1), z = c.min[2] + ((iz + 0.5) / n) * sizeOf(c, 2);
|
|
367
|
+
const ground = groundAt(scene, x, z);
|
|
368
|
+
if (ground !== null && y <= ground) continue;
|
|
369
|
+
above++;
|
|
370
|
+
if (!drawn.some((p) => inside(p, x, y, z))) empty++;
|
|
371
|
+
}
|
|
372
|
+
if (above === 0) return;
|
|
373
|
+
const share = empty / above;
|
|
374
|
+
const volume = [0, 1, 2].reduce((v, a) => v * Math.max(sizeOf(c, a), thin), 1) * (empty / n ** 3);
|
|
375
|
+
if (share > tol.invisibleShare && volume > tol.penVolume) {
|
|
376
|
+
findings.push({ id: c.id ?? `collider${i}`, at: site(c), why: `${Math.round(share * 100)}% of this collider has nothing drawn in it and no nodraw reason: an invisible wall` });
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
return { name: "invisible", examined: colliders.length, findings };
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/* the walk bot ---------------------------------------------------------------- */
|
|
383
|
+
|
|
384
|
+
function rampHeight(ramp, x, z) {
|
|
385
|
+
if (x < ramp.min[0] || x > ramp.max[0] || z < ramp.min[2] || z > ramp.max[2]) return null;
|
|
386
|
+
const axis = ramp.axis === "x" ? 0 : 2, at = axis === 0 ? x : z;
|
|
387
|
+
let t = (at - ramp.min[axis]) / (ramp.max[axis] - ramp.min[axis]);
|
|
388
|
+
if (ramp.rises === "negative") t = 1 - t;
|
|
389
|
+
return ramp.min[1] + t * (ramp.max[1] - ramp.min[1]);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* A kinematic capsule driven with forward input only: no jump, ever. Support is the
|
|
394
|
+
* highest collider top or ramp surface under the body that is within one step of the
|
|
395
|
+
* feet; anything taller that overlaps the body blocks it, and the body slides along it.
|
|
396
|
+
*/
|
|
397
|
+
export function createWalker(scene, tol = TOLERANCES) {
|
|
398
|
+
const boxes = (scene.colliders ?? scene.parts.filter((p) => p.collider)).filter((c) => sizeOf(c, 1) > 0);
|
|
399
|
+
const ramps = scene.ramps ?? [];
|
|
400
|
+
const r = tol.bodyRadius;
|
|
401
|
+
const circleHitsBox = (x, z, c) => {
|
|
402
|
+
const nx = Math.max(c.min[0], Math.min(x, c.max[0])), nz = Math.max(c.min[2], Math.min(z, c.max[2]));
|
|
403
|
+
return (x - nx) ** 2 + (z - nz) ** 2 < r * r - 1e-9;
|
|
404
|
+
};
|
|
405
|
+
function support(x, z, feet) {
|
|
406
|
+
let best = null;
|
|
407
|
+
const ground = groundAt(scene, x, z);
|
|
408
|
+
if (ground !== null && ground <= feet + tol.stepHeight) best = ground;
|
|
409
|
+
for (const c of boxes) if (c.max[1] <= feet + tol.stepHeight + 1e-9 && circleHitsBox(x, z, c) && (best === null || c.max[1] > best)) best = c.max[1];
|
|
410
|
+
for (const ramp of ramps) {
|
|
411
|
+
const h = rampHeight(ramp, x, z);
|
|
412
|
+
if (h !== null && h <= feet + tol.stepHeight && (best === null || h > best)) best = h;
|
|
413
|
+
}
|
|
414
|
+
return best;
|
|
415
|
+
}
|
|
416
|
+
function blocked(x, z, feet) {
|
|
417
|
+
for (const c of boxes) {
|
|
418
|
+
if (c.max[1] <= feet + tol.stepHeight + 1e-9 || c.min[1] >= feet + tol.bodyHeight) continue;
|
|
419
|
+
if (circleHitsBox(x, z, c)) return true;
|
|
420
|
+
}
|
|
421
|
+
return false;
|
|
422
|
+
}
|
|
423
|
+
return {
|
|
424
|
+
support, blocked,
|
|
425
|
+
/** One fixed step toward `goal`. Returns the new position. */
|
|
426
|
+
step(pos, goal, dt) {
|
|
427
|
+
const dx = goal[0] - pos[0], dz = goal[2] - pos[2], dist = Math.hypot(dx, dz);
|
|
428
|
+
let [x, y, z] = pos;
|
|
429
|
+
if (dist > 1e-6) {
|
|
430
|
+
const travel = Math.min(dist, tol.walkSpeed * dt);
|
|
431
|
+
const substeps = Math.max(1, Math.ceil(travel / Math.max(0.05, r * 0.45)));
|
|
432
|
+
const sx = (dx / dist) * travel / substeps, sz = (dz / dist) * travel / substeps;
|
|
433
|
+
for (let i = 0; i < substeps; i++) {
|
|
434
|
+
for (const [mx, mz] of [[sx, sz], [sx, 0], [0, sz]]) {
|
|
435
|
+
const nx = x + mx, nz = z + mz;
|
|
436
|
+
const under = support(nx, nz, y);
|
|
437
|
+
if (blocked(nx, nz, y) || under === null) continue;
|
|
438
|
+
x = nx; z = nz;
|
|
439
|
+
// Step up onto the landing; fall at most one step per substep downhill.
|
|
440
|
+
y = under > y ? under : Math.max(under, y - tol.stepHeight);
|
|
441
|
+
break;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
const under = support(x, z, y);
|
|
446
|
+
if (under !== null && under < y) y = Math.max(under, y - 9.8 * dt);
|
|
447
|
+
return [x, y, z];
|
|
448
|
+
},
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/** Walks each route forward-only. A route passes when the body arrives without stalling. */
|
|
453
|
+
export function checkStairs(scene, tol = TOLERANCES) {
|
|
454
|
+
const routes = scene.routes ?? [];
|
|
455
|
+
const walker = createWalker(scene, tol);
|
|
456
|
+
const visibleUncollided = uncollided(scene);
|
|
457
|
+
const findings = [];
|
|
458
|
+
const dt = 1 / 60;
|
|
459
|
+
for (const route of routes) {
|
|
460
|
+
let pos = [...route.from];
|
|
461
|
+
let lastProgress = 0, best = Infinity, climbed = 0;
|
|
462
|
+
const goal = route.to;
|
|
463
|
+
let arrived = false;
|
|
464
|
+
// One finding per route and cause. The loop runs every frame, so half a second
|
|
465
|
+
// inside one uncollided wall was thirty identical findings, and formatReport's cap
|
|
466
|
+
// hid the different ones behind them.
|
|
467
|
+
const said = new Set();
|
|
468
|
+
const once = (why) => { if (!said.has(why)) { said.add(why); findings.push({ id: route.name, at: pos.map((v) => Math.round(v * 100) / 100), why }); } };
|
|
469
|
+
for (let time = 0; time < tol.routeSeconds; time += dt) {
|
|
470
|
+
const before = pos[1];
|
|
471
|
+
pos = walker.step(pos, goal, dt);
|
|
472
|
+
climbed = Math.max(climbed, pos[1] - route.from[1]);
|
|
473
|
+
if (pos[1] - before > tol.stepHeight + 1e-6) once("rose more than one step in a frame");
|
|
474
|
+
const remaining = Math.hypot(goal[0] - pos[0], goal[2] - pos[2]);
|
|
475
|
+
if (remaining < best - 0.05) { best = remaining; lastProgress = time; }
|
|
476
|
+
if (remaining < 0.25 && Math.abs(pos[1] - goal[1]) <= tol.stepHeight) { arrived = true; break; }
|
|
477
|
+
if (time - lastProgress > tol.stuckSeconds) break;
|
|
478
|
+
for (const p of visibleUncollided) {
|
|
479
|
+
if (pos[0] > p.min[0] && pos[0] < p.max[0] && pos[2] > p.min[2] && pos[2] < p.max[2] && pos[1] + 1 > p.min[1] && pos[1] < p.max[1]) {
|
|
480
|
+
once(`walked through ${p.id}, which is drawn solid and has no collider`);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
if (!arrived) findings.push({ id: route.name, at: pos.map((v) => Math.round(v * 100) / 100), why: `stuck holding forward with no jump, ${best.toFixed(2)} m short, after climbing ${climbed.toFixed(2)} m` });
|
|
485
|
+
}
|
|
486
|
+
return { name: "stairs", examined: routes.length, findings };
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/* ------------------------------------------------------------------- the plants */
|
|
490
|
+
|
|
491
|
+
const clone = (scene) => ({ ...scene, parts: scene.parts.map((p) => ({ ...p })), colliders: scene.colliders?.map((c) => ({ ...c })), ramps: scene.ramps?.map((r) => ({ ...r })), routes: scene.routes?.map((r) => ({ ...r })) });
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* Where a plant goes: open ground on the real scene, so a plant proves the check on
|
|
495
|
+
* this scene's own geometry. The site is the top of a grounded structure larger than a
|
|
496
|
+
* prop, with a clear column above it wide enough for every plant, searched on a grid.
|
|
497
|
+
* A plant that lands inside an existing prop proves nothing about the rule, so a site
|
|
498
|
+
* with anything in the column is skipped.
|
|
499
|
+
*/
|
|
500
|
+
function plantSite(scene, tol) {
|
|
501
|
+
const visible = scene.parts.filter((p) => p.visible !== false);
|
|
502
|
+
const floating = new Set(checkFloat(scene, tol).findings.map((f) => f.id));
|
|
503
|
+
const floors = visible.filter((p) => isSolid(p) && !p.hangs && !floating.has(p.id) && sizeOf(p, 0) > tol.propScale + 0.5 && sizeOf(p, 2) > tol.propScale + 0.5)
|
|
504
|
+
.sort((a, b) => sizeOf(b, 0) * sizeOf(b, 2) - sizeOf(a, 0) * sizeOf(a, 2));
|
|
505
|
+
const half = 1.0, height = 3;
|
|
506
|
+
for (const floor of floors) {
|
|
507
|
+
const top = floor.max[1];
|
|
508
|
+
for (let x = floor.min[0] + half; x <= floor.max[0] - half; x += 0.5) {
|
|
509
|
+
for (let z = floor.min[2] + half; z <= floor.max[2] - half; z += 0.5) {
|
|
510
|
+
const column = { min: [x - half, top + 0.001, z - half], max: [x + half, top + height, z + half] };
|
|
511
|
+
if (visible.some((p) => p !== floor && overlap1(p, column, 0) > 0 && overlap1(p, column, 1) > 0 && overlap1(p, column, 2) > 0)) continue;
|
|
512
|
+
return { x, y: top, z, floor };
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
return null;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
const box = (id, x, y, z, w, h, d, extra = {}) => ({ id, min: [x - w / 2, y, z - d / 2], max: [x + w / 2, y + h, z + d / 2], collider: true, ...extra });
|
|
520
|
+
|
|
521
|
+
/** A synthetic flight of stairs with one riser too tall, and an honest flight beside it. */
|
|
522
|
+
export function stairScene(riser = 0.17, badRiser = null) {
|
|
523
|
+
const parts = [box("ground", 0, -1, 0, 40, 1, 40)];
|
|
524
|
+
let y = 0;
|
|
525
|
+
for (let i = 0; i < 12; i++) {
|
|
526
|
+
const rise = badRiser !== null && i === 6 ? badRiser : riser;
|
|
527
|
+
y += rise;
|
|
528
|
+
parts.push(box(`tread${i}`, 0, 0, -i * 0.3 - 0.15, 1.6, y, 0.3));
|
|
529
|
+
}
|
|
530
|
+
parts.push(box("landing", 0, 0, -3.6 - 1.5, 3, y, 3));
|
|
531
|
+
return { parts, groundY: 0, routes: [{ name: badRiser ? "planted stairs" : "honest stairs", from: [0, 0, 3], to: [0, y, -5.5] }] };
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* Each plant returns the scene with a defect added and the id the check must report.
|
|
536
|
+
* Plants that need a site take it from the real scene; if the scene offers none, the
|
|
537
|
+
* plant reports that rather than passing.
|
|
538
|
+
*/
|
|
539
|
+
const PLANTS = {
|
|
540
|
+
float(scene, tol) {
|
|
541
|
+
const s = plantSite(scene, tol); if (!s) return null;
|
|
542
|
+
const copy = clone(scene);
|
|
543
|
+
copy.parts.push(box("planted-float", s.x, s.y + tol.floatTol * 2.5, s.z, 0.5, 0.5, 0.5));
|
|
544
|
+
return { scene: copy, id: "planted-float" };
|
|
545
|
+
},
|
|
546
|
+
buried(scene, tol) {
|
|
547
|
+
const s = plantSite(scene, tol); if (!s) return null;
|
|
548
|
+
const copy = clone(scene);
|
|
549
|
+
copy.parts.push(box("planted-buried", s.x, s.y - tol.sinkTol * 2, s.z, 0.6, 1.2, 0.6, { prop: true }));
|
|
550
|
+
return { scene: copy, id: "planted-buried" };
|
|
551
|
+
},
|
|
552
|
+
interpenetration(scene, tol) {
|
|
553
|
+
const s = plantSite(scene, tol); if (!s) return null;
|
|
554
|
+
const copy = clone(scene);
|
|
555
|
+
copy.parts.push(box("planted-crate-a", s.x - 0.2, s.y, s.z, 0.8, 0.8, 0.8), box("planted-crate-b", s.x + 0.2, s.y, s.z, 0.8, 0.8, 0.8));
|
|
556
|
+
return { scene: copy, id: "planted-crate-a + planted-crate-b" };
|
|
557
|
+
},
|
|
558
|
+
coplanar(scene, tol) {
|
|
559
|
+
const s = plantSite(scene, tol); if (!s) return null;
|
|
560
|
+
const copy = clone(scene);
|
|
561
|
+
// On a quantised grid the plant sits a step and a half apart, not exactly tied, so a
|
|
562
|
+
// grid tolerance that stopped widening the check would miss it.
|
|
563
|
+
let step = tol.gridStep ?? 0;
|
|
564
|
+
for (const p of scene.parts) step = Math.max(step, p.gridStep ?? 0);
|
|
565
|
+
copy.parts.push(box("planted-panel-a", s.x - 0.25, s.y, s.z, 1, 1, 0.2, { gridStep: step }), box("planted-panel-b", s.x + 0.25, s.y + 0.3, s.z + 1.5 * step, 1, 1, 0.2, { gridStep: step }));
|
|
566
|
+
return { scene: copy, id: "planted-panel-a + planted-panel-b" };
|
|
567
|
+
},
|
|
568
|
+
colliders(scene, tol) {
|
|
569
|
+
const s = plantSite(scene, tol); if (!s) return null;
|
|
570
|
+
const copy = clone(scene);
|
|
571
|
+
copy.parts.push(box("planted-ghost-wall", s.x, s.y, s.z, 1.6, 2, 0.2, { collider: false }));
|
|
572
|
+
return { scene: copy, id: "planted-ghost-wall" };
|
|
573
|
+
},
|
|
574
|
+
invisible(scene, tol) {
|
|
575
|
+
const s = plantSite(scene, tol); if (!s) return null;
|
|
576
|
+
const copy = clone(scene);
|
|
577
|
+
const wall = box("planted-invisible-wall", s.x, s.y, s.z, 1.6, 2, 0.2);
|
|
578
|
+
// A scene with its own collision layer gets the wall there; a scene whose drawn
|
|
579
|
+
// parts are their own colliders gets an undrawn part that collides.
|
|
580
|
+
if (copy.colliders) copy.colliders.push(wall); else copy.parts.push({ ...wall, visible: false });
|
|
581
|
+
return { scene: copy, id: "planted-invisible-wall" };
|
|
582
|
+
},
|
|
583
|
+
stairs(_scene, tol) {
|
|
584
|
+
return { scene: stairScene(0.17, tol.stepHeight + 0.08), id: "planted stairs" };
|
|
585
|
+
},
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
const CHECKS = { float: checkFloat, buried: checkBuried, interpenetration: checkInterpenetration, coplanar: checkCoplanar, colliders: checkColliders, invisible: checkInvisible, stairs: checkStairs };
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* Runs every check (or `only`), each after its plant. Returns
|
|
592
|
+
* `{ ok, failures, checks: [{ name, examined, findings, plant }] }`. A finding is a
|
|
593
|
+
* defect in the scene; a failure is a defect in the instrument or an unexamined check.
|
|
594
|
+
*/
|
|
595
|
+
export function runSceneAudit(scene, { tolerances = {}, only, notApplicable = {} } = {}) {
|
|
596
|
+
const tol = { ...TOLERANCES, ...tolerances };
|
|
597
|
+
const failures = [], checks = [];
|
|
598
|
+
for (const [name, check] of Object.entries(CHECKS)) {
|
|
599
|
+
if (only && !only.includes(name)) continue;
|
|
600
|
+
const reason = notApplicable[name];
|
|
601
|
+
if (typeof reason === "string" && reason.trim()) {
|
|
602
|
+
checks.push({ name, examined: 0, findings: [], plant: "not applicable", reason: reason.trim() });
|
|
603
|
+
continue;
|
|
604
|
+
}
|
|
605
|
+
const plant = PLANTS[name](scene, tol);
|
|
606
|
+
let plantState = "caught";
|
|
607
|
+
if (!plant) { plantState = "no site"; failures.push(`${name}: found no open grounded floor larger than a prop with a clear 2 m column to plant a defect on`); }
|
|
608
|
+
else if (!check(plant.scene, tol).findings.some((f) => f.id === plant.id)) { plantState = "missed"; failures.push(`${name}: the planted defect ${plant.id} was not found, so this check cannot be trusted`); }
|
|
609
|
+
const result = check(scene, tol);
|
|
610
|
+
if (result.examined === 0) failures.push(`${name}: examined nothing${name === "stairs" ? "; add scene.routes for every staircase" : ""}`);
|
|
611
|
+
checks.push({ ...result, plant: plantState });
|
|
612
|
+
}
|
|
613
|
+
const findings = checks.reduce((n, c) => n + c.findings.length, 0);
|
|
614
|
+
return { ok: failures.length === 0 && findings === 0, failures, checks };
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
export function formatReport(report) {
|
|
618
|
+
const lines = [];
|
|
619
|
+
for (const c of report.checks) {
|
|
620
|
+
if (c.reason) { lines.push(`${c.name.padEnd(17)} not applicable: ${c.reason}`); continue; }
|
|
621
|
+
lines.push(`${c.name.padEnd(17)} examined ${String(c.examined).padStart(6)} findings ${String(c.findings.length).padStart(4)} plant ${c.plant}`);
|
|
622
|
+
for (const f of c.findings.slice(0, 20)) lines.push(` ${f.id} at (${f.at.join(", ")}): ${f.why}`);
|
|
623
|
+
if (c.findings.length > 20) lines.push(` and ${c.findings.length - 20} more`);
|
|
624
|
+
}
|
|
625
|
+
for (const failure of report.failures) lines.push(`FAILED ${failure}`);
|
|
626
|
+
lines.push(report.ok ? "Scene audit passed." : "Scene audit did not pass.");
|
|
627
|
+
return lines.join("\n");
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
/* --------------------------------------------------------------- three.js adapter */
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* Reads a three.js scene into the audit's shape. Pass the THREE namespace the game
|
|
634
|
+
* already imports. Mesh flags come from `userData`: `collider`, `nocollide` (a reason),
|
|
635
|
+
* `hangs` (a reason), `group`, `prop`, `decal`, `gridStep`; a collider object may carry
|
|
636
|
+
* `userData.nodraw` (a reason the player can see why it stops them), and a Box3 a
|
|
637
|
+
* `nodraw` property. A hidden mesh marked `collider` is read as a collider nothing draws. Transparent and alpha-tested materials
|
|
638
|
+
* are not opaque volume. `colliders` may be Box3s or meshes from the collision layer.
|
|
639
|
+
*/
|
|
640
|
+
export function fromThreeScene(THREE, root, { colliders = [], groundY = null, floors, triangles = true } = {}) {
|
|
641
|
+
root.updateMatrixWorld(true);
|
|
642
|
+
const parts = [];
|
|
643
|
+
const v = new THREE.Vector3();
|
|
644
|
+
root.traverse((object) => {
|
|
645
|
+
if (!object.isMesh || object.isSkinnedMesh) return;
|
|
646
|
+
const material = Array.isArray(object.material) ? object.material[0] : object.material;
|
|
647
|
+
const data = object.userData ?? {};
|
|
648
|
+
// A mesh is drawn only if it and every ancestor are visible and its material draws.
|
|
649
|
+
// A hidden mesh that collides is still read, as an undrawn collider, so a collision
|
|
650
|
+
// layer kept in the scene graph can be judged by the invisible check.
|
|
651
|
+
let shown = material?.visible !== false;
|
|
652
|
+
for (let o = object; o && shown; o = o.parent) if (!o.visible) shown = false;
|
|
653
|
+
if (!shown && data.collider !== true) return;
|
|
654
|
+
const opaque = !material || (!material.transparent && (material.alphaTest ?? 0) === 0 && (material.opacity ?? 1) >= 1);
|
|
655
|
+
const bounds = new THREE.Box3().setFromObject(object);
|
|
656
|
+
if (bounds.isEmpty()) return;
|
|
657
|
+
const part = { id: object.name || object.uuid, min: bounds.min.toArray(), max: bounds.max.toArray(), visible: shown ? undefined : false, solid: opaque && !data.decal,
|
|
658
|
+
collider: data.collider === true, nodraw: data.nodraw, nocollide: data.nocollide, hangs: data.hangs, group: data.group, prop: data.prop, decal: data.decal || material?.polygonOffset, gridStep: data.gridStep };
|
|
659
|
+
if (triangles && object.geometry?.attributes?.position) {
|
|
660
|
+
const position = object.geometry.attributes.position, index = object.geometry.index;
|
|
661
|
+
const count = index ? index.count : position.count;
|
|
662
|
+
const tris = [];
|
|
663
|
+
for (let i = 0; i + 2 < count; i += 3) {
|
|
664
|
+
const t = [];
|
|
665
|
+
for (let k = 0; k < 3; k++) { v.fromBufferAttribute(position, index ? index.getX(i + k) : i + k).applyMatrix4(object.matrixWorld); t.push(v.x, v.y, v.z); }
|
|
666
|
+
tris.push(t);
|
|
667
|
+
}
|
|
668
|
+
part.triangles = tris;
|
|
669
|
+
}
|
|
670
|
+
parts.push(part);
|
|
671
|
+
});
|
|
672
|
+
const boxes = colliders.map((c, i) => {
|
|
673
|
+
const b = c.isBox3 ? c : new THREE.Box3().setFromObject(c);
|
|
674
|
+
return { id: c.name || `collider${i}`, min: b.min.toArray(), max: b.max.toArray(), nodraw: c.userData?.nodraw ?? c.nodraw };
|
|
675
|
+
});
|
|
676
|
+
return { parts, colliders: boxes.length ? boxes : undefined, groundY, floors };
|
|
677
|
+
}
|