Extracts only the base map art from re3mr PSDs (the top-level LOCATION group), tiles it to WebP, and renders every map on one shared world canvas. Pipeline: psd_tree -> export_base -> tile -> build -> preview, driven entirely by maps.json. Adding a map is a config change. Maps are placed on an 8192px grid (tileSize * 2^maxZoom) so a cell's tile index shift is exactly cell * 2^z at every zoom. Each map keeps its own locally numbered pyramid and the browser translates on the fly, so adding a map never re-tiles the others. excludeLayers works around psd-tools rendering stroke-only vector shapes as solid fills, which otherwise buries Customs under a white fill. Co-Authored-By: Claude Opus 5 <[email protected]>
11 KiB
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. Phase 1 is built and running.
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.
.gitignorecoverssources/,*.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, zoom 0–5, 1:1 at z5 | ~500 tiles per map; z0 is a whole-cell thumbnail |
| 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 | Shared world canvas on an 8192 px grid | See below — this is the core of revision 2 |
| 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 |
The world grid (A5)
Each map is tiled independently, numbered from its own top-left corner. A map in
grid cell (gx, gy) sits at world pixel (gx · cellSize, gy · cellSize) where
cellSize = tileSize · 2^maxZoom = 256 · 32 = 8192
At that cell size the tile-index shift is exactly gx · 2^z at every zoom —
always an integer. So getTileUrl converts world tile coords to a map's local
ones with integer arithmetic and no resampling.
Consequences, and the reason this design was chosen:
- Adding a map never re-tiles another map.
- Unrelated maps share one continuous, pannable canvas.
- A map must fit one cell (8192²).
maxZoom + 1doubles the cell.
Current layout: Customs (0,0), Customs — Dorms (1,0).
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-2 tiles | Slightly soft on high-DPI phones at 1:1 | Stage 7 |
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,.gitignorecovering sources, build output and tiles- Directory skeleton,
tools/requirements.txt README.mdwith 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
LOCATIONconvention - Derived 7.39 px/m for Customs
- Confirmed CC BY-NC-SA 4.0
Stage 2 — Contracts [x]
maps.jsonschema — the single input contractweb/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 incommon.py docs/adding-a-map.mdwritten as the runbook
Stage 3 — Extraction [x]
psd_tree.pyfor onboarding inspectionexport_base.pyrenders one named group, drops all siblingsexcludeLayersescape hatch for the shape-fill bug- Warns loudly when an
excludeLayersentry 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.pyorchestrates and emitsworld.json; skips the slow render whenbase.pngis 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
OffsetTileLayerwithbounds - Map picker, URL hash state, non-dismissible attribution
- Minimal dark UI,
maxNativeZoomover-zoom, transparenterrorTileUrl - Verified in-browser: 972 tiles, zero 404s, zero broken tiles, correct cross-map offsets
Stage 6 — Serving [~]
server/serve.py— dependency-free, binds0.0.0.0, prints the LAN URLimage/webpMIME, tiles cached 7 days, app shell uncached- 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
- Decide on retina: one extra zoom level vs.
@2xtiles vs. accept - 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
LOCATIONconvention 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 (
gridColsis currently 4) - Consider labelling each map on the canvas at low zoom, so the overview is readable
- Consider per-map
maxBoundssnapping 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
- Where do master PSDs live so every contributor can reach them? (blocks Stage 0's last item)
- Which maps next, and in what order?
- Is public hosting ever intended? Changes the licence conversation entirely.
- Does the missing Customs play-area boundary matter enough to restore?
Last updated: 2026-08-07 · Phase 1 complete and verified; Phase 2 next.