Files
healer-man/scripts/runewaker-pipeline/NATIVE_COLLISION_ASSEMBLY.md
T
2026-10-06 22:25:34 -04:00

3.5 KiB
Raw Blame History

Native Runewaker collision assembly

assemble-native-collision.mjs assembles WDB static placements from collision structures serialized in their ROS resources. It reads the exact column-major staticPlacements[].transform.primaryLocalThreeMatrix values from a placement manifest, applies the recipe's source-unit conversion, and writes all-source and Trekker-filtered collision GLB chunks. It never substitutes render triangles when serialized collision is missing.

Build the separate native Rune Engine extractor when needed:

powershell -ExecutionPolicy Bypass -File scripts/runewaker-pipeline/build-native-collision-audit.ps1

Then run the Origin assembly:

node scripts/runewaker-pipeline/assemble-native-collision.mjs `
  --recipe scripts/runewaker-pipeline/recipes/the-origin.json `
  --placement-manifest runewaker-export-work/the-origin/converted/wdb-placement-manifest.json `
  --collision-mode respect-options `
  --output-root artifacts/playtest/native-collision/the-origin

--collision-mode complete is the default full-source audit and includes triangles regardless of ruENTITYOPTION_COLLISION. Use --collision-mode respect-options for collision intended to match the engine’s default m_ignoreCollisionFlag=false: a disabled entity prevents querying its own collision object/model and suppresses its descendants. The native report keeps both complete and option-enabled triangle totals, counts entities whose collision option is disabled, counts nodes unreachable below an option gate, and records render-mesh fallback separately. Only serialized native collision structures are assembled into GLBs; render-mesh fallback is diagnostic and is not silently substituted. Inventory identity includes the collision mode and both extractor executable/source hashes, so complete-mode sidecars cannot be reused as option-respecting output.

Use --source-root to override the recipe's Runewaker source root. Use --extractor to select a separately built native auditor. A generated native inventory is kept in an immutable hash-keyed subdirectory under --output-root; it includes exact SHA-256 values for the source WDB, every source ROS, each extractor report, each OBJ triangle soup, each little-endian per-triangle flag sidecar, and the extractor binary/source. Pass --inventory-root <path> to reuse an indexed inventory; the command revalidates every source ROS and generated sidecar before assembly. Legacy diagnostic inventories without this index are rejected rather than attributed to current source files.

The output is grouped under runs/<input-fingerprint>/. Its JSON report includes source hashes, placement/resource counts, complete/option-enabled/omitted triangle totals, per-resource disabled option counts, per-placement flag counts, omissions, and each collision chunk's hash, byte size, tile, triangle count, and flag histogram. --report-output <path> copies the full report to a stable workspace path. Every GLB is capped at 90,000 triangles. Primitive extras store one source triangle flag for each consecutive triangle in position order. Spatial tiles default to 256 meters and can be changed with --tile-size-meters.

The optional Trekker path set excludes flag mask 0x00A00000 (water 0x00200000 and foliage 0x00800000), matching RuFusion_Trekker.cpp::IsPathClear and ::FindRestingHeight. All-source output retains those triangles. Both sets remain review assets; the CLI does not wire collision into runtime or shipping packages.