Buildings (modern/fantasy, multi-floor, footprint shapes), caves, outdoor biomes, and town/village + city-block settlements. Auto-places Foundry walls, doors, windows, lighting; furniture as locked tiles; live preview. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Mapwright — Battle Map Generator (Foundry VTT)
One-click procedural battle maps for any Foundry world. Generates good-looking floor plans with Foundry walls, doors, windows and lighting already placed, so a map is playable the moment it's created. Built to be usable with no prior experience.
Status — v0.4.0
Six map categories. New since v0.3:
- Town / Village and City Block — top-down tactical maps where buildings are solid rooftop blocks (perimeter walls block tokens; streets are the open, token-scaled play space). City = street grid + sidewalks + lane markings; Village = curved road, scattered houses, gardens, trees, optional pond.
- Furniture is now locked Tiles (not painted into the background): room-aware placement (grid-aligned, against walls, doorways clear), players can't move them, sprites auto-generated + cached.
- Backgrounds set via the v14 Level system; flat/fully-lit by default with dynamic lighting opt-in.
Earlier — v0.3.0
Three generator families, all standalone, all auto-placing Foundry walls/doors/lights:
Buildings (Modern / Fantasy)
- Non-rectangular footprints: Rectangle / L / T / U / Cross.
- Multi-floor (1–4): a folder of linked scenes sharing one footprint, with a vertical-circulation column — elevator (modern) or staircase (fantasy) — aligned at the same spot on every floor, plus up/down GM notes.
- Era-aware door & window artwork: planked wood doors / metal-slab glass doors with handles + swing arcs; framed, mullioned windows. The Foundry door/window walls are placed to match the art exactly.
- Furniture / props drawn per room type (beds, desks, meeting tables, server racks, counters, crates, shelves…). System-agnostic, vector, no external art.
Caves / Dungeons (Rough Cave / Crypt / Sewer)
- Organic cellular-automata caverns — flowing, non-axis-aligned walls (contour traced, smoothed, simplified to diagonal Foundry wall segments). Rock floor, cast shadows, scattered debris, labelled features + torch lighting.
Outdoors (Grassland / Desert / Snow / Badlands)
- Open terrain with organic water bodies (shoreline blocks movement, not sight), boulder cover, clustered trees, biome ground texture.
Shared: live WYSIWYG preview, seeded reproducibility (🎲 reroll), Foundry Walls / Doors / Windows / AmbientLights / Notes — works in any world.
Planned next: prop/furniture as interactive Tiles, built-dungeon (rooms+corridors) style, water/elevation in caves, UVTT export.
Architecture
One geometry model drives both the picture and the playable walls, so they can never disagree (the failing the older generators had):
seed → building.mjs (BSP → rooms + region grid)
→ walls.mjs (region grid → merged wall/door/window segments + connectivity)
├─ render-vector.mjs → SVG (preview + scene background)
└─ scene.mjs → Foundry Walls/Doors/Lights/Notes
module/lib/* is pure and Foundry-agnostic (unit-testable in Node).
module/app/* is the dialog. module/mapwright.mjs wires the toolbar button.
Try it
- Enable Mapwright in Manage Modules (it's standalone — no dependencies).
- Open the Walls tool group in the scene controls → click the map icon
(or run
game.mapwright.open()in the console, or use the Scenes tab button). - Pick a type/size, watch the preview, hit Create Map.
Dev
node dev/render-sample.mjs renders sample SVGs (no Foundry needed) for eyeballing
visual quality. On macOS, qlmanage -t -s 1600 -o . *.svg rasterises them to PNG.