- tools/meshlet_page.py: in summarise_page, hoist the block4240 vertex-count set outside the generator expression to avoid rebuilding the set for every group.
- tools/meshlet_page.py: in block4240_checks, compute count statistics in a streaming pass over packed slot-0 positions instead of materializing full tuple lists, preserving positions_4240 for callers requiring coordinates.
- tests/test_meshlet_page.py: add test_block4240_checks_streaming_and_summary_counts.
Each tool refused a report at <source>/index.json only when a carve
manifest already existed there. A report written before the carve took
the name hashdict.py and the other tools read as the carve manifest.
Refuse that path whether or not the manifest exists yet, as #3156 does
for page_index and story_index. bvh_index is left to BUILD-454.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FXR27ZYP9qtZtN8SG7QPWW
Review fix (shdann on #3806): centre_distance returns None for a NaN or infinite sum, so min() never sees a NaN.
With no finite candidate the old choice stays, as on the merge base. Test with a NaN-bias block in both orders and
the all-non-finite case.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
e = 0..4 occur; the bit-28-only rule read the 157 minigame meshlets with e = 2
at 1/8 m, where their radius covers none of them (157 of 157 at 1/4 m).
centre_step takes the exponent, coarse_steps counts e > 0, tests cover e = 1..3,
and the docs/story.md tables are recounted.
When several 42 40 blocks in a page have a group's vertex count, summarise_page took the nearest one before the
group. Nothing in the page orders them (in Q0 Q1 G0 G1 pages G0 is built on either block), so it now takes the
block whose vertex boxes are closest to the group's stored centres (centre_distance), keeping the old choice on
a tie. New counters groups_4240_several_blocks and groups_4240_block_by_centres.
Over all of story000.rpf: 16,059 groups have several blocks and 8,668 change block; opposed neighbouring faces
fall from 518,113 to 16,408 of about 36.7 M shared edges, and faces within ~25 degrees rise from 90.8% to 92.7%.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
story000.rpf has 256 KiB pages where texture-like data follows the mesh chunks
on a 256-byte boundary behind zero padding; the walk now stops there
(stopped_at_other_data) instead of rejecting the page. Anything else that
doesn't parse stays an error. The default position counts now come from the
header box when it lies inside 300 m (same totals, the default run back near
#2424's time; review on #2601).
1,732 large, far meshlets in the minigame archive set it; read at 1/16 m their
radius covers the farthest vertex in 0 of them, at 1/8 m in 98.0% (99.9% with
the rounding allowance). centre_step and meshlet_centre take the bit,
centre_agreement uses each meshlet's step and counts coarse_steps; the
docs/story.md tables are recounted (centres 50.1% / 71.8%, radius 96.5% /
98.7%). Also fixes the docstring sentence #3033 garbled.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Axis octahedral 6+6 unorm (bits 14-19, 20-25), sin(half-angle) = (31 - f)/31
from bits 26-30, all-zero = no cone. Over the minigame archive (counts
only): 43,415 cones, axis within 25 degrees of the mean face normal for 82.0%,
every face inside within 0.05 for 97.8% (core_restofworld 74.9% / 99.7%).
meshlet_cone, cone_agreement under --cones, tests, docs/story.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Around the stored centre: it covers the farthest vertex in 95.3% of 142,613
minigame meshlets (97.5% allowing the centre's 1/16 m rounding) and 97.4% /
99.9% of 4,899 in core_restofworld; 99.9% are within 1.25x the tightest
radius (counts only). meshlet_radius, radius counts under --centres, tests,
docs/story.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Unit vectors perpendicular to the stored normal: 98.9% of 7,520,441 minigame
tangent words within |dot| < 0.05; bits 30-31 are 3 or 0 in every one
(+1 / -1). tangents_4240, tangent_agreement under --normals, a test, and
docs/story.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Checked against the summed face normals of the decoded positions (counts
only): 86.0% of 14.4M minigame vertices within 8 degrees, 1.5% opposed;
core_restofworld 66.3% / 11.3%, where 2% of groups are mostly inverted.
normals_4240 and normal_agreement, a --normals check, and docs/story.md with
the rule and the second-archive counts for positions, faces and centres.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rpf9-explorer's RageModelDecoder reads vertex slots this way; it sizes all
99,184 slot words of the minigame archive's 63 30 and 42 40 blocks (counts
only), so tag_stride replaces the per-tag table (for the six types seen) and
the archive walk gives identical totals. docs/story.md gets the tag/type
table, the +0x7C meaning (snorm16 UV scale, rpf9-explorer) and the slots
actually used (0-4, 11-15, 18; #2424 said 0-4 and 11-14).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
w2 bits 0-11, 12-23 and w3 bits 0-11 are x, y and z as (field - 2047) / 16.
meshlet_centre decodes them; --centres compares them with each meshlet's
vertex-box centre on 42 40 geometry: 49.8% of 427,839 axes in the same
1/16 m step and 71.4% within one over the minigame archive (counts only);
offset 2048, 1/8 m steps or swapped axes fit far worse. docs/story.md records
the rule, the controls, why the 63 30 test saw nothing (default words), and
what of the record is still open.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Slot 0 (tag 0x42, 8 bytes) is the (8, 16) position form rpf9-explorer's
RageModelDecoder already reads: bias f32x3 at +0x60, axis order at +0x6C,
scale f32x3 at +0x70; a = bits 8-31, b = bits 32-47 << 8 | bits 0-7,
c = bits 48-63. positions_4240 decodes it, the page checks count finite and
within-300 m positions, and --faces counts neighbouring-face agreement
(83.7% within ~25 degrees, 0.26% opposed over the minigame archive's
17.3M shared edges; counts only). The record key mode becomes axis.
docs/story.md gets the independent check and drops the open item.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The directory prefilter admitted only 63 30 and group-led files, so a carved page
that starts with a 42 40 block was skipped before is_mesh_page saw it (found by
whattheflop in review). The directory/archive CLI test now has such a page and
fails without the fix.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 42 40 block has a 0x80-byte header with the same slot words; tag 0x42
streams are 8 bytes a vertex and tags 0x21/0x26/0x27/0x28 4 bytes. Over
shared_minigame000.rpf 14,671 headers fit exactly and every one is followed
by a recognised chunk. The walk used to stop at these blocks; it now reads
1,569 streams instead of 335 (159,387 meshlets, 16.9M triangles), 0 left
unparsed. A 63 30 block slot past 4 takes its tag's stride. Positions and
attributes are not decoded. Counts only in docs/story.md; synthetic tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
open(path, "w") without newline= turns each \n into \r\n on Windows, so the same JSON report, manifest or assembly
listing was CRLF there and LF elsewhere. 91 text-mode writes (open, os.fdopen, Path.write_text) under tools/, scripts/,
make_game.py and runtime/test/shaders/ now pass newline="\n". tests/test_text_write_line_endings.py reads the source
with ast and fails for a writer that forgets it; CONTRIBUTING.md names the convention.
AI-assisted (Claude), on behalf of dev-ewann.
On Windows a redirected stdout uses the console's ANSI code page, and python -I ignores PYTHONUTF8 and
PYTHONIOENCODING, so a caller path with a character outside that code page ended a run with
UnicodeEncodeError as soon as a tool printed it. #1406 fixed make_game.py; every CLI tool in tools/ now starts
its __main__ block the same way (stdout errors="replace").
tests/test_tool_stdout_encoding.py checks every tool's __main__ block and reruns two measured crashes
(analyze_4240_full.py, meshlet_page.py) with a private-use-named input. Found by @abilliontokens.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In data.rpf at offset 0x122771b0, a vertex block has slots 0 (float3 pos), 3 (float2 uv0), and 4 (float2 uv1), but no slot 2 (normals). Currently parse_block requires slot 2 and calculates vertex count as (slot 2 - slot 0) / 12. Only slot 0 is required: vertex count is determined by the span of slot 0 to the next slot in offset order, divided by 12. In block_checks, unpack normals only if slot 2 exists. Adds synthetic unit tests in tests/test_meshlet_page.py.