Skip to content

docs/models.md: measured reject classes for the 71 levels.rpf fragments (ASSET-504) - #6102

Open
abilliontokens wants to merge 7 commits into
ProjectLeonida:mainfrom
abilliontokens:modelrecovery/fragment-candidates
Open

abilliontokens wants to merge 7 commits into
ProjectLeonida:mainfrom
abilliontokens:modelrecovery/fragment-candidates

Conversation

@abilliontokens

@abilliontokens abilliontokens commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds the measured three-class breakdown of the 71 unrecovered fragment candidates in levels.rpf at the e293917 pin to docs/models.md.

Depends on: #5674 (ASSET-430 pin bump to 16134b0). This PR is rebased on top of #5674's head (63a81ccc3) and only adds the classification subsection; all pin text and re-count numbers remain #5674's. It merges cleanly into #5674 (verified with git merge-tree --write-tree). #4687 owns the 7ef5c51 pin referenced in the classification.

Item: ASSET-504 (the 71 unrecovered fragment candidates in levels.rpf).

AI-assisted (omp orchestrator).

What this PR adds vs. what it leaves to #5674

  • Adds: the ##### Measured reject classes at e293917 subsection under the e293917 re-count — the instrumented-recovery method, the 64/1/6 class table, and the per-pin recovery counts (64 at 7ef5c51, 65 at 16134b0).
  • Leaves to ASSET-430: Integrate merged rpf9-explorer fragment recovery fix #5674: the 16134b0 pin bump, the ten-archive re-count table, the ASSET-430 prose, and all other docs/models.md rewrites.

Classification (counts and failure classes only, no game data)

Re-ran recovery over all 235,330 levels.rpf candidates with an instrumented copy of Rpf9ModelRecovery.TryResource that records which check drops each candidate (the same method used for the 917e9b9 classification). The instrumented run reproduces the release counts exactly (235,259 recovered, 71 rejected) and yields:

Class Count Mechanism
Large-mesh index buffers 64 system/graphics split found, but RageModelDecoder.Decode rejects the drawable (mesh > 65,535 triangles or vertex references); the recovery loop keeps requesting continuation blocks until the archive ends and reports no continuation
Short secondary LOD palette 1 LooksLikeFragment true but the ordinary extent probe cannot complete (MetadataComplete == false on the first block), leaving the split ambiguous; the declared-split fragment probe resolves it
Extent probe returns null 6 single-block .#ft fragments whose main drawable is empty (null LOD0–3, empty-sentinel bounds), so ExtentReader.Probe() fails LooksLikeDrawableHeader and returns null; Rpf9TextureRecovery recovers none, so they are not texture dictionaries

The 64 are recovered by upstream rpf9-explorer#18 and the 1 by rpf9-explorer#26. The 6 remain rejected at 16134b0 and at upstream main 4eee1e6.

Why the 6 fail (commit 1b4c83a47): they are the 6 fragments that docs/character_models.md (ASSET-261, tools/fragment_children.py) counts as having "a main drawable that fails the embedded-drawable header test".

  • Each declares two 0x110-byte drawable records (u16 +0x30 = 2).
  • All of the geometry is in the child record at main +0x110, whose LOD0 pointer is at main +0x160.
  • A scratch copy of the 16134b0 decoder that reads the LOD groups from the child record recovers all 6, from 1 mesh / 55 vertices to 2 meshes / 3,638 vertices.
  • With that copy, a full levels.rpf run recovered 235,330 of 235,330 candidates with none lost.
  • The decoder fix belongs in the submodule. It is reported upstream as rpf9-explorer#29, with a structural description only.
  • Whether the child record is a detail or variant drawable is stated in the doc as a hypothesis.

Fragment child drawables are not exported (commit 82459b7e3): this adds a new docs/models.md subsection.

  • Omitted: tools/rpf9dump models writes only a fragment's main drawable, so its OBJ and manifest output, and batch_glb.py/world_build.py downstream, omit the 735 child drawable records of the 734 levels.rpf child-array fragments.
  • Why: the decoder API pins fragments to +0x18 (Require(selectedOffset == drawable)), and DecodeModels splits only dictionaries. This is the same at e293917, 16134b0 and 4eee1e6, so it is not a Leonida-side filter.
  • How measured: a scratch harness repeats Export() at e293917. It reproduces the levels.rpf export exactly (343,327 models, 2,509,947,536 triangles).
  • Counts: the child records hold 3,520 meshes, 2,065,882 vertices and 1,992,588 triangles. All 735 decode at LOD0, and none shares a buffer with an exported mesh. 41 are byte-identical copies, and excluding them leaves 3,479 meshes, 2,060,291 vertices and 1,985,528 triangles.
  • Scale: that is about 31% of these fragments' exported geometry, and 0.079% of the archive's exported triangles.
  • Upstream: the API request is on rpf9-explorer#29.

Tests

Docs-only change. All docs-structure tests pass:

python -I tests/test_docs_links.py          -> OK
python -I tests/test_docs_list_items.py     -> OK
python -I tests/test_docs_table_rows.py     -> OK
python -I tests/test_docs_repeated_lines.py -> OK
python -I tests/test_docs_repo_paths.py     -> OK
python -I tests/test_docs_table_ids.py      -> OK
python -I tests/test_docs_cli_flags.py      -> OK
python -I tests/test_docs_design_rows.py    -> OK
python -I tests/test_docs_env_vars.py       -> OK
python -I tests/test_docs_pr_template.py    -> OK
python -I tests/test_docs_python_deps.py    -> OK
python -I tests/test_design_contract_rows.py -> OK
python -I tests/test_i18n_index.py          -> OK

git diff --check: clean.

Commits 59b50494c, 1b4c83a47 and 82459b7e3 on modelrecovery/fragment-candidates (rebased on #5674 head 63a81ccc3), then merge commit 0cfadb646, which brings in origin/main at 1cc6e3c12 without rewriting them. Its only conflict was the status table in README.md: main had dropped the duplicated rows next to the Models row (#6323), so the merged table keeps main's rows and the 16134b0 Models row. Docs tests above re-run at 0cfadb646: all OK; git diff --check clean.

Environment

Windows 11, .NET 8 SDK, third_party/rpf9-explorer at 16134b0 (matching #5674's pin). Game package read-only (no game data committed; counts and failure classes only).

…ts (ASSET-504)

Add the three-class breakdown (64 large-mesh index, 1 short secondary
LOD palette, 6 extent-probe-null) with the instrumented-recovery method,
on top of ItsNotRexed#5674's pin bump and re-count. The classification is additive;
pin text and re-count numbers remain ItsNotRexed#5674's.
@abilliontokens
abilliontokens force-pushed the modelrecovery/fragment-candidates branch from 800396e to 59b5049 Compare November 23, 2026 13:15
@abilliontokens abilliontokens changed the title docs/models.md: classify the 71 levels.rpf fragment rejects at e293917 (ASSET-504) docs/models.md: measured reject classes for the 71 levels.rpf fragments (ASSET-504) Nov 23, 2026
@memorypressure

Copy link
Copy Markdown

Re-verified at your current head 59b5049 — you force-pushed mid-review (800396e → three commits incl. the ASSET-430 submodule pin bump to 16134b0), and this comment covers the new head: all docs guards pass (links 6, list-items 2, design-rows 4, repeated-lines 2, contract-rows 4, i18n 9) and the arithmetic reconciles — 383,997−382,781 = 1,216 = 65 recovered rejects + 1,151 new candidates (65 + 250 levels, 899 packs, 2 minigame), rejects 72→7 with the textures.rpf dictionary reject unchanged. No game data in the diff, just counts. The pin bump and the upstream #18/#19/#26 content claims are not re-derivable from this host. FYI: README.md lines 55/57 carry a pre-existing duplicated Models (OBJ) row pair — also on main — and only the first received the new count. Checks now pending, none failing. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run).

…ent probe (ASSET-504)

Main drawable empty, geometry in the 0x110 child record; links rpf9-explorer#29. AI-assisted (omp orchestrator).
…s.rpf counts (ASSET-504)

AI-assisted (omp orchestrator).
…t-candidates

Conflicts in README.md: main dropped the duplicated status rows (ItsNotRexed#6323) next to the Models row that ItsNotRexed#5674 re-counts at 16134b0. The merged table keeps main's rows and that 16134b0 row.
@abilliontokens

Copy link
Copy Markdown
Contributor Author

New head 0cfadb646: merge commit 0cfadb646 brings origin/main at 1cc6e3c12 into the branch and was pushed as a fast-forward, so 59b50494c (re-verified by memorypressure) and 82459b7e3 stay in the history unchanged.

  • Changed against 82459b7e3: only what main brought in, plus one resolved conflict in the status table of README.md. main had dropped the duplicated rows beside the Models row (README: drop duplicated rows in the project status table #6323), so the merged table keeps main's rows and the 16134b0 Models row; the duplicated pair noted in the review is gone.
  • Diff against main: the same 9 files with the same line counts as before the merge.
  • Tests at 0cfadb646 (Windows 11): the 11 tests/test_docs_*.py guards, tests/test_design_contract_rows.py and tests/test_i18n_index.py pass; git diff --check is clean; scripts/merge_check.py reports clean.

#5674 is unchanged (63a81ccc3), so Depends on: #5674 stays. AI-assisted (omp orchestrator).

@abilliontokens

abilliontokens commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor Author

Merge-conflict refresh (AI-assisted, omp orchestrator). New head 9934b2437: a normal merge of origin/main 867d922f0 into the branch (old head 0cfadb646, still an ancestor; no rebase, no force-push). Depends on: #5674 is still open at 63a81ccc3, which this branch already contains, so nothing else was merged.

Conflicted files:

  • docs/README.md: this stack's models.md row (383,997 models at 16134b0) against main's unchanged e293917 row and its new strand_grooms.md row. Kept this stack's models.md row and main's strand_grooms.md row.
  • docs/models.md, "What to do next": this stack replaced the six list items after item 1 (the e293917 items, numbered 2 to 5 and again 3 and 4) with its two 16134b0 items; main appended the section "Predict model offsets for placements" after the list. Kept this stack's items, then main's whole new section.

A line-for-line check found every line either side added. The diff against main is still this PR's 9 files.

Tests at 9934b2437, Windows 11, python -I: tests/test_docs_*.py 8 of 11 files OK; test_docs_cli_flags.py, test_docs_design_rows.py and test_docs_links.py fail the same way on main 867d922f0 alone, so they are not from this change. tests/test_make_game_submodule.py 3 OK, tests/test_make_game_preflight.py 95 OK, tests/test_make_game_dry_run.py 24 OK, tests/test_make_game_assets_decoder.py 5 OK.

@rideinstead

Copy link
Copy Markdown

✅ Automated security review: CLEAN (commit 0cfadb64)

  • rpf9-explorer pin 16134b0b is an ancestor of the submodule repo's main

Scope: static analysis of added diff lines only; no code was executed. Please review findings manually.

@OlaiFG7

OlaiFG7 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Reviewed 9934b24, docs read, AI-assisted: the class counts reconcile (64+1+6 = 71 and 235,330 − 235,259 = 71), and the character_models.md#what-is-not-decoded anchor and tools/fragment_children.py exist on main. Two requests. (1) This is not only a docs change: the diff covers 9 files including the third_party/rpf9-explorer pin bump and README.md, which come from #5674; please keep it a draft until #5674 merges. (2) The text quotes several struct offsets (+0x30, +0x50, +0x110, +0x160, a 0x110 stride); please confirm they are acceptable under the no-game-data rule or reduce them to counts. The method also rests on a scratch decoder that is not in the repo, and I could not check the submodule commits it cites.

@shadshuvo shadshuvo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code read (CPU) ?

Review

This PR correctly documents the model recovery improvements from rpf9-explorer pin bump to 16134b0 (ASSET-430).

Documentation Quality

? Clear statistics: New pin recovers 383,997 models (up from 382,781), 7 rejects (down from 72)
? Comprehensive explanation: Documents why the 6 remaining fragment candidates fail (no LOD pointers, bounds validation)
? Historical context: Preserves earlier pin measurements as controls
? Technical accuracy: Explains the one new fragment recovery (secondary-LOD bone palette extent issue)
? Proper attribution: Credits upstream PRs #18, #19, #26

Changes Verified

  • Updates rpf9-explorer submodule reference to 16134b0
  • Documents +1,216 models (1,151 new candidates + 65 from rejects)
  • Explains fragment recovery validation requirements
  • Maintains historical measurements for comparison
  • Updates README.md and related docs consistently

Impact

  • Provides clear record of model recovery state
  • Helps contributors understand what remains to fix
  • Documents validation requirements for future work

This is high-quality technical documentation that accurately reflects the measured state of model recovery.

Ready to merge.


Reviewed on Windows 11 (AI-assisted)

@sovljanskii

Copy link
Copy Markdown
Contributor

Tested 9934b24 merged onto main dde82f2 on Apple M4, macOS 27.2.1, .NET SDK 10.0.402, Python 3.15.2 and 3.12.16, with my own 1.0.2.1 copy: pass. The reject classes reproduce exactly, and so does the 16134b0 levels.rpf row they lead to.

  • Method: the instrumented copy of TryResource isn't published, so I wrote my own.
    • A small harness calls the submodule's Rpf9ModelRecovery.FindCandidateOffsets and RecoverAtOffsets over levels.rpf. These are the calls tools/rpf9dump models makes before it writes anything; no OBJ export was run.
    • Built against upstream e293917 with flags added to TryResource / TrySplit. They record which split check failed, and whether a failed Decode met a mesh with more than 65,535 triangles or vertex references.
    • Also built against 7ef5c51, 16134b0 and 4eee1e6, unchanged.
  • e293917, full run (600 s, 6 threads): 235,330 candidates, 235,259 recovered, 71 rejected, 343,327 model entries. All match the doc.
  • The three classes:
    • 64 large-mesh. In each, Decode failed on a mesh over 65,535 triangles or vertex references. Each spans more than one block and ends with no continuation block found (neither TryNext nor TryRawTail), not at the block or byte cap. In 63 of the 64, the first block's metadata probe was also incomplete. That fits the "in sampled cases" sentence and why it wasn't the cause.
    • 1 short secondary palette: LooksLikeFragment is true and MetadataComplete is false on the first block. No decode failure, and no continuation block.
    • 6 null extent probe: each is a single block, a fragment, and ProbeRequiredExtents returns null at every split.
  • Re-running RecoverAtOffsets on the 71:
    • 7ef5c51 recovers 64, exactly the large-mesh class.
    • 16134b0 recovers 65, adding the short-palette one. 4eee1e6 also recovers 65.
    • The same 6 null-extent fragments stay rejected at 16134b0 and 4eee1e6.
    • Rpf9TextureRecovery finds 0 texture dictionaries among them.
  • 16134b0, full run (595 s): 235,580 candidates, 235,574 recovered, 6 rejected, 343,642 model entries, as in the re-count table. The 6 are the same 6 null-extent fragments.
  • Cross-check with tools/fragment_children.py over levels.rpf (100 s):
    • 50,802 fragments, 734 child arrays and 735 child drawables (at most 2 per fragment). 6 fragments have an invalid main drawable.
    • Those 6 are exactly the 6 null-extent rejects, and each declares 2 drawables with 1 child, as the doc says.
    • All 71 rejects are fragments in that census. 10 of them have a child array: the 6, plus 4 from the large-mesh class. That matches "of the 10 without an exported model, 6 are the empty-primary fragments … the other 4 are large-mesh rejects".
  • Submodule pin: tools/rpf9dump builds against 16134b0 with 0 warnings and 0 errors.
  • Docs tests (merged tree, 3.15 and 3.12):
    • Pass: test_docs_env_vars, list_items, pr_template, python_deps, repeated_lines, repo_paths, table_ids, table_rows, test_design_contract_rows and test_i18n_index.
    • test_docs_cli_flags and test_docs_links fail on main dde82f2 too.
    • test_docs_design_rows fails on duplicated strand_grooms.md and ped_catalogues.md rows in docs/README.md. Those come from main 867d922, which the branch merged, not from this PR.
    • git diff --check is clean.
  • Wording: "A full levels.rpf run recovered 235,330 of 235,330 candidates" (patched 16134b0 decoder). At 16134b0 a full scan finds 235,580 candidates (the re-count table, and my run), so 235,330 must be the e293917 candidate list. Please say which list it is, or give the count over 235,580.
  • Not recounted:
    • The child-drawable geometry table (3,520 meshes and so on) and the six fragments' mesh, vertex and triangle ranges. Both need the scratch decoder copy, which isn't published.
    • The export's mesh, vertex and triangle totals, which need a full decode. The 343,327 model count matches.

Counts only, no game files; the harness keeps candidate offsets in a local scratch file that is deleted afterwards.

AI-assisted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants