Files
TarkovMaps/docs/adding-a-map.md
T

9.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

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

Put the PSD under sources/<id>/. PSD, PSB, archive, and source-reference PNG files are stored through Git LFS according to .gitattributes.


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/Map&OverlayArt/{RawMapLayer,WaterDetail}
Lighthouse Day (there is also a hidden Night)
Shoreline Baselayer
Shoreline Resort BGCOLOR PATTERN, BASEMAP+2DLAYERS
Interchange 3DRENDER
Reserve Day copy
Streets Map - 3D map portion…

Note the shapes this takes: several maps need more than one top-level layer, and some bury the art inside wrapper groups (use a slash path — Woods is three deep).

Watch for layers that are really just plates. Interchange's Background and Reserve's Color Fill 1 are solid white; Woods' MapBlackout and Streets' Layer 1 are solid black. Including them hides the terrain underneath, so leave them out.

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/Map&OverlayArt/RawMapLayer"],
  "excludeLayers": [],
  "crop": null,
  "place": { "cx": 814, "cy": 672, "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
minZoom optional close-view reveal threshold for nested detail maps; otherwise derived from size
place center anchor and dimensions on the world map; optional h enables independent stretch — see step 4
parent optional parent map id; groups the sub-map directly below its parent and includes it in parent focus
pxPerMeter optional, from the map's scale bar; recorded for later use
trim optional normalized playable-area polygon and outside transparency

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 (45°) 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.

Because placements are approximate, map rectangles do overlap where the real locations don't. That is handled in the viewer rather than by chasing perfect boxes: the map whose centre you are viewing is always lifted to the top, so an overlapping neighbour can never hide it.

Changing the tilt

place coordinates live in the rotated frame, so editing world.rotate by hand would move every map. Use the helper instead — it converts all placements through the old and new angles so geography is preserved:

python tools/retilt.py 35

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
python tools/extract_markers.py <id>     # PSD metadata -> semantic marker JSON
python tools/backup_markers.py           # one-time read-only default snapshot
python tools/render_marker_audit.py <id> # visible PSD vs semantic markers

Marker extraction recognizes visible on-map groups whose paths use names such as Overlay, OnMap, Map Markers, extracts, spawns, caches and locations. Keep legends and title furniture in clearly named groups so the extractor can exclude them. Marker coordinates are stored normalized to the configured crop, not as raster overlays.

Always review <id>-comparison.jpg from render_marker_audit.py before accepting extraction. Its left pane is the PSD flattened with every visible layer; the right pane uses that exact crop with the semantic records overlaid. Confirm that on-map PMC, Scav, shared/co-op, hidden and transit extracts are named once, and that legends, credits, side indicators and notes produce no records.

If extraction produces a new category, add it to web/data/marker-config.json. Categories can share a group and independently configure their label, color, size, text-or-emoji symbol, visible text and default visibility. Viewer-wide label zoom and spatial-index tuning live in the same file under defaults.

Manual marker moves, names, categories and additions live separately in web/data/marker-edits/<map-id>.json. Re-running extraction replaces only web/data/markers/<map-id>.json and preserves those user-authored overrides. Deleted extracted markers are stored as IDs in the same edit file, so defaults are never modified. Run backup_markers.py after approving the initial marker set; it will refuse to overwrite a different existing backup.

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

Retiling a map changes its version in world.json, which is appended to its tile URLs as ?v=. That is what stops a browser mixing a previous build's tiles with the new ones — you do not need to hard-reload after a rebuild.


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 defaults to 0 so a main map remains visible in the overview. Set it explicitly for a nested detail view that should stay out of the main view until the user zooms closer; the configured value can only raise the automatic threshold.

For visual placement, run pwsh server/run.ps1, select the map in the viewer, and use Edit placement. Dragging the center anchor previews the move immediately. Width and Height stretch it independently around that anchor; Save & rebuild updates maps.json and retiles that map.

Use Trim area in the same viewer to add a playable-area polygon. Its points are normalized to the displayed map, so later placement and stretching do not invalidate the boundary. Save trim updates local configuration, preserves the PSD, base.png, and original tile pyramid, then writes a derived build/<id>/trimmed.png and web/tiles-trimmed/<id>/ pyramid. The normal viewer uses the derived copy; the original remains available to edit again.