# worldmap-viewer A 3D globe in the browser for worlds built with [worldgen](../worldgen): fly from orbit down to ground level, inspect every value, measure, pin places, refine regions to ≈ 5 km detail, and export terrain squares for game engines. Runs locally (binds 127.0.0.1 only); three.js is vendored. ## Setup Clone next to worldgen (or set `WORLDGEN=/path/to/worldgen`, or put it inside this folder as `worldgen/`): ``` games/ worldgen/ the generator worldmap-viewer/ this myworld/ a world folder (config/, sketch/, out/ …) ``` ```bash python3 -m venv .venv && .venv/bin/pip install -r requirements.txt .venv/bin/python serve.py --world ../myworld # open http://127.0.0.1:8765 — Ctrl-C stops it ``` Build the world first (`worldgen/mapgen.py build`). The first start after a build prepares caches (a minute or more at res 5); later starts are quick. Tiles render on demand and are cached in the world's `out/`. ## Commands | Command | What | |---|---| | `serve.py [--world DIR …] [--res N] [--port 8765] [--lore DIR] [--workers N] [--public [--allow-host NAME] [--bind ADDR]] [--tile-cache-gb GB [--tile-keep-z Z]] [--max-renders N]` | the viewer. `--lore`: a folder of `.md` notes pins may link to. Several `--world`: one server, each world at `/w//` (id from `[render] name`), a world menu switches; `--res` then applies to all. `--workers N`: render processes (default CPUs − 2, max 6). `--public`: read-only map for anyone — no writes; pins, regions, exports and lore ids are not served, the page hides those tabs; tiles are sent `immutable` (their URL carries the version). `--allow-host NAME`: also answer requests for that public name (a reverse proxy or tunnel on the same machine passes it on); `--bind ADDR` (default 127.0.0.1; another address, e.g. 0.0.0.0 in a container behind a proxy, needs `--public`). `--tile-cache-gb GB`: cap on saved tiles (all worlds); past it the least recently used go (down to 90 %); `--tile-keep-z Z` keeps relief and mesh tiles to zoom Z (a shipped prerender) out of it. `--max-renders N`: at most N tiles rendering or waiting (all worlds), more get 503 + `Retry-After` and the page retries; `--public` defaults it to 4 × workers. Every option can also come from the environment (a container): `WORLDMAP_