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

Open
opened 2026-11-26 21:20:53 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2338
Author: @syfyra
Created: 11/26/2026
Status: 🔄 Open

Base: main ← Head: feat/viewer-overview-map


📝 Commits (1)

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

📊 Changes

3 files changed (+609 additions, -0 deletions)

View changed files

📝 docs/world.md (+22 -0)
➕ tests/test_viewer_map.cjs (+409 -0)
📝 viewer/index.html (+178 -0)

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2338 **Author:** [@syfyra](https://github.com/syfyra) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/viewer-overview-map` --- ### 📝 Commits (1) - [`ad1c662`](https://github.com/ubiquitarianism/leonida/commit/ad1c6627164730550501e3e75b9345bc554ae9a0) viewer: an overview map of the world's chunks, with click to fly there (VIEWER-OVERVIEW-MAP) ### 📊 Changes **3 files changed** (+609 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs/world.md` (+22 -0) ➕ `tests/test_viewer_map.cjs` (+409 -0) 📝 `viewer/index.html` (+178 -0) </details> ### 📄 Description 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) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#2342
No description provided.