Files
TarkovMaps/PLAN.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

13 KiB
Raw Blame History

TarkovMap — Project Plan

Self-hosted, mobile-friendly Escape from Tarkov map viewer on Leaflet. Layered PSDs in, XYZ tile pyramid out, every map placed on one shared pannable canvas.

Status legend: [ ] not started · [~] in progress · [x] done · [!] blocked Every stage lists Owner, Depends on, and Done when. Don't tick [x] until Done when is objectively true.

Revision 2 (2026-08-07) — scope narrowed to base map art only; marker, spawn and label overlays are cut. Architecture changed from "one pyramid per map plus a switcher" to a single shared world canvas holding unrelated maps side by side.

Revision 3 (2026-08-08) — the canvas is now geographic. overall.jpeg is the base, rotated 31° so north is up, and every detail map is scaled and positioned onto its real location. Seven more maps added (Woods, Interchange, Reserve, Shoreline, Shoreline Resort, Lighthouse, Streets). The abstract grid of unrelated cells is gone.


1. Goals / Non-goals

Goals

  • Extract only the base map from each PSD. No markers, spawns, extracts, captions, legends or titles.
  • All maps — including ones with no geographic relationship, like Customs and its Dorms floor plans — live on one big canvas you pan across.
  • Adding a map is a config change, never a code change, and never re-tiles existing maps.
  • Fast on a phone over LAN.
  • A flow a teammate can follow from a document without asking questions.

Non-goals

  • Marker / spawn / extract overlays (cut in revision 2 — see §8 backlog).
  • Public internet hosting (licence constrains this — §3).
  • Accounts, editing UI, quest tracking, live player position.

2. Source audit — findings [x]

Measured 2026-08-07 from the two supplied PSDs.

Customs Customs — Dorms
PSD canvas 7832 × 5016 4301 × 4904
PSD size 1.09 GB, 295 layers 198 MB
Base group LOCATION LOCATION
Siblings dropped LEGEND, OVERLAYS, TITLE SECTION OVERLAY, LEGEND, TITLE, Credits
Extra exclusion Map Borders (see §6) none
Crop applied [0, 860, 7832, 3875] → 7832 × 3015 none (art fills canvas)
Scale ≈ 7.39 px/m from the scale bar not marked
Render time 158 s 321 s
Tiles 503 (8.4 MB) 469 (1.4 MB)

Both PSDs use the same top-level convention — LOCATION next to OVERLAY, LEGEND, TITLE. That is what makes "render one group, drop the rest" a general rule rather than a Customs special case. Expect it to hold for other re3mr maps; verify per map at step 1 of the runbook.

Licence in both files: CC BY-NC-SA 4.0, "Made by re3mr.com".


3. Constraints

  • CC BY-NC-SA 4.0. Attribution stays visible in the viewer; non-commercial only; derived map images inherit the licence. LAN use is fine. Sign-off required before public hosting.
  • Source art never enters git. 1.09 GB + 198 MB + a 608 MB archive for one map. .gitignore covers sources/, *.psd, *.7z, build/, web/tiles/.
  • Tooling on the build machine: Python 3.13, Pillow 12, psd-tools 1.18 + scikit-image, Node 22. No ImageMagick / libvips / GDAL needed.

4. Architecture — as built

# Decision Notes
A1 Leaflet + custom CRS.Simple, XYZ pyramid LatLng is (y, x) in world pixels at native resolution
A2 256 px tiles, world zoom 0–9 Base map is native at z3; detail maps at z7–z9
A3 WebP q82, transparent padding on edge tiles 9.8 MB for both maps combined
A4 Chrome cropped away, not rebuilt Scope is base art only, so there is no legend to rebuild
A5 Geographic world canvas on the rotated overall map See below — the core of revision 3
A6 maps.json in, web/data/world.json out The app hard-codes nothing about any map
A7 Dependency-free static server, long cache on tiles Caddy/nginx drop-in later if wanted
A8 Pure-Python pipeline (psd-tools + Pillow) No native binaries to install on three machines
A9 excludeLayers escape hatch Needed because psd-tools fills stroke-only vector shapes
A10 Coarse underlay layer per map at underlayZoom (2) Whole world = 17 tiles / 134 KB, on screen in ~120 ms; detail tiles draw over it, so loading gaps never show black

The world canvas (A5)

The base is overall.jpeg, rotated 31° to put north at the top. That angle was measured rather than guessed: Customs' detail map is north-up (confirmed by its PSD compass) and runs 2.6:1 east–west, so solving its 259 × 207 zone outline for the band angle yields 31°. Rotation maths is verified sub-pixel against PIL in rotate_point.

World pixels are overall-map pixels × overallScale (64) — chosen so Customs lands at almost exactly its native 7832 px. Each map's place gives centre and width in rotated overall-map pixels; tools/place_preview.py draws a gridded preview to author against.

Tile grids must stay integral: a map's tile-index offset has to be a whole number of tiles at every zoom, which only holds when its origin is a multiple of tileSize · 2^maxZoom = 131 072 px — hopeless for positioning. So rather than moving a map onto the grid, the tiler pads it up-and-left to the nearest cell boundary and visits only tiles containing content. Exact placement, integral grid, zero padding cost.

Each map is tiled only to its native level (deepest zoom still downscaling the source) and carries a minZoom below which it does not load, so the overview is just the base map and detail fades in as you zoom.


5. Repository layout

maps.json          the only file you edit to add or change a map
tools/
  psd_tree.py      inspect a PSD's layer tree
  export_base.py   PSD -> build/<id>/base.png   (base group only)
  tile.py          base.png -> web/tiles/<id>/{z}/{x}/{y}.webp
  build.py         orchestrator; writes web/data/world.json
  preview.py       stitch built tiles into one overview image
  common.py        config loading + world-grid maths
server/serve.py    static server, LAN-reachable, cache headers
web/               index.html, app.js, style.css, vendored Leaflet 1.9.4
docs/adding-a-map.md
sources/ build/ web/tiles/     gitignored

6. Known issues

Issue Impact Status
psd-tools fills stroke-only vector shape layers as solid colour Customs rendered white over the whole playable area until Map Borders was excluded Worked around via excludeLayers; documented as a check in the runbook
Excluding Map Borders also removes the playable-area boundary outline Customs no longer shows the dotted play-area edge; the out-of-bounds grey-out still marks it Accepted. Revisit only if the boundary is missed
No retina / DPR tiles Soft on high-DPI screens Fixed — DENSITY_BOOST requests one level deeper; 0.56 → 1.33 source px per device px at DPR 1.5
z5 is a hard detail ceiling Upscaling past zoom 5 is browser-side and blurry Inherent. The embedded terrain smart object is 7832 × 3720 placed 1:1, so there is no further source detail to extract
flyToBounds depends on requestAnimationFrame Picker doesn't move the view in a non-compositing tab Cosmetic; not seen in a real browser
Dorms has no scale bar No px/m for that map Fine — pxPerMeter is optional

7. Stages

Phase 1 — pipeline and viewer ✅ complete

Stage 0 — Repo foundations [x]

  • git init, .gitignore covering sources, build output and tiles
  • Directory skeleton, tools/requirements.txt
  • README.md with quickstart
  • Sources moved to sources/customs/
  • Verified nothing large is tracked — 0.43 MB staged
  • Decide where master PSDs live for the team (shared drive / NAS / Syncthing) and record the path in the README

Stage 1 — Source audit [x]

  • Dimensions, layer trees, blend modes, masks for both PSDs
  • Identified the shared LOCATION convention
  • Derived 7.39 px/m for Customs
  • Confirmed CC BY-NC-SA 4.0

Stage 2 — Contracts [x]

  • maps.json schema — the single input contract
  • web/data/world.json — the single output contract the app reads
  • Tile URL scheme tiles/{id}/{z}/{x}/{y}.webp, XYZ, y-down
  • Coordinate spec: LatLng = (y, x) in world pixels; grid maths in common.py
  • docs/adding-a-map.md written as the runbook

Stage 3 — Extraction [x]

  • psd_tree.py for onboarding inspection
  • export_base.py renders one named group, drops all siblings
  • excludeLayers escape hatch for the shape-fill bug
  • Warns loudly when an excludeLayers entry matches nothing
  • Both maps verified by eye — no markers, labels, legends or titles survive

Stage 4 — Tiler [x]

  • Crop, Lanczos pyramid, 256 px WebP tiles, z0–z5
  • Edge tiles padded to square with alpha; fully-empty tiles skipped
  • Rejects a map too large for its grid cell with an actionable message
  • build.py orchestrates and emits world.json; skips the slow render when base.png is current
  • Partial builds keep other maps in world.json

Stage 5 — Viewer [x]

  • Vendored Leaflet 1.9.4 (no CDN — must work offline on LAN)
  • Custom CRS, world grid, per-map OffsetTileLayer with bounds
  • Map picker, URL hash state, non-dismissible attribution
  • Minimal dark UI, maxNativeZoom over-zoom, transparent errorTileUrl
  • Verified in-browser: 972 tiles, zero 404s, zero broken tiles, correct cross-map offsets

Stage 6 — Serving [~]

  • server/serve.py — dependency-free, binds 0.0.0.0, prints the LAN URL
  • image/webp MIME, tiles cached 7 days, app shell uncached
  • Fixed serve.py defaulting to HTTP/1.0 (a TCP handshake per tile); now HTTP/1.1 keep-alive
  • Benchmarked and added Caddy as the default engine — serve.py collapses to 462 req/s at concurrency 32 while Caddy holds 5,877
  • run.ps1 picks Caddy when present, falls back to serve.py; get-caddy.ps1 fetches the binary
  • Verified through Caddy: immutable + ETag on tiles, no-cache + zstd on the shell, bare 404 for missing tiles
  • Windows Firewall rule for the port
  • Confirm from a phone on the LAN and record the URL in the README

Phase 2 — verification and hardening ← next

Stage 7 — Mobile pass

Owner: __ · Depends on: 6

  • Viewport meta with viewport-fit=cover, safe-area insets, 44 px touch targets
  • Collapsible picker; zoom buttons hidden under 640 px in favour of pinch
  • Test on a real iOS Safari and a real Android Chrome over LAN — nothing here is proven until this happens
  • Check pinch, double-tap and inertial pan don't fight page scroll
  • Retina decided: DENSITY_BOOST requests one pyramid level deeper instead of shipping @2x tiles — no extra build output, fixes fractional-zoom softness too
  • First-paint budget on LAN (target ~2 s)

Stage 8 — Third map by someone else

Owner: __ · Depends on: 2

The real test of the runbook is a person who has not seen the pipeline.

  • Pick a third map (Factory is the fastest loop; Woods/Streets stress size)
  • A teammate adds it using only docs/adding-a-map.md
  • Every question they have to ask is a documentation bug — fix the doc
  • Confirm the LOCATION convention holds; if it doesn't, note the variant
  • Confirm no map needs more than one grid cell

Stage 9 — Grid ergonomics

Owner: __ · Depends on: 8

  • Decide grid layout policy as map count grows (gridCols is currently 4)
  • Consider labelling each map on the canvas at low zoom, so the overview is readable
  • Consider per-map maxBounds snapping so panning between maps feels deliberate

Phase 3 — backlog (only if wanted)

  • Measure tool using pxPerMeter (Customs has it; Dorms doesn't)
  • PWA / offline tile caching for phones that leave the LAN
  • PMTiles single-file archives instead of loose tiles — revisit around 5+ maps
  • Marker/overlay layers — cut in revision 2. The PSDs make this cheap to revive: every marker is its own layer with a known bbox, so positions can be extracted programmatically rather than hand-placed
  • Restore the Customs playable-area boundary, if its absence turns out to matter

8. Parallelisation

Phase 1 is done, so the tracks are narrower now:

Track Stages Skills
Mobile / frontend 7 JS, Leaflet, touch CSS, real devices
Content 8 Photoshop-adjacent; mostly following the runbook
Ops 6 tail Windows networking, firewall

Stages 7 and 8 are fully independent — run them in parallel.


9. Open questions

  1. Where do master PSDs live so every contributor can reach them? (blocks Stage 0's last item)
  2. Which maps next, and in what order?
  3. Is public hosting ever intended? Changes the licence conversation entirely.
  4. Does the missing Customs play-area boundary matter enough to restore?

Last updated: 2026-08-07 · Phase 1 complete and verified; Phase 2 next.