Files
TarkovMaps/docs/adding-a-map.md
T
Claude e8d8738892 Place all nine maps onto a north-up geographic world canvas
The canvas is no longer an abstract grid of unrelated cells. overall.jpeg is
now the base, rotated 31 degrees so north is up, and every detail map is
scaled and positioned onto its real location. Zoom out for all of Tarkov;
zoom in and the full-resolution re3mr map takes over.

The 31 degrees was measured, not guessed: Customs' detail map is north-up
(its PSD compass confirms it) and runs 2.6:1 east-west, so solving its
259x207 zone outline for the band angle gives 31. rotate_point is verified
sub-pixel against PIL.

Adds Woods, Interchange, Reserve, Shoreline, Shoreline Resort, Lighthouse
and Streets, and moves every source under sources/<id>/.

baseGroup becomes baseLayers, a list of slash-paths. These PSDs share no
naming convention at all -- the base is variously LOCATION, Baselayer, Day,
3DRENDER, BASEMAP+2DLAYERS or Map&Art; several need more than one top-level
layer, and Woods buries its terrain three groups deep. Exports also keep
alpha now, so maps composite onto the terrain instead of sitting in opaque
rectangles.

Placement needs sub-cell precision, but tile grids stay integral only when
a map's origin is a multiple of tileSize * 2^maxZoom (131072 px). So rather
than snapping a map to the grid, the tiler pads it up-and-left to the
nearest cell boundary and visits only tiles holding content: exact
placement, integral grid, no cost. Each map is tiled to its native level
and carries a minZoom, so the overview stays cheap.

Two psd-tools failures worked around: stroke effects on empty-bbox layers
crash scikit-image (patched to skip), and psd_tools.composite exports a
function that shadows its own submodule.

Verified zoom 0-9: 10 layers, zero broken tiles.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-08-08 04:02:38 -07:00

5.0 KiB
Raw Blame History

Adding a map

Point the config at a PSD, name the layers holding the map art, say where it goes on the world map, build. No application code changes.

Budget ~10 minutes plus render time (roughly 3 minutes per GB of PSD).


0. Once per machine

python -m pip install -r tools/requirements.txt

Put the PSD under sources/<id>/. That directory is gitignored — source art lives on the shared drive, never in the repo.


1. Find the layers holding the map art

python tools/psd_tree.py sources/woods/woods.psd --depth 2

There is no naming convention. Every re3mr map does this differently, so you have to look each time:

Map Base layers
Customs, Customs Dorms LOCATION
Woods re3mr.com/Map&Art (nested inside a wrapper group)
Lighthouse Day (there is also a hidden Night)
Shoreline Baselayer
Shoreline Resort BGCOLOR PATTERN, BASEMAP+2DLAYERS
Interchange Background, 3DRENDER
Reserve Day copy, Color Fill 1, Group 5
Streets Layer 1, Map - 3D map portion…

Note the two shapes this takes: several maps need more than one top-level layer, and some bury the art inside a wrapper group (use a slash path).

Also note any shape layers — psd-tools renders stroke-only vector shapes as solid fills, so they may need excludeLayers.


2. Add it to maps.json

{
  "id": "woods",
  "name": "Woods",
  "psd": "sources/woods/woods.psd",
  "baseLayers": ["re3mr.com/Map&Art"],
  "excludeLayers": [],
  "crop": null,
  "place": { "cx": 818, "cy": 652, "w": 380 }
}
Field Meaning
baseLayers slash-paths from the document root; everything else is hidden
excludeLayers layer names to hide anywhere inside the kept set
crop [x0, y0, x1, y1] in PSD pixels, or null for the full canvas
place where it sits on the world map — see step 4
pxPerMeter optional, from the map's scale bar; recorded for later use

3. Render the base layer and look at it

python tools/export_base.py woods

Open build/woods/base.png and check for:

  • large flat areas of solid colour — a shape layer is filling. Add its name to excludeLayers. (Customs needs "Map Borders"; without it the whole playable area renders white.)
  • leftover markers, legends or titles — wrong baseLayers.
  • missing terrain — you kept the overlay group but not the art beneath it.
  • dead canvas around the art — that sets your crop.

A failed map no longer aborts the batch; check the summary at the end.


4. Position it on the world map

The base of the canvas is sources/overall/overall.jpeg, rotated by world.rotate (31°) so north is up. place is in rotated overall-map pixels — the north-up image you actually look at.

python tools/place_preview.py

That writes build/place-preview.png: the rotated base with a 100 px grid and every current place box drawn on it. Read the coordinates for your zone straight off the grid, set cx/cy/w, re-run. The loop takes seconds because nothing is tiled.

w is the map's width in overall-map pixels; height follows from the source aspect ratio. Positions are deliberately approximate — the game's individual maps are not drawn to match the satellite view exactly, so aim for "clearly the right place", not pixel alignment.


5. Build and verify

python tools/build.py woods
python tools/preview.py 4

build/world-preview.png composites everything at its world position. Then:

pwsh server/run.ps1

Useful variations

python tools/build.py                    # base + every map
python tools/build.py overall            # just retile the base map
python tools/build.py --tiles-only       # re-tile after a place/crop change
python tools/build.py --force-export     # re-render even if base.png is current

build.py skips the PSD render when base.png is newer than the PSD, so iterating on place and crop is seconds, not minutes.


How placement works

World pixels are overall-map pixels × world.overallScale (64), chosen so the detail maps land near their native resolution — Customs works out to almost exactly its 7832 px source width.

Tile grids have to stay integral: a map's tile-index offset must be a whole number of tiles at every zoom, which only holds when its origin is a multiple of tileSize · 2^maxZoom. That is 131 072 world pixels — far too coarse to position anything. So rather than moving a map onto the grid, the tiler pads it: the raster is padded up-and-left to the nearest cell boundary and only tiles containing real content are ever visited. Exact placement, integral grid, and the padding costs nothing.

Each map is also only tiled down to its native level — the deepest zoom at which we are still downscaling its source. Past that the browser upscales, which looks the same as upscaling during the build but without storing tiles. minZoom likewise stops a map loading while it would be a speck on screen.