garage44.eu/jeroen/cartopolis

logclone: git clone https://garage44.eu/jeroen/cartopolis.git

.. /docs/adr/020-map-tier-and-sim-tier-world-model.md

raw

ADR-020: Two-Tier World — Continuous Map Surface and Discrete Sim Regions


Metadata:


Update. The map tier and the one-shared-ruler principle below are implemented (streamed multi-zoom tiles, OSM buildings, the planetary globe — ADR-025). The sim tier's shape has changed: content is no longer fixed discrete region squares (ADR-021, being retired) but a capacity-bounded set of assets placed at any real-world position. The map-vs-content separation and the shared floating-origin frame still hold; wherever this ADR says "region", read "server-authoritative content anchored by lat/lng". A forthcoming ADR specifies the capacity-bounded asset model.

Update 2 (ADR-035). The map tier is moving from raster tiles to self-hosted vector tiles (MVT), so wherever this ADR calls the map tier a "stack of photos" or read-only "wallpaper", read streamed geometry styled on the client — which is what lets the basemap respond to the day/night cycle and weather. The two-tier split, the map/sim decoupling and the one-shared-ruler principle are unchanged.

Context

Problem (in plain terms): Today the world is built from fixed squares of ground, each square textured with one OpenStreetMap (OSM) map image at a single zoom level (zoom 17, ~256 m). That square does double duty: it is both the map you look at and the area the game simulates. This was a shortcut to get the real-world scale roughly right.

We want two things that the shortcut can't give us:

  1. A proper map you can browse at any zoom — zoom out to see a city, zoom in to see a street — like Google Maps or Cesium, eventually with 3D buildings from OSM.
  2. Solid, well-defined game areas ("regions" in the Second Life / OpenSim sense) that have a fixed, real-world size and crisp boundaries, where avatars, objects, and physics live.

The shortcut couples these two ideas together, so improving one breaks the other. A separate precision spike (ADR-019) proved we can place things anywhere on Earth accurately, which removes the only reason the shortcut existed.

Requirements:

Decision

Split the world into two independent layers that share one coordinate system:

  1. Map tier — a read-only "wallpaper" of the world. A grid of OSM map tiles, streamed in at whatever zoom suits the camera. Pretty to look at; nothing happens here.
  2. Sim tier — the actual game. Fixed-size regions (e.g. 256 m × 256 m of real meters) with crisp edges, where objects and avatars live and the server is in charge.

The map tier is the backdrop; the sim tier sits on top of it. They are not tied to each other — the map's tiles and the game's regions are two different ways of dividing up space.

Approach (the simple version):

Rationale

Primary Reasoning (why this shape):

  1. Each layer can improve on its own. We can make the map prettier (more zooms, 3D buildings) without touching the game rules, and vice versa — they have clean, separate jobs (P-05).
  2. Regions stay honest. Map tiles change real-world size depending on latitude; game regions must not. Decoupling lets regions be a fixed real size everywhere, so a 256 m plot is always 256 m.
  3. It matches how the pros do it. Cesium (and Cesium-for-Unreal) keep a continuous, streamed, level-of-detail map completely separate from any game/semantic content placed on top via an "anchor." Our region anchor is the same idea. Their map tiles are units of display, never units of gameplay — which is exactly the separation we want.
  4. It unlocks buildings cleanly. OSM 3D buildings are just more content placed by real-world position; with one shared ruler they drop onto the map without caring about tiles or regions.

Alternatives Considered:

AlternativeProsConsRejected Because
Keep one square = map + game (today)Simple nowCan't browse zooms; region size stretches with latitudeFails both goals
One giant textured ground that swaps its pictureNo grid to manageHits hardware texture-size limits; can't stream per-area or mix zoomsDoesn't scale past a small area
Make game regions follow the map tilesAuto-aligned artRegion size then varies with latitude/zoom (the bug we're removing)Regions must be a fixed real size
Adopt the 3D Tiles standard for everything nowBattle-tested streaming/LODHeavy spec; overkill before basics existDefer; revisit for buildings

Consequences

Positive:

Negative:

Related