diff options
| author | Rafael <rafaelalvesp2005@gmail.com> | 2026-11-23 15:36:26 -0300 |
|---|---|---|
| committer | Rafael <rafaelalvesp2005@gmail.com> | 2026-11-23 15:36:26 -0300 |
| commit | 63f0e0dea3a9d44201db408c4e2c3f2f5b2b94d6 (patch) | |
| tree | 86f0dcad8070e2a3a693ef4897aa83950cfeb224 /docs/models.md | |
| parent | f78f7d6a2a9364cb128c03ac539fe540d5c70df1 (diff) | |
| parent | 6dda0630bd6fc0514baadb94fb98e36bd7d64c0b (diff) | |
Merge main into fix/walk-bink_names
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'docs/models.md')
| -rw-r--r-- | docs/models.md | 198 |
1 files changed, 156 insertions, 42 deletions
diff --git a/docs/models.md b/docs/models.md index bebdfecd6..a65bebf39 100644 --- a/docs/models.md +++ b/docs/models.md | |||
| @@ -20,8 +20,8 @@ reader. Commits `917e9b9..e293917` add upstream `v1.2` model-discovery changes ( | |||
| 20 | optional fragment pointers, skipping texture dictionaries in drawable-dictionary scans, 16-bit | 20 | optional fragment pointers, skipping texture dictionaries in drawable-dictionary scans, 16-bit |
| 21 | bone-palette indices, probe-count parity, and zero-radius drawables) plus BCPack BC1/BC3/BC4/BC5 | 21 | bone-palette indices, probe-count parity, and zero-radius drawables) plus BCPack BC1/BC3/BC4/BC5 |
| 22 | decoding (PR #7). A full ten-archive re-count at `e293917` recovers **382,781 models** (**+32,530** | 22 | decoding (PR #7). A full ten-archive re-count at `e293917` recovers **382,781 models** (**+32,530** |
| 23 | over `917e9b9`'s 350,251) with **0 decode failures**; the `levels.rpf` fragment, bone-binding and | 23 | over `917e9b9`'s 350,251) with **0 decode failures**, **55,417 fragments** and **2,636,248,990 |
| 24 | triangle cells are not independently reproduced (see the table note), and the earlier | 24 | triangles** (the `levels.rpf` cells from a full export, see the table note), and the earlier |
| 25 | `917e9b9`, `c3708fb`, and `48557ea` measurements are kept below as controls. This page records the | 25 | `917e9b9`, `c3708fb`, and `48557ea` measurements are kept below as controls. This page records the |
| 26 | measured state; it is not a competing patch. | 26 | measured state; it is not a competing patch. |
| 27 | 27 | ||
| @@ -60,22 +60,29 @@ effect of upstream `v1.2` PRs #8–#12: | |||
| 60 | | `pack/story000_restofworld/...` | 1 | **3** | 3 | 0 | 0 | 0 | 2,620 | 0 | 0 | | 60 | | `pack/story000_restofworld/...` | 1 | **3** | 3 | 0 | 0 | 0 | 2,620 | 0 | 0 | |
| 61 | | `pack/story000/story000.rpf` | 4,195 | **7,461** | 4,156 | 3,305 | 0 | 0 | 39,861,747 | 0 | +1 | | 61 | | `pack/story000/story000.rpf` | 4,195 | **7,461** | 4,156 | 3,305 | 0 | 0 | 39,861,747 | 0 | +1 | |
| 62 | | `packs.rpf` | 26,389 | **26,585** | 23,720 | 2,865 | 2,865 | 26,585 | 64,966,572 | 0 | +2,551 | | 62 | | `packs.rpf` | 26,389 | **26,585** | 23,720 | 2,865 | 2,865 | 26,585 | 64,966,572 | 0 | +2,551 | |
| 63 | | `levels.rpf` | 235,330 | **343,327** | 130,239 | 213,088 | † | † | † | 71 | +29,327 | | 63 | | `levels.rpf` | 235,330 | **343,327** | 130,239 | 213,088 | 50,731 | 59,544 | 2,509,947,536 | 71 | +29,327 | |
| 64 | | `textures.rpf` | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | | 64 | | `textures.rpf` | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | |
| 65 | | `common.rpf`, `core_restofworld001` | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | | 65 | | `common.rpf`, `core_restofworld001` | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
| 66 | | **Total** | **270,819** | **382,781** | **159,511** | **223,270** | **†** | **†** | **†** | **72** | **+32,530** | | 66 | | **Total** | **270,819** | **382,781** | **159,511** | **223,270** | **55,417** | **89,887** | **2,636,248,990** | **72** | **+32,530** | |
| 67 | 67 | ||
| 68 | † `levels.rpf` was counted with `count.exe recover --verify`, which reports candidates, models, | 68 | `levels.rpf` was first counted with `count.exe recover --verify`, which reports candidates, models, |
| 69 | dictionary children, standalone models, rejects and decode failures only: no `levels.rpf` manifest | 69 | dictionary children, standalone models, rejects and decode failures only, so its fragment, |
| 70 | exists and the harness emits no fragment, bone-binding or triangle field. Those three `levels.rpf` | 70 | bone-binding and triangle cells were open. A full `rpf9dump models <levels.rpf> <out>` export at |
| 71 | cells, and the totals that would include them, are therefore **not independently reproduced**. The | 71 | `e293917` (25 min, about 340 GB of OBJ, deleted afterwards) fills them from its manifest: 235,330 |
| 72 | other archives measure 4,686 fragments, 30,343 bone-bound and 126,301,454 triangles. | 72 | candidates, 235,259 recovered, 71 not recovered, 343,327 entries, `fail=0`, the recovery count to |
| 73 | the row. Its `Drawable` field is set on 130,239 entries and null on 213,088, the dictionary-children | ||
| 74 | and standalone cells above (3,694 dictionaries have a single child, so counting shared offsets | ||
| 75 | instead gives 126,545 / 216,782). `IsFragment` is true on 50,731 entries and `HasBoneBindings` on | ||
| 76 | 59,544; `Tris` sums to 2,509,947,536. The same counting on a fresh `data.rpf` export gives that | ||
| 77 | row's 268 / 2,907, 1,758, 2,891 and 3,387,016. The other archives measure 4,686 fragments, 30,343 | ||
| 78 | bone-bound and 126,301,454 triangles. | ||
| 73 | 79 | ||
| 74 | Every recovered entry was read back from its archive segments and decoded through | 80 | Every recovered entry was read back from its archive segments and decoded through |
| 75 | `RageModelDecoder.Decode`: **382,781 / 382,781 decoded, 0 decode failures**. The other archives | 81 | `RageModelDecoder.Decode`: **382,781 / 382,781 decoded, 0 decode failures**. The other archives |
| 76 | measure **236,311 meshes**, **104,183,438 vertices**, **126,301,454 triangles** and **512 embedded | 82 | measure **236,311 meshes**, **104,183,438 vertices**, **126,301,454 triangles** and **512 embedded |
| 77 | textures**; the `levels.rpf` mesh/vertex/triangle/embedded cells are not independently reproduced | 83 | textures**; `levels.rpf` adds 3,854,587 meshes, 2,364,218,711 vertices, 2,509,947,536 triangles and |
| 78 | (see the table note). | 84 | 1,293 embedded textures (the export's own summary line), for **4,090,898 meshes**, **2,468,402,149 |
| 85 | vertices**, **2,636,248,990 triangles** and **1,805 embedded textures** over all ten archives. | ||
| 79 | 86 | ||
| 80 | What moved between `917e9b9` and `e293917`: | 87 | What moved between `917e9b9` and `e293917`: |
| 81 | 88 | ||
| @@ -129,7 +136,7 @@ entries are dictionary children. | |||
| 129 | ### Re-count at `e293917` | 136 | ### Re-count at `e293917` |
| 130 | 137 | ||
| 131 | A full `rpf9dump models` re-run over the same archives at the current pin (the manifests are | 138 | A full `rpf9dump models` re-run over the same archives at the current pin (the manifests are |
| 132 | local; `levels.rpf` has a recovery count but no full OBJ export): | 139 | local; `levels.rpf` was exported separately, see the table note above): |
| 133 | 140 | ||
| 134 | | Archive | Rows | Non-fragment | Fragments | Delta vs `917e9b9` | | 141 | | Archive | Rows | Non-fragment | Fragments | Delta vs `917e9b9` | |
| 135 | |---|---:|---:|---:|---:| | 142 | |---|---:|---:|---:|---:| |
| @@ -141,7 +148,8 @@ local; `levels.rpf` has a recovery count but no full OBJ export): | |||
| 141 | | `story000_restofworld` | **3** | 3 | 0 | 0 | | 148 | | `story000_restofworld` | **3** | 3 | 0 | 0 | |
| 142 | | `common`, `textures`, `story000_script`, `core_restofworld001` | 0 | 0 | 0 | 0 | | 149 | | `common`, `textures`, `story000_script`, `core_restofworld001` | 0 | 0 | 0 | 0 | |
| 143 | | **Total, excluding `levels.rpf`** | **39,454** | **34,768** | **4,686** | **+3,203** | | 150 | | **Total, excluding `levels.rpf`** | **39,454** | **34,768** | **4,686** | **+3,203** | |
| 144 | | `levels.rpf` | recovery count only, see below | - | - | +29,327 | | 151 | | `levels.rpf` | **343,327** | 292,596 | 50,731 | +29,327 | |
| 152 | | **Total** | **382,781** | **327,364** | **55,417** | **+32,530** | | ||
| 145 | 153 | ||
| 146 | The gain outside `levels.rpf` is fragments: upstream `v1.2` PRs #8-#12 recover zero-radius | 154 | The gain outside `levels.rpf` is fragments: upstream `v1.2` PRs #8-#12 recover zero-radius |
| 147 | fragments that the earlier export skipped (2,551 in `packs.rpf`, 594 in `data.rpf`), plus one | 155 | fragments that the earlier export skipped (2,551 in `packs.rpf`, 594 in `data.rpf`), plus one |
| @@ -150,8 +158,8 @@ is 0. | |||
| 150 | 158 | ||
| 151 | `levels.rpf` was re-counted at `e293917` (10 shards over 235,330 candidates): **343,327 models** | 159 | `levels.rpf` was re-counted at `e293917` (10 shards over 235,330 candidates): **343,327 models** |
| 152 | (130,239 dictionary children + 213,088 standalone), against 314,000 at `917e9b9` (206,981 | 160 | (130,239 dictionary children + 213,088 standalone), against 314,000 at `917e9b9` (206,981 |
| 153 | candidates; 130,225 children + 183,801). The +29,327 is a recovery count, not a row-for-row delta, | 161 | candidates; 130,225 children + 183,801). The +29,327 is a recovery count, not a row-for-row delta. |
| 154 | and no full OBJ export was run. Triangle totals were not re-run either. | 162 | The full OBJ export at `e293917` (table note above) gives the same 343,327 rows. |
| 155 | 163 | ||
| 156 | The last column is the `c3708fb` recovery for comparison. `story000`'s standalone count is | 164 | The last column is the `c3708fb` recovery for comparison. `story000`'s standalone count is |
| 157 | 3,304 vs 3,305; the full new-pin standalone total is 190,765, 27 below the `c3708fb` 190,792. | 165 | 3,304 vs 3,305; the full new-pin standalone total is 190,765, 27 below the `c3708fb` 190,792. |
| @@ -248,9 +256,8 @@ reproduced the ten-archive total. The `48557ea` column is the pre-fix control: | |||
| 248 | The `packs.rpf` row is the pre-dictionary-root control: at `917e9b9` that archive recovers | 256 | The `packs.rpf` row is the pre-dictionary-root control: at `917e9b9` that archive recovers |
| 249 | 24,034 models (26,585 at `e293917`), and the other archives' new-pin counts are in the table above. | 257 | 24,034 models (26,585 at `e293917`), and the other archives' new-pin counts are in the table above. |
| 250 | The rows here are the `c3708fb` measurements (190,792 models); the `917e9b9` re-count is 350,251, | 258 | The rows here are the `c3708fb` measurements (190,792 models); the `917e9b9` re-count is 350,251, |
| 251 | and the `e293917` re-count outside `levels.rpf` is 39,454. Triangle totals have not been re-run at | 259 | and the `e293917` re-count outside `levels.rpf` is 39,454. The `e293917` triangle totals of all ten |
| 252 | either new pin; the `e293917` `levels.rpf` geometry cells are not independently reproduced (see | 260 | archives, `levels.rpf` included, are in the table above. |
| 253 | the table note above). | ||
| 254 | 261 | ||
| 255 | At `c3708fb`, every candidate is recovered, read back and decoded: 0 decode failures, 0 readback | 262 | At `c3708fb`, every candidate is recovered, read back and decoded: 0 decode failures, 0 readback |
| 256 | failures, no duplicate model names, and 2.22 billion triangles (1.95 billion before). The | 263 | failures, no duplicate model names, and 2.22 billion triangles (1.95 billion before). The |
| @@ -443,22 +450,39 @@ records. No unhandled layout tag appears: | |||
| 443 | - **Sentinels.** On each surface, 11 entries have every estimate 0 and 10 more have zero speeds with an | 450 | - **Sentinels.** On each surface, 11 entries have every estimate 0 and 10 more have zero speeds with an |
| 444 | infinite time (`inf`). `inf` occurs in 38 road and 99 offroad blocks overall, so a parser must accept `inf` | 451 | infinite time (`inf`). `inf` occurs in 38 road and 99 offroad blocks overall, so a parser must accept `inf` |
| 445 | in these fields (it reads as "never reaches the test speed or distance"). | 452 | in these fields (it reads as "never reaches the test speed or distance"). |
| 446 | - **`fOverallRating` is a weighted mean of the other four ratings** (measured, confirmed to float noise). Over the | 453 | - **`fOverallRating` is a weighted mean of the other four ratings** (measured, confirmed to float noise) on the |
| 447 | 504 rating blocks, `fOverallRating` = 0.21 `fSpeedRating` + 0.38 `fHandlingRating` + 0.40 | 454 | 345 of the 504 rating blocks whose four parts are all above 10: there `fOverallRating` = 0.21 |
| 448 | `fAccelerationRating` + 0.01 `fBrakesRating`: the four weights sum to 1, so handling and acceleration weigh | 455 | `fSpeedRating` + 0.38 `fHandlingRating` + 0.40 `fAccelerationRating` + 0.01 `fBrakesRating`, with a residual |
| 449 | about twice speed and brakes is 1%. The residual is at most 7e-5 on the 345 rating blocks whose four parts are | 456 | of at most 7e-5. The four weights sum to 1, so handling and acceleration weigh about twice speed and brakes is 1%. |
| 450 | all above 10, and differencing a key's road and offroad blocks gives the same 0.2100 / 0.3800 / 0.4000 / | 457 | Differencing a key's road and offroad blocks gives the same 0.2100 / 0.3800 / 0.4000 / 0.0100 on the 139 keys |
| 451 | 0.0100 on the 139 keys that are above 10 on both surfaces, so the weights do not depend on the surface. | 458 | that are above 10 on both surfaces, so the weights do not depend on the surface. |
| 452 | - **The same 10 floor is on the overall** (likely). 24 blocks whose four parts run 10.0 to 11.97 carry an | 459 | - **The overall has the same observed minimum of 10.** The other 159 rating blocks each have at least one part |
| 453 | `fOverallRating` of exactly 10; and the other 159 rating blocks, which have at least one part at exactly 10, | 460 | at exactly 10, and the formula does not hold for them: they sit up to 4.1 below the weighted mean, and 24 of |
| 454 | sit up to 4.1 below the weighted mean, as parts raised to 10 from a lower value would, while no block without | 461 | them carry an `fOverallRating` of exactly 10. No block without a part at 10 deviates. The exports show only |
| 455 | a part at 10 deviates. | 462 | this minimum; they cannot tell where, or whether, the engine clamps. |
| 456 | - **Scale.** The ratings are continuous floats, not a 0-1 or 0-100 score: 342 to 451 distinct values per field | 463 | - **Scale.** The ratings are continuous floats, not a 0-1 or 0-100 score: 342 to 451 distinct values per field |
| 457 | over the 504 blocks, a floor of exactly 10, and `fAccelerationRating` the only field past 1,000 (22 blocks, | 464 | over the 504 blocks, a floor of exactly 10, and `fAccelerationRating` the only field past 1,000 (22 blocks, |
| 458 | maximum 1,327). | 465 | maximum 1,327). |
| 459 | 466 | ||
| 460 | Not measured here (hypothesis): whether the estimates are precomputed from handling data or measured by | 467 | Not measured here (hypothesis): whether the estimates are precomputed from handling data or measured by |
| 461 | simulation, and what fixes the top of the rating scale. | 468 | simulation, and what fixes the top of the rating scale. |
| 469 | - **The estimates are a separate stored table, not the performance maps.** `common.rpf`'s data area at `0x9580` | ||
| 470 | also holds `CVehiclePerformanceMaps` (285 rows, 10 result fields) and `CTyreDataSet` (40 tyre types). 251 of the | ||
| 471 | 252 estimate keys join the performance rows, but no field reproduces an estimate exactly: the best OLS over | ||
| 472 | all ten gives R^2 0.872, and `fAccelerationTime` against `accelZeroSixty` is R^2 0.811 with a median |residual| | ||
| 473 | of 0.54 s. The clearest relation is internal to the estimates: over the 231 rows with a finite top speed, | ||
| 474 | `fStandingQuarterTime = 6.73 + 401.0 / fTopSpeed` (R^2 0.99998, median |residual| 1.01 s; R^2 0.82 over the | ||
| 475 | 209 rows under 30 s). For the seven top-speed-limited rows, `fTopSpeed * fStandingQuarterTime` is | ||
| 476 | 402.339 +/- 0.0003 m, a quarter mile; the residual tracks the 0-60 time. | ||
| 477 | - **The ratings are deterministic functions of the estimates.** Each of the 223 distinct road top speeds gives | ||
| 478 | one `fSpeedRating`; handling/corner has 221 levels, acceleration/acceleration time 204, brakes two collisions, | ||
| 479 | and `fOverallRating` uses more than one field. The rating scale and the overall weighting are still not fitted. | ||
| 480 | - **The handling inputs are not in the readable archives.** No `CHandlingData`/`handling.meta`, `fMass`, | ||
| 481 | `fInitialDriveForce`, `fInitialDragCoeff`, `nInitialDriveGears`, `fTractionCurve*`, `fBrakeForce` or | ||
| 482 | `fSuspensionForce` occurs in `common.rpf`, `data.rpf`, `packs.rpf` or `script.rpf`; the executable is absent. | ||
| 483 | `levels.rpf` is map data and was not fully scanned. The table is therefore consistent with an offline | ||
| 484 | estimator fed by handling-derived scalars, but whether it was fitted to handling or copied from a simulation | ||
| 485 | cannot be verified from this package. | ||
| 462 | 486 | ||
| 463 | ## Character skeletons | 487 | ## Character skeletons |
| 464 | 488 | ||
| @@ -485,9 +509,11 @@ python -I tools/character_census.py <models-dir-or-manifest> [--json FILE] [--cs | |||
| 485 | It reads every nested `model.json` (the decoded-pack layout: `type`, `vertex_count`, | 509 | It reads every nested `model.json` (the decoded-pack layout: `type`, `vertex_count`, |
| 486 | `triangle_count`, `materials[].shader_name_hash`, `materials[].textures[].hash64`, | 510 | `triangle_count`, `materials[].shader_name_hash`, `materials[].textures[].hash64`, |
| 487 | `drawable.skeleton`/`drawable.models[].bone_palette` and `meshes[].skin_influences`), or the | 511 | `drawable.skeleton`/`drawable.models[].bone_palette` and `meshes[].skin_influences`), or the |
| 488 | `Items[]` of a manifest (`Verts`, `Tris`, `IsFragment`, `HasBoneBindings`, `Materials[]`). It | 512 | `Items[]` of a manifest (`Verts`, `Tris`, `IsFragment`, `HasBoneBindings`, `Materials[]`). The |
| 489 | prints one row per model with kind, vertex/triangle counts, bones, 8-influence skin, shader | 513 | local exporter does not write an index count, so the index column and total normally stay unknown; |
| 490 | hashes and texture keys, then totals by kind and by shader hash. A missing or wrongly typed field | 514 | an input that supplies `index_count` is counted, but the field is optional and not part of the |
| 515 | decoded layout. It prints one row per model with kind, vertex/triangle counts, bones, 8-influence | ||
| 516 | skin, shader hashes and texture keys, then totals by kind and by shader hash. A missing or wrongly typed field | ||
| 491 | is reported on that row instead of ending the run. An `rpf9dump models` manifest records only | 517 | is reported on that row instead of ending the run. An `rpf9dump models` manifest records only |
| 492 | `HasBoneBindings`, not a bone count or influence width, so those cells stay `?`. Report paths that | 518 | `HasBoneBindings`, not a bone count or influence width, so those cells stay `?`. Report paths that |
| 493 | alias an input are refused. The tests are synthetic: `python -I tests/test_character_census.py`. | 519 | alias an input are refused. The tests are synthetic: `python -I tests/test_character_census.py`. |
| @@ -517,6 +543,11 @@ Names are per model and a building holds glass, decal and opaque shaders alike, | |||
| 517 | in absolute terms; the enrichment against bucket 0 is the signal. For export: bucket 1 needs blending, 2 is | 543 | in absolute terms; the enrichment against bucket 0 is the signal. For export: bucket 1 needs blending, 2 is |
| 518 | a projected decal, 3 needs alpha testing, 6 is a water surface. | 544 | a projected decal, 3 needs alpha testing, 6 is a water surface. |
| 519 | 545 | ||
| 546 | `common.rpf` carries the matching preset-to-effect table (`SPS1`, decoded by `tools/gamedata_sps1.py`, | ||
| 547 | [`gamedata.md`](gamedata.md#sps1-shader-preset-table)): `858` `.sps` presets map onto `539` `SGD5` Database 0 effects | ||
| 548 | with a default `u8` render bucket (`0..7`), `63` effects accept multiple buckets, and the single bucket-`4` | ||
| 549 | and bucket-`5` presets both resolve to effect `fc34f08b`. | ||
| 550 | |||
| 520 | ## Material shader hashes and the carved programs | 551 | ## Material shader hashes and the carved programs |
| 521 | 552 | ||
| 522 | `rpf9dump` also writes each material's shader hash (`manifest.json` → `Materials[].Shader`, u32 as 8 hex digits). | 553 | `rpf9dump` also writes each material's shader hash (`manifest.json` → `Materials[].Shader`, u32 as 8 hex digits). |
| @@ -635,7 +666,21 @@ They are reachable through the **effect records** in `shaders.rpf` (found by @je | |||
| 635 | are little-endian: | 666 | are little-endian: |
| 636 | 667 | ||
| 637 | 1. **The effect record.** It starts with a one-byte name length and the name, including its terminator, then a | 668 | 1. **The effect record.** It starts with a one-byte name length and the name, including its terminator, then a |
| 638 | u32 whose meaning is not known. Six stage lists follow, each a u32 count and that many u32 ordinals. | 669 | u32 (below). Six stage lists follow, each a u32 count and that many u32 ordinals. |
| 670 | |||
| 671 | The u32 is a size computed from the record's own counted fields (@jeremygold02). Let G be the ordinals in the | ||
| 672 | six lists, T the techniques, P the passes, and W the post-pass word count. Let A and B be the two block | ||
| 673 | lengths after them, E the post-pass entry count, I the payload bytes of the entries whose tag is a length | ||
| 674 | (not `0x80000000`), and S the string-pool length. Lengths don't count their own prefixes. Then, with | ||
| 675 | `x = 4W + A + B`: | ||
| 676 | |||
| 677 | ```text | ||
| 678 | word = 48 + 8(G + T + E) + 32P + I + S + (round_up(x, 8) if E else x) | ||
| 679 | ``` | ||
| 680 | |||
| 681 | This holds for all 932 records of this build (910 + 22, recomputed here). The value never equals the record's | ||
| 682 | serialized length (0 of 932), so the next record is found by the sequential walk, not by this word. What the | ||
| 683 | runtime uses it for is unknown. Groups 3 and 4 are empty here, so their share of it is unmeasured. | ||
| 639 | 684 | ||
| 640 | `shaders.rpf` holds **two shader databases** (SGD5), and an ordinal counts within one of them (found by | 685 | `shaders.rpf` holds **two shader databases** (SGD5), and an ordinal counts within one of them (found by |
| 641 | @jeremygold02). Each database stores six program groups, each a u32 count followed by its programs. A program | 686 | @jeremygold02). Each database stores six program groups, each a u32 count followed by its programs. A program |
| @@ -682,7 +727,8 @@ record, technique and pass. The record and pass format below was also checked by | |||
| 682 | 727 | ||
| 683 | Two things are still open: | 728 | Two things are still open: |
| 684 | 729 | ||
| 685 | - **The u32 after an effect's name.** What it means is still unknown. | 730 | - **The u32 after an effect's name.** It is reproduced from the record's fields; how the runtime uses it is |
| 731 | still unknown. | ||
| 686 | - **Which technique and pass the game draws with.** That is a run-time choice; it is presumably made in the | 732 | - **Which technique and pass the game draws with.** That is a run-time choice; it is presumably made in the |
| 687 | executable (RT-5). | 733 | executable (RT-5). |
| 688 | 734 | ||
| @@ -713,15 +759,29 @@ vehicle models to far-away light recipes. Counts only; no model names. | |||
| 713 | this build the document is an index from model and variant to recipe with the light positions absent, | 759 | this build the document is an index from model and variant to recipe with the light positions absent, |
| 714 | so distant vehicle lights cannot be reconstructed from it. | 760 | so distant vehicle lights cannot be reconstructed from it. |
| 715 | 761 | ||
| 762 | To reproduce the joins, locate the XML roots in the [common carve catalog](gamedata.md) with | ||
| 763 | `python -I tools/gamedata_xml.py <common-carve-dir> --json xml.json`. Trim and lowercase the field | ||
| 764 | text, then match each nonempty `CVehicleDistantLightData/recipeLights/Item` by `vehicleModelName` | ||
| 765 | and its sorted list of `secondaryRecipes/Item` values against `vehicleName` and the same list on | ||
| 766 | `CPaletteIndexedRecipeTintsArray` rows at `.//recipeCombinations/Item`. For the carriage check, | ||
| 767 | expand the light lists to distinct pairs and compare with `CTrainConfigs` rows at `.//carriages/Item`. | ||
| 768 | |||
| 716 | The sampled `CPaletteIndexedRecipeTintsArray` document reuses 746 of the 780 distinct distant-light | 769 | The sampled `CPaletteIndexedRecipeTintsArray` document reuses 746 of the 780 distinct distant-light |
| 717 | secondary tokens in its own `secondaryRecipes` field. Of the 1,668 distant-light rows with at least one | 770 | secondary tokens in its own `secondaryRecipes` field. Of the 1,668 distant-light rows with at least one |
| 718 | token, 1,339 match a palette recipe on both vehicle name and the complete token list, ignoring case and | 771 | token, 1,339 match a palette recipe on both vehicle name and the complete token list, ignoring case and |
| 719 | token order. Replacing each vehicle name with the next of the 319 lowercased names in sorted order | 772 | token order. Replacing each vehicle name with the next of the 319 distinct names from all light rows in sorted order |
| 720 | (wrapping at the end) and keeping its tokens fixed gives 56 matches among the same 1,668 rows. | 773 | (wrapping at the end) and keeping its tokens fixed gives 56 matches among the same 1,668 rows. |
| 721 | 774 | ||
| 775 | For a single-token comparison, the distant-light rows give 1,547 distinct (vehicle, secondary token) | ||
| 776 | pairs. Four match the `modelName` and `modelSetName` fields on the same `CTrainConfigs` carriage row, | ||
| 777 | after trimming whitespace and ignoring case. These four pairs cover two vehicle models and four model | ||
| 778 | sets. Rotating the 319 vehicle names as above gives zero matching pairs. Keeping the vehicle fixed and | ||
| 779 | rotating the 780 distinct tokens in sorted order, with wraparound, gives two matching pairs. | ||
| 780 | |||
| 722 | In the 34-row `CVehicleBoneOffsetsArray` document, 0 of the 780 distinct tokens match a whole text or | 781 | In the 34-row `CVehicleBoneOffsetsArray` document, 0 of the 780 distinct tokens match a whole text or |
| 723 | attribute value case-insensitively. In the 2,447-row document of the same type, 178 of the 780 match | 782 | attribute value case-insensitively. In the 2,447-row document of the same type, 178 of the 780 match |
| 724 | `boneOffsets/Item/name`. These comparisons establish recipe reuse across the light and palette documents. | 783 | `boneOffsets/Item/name`. All 2,447 rows have empty `vehicleName` fields, so those name matches provide |
| 784 | no same-row vehicle association. | ||
| 725 | Which physical parts or liveries a token selects, and where the runtime obtains light positions, remain open. | 785 | Which physical parts or liveries a token selects, and where the runtime obtains light positions, remain open. |
| 726 | 786 | ||
| 727 | ## Skinned GLB export | 787 | ## Skinned GLB export |
| @@ -739,21 +799,75 @@ the drawable's local joint palette through the drawable and ped tables, and emit | |||
| 739 | in [character_skeleton.md](character_skeleton.md#skinned-glb-export). On the 1.0.2.1 package, the | 799 | in [character_skeleton.md](character_skeleton.md#skinned-glb-export). On the 1.0.2.1 package, the |
| 740 | head (8,983 v) and biker jacket (9,818 v) produce one skin with 596 ped joints (703 with the | 800 | head (8,983 v) and biker jacket (9,818 v) produce one skin with 596 ped joints (703 with the |
| 741 | jacket's `GM_U01_*` helpers); every weight sums to 255 and the rest-pose reconstruction error is | 801 | jacket's `GM_U01_*` helpers); every weight sums to 255 and the rest-pose reconstruction error is |
| 742 | 6e-8 m. `python -I tests/test_skinned_glb.py` runs 10 synthetic tests and needs no game files. | 802 | 6e-8 m. `python -I tests/test_skinned_glb.py` runs 19 synthetic tests and needs no game files. |
| 743 | 6e-8 m. `python -I tests/test_skinned_glb.py` runs 15 synthetic tests and needs no game files. | 803 | |
| 804 | `tools/glb_inspect.py` reads such a GLB back without a library, so an export can be checked | ||
| 805 | before it is opened in a viewer: | ||
| 806 | |||
| 807 | ``` | ||
| 808 | python -I tools/glb_inspect.py out.glb [--json report.json] | ||
| 809 | ``` | ||
| 810 | |||
| 811 | It prints the chunk layout and padding, the `counts` of scenes, nodes, meshes, materials, images, | ||
| 812 | skins and animations, each mesh's primitive, vertex and triangle counts, each material's | ||
| 813 | `baseColorTexture`, each skin's joint count, each animation's channels and duration, and the | ||
| 814 | POSITION bounding box (marked `partial` when a POSITION accessor has no `min`/`max`). It reports | ||
| 815 | what the JSON chunk says — a field the exporter dropped reads `(missing)` — and never infers | ||
| 816 | geometry from the BIN chunk. Standard library only; no game files. | ||
| 744 | 817 | ||
| 745 | ## What to do next | 818 | ## What to do next |
| 746 | 819 | ||
| 747 | 1. **Done:** [rpf9-explorer PR #1](https://github.com/breadbbbb/rpf9-explorer/pull/1) is merged upstream. | 820 | 1. **Done:** [rpf9-explorer PR #1](https://github.com/breadbbbb/rpf9-explorer/pull/1) is merged upstream. |
| 748 | 2. **Done:** the pin is `e293917` (was `917e9b9`, originally `48557ea`). | 821 | 2. **Done:** the pin is `e293917` (was `917e9b9`, originally `48557ea`). |
| 749 | 3. **Done:** all ten `MODEL_ARCHIVES` were re-counted and read-back decoded at `e293917` (**382,781 | 822 | 3. **Done:** all ten `MODEL_ARCHIVES` were re-counted and read-back decoded at `e293917` (**382,781 |
| 750 | models**, **0 decode failures**; table above; the `levels.rpf` geometry cells are not | 823 | models**, **0 decode failures**; table above, `levels.rpf` geometry from a full export). |
| 751 | independently reproduced). | ||
| 752 | 4. Investigate the 71 remaining unrecovered fragment candidates in `levels.rpf` (and the 1 | 824 | 4. Investigate the 71 remaining unrecovered fragment candidates in `levels.rpf` (and the 1 |
| 753 | texture-dictionary candidate in `textures.rpf`) if further upstream recovery is wanted. | 825 | texture-dictionary candidate in `textures.rpf`) if further upstream recovery is wanted. |
| 754 | 5. Keep issue #29 in sync with the `e293917` counts. | 826 | 5. Keep issue #29 in sync with the `e293917` counts. |
| 755 | 3. **Done:** `tools/rpf9dump models` was re-run over the model-bearing archives at `e293917`; | 827 | 3. **Done:** `tools/rpf9dump models` was re-run over the model-bearing archives at `e293917`; |
| 756 | the six non-`levels.rpf` archives total 39,454 rows (+3,203, almost all recovered fragments). | 828 | the six non-`levels.rpf` archives total 39,454 rows (+3,203, almost all recovered fragments). |
| 757 | `levels.rpf` has a recovery count (343,327 models, +29,327) but no full OBJ export; triangle | 829 | `levels.rpf` has the same 343,327 rows in a full export (50,731 fragments, 2,509,947,536 |
| 758 | totals were not re-run. | 830 | triangles). |
| 759 | 4. Keep the README and issue #29 in sync with the new counts. | 831 | 4. Keep the README and issue #29 in sync with the new counts. |
| 832 | |||
| 833 | ### Predict model offsets for placements | ||
| 834 | |||
| 835 | Run `python -I tools/world_drawable_lookup.py entities.jsonl archetypes.json names.json` | ||
| 836 | with the placement rows from `world_index.py --entities-out`, the definitions from | ||
| 837 | `world_archetypes.py`, and a bounded `rpf9_names.py --types dr,ft` report. The command | ||
| 838 | prints local scratch JSON. Supply `--manifest path/to/models/manifest.json` for each | ||
| 839 | existing export whose listed identities should be excluded. | ||
| 840 | |||
| 841 | The lookup requires agreement between the placement archetype, the definition's name and | ||
| 842 | assetName, the resource stem's joaat and its 64-bit placement key. It considers type 1 | ||
| 843 | fragments and type 2 drawables at page offset +16. Multiple offsets for an identity in | ||
| 844 | the indexed window are marked ambiguous. Even a single hit is a prediction: a stream | ||
| 845 | can mention another model. Export a window around the predicted offset with | ||
| 846 | `rpf9dump models <archive> <outdir> --start BYTES --length BYTES`, compare the manifest offset and | ||
| 847 | model identity and run `world_build.py --placements` with the exported geometry. | ||
| 848 | |||
| 849 | Save the lookup JSON and run | ||
| 850 | `python -I tools/world_drawable_verify.py lookup.json first/models/manifest.json second/models/manifest.json` | ||
| 851 | to verify single-offset predictions. Supply completed normal model manifests from the | ||
| 852 | same source archive. The verifier reads cached JSON only. It uses the world builder's | ||
| 853 | name hashes and counts each identity and its placements once. A matching offset and both | ||
| 854 | hashes confirm an observation, including dictionary children sharing an offset. The local | ||
| 855 | report counts repeat exact observations and lists other offsets for the same identity. | ||
| 856 | Without an exact match, a different name at the offset takes precedence over a matching | ||
| 857 | identity elsewhere. The coverage flag independently records whether the predicted offset | ||
| 858 | falls in a supplied scan (start inclusive, end exclusive). A full scan covers all offsets. | ||
| 859 | A covered prediction with no named evidence remains missing. Geometry loadability is | ||
| 860 | checked separately by running the normal world builder on confirmed placement rows. | ||
| 861 | |||
| 862 | Add `--window-bytes BYTES` to recommend one scan in the name index's archive. | ||
| 863 | The optional `export_window` field gives the decimal `start` and `length` for | ||
| 864 | `rpf9dump models`. It maximizes the sum of unmatched placement rows with a | ||
| 865 | single predicted offset in that index. Each identity contributes its placement | ||
| 866 | count once. Ambiguous identities contribute zero. For a tie it takes the earliest | ||
| 867 | last offset, then trims the interval to its first and last included bytes. | ||
| 868 | An empty selection yields JSON null. Run the lookup separately for each archive. | ||
| 869 | |||
| 870 | The budget bounds the half-open range of candidate **starts**. The exporter can | ||
| 871 | inspect prefix bytes and read model segments beyond the range. The report | ||
| 872 | predicts coverage. Confirm identities and offsets in the exported manifest and | ||
| 873 | check the resulting placement count with `world_build.py`. | ||