viewer: an overview map of the world's chunks, with click to fly there (VIEWER-OVERVIEW-MAP) #2338

Merged
leonida/mandy
syfyra merged 1 commit from feat/viewer-overview-map into main 2026-12-01 15:19:30 +00:00

Pull request successfully merged and closed

syfyra commented 2026-11-26 14:05:34 +00:00

Claimed in the coordination issue as: VIEWER-OVERVIEW-MAP (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7193940963)

Depends on: none. It merges cleanly with the open pull requests on the viewer page and its tests (#93, #651, #918, #2243), and the viewer's Node tests pass on each of those four merges.

What and why

The map viewer loads only what is near the camera (1,400 m, or one band per LOD tier), and nothing in it shows where the rest of a world is. A placed world is kilometres across, G draws the chunk boxes in 3D, which helps only for what is in view, and a chunk that fails to load is a count in the HUD with no way to tell which chunk it was.

M opens a map of the whole world from above, drawn from world.json alone:

  • One rectangle per chunk (its cell when it names a tier, otherwise the X/Z extent of its bounds), coloured by its streaming state: not loaded, loading, loaded, or failed (its three attempts are used up). +x is right and +z is down, so a placed world has north (RAGE +Y) at the top.
  • The camera as an arrow along its view direction, the spawn point, a scale bar and, in a world without LOD sets, the loading radius.
  • Under the map, the point under the cursor in glTF metres, in a placed world also as RAGE X and Y (the numbers world_build.py --region takes), and the chunk there with its state. That is how a chunk that fails to load is found by id.
  • A click moves the camera there. Its height stays unless full-detail geometry reaches higher at that point; then it arrives 10 m above the top of those chunks' bounds. Coarser LOD tiers are left out of that, because one distant model in them can span kilometres.
  • The wheel over the map zooms it about the cursor, up to 64 times, and does not change the flying speed.

Opening the map releases a locked mouse, since the map is used with the cursor. #map sits above the "Click to fly" layer, so a click on the map reaches the map and a click beside it locks the mouse again; the map stays open while flying.

Nothing touches the page until the map is first opened, so the existing tests that run the whole module with a getElementById that returns {} are unchanged. An open map is redrawn at most every 100 ms. Chunk ids come from world.json and are written with textContent. docs/world.md gets a section on the map.

Tested

Windows 11, Node 26.12.1, Python 3.14.7:

  • node --test tests/test_*.cjs: 89 pass, 20 of them new in tests/test_viewer_map.cjs. The new file runs the map's code from the page together with the streaming section, so the chunk states it checks come from real stream() calls (a load, a pending request, one failure, three failures). It covers the fit and the gap between cells, high-DPI canvases, the four colours and the legend, the arrow, the radius and the spawn ring, the scale bar, north and the RAGE coordinates, the info line (also for a cursor that rests while a chunk loads), LOD cells, the click and its height rule, the zoom and its limits, the redraw interval, an empty world and a collapsed panel.
  • The new file fails on main, where the page has no map section.
  • 42 one-line changes to the new code (a removed stopPropagation, a swapped axis, a dropped tier check, innerHTML for textContent, and so on) each make at least one of the new tests fail.
  • In Chromium (the Claude desktop app's browser pane) with python -I viewer/serve.py: the test terrain (576 chunks), and a synthetic world.json with LOD sets, "layout": "placements" and no chunk files, where the cells turn from loading to failed. Opened, hovered, clicked to fly, zoomed with the wheel (the speed in the HUD stayed at 40 m/s) and closed, at 1024x768 and in a 700x560 window.
  • python -I on every tests/test_docs_*.py, tests/test_i18n_index.py, tests/test_viewer_cdn_integrity.py, tests/test_text_write_line_endings.py and tests/test_ci_registration.py; python -I scripts/check_no_game_data.py on the three changed files.
  • Not tested: a world built from a package (both manifests above are synthetic), Firefox and Safari, and a locked mouse in a browser (I did not lock it there; the release on opening is covered by the Node test only). Touch devices have no key for the map.

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (No translator rule in this change.)

🤖 Generated with Claude Code

Claimed in the coordination issue as: VIEWER-OVERVIEW-MAP (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7193940963) Depends on: none. It merges cleanly with the open pull requests on the viewer page and its tests (#93, #651, #918, #2243), and the viewer's Node tests pass on each of those four merges. ### What and why The map viewer loads only what is near the camera (1,400 m, or one band per LOD tier), and nothing in it shows where the rest of a world is. A placed world is kilometres across, `G` draws the chunk boxes in 3D, which helps only for what is in view, and a chunk that fails to load is a count in the HUD with no way to tell which chunk it was. `M` opens a map of the whole world from above, drawn from `world.json` alone: - One rectangle per chunk (its `cell` when it names a tier, otherwise the X/Z extent of its `bounds`), coloured by its streaming state: not loaded, loading, loaded, or failed (its three attempts are used up). +x is right and +z is down, so a placed world has north (RAGE +Y) at the top. - The camera as an arrow along its view direction, the spawn point, a scale bar and, in a world without LOD sets, the loading radius. - Under the map, the point under the cursor in glTF metres, in a placed world also as RAGE X and Y (the numbers `world_build.py --region` takes), and the chunk there with its state. That is how a chunk that fails to load is found by id. - A click moves the camera there. Its height stays unless full-detail geometry reaches higher at that point; then it arrives 10 m above the top of those chunks' bounds. Coarser LOD tiers are left out of that, because one distant model in them can span kilometres. - The wheel over the map zooms it about the cursor, up to 64 times, and does not change the flying speed. Opening the map releases a locked mouse, since the map is used with the cursor. `#map` sits above the "Click to fly" layer, so a click on the map reaches the map and a click beside it locks the mouse again; the map stays open while flying. Nothing touches the page until the map is first opened, so the existing tests that run the whole module with a `getElementById` that returns `{}` are unchanged. An open map is redrawn at most every 100 ms. Chunk ids come from `world.json` and are written with `textContent`. `docs/world.md` gets a section on the map. ### Tested Windows 11, Node 26.12.1, Python 3.14.7: - `node --test tests/test_*.cjs`: 89 pass, 20 of them new in `tests/test_viewer_map.cjs`. The new file runs the map's code from the page together with the streaming section, so the chunk states it checks come from real `stream()` calls (a load, a pending request, one failure, three failures). It covers the fit and the gap between cells, high-DPI canvases, the four colours and the legend, the arrow, the radius and the spawn ring, the scale bar, north and the RAGE coordinates, the info line (also for a cursor that rests while a chunk loads), LOD cells, the click and its height rule, the zoom and its limits, the redraw interval, an empty world and a collapsed panel. - The new file fails on `main`, where the page has no map section. - 42 one-line changes to the new code (a removed `stopPropagation`, a swapped axis, a dropped tier check, `innerHTML` for `textContent`, and so on) each make at least one of the new tests fail. - In Chromium (the Claude desktop app's browser pane) with `python -I viewer/serve.py`: the test terrain (576 chunks), and a synthetic `world.json` with LOD sets, `"layout": "placements"` and no chunk files, where the cells turn from loading to failed. Opened, hovered, clicked to fly, zoomed with the wheel (the speed in the HUD stayed at 40 m/s) and closed, at 1024x768 and in a 700x560 window. - `python -I` on every `tests/test_docs_*.py`, `tests/test_i18n_index.py`, `tests/test_viewer_cdn_integrity.py`, `tests/test_text_write_line_endings.py` and `tests/test_ci_registration.py`; `python -I scripts/check_no_game_data.py` on the three changed files. - Not tested: a world built from a package (both manifests above are synthetic), Firefox and Safari, and a locked mouse in a browser (I did not lock it there; the release on opening is covered by the Node test only). Touch devices have no key for the map. GPUs tested: n/a AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (No translator rule in this change.) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
lixonik reviewed 2026-11-26 15:40:32 +00:00
lixonik left a comment
No description provided.
Windows 11/Node: all 77 map and streaming tests passed, including bounds, pointer mapping and fly-to controls in the test harness. No findings from those checks. AI-assisted.
aslan2142 reviewed 2026-12-01 11:51:03 +00:00
aslan2142 left a comment
No description provided.
Draft review note: `VIEWER-OVERVIEW-MAP` (`viewer/index.html`, `tests/test_viewer_map.cjs`, `docs/world.md`) is cleanly scoped, mergeable on `main`, and passed independent Node map/streaming testing, but remains a draft with no CI run. Please run CI to green and mark ready for review when ready. *(AI-assisted review.)*
aslan2142 commented 2026-12-01 12:29:28 +00:00

Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review.

(AI-assisted triage.)

Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review. *(AI-assisted triage.)*
aslan2142 approved these changes 2026-12-01 13:05:45 +00:00
aslan2142 left a comment

Now ready for review and MERGEABLE. Clean-room verified: the chunk overview map with click-to-fly in viewer/index.html, docs/world.md update, and tests/test_viewer_map.cjs are clean and verified (77/77 viewer tests by @lixonik).

Approving — ready to merge once CI runs green on current main.

(AI-assisted review.)

Now ready for review and `MERGEABLE`. Clean-room verified: the chunk overview map with click-to-fly in `viewer/index.html`, `docs/world.md` update, and `tests/test_viewer_map.cjs` are clean and verified (77/77 viewer tests by `@lixonik`). Approving — ready to merge once CI runs green on current `main`. *(AI-assisted review.)*
Sign in to join this conversation.
No description provided.