Find 99.98% of map placements (was 95.86%) by reading drawable dictionaries as their member models #8

Closed
github-bot wants to merge 1 commit from gh-pr/8/head into gh-pr/8/base
Owner

@⁠labj1987 on GitHub · 2026-11-22 09:31 UTC · original
dictionary-members → master · +953 −102 · 12 files · 1 commits · closed without merging

Problem. A drawable dictionary is one resource that holds several member models, each with its own name and LOD table, and most map LOD/SLOD models are stored that way. SixNG read such a resource as one drawable, so every member but one had no name, no model and no archetype link, and their placements stayed unresolved: about 93,000 placements, almost all distant LOD/SLOD objects, were missing from the 3D map.

Fix. Each dictionary member becomes its own entry (<entry id>#<member>) with its own models per LOD, its own shaders and textures (each member has its own shader array: member root +0x10 → +0x10), bounds, name and archetype link, and its own GLB export. The model picker lists the members; LOD discovery tolerates holes (older cached exports without model.glb are regenerated); extract and inspect accept member ids. Fragments, single drawables and drawables with named nested parts keep the old behaviour.

Proof. Fresh index, link-archetypes, lod-links and placements on the 1.0.2.1 package, base 3af3a69 vs this change; re-run on this change rebased onto f555c9f gives the same numbers:

  • placements resolved: 2,156,290 → 2,249,127 of 2,249,490 (95.86% → 99.98%)
  • archetypes named through dictionary members: 99,980; unresolved archetypes: 84,215 → 37
  • all 18,476 dictionaries in levels.rpf: no dictionary root carries its own LOD table and no model is shared between members
  • three sampled dictionaries: every member (51) gets its own shader records and textures
  • cargo build --release --locked has no warnings and cargo test --release --locked passes (50 tests on f555c9f); the new tests use synthetic data, with one per review finding that fails without its fix
  • the model picker keeps #9's rule for generic clothing pieces, now applied per member

Notes, not changed here:

  • link_archetypes's name-order gap rule links a single candidate without a bounds check, and model_names_base mixes offsets from all archives while the rule compares them as levels.rpf offsets. On 3af3a69 the rule makes 6 links; with this change members link by name and it makes none.
  • gaps.rs writes no material_count, so the map heatmap counts one flat material in a ten-material model as 100% flat instead of 10%.

🤖 Generated with Claude Code

**@⁠labj1987** on GitHub · 2026-11-22 09:31 UTC · [original](https://github.com/holdmysocks/SixNG/pull/8) `dictionary-members` → `master` · +953 −102 · 12 files · 1 commits · closed without merging **Problem.** A drawable dictionary is one resource that holds several member models, each with its own name and LOD table, and most map LOD/SLOD models are stored that way. SixNG read such a resource as one drawable, so every member but one had no name, no model and no archetype link, and their placements stayed unresolved: about 93,000 placements, almost all distant LOD/SLOD objects, were missing from the 3D map. **Fix.** Each dictionary member becomes its own entry (`<entry id>#<member>`) with its own models per LOD, its own shaders and textures (each member has its own shader array: member root +0x10 → +0x10), bounds, name and archetype link, and its own GLB export. The model picker lists the members; LOD discovery tolerates holes (older cached exports without `model.glb` are regenerated); extract and inspect accept member ids. Fragments, single drawables and drawables with named nested parts keep the old behaviour. **Proof.** Fresh `index`, `link-archetypes`, `lod-links` and `placements` on the 1.0.2.1 package, base 3af3a69 vs this change; re-run on this change rebased onto f555c9f gives the same numbers: - placements resolved: 2,156,290 → 2,249,127 of 2,249,490 (95.86% → 99.98%) - archetypes named through dictionary members: 99,980; unresolved archetypes: 84,215 → 37 - all 18,476 dictionaries in `levels.rpf`: no dictionary root carries its own LOD table and no model is shared between members - three sampled dictionaries: every member (51) gets its own shader records and textures - `cargo build --release --locked` has no warnings and `cargo test --release --locked` passes (50 tests on f555c9f); the new tests use synthetic data, with one per review finding that fails without its fix - the model picker keeps #9's rule for generic clothing pieces, now applied per member **Notes, not changed here:** - `link_archetypes`'s name-order gap rule links a single candidate without a bounds check, and `model_names_base` mixes offsets from all archives while the rule compares them as `levels.rpf` offsets. On 3af3a69 the rule makes 6 links; with this change members link by name and it makes none. - `gaps.rs` writes no `material_count`, so the map heatmap counts one flat material in a ten-material model as 100% flat instead of 10%. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A drawable dictionary resource holds several member drawables, each with its
own name string and LOD table (map LOD/SLOD models are mostly stored this
way). They were read as one drawable, so every member but one had no name,
no model and no archetype link, and their placements stayed unresolved.

- drawable: find the members (named drawable roots with a valid LOD table;
  not fragments, not single drawables, not drawables whose own root has a
  LOD table), assign each model occurrence to its member and LOD, and select
  one member's models, geometry, shaders and textures (each member has its
  own shader array: member root +0x10 -> +0x10); member bounds come from the
  member's own geometry.
- scan/index: record member names (index version bumped).
- export: member entries (`<entry id>#<member>`) export as their own GLBs;
  link-archetypes links dictionary members by name; the map bake gets
  member bounds.
- gui: the model picker lists members; LOD discovery tolerates holes (older
  cached exports without model.glb are regenerated) and
  keeps physical LOD numbers.
- cli: member ids are accepted by extract/inspect.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:02:52 +00:00
github-bot closed this pull request 2026-11-26 20:02:52 +00:00
Author
Owner

@⁠holdmysocks on GitHub · 2026-11-22 17:16 UTC · original

Squash-merged into master as 4c496f2 (one small conflict in the model picker resolved by hand). Thanks!

**@⁠holdmysocks** on GitHub · 2026-11-22 17:16 UTC · [original](https://github.com/holdmysocks/SixNG/pull/8#issuecomment-7082715226) Squash-merged into master as 4c496f2 (one small conflict in the model picker resolved by hand). Thanks!

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.