# spytheeuclidean-a11y/knoxmap architecture

> Architecture diagram of the GitHub repository spytheeuclidean-a11y/knoxmap, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/spytheeuclidean-a11y/knoxmap
- Repository: https://github.com/spytheeuclidean-a11y/knoxmap

## Overview

KnoxMap is a desktop-facing map generator that turns a selected real-world area into an installable Project Zomboid map. The documented user journey is area selection, map generation, building, compilation, and installation. Its generation stage combines geographic data with raster rendering; building adds interiors and population, while compilation packages the project for the game. The README documents additional map and building capabilities, but many implementation details were not sampled, so some subsystem links are documented at a high level rather than traced through source.

Main entry points: [`web/generation.py`](https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/web/generation.py) (Generation workflow), [`generator/renderer.py`](https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/generator/renderer.py) (Terrain rendering), [`static/js/app.js`](https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/static/js/app.js) (Map window), [`knoxbuild/build.py`](https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/knoxbuild/build.py) (Map building)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Desktop interface"]
  node_ui["Map window<br/>[app.js]"]
  node_web["Local API<br/>[app.py]"]
end

subgraph group_generation["Map generation"]
  node_generation_api["Generation workflow<br/>[generation.py]"]
  node_osm["OpenStreetMap data<br/>[osm.py]"]
  node_regional_data["Regional datasets"]
  node_projection["Map projection<br/>[projection.py]"]
  node_roads["Road layout<br/>[snap.py]"]
  node_renderer["Terrain rendering<br/>[renderer.py]"]
  node_palette["PZ color palette<br/>[pz_colors.py]"]
  node_forest_preview["Forest preview<br/>[forest_preview.py]"]
  node_route_native["Native road search<br/>[main.rs]"]
end

subgraph group_build["Building design"]
  node_map_state["Map state<br/>[mapstate.py]"]
  node_building_layout["Building interiors<br/>[furnishing.py]"]
  node_catalog["Building catalog<br/>[catalog.py]"]
  node_build_engine["Map building<br/>[build.py]"]
  node_zombie_spawns["Population spawns<br/>[population.py]"]
end

subgraph group_delivery["Game delivery"]
  node_compile["Map compiler<br/>[compile_map.py]"]
  node_mod_install["Mod installation<br/>[make_map_mod.py]"]
end

node_player(("Map maker"))
node_game["Project Zomboid"]

node_player -->|"chooses area"| node_ui
node_ui -->|"sends requests"| node_web
node_web -->|"routes generation"| node_generation_api
node_generation_api -->|"fetches features"| node_osm
node_generation_api -->|"loads layers"| node_regional_data
node_generation_api -->|"renders map"| node_renderer
node_renderer -->|"uses projection"| node_projection
node_renderer -->|"uses colors"| node_palette
node_renderer -.->|"snaps roads"| node_roads
node_roads -->|"runs search"| node_route_native
node_ui -.->|"previews forest"| node_forest_preview
node_generation_api -->|"saves state"| node_map_state
node_player -->|"requests build"| node_build_engine
node_build_engine -.->|"lays out interiors"| node_building_layout
node_building_layout -->|"uses catalog"| node_catalog
node_build_engine -.->|"creates spawns"| node_zombie_spawns
node_player -->|"requests compile"| node_compile
node_compile -.->|"packages map"| node_mod_install
node_player -->|"installs map"| node_mod_install
node_mod_install -->|"adds game map"| node_game

click node_ui "https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/static/js/app.js"
click node_web "https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/app.py"
click node_generation_api "https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/web/generation.py"
click node_osm "https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/generator/osm.py"
click node_regional_data "https://github.com/spytheeuclidean-a11y/knoxmap/tree/main/knoxdata"
click node_projection "https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/generator/rendering/projection.py"
click node_roads "https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/generator/roadgraph/snap.py"
click node_renderer "https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/generator/renderer.py"
click node_palette "https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/generator/pz_colors.py"
click node_forest_preview "https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/generator/rendering/forest_preview.py"
click node_map_state "https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/knoxbuild/mapstate.py"
click node_building_layout "https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/knoxbuild/layout/furnishing.py"
click node_catalog "https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/knoxbuild/catalog.py"
click node_build_engine "https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/knoxbuild/build.py"
click node_zombie_spawns "https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/knoxbuild/population.py"
click node_compile "https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/tools/compile_map.py"
click node_mod_install "https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/tools/make_map_mod.py"
click node_route_native "https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/rust/knoxroute/src/main.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ui,node_web toneBlue
class node_generation_api,node_osm,node_regional_data,node_projection,node_roads,node_renderer,node_palette,node_forest_preview,node_route_native toneAmber
class node_map_state,node_building_layout,node_catalog,node_build_engine,node_zombie_spawns toneMint
class node_compile,node_mod_install toneRose
class node_player,node_game toneIndigo
```

## Components

### Desktop interface

- [Map window](https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/static/js/app.js): `static/js/app.js`
- [Local API](https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/app.py): `app.py`

### Map generation

- [Generation workflow](https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/web/generation.py): `web/generation.py`
- [OpenStreetMap data](https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/generator/osm.py): `generator/osm.py`
- [Regional datasets](https://github.com/spytheeuclidean-a11y/knoxmap/tree/main/knoxdata): `knoxdata`
- [Map projection](https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/generator/rendering/projection.py): `generator/rendering/projection.py`
- [Road layout](https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/generator/roadgraph/snap.py): `generator/roadgraph/snap.py`
- [Terrain rendering](https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/generator/renderer.py): `generator/renderer.py`
- [PZ color palette](https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/generator/pz_colors.py): `generator/pz_colors.py`
- [Forest preview](https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/generator/rendering/forest_preview.py): `generator/rendering/forest_preview.py`
- [Native road search](https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/rust/knoxroute/src/main.rs): `rust/knoxroute/src/main.rs`

### Building design

- [Map state](https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/knoxbuild/mapstate.py): `knoxbuild/mapstate.py`
- [Building interiors](https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/knoxbuild/layout/furnishing.py): `knoxbuild/layout/furnishing.py`
- [Building catalog](https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/knoxbuild/catalog.py): `knoxbuild/catalog.py`
- [Map building](https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/knoxbuild/build.py): `knoxbuild/build.py`
- [Population spawns](https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/knoxbuild/population.py): `knoxbuild/population.py`

### Game delivery

- [Map compiler](https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/tools/compile_map.py): `tools/compile_map.py`
- [Mod installation](https://github.com/spytheeuclidean-a11y/knoxmap/blob/main/tools/make_map_mod.py): `tools/make_map_mod.py`

### Other components

- **Map maker**
- **Project Zomboid**

## Connections

- Map maker → Map window: chooses area (evidence: `README.md`)
- Map window → Local API: sends requests (evidence: `README.md`)
- Local API → Generation workflow: routes generation (evidence: `app.py`)
- Generation workflow → OpenStreetMap data: fetches features (evidence: `web/generation.py`)
- Generation workflow → Regional datasets: loads layers (evidence: `web/generation.py`)
- Generation workflow → Terrain rendering: renders map (evidence: `generator/renderer.py`)
- Terrain rendering → Map projection: uses projection (evidence: `generator/renderer.py`)
- Terrain rendering → PZ color palette: uses colors (evidence: `generator/renderer.py`)
- Terrain rendering → Road layout: snaps roads
- Road layout → Native road search: runs search (evidence: `generator/roadgraph/snap.py`)
- Map window → Forest preview: previews forest
- Generation workflow → Map state: saves state (evidence: `web/generation.py`)
- Map maker → Map building: requests build (evidence: `README.md`)
- Map building → Building interiors: lays out interiors
- Building interiors → Building catalog: uses catalog (evidence: `knoxbuild/layout/furnishing.py`)
- Map building → Population spawns: creates spawns
- Map maker → Map compiler: requests compile (evidence: `README.md`)
- Map compiler → Mod installation: packages map
- Map maker → Mod installation: installs map (evidence: `README.md`)
- Mod installation → Project Zomboid: adds game map (evidence: `README.md`)
