Skip to content

world_lights_paths: map lights and the vehicle lane graph in levels.rpf (ASSET-102) - #1648

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
cxchhh:world-lights-lane-graph
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
cxchhh:world-lights-lane-graph

Conversation

@cxchhh

@cxchhh cxchhh commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

ASSET-102 (claimed in #1218, tracked in #1380).

Why

docs/world.md covers entity placement, but it has no light emitters and no vehicle paths. Both are in the same 0x7a resources as the map placements, and nothing in the repository read them.

Change

  • tools/world_lights_paths.py (stdlib only, on top of world_census.assemble and the world_index header readers) reads every field by its member hash from each resource's own schema:
    • Lights: every CExtensionDefLightEffect reachable from the extensions list of a CBaseArchetypeDef, CMloArchetypeDef or CEntityDef, and its CLightAttrDef lists. It reports counts per light type, owner and resource kind, value ranges and checks. With --entities (the rows from world_build: place models at their map placements (--placements) #1183's world_index.py --entities-out), it places archetype lights in world space through each map entity's transform, the same one world_build.py --placements uses. --lights-out writes the placed lights, to the local work folder only.
    • Lane graph: path nodes, links (lane counts, flags, length) and junctions (entrances, turns, traffic-light phases). It also measures connectivity: components, isolated nodes, link reciprocity, and junction references that resolve.
  • tests/test_world_lights_paths.py: 14 tests on synthetic resources, including a pool reference whose offset 0x5xx also looks like a system pointer.
  • docs/world_lights_paths.md: layouts, the names that are joaat-verified versus labels, the counts below, and the SixNG cross-check. It is linked from docs/world.md and docs/README.md.

Measured

Full levels.rpf on current main, 75 s with --jobs 24:

Measure Count
Lights / light effects / resources 280,105 / 146,733 / 8,576
on archetypes / on entities 137,294 / 142,811
spot / capsule / point / type 32 152,773 / 66,383 / 55,115 / 5,834
placed in world space (map entities) 450,195 (349,799 archetype lights on 190,319 entities + 100,396 entity lights)
lane-graph nodes / links 63,808 / 145,518 (145,510 with a reverse link; 27 components)
junctions / signalised / phases 1,546 / 369 / 1,033
entrances / turns (all resolve) 6,790 / 11,604

Cross-check against SixNG's independent output for the same package:

  • Lane graph: identical on all seven counts.
  • Lights: 280,105 here against 274,820. Every one of the 5,285 extra lights is on this side, and SixNG has none that this tool misses. SixNG resolves 0x5xxxxxxx/0x6xxxxxxx before the pool form, so it misreads pool references with an offset of 0x500..0x6ff. Rereading with SixNG's order gives equal counts on 8,434 of 8,576 light resources.
  • Placed lights: SixNG's placed total (774,847) also includes interior (MLO) instances, which this PR leaves in interior space.

Tested

Tested on Linux x64 with Python 3.11, no GPU. These pass: python -m compileall -q make_game.py tools tests, python -I make_game.py --help, python -I tests/test_world_lights_paths.py, and the existing test_world_index, test_world_census, test_world_place and test_world_instancing.

AI-assisted: an AI agent (Claude, Anthropic) did the investigation, code, tests and measurements on the author's behalf. Counts and layouts only; no game data.

🤖 Generated with Claude Code

…pf (ASSET-102)

New stdlib tool on top of world_census.assemble and the world_index header
readers. Every field is read by member hash from each 0x7a resource's own
schema.

Lights: every CExtensionDefLightEffect reachable from the extensions list
of an archetype, interior archetype or entity, and its CLightAttrDef
lists. Counts per type, owner and resource kind, value ranges and checks.
With --entities (world_index.py --entities-out rows) archetype lights are
placed in world space through each map entity's transform, the same one
world_build.py --placements uses; --lights-out writes them (local only).

Lane graph: path nodes, links (lanes, flags, length) and junctions
(entrances, turns, traffic-light phases), with connectivity measured.

Full levels.rpf: 280,105 lights (450,195 placed through map entities),
63,808 nodes, 145,518 links, 1,546 junctions (369 signalised). The lane
graph equals SixNG's on every count; all 5,285 lights SixNG lacks come
from pool references at offsets 0x500..0x6ff that it reads as pointers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ItsNotRexed
ItsNotRexed merged commit d47024b into ItsNotRexed:main Nov 22, 2026
3 of 4 checks passed
@rafaelpssz

Copy link
Copy Markdown
Contributor

Post-merge check of 840a6e3e on a second 1.0.2.1 copy (mine, counts only), Windows 11, Python 3.14. tests/test_world_lights_paths.py: 14 passed. A full levels.rpf run reproduces the description exactly:

  • Lights: 280,105 lights and 146,733 effects over 8,576 resources. 137,294 on archetypes and 142,811 on entities. 152,773 spot, 66,383 capsule, 55,115 point, 5,834 type 32.
  • Lane graph: 63,808 nodes, 145,518 links (145,510 with a reverse link), 27 components. 1,546 junctions, 369 of them signalised, with 1,033 phases. 6,790 entrances, 11,604 turns.
  • One small thing the doc doesn't explain: node_keys_unique and num_links_matches_range are both 63,807, one short of the 63,808 nodes.

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.

3 participants