doom-osm-godmode 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,332 +1,364 @@
1
- <p align="center">
2
- <img src="assets/header.png" alt="DOOM OSM GODMODE" width="800"/>
3
- </p>
4
-
5
- <p align="center">
6
- <a href="https://github.com/eoinjordan/doom-osm-godmode/actions"><img src="https://github.com/eoinjordan/doom-osm-godmode/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
7
- <a href="https://www.npmjs.com/package/doom-osm-godmode"><img src="https://img.shields.io/npm/v/doom-osm-godmode?color=cc2200" alt="npm"></a>
8
- <img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen" alt="Node 20+">
9
- <img src="https://img.shields.io/badge/dependencies-0-blue" alt="Zero deps">
10
- <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-yellow" alt="MIT"></a>
11
- </p>
12
-
13
- ---
14
-
15
- Give it a place name, a GeoJSON file, or a config — it geocodes through Nominatim, pulls polygon features from OpenStreetMap via Overpass, projects them into a connected room-and-corridor layout, and writes a PWAD in UDMF format ready for GZDoom.
16
-
17
- Zero npm dependencies. Node 20+ only.
18
-
19
- ## Quick Start
20
-
21
- ```bash
22
- # run the bundled demo (offline, no network)
23
- npm run demo
24
-
25
- # build a real place
26
- node src/cli.js build-place "Colosseum, Rome, Italy" --radius 450
27
-
28
- # search without building
29
- node src/cli.js search "Eiffel Tower, Paris"
30
-
31
- # build from a config file
32
- node src/cli.js build-config examples/colosseum.json
33
- ```
34
-
35
- ## Installation
36
-
37
- ```bash
38
- git clone https://github.com/eoinjordan/doom-osm-godmode.git
39
- cd doom-osm-godmode
40
- npm test # verify everything works
41
- npm run demo # generate a WAD from the bundled demo site
42
- ```
43
-
44
- Or install globally from npm:
45
-
46
- ```bash
47
- npx doom-osm-godmode build-place "Colosseum, Rome" --radius 450
48
- ```
49
-
50
- No `npm install` needed — there are no dependencies.
51
-
52
- ## CLI Reference
53
-
54
- ```
55
- doom-osm-godmode
56
-
57
- Commands:
58
- search <query> Search Nominatim for a place
59
- build-place <query> [options] Geocode + OSM fetch + WAD export
60
- build-config <config.json> Build from a JSON config file
61
- demo [--out output/demo-site] Build the bundled demo WAD
62
-
63
- Options for build-place:
64
- --radius <meters> Override bounding box with a fixed radius (default: use Nominatim bbox)
65
- --map <MAPXX> Map lump name (default: MAP01)
66
- --max-rooms <count> Cap on rooms generated (default: 12)
67
- --title <name> Override the map title
68
- --out <dir> Output directory (default: output/<slugified-title>)
69
- ```
70
-
71
- ## Programmatic API
72
-
73
- ```javascript
74
- const { buildFromPlace, buildFromConfig, buildDemo } = require('doom-osm-godmode');
75
-
76
- // from a place name (hits Nominatim + Overpass)
77
- const result = await buildFromPlace('Sydney Opera House', {
78
- radiusMeters: 500,
79
- mapName: 'MAP01',
80
- maxRooms: 10,
81
- outputDir: './output/sydney'
82
- });
83
-
84
- // from a config file (place query or offline GeoJSON)
85
- const result = await buildFromConfig('examples/colosseum.json');
86
-
87
- // bundled demo (no network)
88
- const result = await buildDemo('./output/demo');
89
- ```
90
-
91
- All functions return `{ outputDir, mapPath, featureCount, exportedFeatures }`.
92
-
93
- ## Output
94
-
95
- Each build writes a folder containing:
96
-
97
- | File | Description |
98
- |------|-------------|
99
- | `site.json` | Normalized feature set with projected metrics |
100
- | `layout.json` | Room/corridor grid layout used for WAD generation |
101
- | `TEXTMAP.udmf` | Human-readable UDMF map geometry |
102
- | `MAPINFO.txt` | GZDoom map metadata (sky, music, title) |
103
- | `<MAPXX>.wad` | Packaged PWAD — load this in GZDoom |
104
-
105
- ## Config Format
106
-
107
- Place query (network):
108
-
109
- ```json
110
- {
111
- "title": "Colosseum District",
112
- "mapName": "MAP01",
113
- "placeQuery": "Colosseum, Rome, Italy",
114
- "radiusMeters": 450,
115
- "maxRooms": 10,
116
- "outputDir": "../output/colosseum"
117
- }
118
- ```
119
-
120
- Offline GeoJSON:
121
-
122
- ```json
123
- {
124
- "title": "Demo Waterfront",
125
- "mapName": "MAP01",
126
- "inputGeoJson": "demo-site.geojson",
127
- "maxRooms": 8,
128
- "outputDir": "../output/demo-site"
129
- }
130
- ```
131
-
132
- Relative paths in configs resolve from the config file's directory.
133
-
134
- ## Architecture
135
-
136
- ```
137
- place query / GeoJSON
138
-
139
-
140
- geocode.js ──► Nominatim API
141
-
142
-
143
- osm.js ────► Overpass API (polygon features)
144
-
145
-
146
- feature-set.js project to local coords, filter, sort
147
-
148
-
149
- layout.js grid-based room placement + corridors + theming
150
-
151
-
152
- udmf.js UDMF vertices, linedefs, sidedefs, sectors, things
153
-
154
-
155
- wad.js binary PWAD packaging
156
-
157
-
158
- MAP01.wad ready for GZDoom
159
- ```
160
-
161
- ### Key Source Files
162
-
163
- | File | Purpose |
164
- |------|---------|
165
- | `src/cli.js` | CLI entry point and command router |
166
- | `src/workflow.js` | Build pipeline orchestrator |
167
- | `src/geocode.js` | Nominatim geocoding |
168
- | `src/osm.js` | Overpass polygon fetching |
169
- | `src/feature-set.js` | Feature normalization and projection |
170
- | `src/geo.js` | Mercator projection, bbox, polygon math |
171
- | `src/layout.js` | Grid room placement, corridors, theming |
172
- | `src/udmf.js` | UDMF text map generation |
173
- | `src/wad.js` | PWAD binary packing |
174
- | `src/lib/cli.js` | Argument parser |
175
- | `src/lib/fs.js` | File I/O utilities |
176
-
177
- ### Room Theming
178
-
179
- Features are themed by kind:
180
-
181
- | Kind | Floor | Ceiling | Light | Notes |
182
- |------|-------|---------|-------|-------|
183
- | building | stone | flat | 152 | Default indoor |
184
- | water | nukage | flat | 144 | Floor at -24 |
185
- | park | grass | sky | 176 | Outdoor feel |
186
- | road | light stone | flat | 160 | Corridors |
187
-
188
- ## Testing
189
-
190
- ```bash
191
- npm test # smoke tests via node:test
192
- npm run check # syntax-check all source files
193
- npm run validate # structural WAD/UDMF validation (builds + verifies integrity)
194
- ```
195
-
196
- ## Agent Playtest via doom-mcp
197
-
198
- Generated WADs can be playtested by an AI agent using [doom-mcp](https://github.com/gunnargrosch/doom-mcp) a Rust MCP server that embeds the real DOOM engine.
199
-
200
- ### Quick setup
201
-
202
- The repo includes a `.mcp.json` that configures doom-mcp to load your demo WAD:
203
-
204
- ```bash
205
- # 1. Build a WAD first
206
- npm run demo
207
-
208
- # 2. Playtest it (automated agent navigation sequence)
209
- npm run playtest -- output/demo-site/MAP01.wad
210
-
211
- # 3. Or playtest a real-place WAD
212
- node src/cli.js build-place "Colosseum" --radius 450
213
- npm run playtest -- output/colosseum/MAP01.wad --skill 1 --ticks 300
214
- ```
215
-
216
- ### What the playtest validates
217
-
218
- The automated playtest spawns doom-mcp, loads the WAD, and runs through a navigation sequence:
219
-
220
- - **Game starts** — doom engine accepts the WAD
221
- - **Player spawns**HP > 0 at spawn point
222
- - **Player can move** — position changes across multiple actions
223
- - **Player survives** — doesn't die during baby-difficulty walkthrough
224
-
225
- ### Using doom-mcp interactively
226
-
227
- For interactive agent playtesting (e.g., in Claude Code or Cursor):
228
-
229
- ```json
230
- {
231
- "mcpServers": {
232
- "doom": {
233
- "type": "stdio",
234
- "command": "npx",
235
- "args": ["-y", "doom-mcp"],
236
- "env": {
237
- "DOOM_WAD_PATH": "/path/to/your/MAP01.wad"
238
- }
239
- }
240
- }
241
- }
242
- ```
243
-
244
- Then tell the agent: *"Play this DOOM level and tell me if it's fun"*
245
-
246
- ### CI integration
247
-
248
- The `playtest.yml` workflow runs structural validation on every tag push and can be triggered manually for any place:
249
-
250
- ```
251
- Actions → Playtest → Run workflow → Enter place name → Go
252
- ```
253
-
254
- ## Playing the WAD
255
-
256
- ```bash
257
- # GZDoom (adjust path to your install)
258
- gzdoom -file output/colosseum/MAP01.wad
259
- ```
260
-
261
- The WAD is a PWAD — it layers on top of any IWAD (DOOM2.WAD, FREEDOOM2.WAD, etc.).
262
-
263
- ## Hand-Crafted Buildings
264
-
265
- The OSM pipeline creates grid-based rooms. For architecturally accurate buildings (cathedrals, temples, etc.), use a hand-crafted script:
266
-
267
- ```bash
268
- # Build the Galway Cathedral demo (cross-shaped plan, dome, catacombs)
269
- node scripts/build-galway-cathedral.js
270
-
271
- # Launch in GZDoom
272
- gzdoom -iwad DOOM2.WAD -file output/galway-cathedral-v3/MAP01.wad +map MAP01
273
- ```
274
-
275
- The cathedral builder demonstrates the `UDMFBuilder` class with polygon-based sector creation, self-validation, and teleporter-linked sub-areas. Use it as a template for new hand-crafted maps.
276
-
277
- ### Validate any WAD
278
-
279
- ```bash
280
- # Structural UDMF diagnostic (checks for duplicate linedefs, etc.)
281
- node scripts/diagnose-udmf.js output/galway-cathedral-v3/TEXTMAP.udmf
282
-
283
- # Agent playtest via doom-mcp
284
- npm run playtest -- output/galway-cathedral-v3/MAP01.wad
285
- ```
286
-
287
- ## UDMF Geometry Rules
288
-
289
- Common issues found when generating DOOM maps from real-world data:
290
-
291
- | Issue | Symptom | Fix |
292
- |-------|---------|-----|
293
- | Duplicate linedefs (same vertex pair) | Flickering/transparent walls | Use a single polygon for complex shapes; deduplicate in `addInnerSector` |
294
- | Collinear overlapping linedefs | See-through walls, BSP errors | Never let two linedefs share the same 2D line segment |
295
- | Inner sector outside parent bounds | Rendering void, hall-of-mirrors | Ensure all inner sector vertices are strictly inside the outer polygon |
296
- | Separate rooms at same crossing | Duplicate shared edges | Use ONE polygon for the union shape (e.g., a cross), not overlapping rectangles |
297
- | Underground areas sharing x,y with upper | DOOM 2.5D sector conflict | Place underground areas at different x,y coords; connect via teleporter |
298
- | Invisible walls on two-sided linedefs | Side walls transparent where floor heights match | Set `wrapmidtex = true` + `blocking = true` + `texturemiddle` on the two-sided linedef |
299
- | Floating mid-textures on promoted linedefs | Choppy half-height walls | Clear `texturemiddle` when promoting one-sided to two-sided; use upper/lower instead |
300
- | Zero-height pillar sectors (floor = ceiling) | Player stuck, node builder errors | Use Thing-based pillars (type 30) instead of sector-based pillars |
301
-
302
- ### Repeatable pattern for future OSM meshes
303
-
304
- 1. Run `node src/cli.js build-place ...` for the grid-room WAD
305
- 2. Run `node scripts/diagnose-udmf.js output/<name>/TEXTMAP.udmf` to check geometry
306
- 3. Run `npm run playtest -- output/<name>/MAP01.wad` for engine validation
307
- 4. If the grid rooms are too abstract, create a hand-crafted script (see `scripts/build-galway-cathedral.js`)
308
- 5. Always run self-validation before writing the WAD
309
-
310
- ## Notes
311
-
312
- - Network commands use public OSM infrastructure (Nominatim, Overpass). Keep requests reasonable.
313
- - Only polygon features become rooms. Roads and linear features are not yet carved into sectors.
314
- - The layout is a blockout interpretation — connected rooms reflecting real feature hierarchy, not pixel-perfect street geometry.
315
-
316
- ## Roadmap
317
-
318
- - exact polygon-to-sector carving (replace grid rooms with real building outlines)
319
- - road and canal line buffering into traversable sectors
320
- - Doom encounter placement (monsters, ammo, weapons)
321
- - texture themes per location style
322
- - multi-map episode generation
323
- - freeform agent-described layouts (no OSM needed)
324
- - automatic duplicate linedef detection in the OSM pipeline
325
-
326
- ## Contributing
327
-
328
- PRs welcome. Run `npm test` and `npm run check` before submitting.
329
-
330
- ## License
331
-
332
- MIT see [LICENSE](LICENSE)
1
+ <p align="center">
2
+ <a href="https://github.com/eoinjordan/doom-osm-godmode/releases"><img src="https://img.shields.io/github/v/tag/eoinjordan/doom-osm-godmode?sort=semver&label=release&color=brightgreen" alt="release tag"></a>
3
+ <a href="https://www.npmjs.com/package/doom-osm-godmode"><img src="https://img.shields.io/npm/v/doom-osm-godmode?color=brightgreen" alt="npm"></a>
4
+ <a href="https://github.com/eoinjordan/doom-osm-godmode/actions"><img src="https://github.com/eoinjordan/doom-osm-godmode/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
5
+ <img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen" alt="Node 20+">
6
+ <img src="https://img.shields.io/badge/dependencies-0-blue" alt="Zero deps">
7
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-yellow" alt="MIT"></a>
8
+ </p>
9
+
10
+ <p align="center">
11
+ <img src="assets/header.png" alt="DOOM OSM GODMODE" width="800"/>
12
+ </p>
13
+
14
+ ---
15
+
16
+ Give it a place name, a GeoJSON file, or a config — it geocodes through Nominatim, pulls polygon features from OpenStreetMap via Overpass, projects them into a connected room-and-corridor layout, and writes a PWAD in UDMF format ready for GZDoom.
17
+
18
+ Zero npm dependencies. Node 20+ only.
19
+
20
+ ## Quick Start
21
+
22
+ ```bash
23
+ # run the bundled demo (offline, no network)
24
+ npm run demo
25
+
26
+ # build a real place
27
+ node src/cli.js build-place "Colosseum, Rome, Italy" --radius 450
28
+ node src/cli.js build-place "Eiffel Tower, Paris" --radius 450
29
+
30
+ # hand-crafted architecturally accurate building
31
+ node scripts/build-galway-cathedral.js
32
+
33
+ # search without building
34
+ node src/cli.js search "Eiffel Tower, Paris"
35
+
36
+ # build from a config file
37
+ node src/cli.js build-config examples/colosseum.json
38
+ ```
39
+
40
+ ## Installation
41
+
42
+ ```bash
43
+ git clone https://github.com/eoinjordan/doom-osm-godmode.git
44
+ cd doom-osm-godmode
45
+ npm test # verify everything works
46
+ npm run demo # generate a WAD from the bundled demo site
47
+ ```
48
+
49
+ Or install globally from npm:
50
+
51
+ ```bash
52
+ npx doom-osm-godmode build-place "Colosseum, Rome" --radius 450
53
+ ```
54
+
55
+ No `npm install` needed — there are no dependencies.
56
+
57
+
58
+ Start the map on GZDOOM or Ultimate on Windows:
59
+
60
+ ```
61
+ "C:\Games\GZDoom\gzdoom.exe" -iwad "C:\Program Files (x86)\Steam\steamapps\common\Ultimate Doom\base\doom2\DOOM2.WAD" -file "C:\Users\Eoin\git\doom-osm-wad\output\galway-cathedral-v3\MAP01.wad" +map MAP01
62
+ ```
63
+
64
+ <img width="899" height="689" alt="image" src="https://github.com/user-attachments/assets/894904fe-5e10-4226-ad60-72ff50e7b9ce" />
65
+
66
+ ## Screenshots
67
+
68
+ <p align="center">
69
+ <img src="https://raw.githubusercontent.com/eoinjordan/doom-osm-godmode/main/assets/screens/outside.jpg" alt="Galway Cathedral outside" width="400"/>
70
+ <img src="https://raw.githubusercontent.com/eoinjordan/doom-osm-godmode/main/assets/screens/inside.jpg" alt="Galway Cathedral inside" width="400"/>
71
+ </p>
72
+
73
+ <p align="center"><em>Galway Cathedral — hand-crafted map. Some visual clipping bugs are known and will be addressed in future releases.</em></p>
74
+
75
+ ## CLI Reference
76
+
77
+ ```
78
+ doom-osm-godmode
79
+
80
+ Commands:
81
+ search <query> Search Nominatim for a place
82
+ build-place <query> [options] Geocode + OSM fetch + WAD export
83
+ build-config <config.json> Build from a JSON config file
84
+ demo [--out output/demo-site] Build the bundled demo WAD
85
+
86
+ Options for build-place:
87
+ --radius <meters> Override bounding box with a fixed radius (default: use Nominatim bbox)
88
+ --map <MAPXX> Map lump name (default: MAP01)
89
+ --max-rooms <count> Cap on rooms generated (default: 12)
90
+ --title <name> Override the map title
91
+ --out <dir> Output directory (default: output/<slugified-title>)
92
+ ```
93
+
94
+ ## Programmatic API
95
+
96
+ ```javascript
97
+ const { buildFromPlace, buildFromConfig, buildDemo } = require('doom-osm-godmode');
98
+
99
+ // from a place name (hits Nominatim + Overpass)
100
+ const result = await buildFromPlace('Sydney Opera House', {
101
+ radiusMeters: 500,
102
+ mapName: 'MAP01',
103
+ maxRooms: 10,
104
+ outputDir: './output/sydney'
105
+ });
106
+
107
+ // from a config file (place query or offline GeoJSON)
108
+ const result = await buildFromConfig('examples/colosseum.json');
109
+
110
+ // bundled demo (no network)
111
+ const result = await buildDemo('./output/demo');
112
+ ```
113
+
114
+ All functions return `{ outputDir, mapPath, featureCount, exportedFeatures }`.
115
+
116
+ ## Output
117
+
118
+ Each build writes a folder containing:
119
+
120
+ | File | Description |
121
+ |------|-------------|
122
+ | `site.json` | Normalized feature set with projected metrics |
123
+ | `layout.json` | Room/corridor grid layout used for WAD generation |
124
+ | `TEXTMAP.udmf` | Human-readable UDMF map geometry |
125
+ | `MAPINFO.txt` | GZDoom map metadata (sky, music, title) |
126
+ | `<MAPXX>.wad` | Packaged PWAD — load this in GZDoom |
127
+
128
+ ## Config Format
129
+
130
+ Place query (network):
131
+
132
+ ```json
133
+ {
134
+ "title": "Colosseum District",
135
+ "mapName": "MAP01",
136
+ "placeQuery": "Colosseum, Rome, Italy",
137
+ "radiusMeters": 450,
138
+ "maxRooms": 10,
139
+ "outputDir": "../output/colosseum"
140
+ }
141
+ ```
142
+
143
+ Offline GeoJSON:
144
+
145
+ ```json
146
+ {
147
+ "title": "Demo Waterfront",
148
+ "mapName": "MAP01",
149
+ "inputGeoJson": "demo-site.geojson",
150
+ "maxRooms": 8,
151
+ "outputDir": "../output/demo-site"
152
+ }
153
+ ```
154
+
155
+ Relative paths in configs resolve from the config file's directory.
156
+
157
+ ## Architecture
158
+
159
+ ```
160
+ place query / GeoJSON
161
+
162
+
163
+ geocode.js ──► Nominatim API
164
+
165
+
166
+ osm.js ────► Overpass API (polygon features)
167
+
168
+
169
+ feature-set.js project to local coords, filter, sort
170
+
171
+
172
+ layout.js grid-based room placement + corridors + theming
173
+
174
+
175
+ udmf.js UDMF vertices, linedefs, sidedefs, sectors, things
176
+
177
+
178
+ wad.js binary PWAD packaging
179
+
180
+
181
+ MAP01.wad ready for GZDoom
182
+ ```
183
+
184
+ ### Key Source Files
185
+
186
+ | File | Purpose |
187
+ |------|---------|
188
+ | `src/cli.js` | CLI entry point and command router |
189
+ | `src/workflow.js` | Build pipeline orchestrator |
190
+ | `src/geocode.js` | Nominatim geocoding |
191
+ | `src/osm.js` | Overpass polygon fetching |
192
+ | `src/feature-set.js` | Feature normalization and projection |
193
+ | `src/geo.js` | Mercator projection, bbox, polygon math |
194
+ | `src/layout.js` | Grid room placement, corridors, theming |
195
+ | `src/udmf.js` | UDMF text map generation |
196
+ | `src/wad.js` | PWAD binary packing |
197
+ | `src/lib/cli.js` | Argument parser |
198
+ | `src/lib/fs.js` | File I/O utilities |
199
+
200
+ ### Room Theming
201
+
202
+ Features are themed by kind:
203
+
204
+ | Kind | Floor | Ceiling | Light | Notes |
205
+ |------|-------|---------|-------|-------|
206
+ | building | stone | flat | 152 | Default indoor |
207
+ | water | nukage | flat | 144 | Floor at -24 |
208
+ | park | grass | sky | 176 | Outdoor feel |
209
+ | road | light stone | flat | 160 | Corridors |
210
+
211
+ ## Testing
212
+
213
+ ```bash
214
+ npm test # smoke tests via node:test
215
+ npm run check # syntax-check all source files
216
+ npm run validate # structural WAD/UDMF validation (builds + verifies integrity)
217
+ ```
218
+
219
+ ## Agent Playtest via doom-mcp
220
+
221
+ Generated WADs can be playtested by an AI agent using [doom-mcp](https://github.com/gunnargrosch/doom-mcp) a Rust MCP server that embeds the real DOOM engine.
222
+
223
+ ### Quick setup
224
+
225
+ The repo includes a `.mcp.json` that configures doom-mcp to load your demo WAD:
226
+
227
+ ```bash
228
+ # 1. Build a WAD first
229
+ npm run demo
230
+
231
+ # 2. Playtest it (automated agent navigation sequence)
232
+ npm run playtest -- output/demo-site/MAP01.wad
233
+
234
+ # 3. Or playtest a real-place WAD
235
+ node src/cli.js build-place "Colosseum" --radius 450
236
+ npm run playtest -- output/colosseum/MAP01.wad --skill 1 --ticks 300
237
+ ```
238
+
239
+ ### What the playtest validates
240
+
241
+ The automated playtest spawns doom-mcp, loads the WAD, and runs through a navigation sequence:
242
+
243
+ - **Game starts** — doom engine accepts the WAD
244
+ - **Player spawns** HP > 0 at spawn point
245
+ - **Player can move** — position changes across multiple actions
246
+ - **Player survives** — doesn't die during baby-difficulty walkthrough
247
+
248
+ ### Using doom-mcp interactively
249
+
250
+ For interactive agent playtesting (e.g., in Claude Code or Cursor):
251
+
252
+ ```json
253
+ {
254
+ "mcpServers": {
255
+ "doom": {
256
+ "type": "stdio",
257
+ "command": "npx",
258
+ "args": ["-y", "doom-mcp"],
259
+ "env": {
260
+ "DOOM_WAD_PATH": "/path/to/your/MAP01.wad"
261
+ }
262
+ }
263
+ }
264
+ }
265
+ ```
266
+
267
+ Then tell the agent: *"Play this DOOM level and tell me if it's fun"*
268
+
269
+ ### CI integration
270
+
271
+ The `playtest.yml` workflow runs structural validation on every tag push and can be triggered manually for any place:
272
+
273
+ ```
274
+ Actions → Playtest → Run workflow → Enter place name → Go
275
+ ```
276
+
277
+ ## Playing the WAD
278
+
279
+ ```bash
280
+ # GZDoom (adjust path to your install)
281
+ gzdoom -file output/colosseum/MAP01.wad
282
+ ```
283
+
284
+ The WAD is a PWAD — it layers on top of any IWAD (DOOM2.WAD, FREEDOOM2.WAD, etc.).
285
+
286
+ ## Hand-Crafted Buildings
287
+
288
+ The OSM pipeline creates grid-based rooms. For architecturally accurate buildings (cathedrals, temples, etc.), use a hand-crafted script:
289
+
290
+ ```bash
291
+ # Build the Galway Cathedral demo (cross-shaped plan, green copper dome, grand nave)
292
+ node scripts/build-galway-cathedral.js
293
+
294
+ # Launch in GZDoom
295
+ gzdoom -iwad DOOM2.WAD -file output/galway-cathedral-v3/MAP01.wad +map MAP01
296
+ ```
297
+
298
+ The cathedral builder demonstrates the `UDMFBuilder` class with polygon-based sector creation, grand interior aisle, raised chancel, self-validation, and exterior forecourt. Use it as a template for new hand-crafted maps.
299
+
300
+ **Example maps included:**
301
+
302
+ | Map | Type | Script / Command |
303
+ |-----|------|------------------|
304
+ | Galway Cathedral | Hand-crafted | `node scripts/build-galway-cathedral.js` |
305
+ | Colosseum, Rome | OSM / live | `node src/cli.js build-place "Colosseum, Rome, Italy" --radius 450` |
306
+ | Eiffel Tower, Paris | OSM / live | `node src/cli.js build-place "Eiffel Tower, Paris" --radius 450` |
307
+ | Demo Waterfront | Offline GeoJSON | `npm run demo` |
308
+
309
+ ### Validate any WAD
310
+
311
+ ```bash
312
+ # Structural UDMF diagnostic (checks for duplicate linedefs, etc.)
313
+ node scripts/diagnose-udmf.js output/galway-cathedral-v3/TEXTMAP.udmf
314
+
315
+ # Agent playtest via doom-mcp
316
+ npm run playtest -- output/galway-cathedral-v3/MAP01.wad
317
+ ```
318
+
319
+ ## UDMF Geometry Rules
320
+
321
+ Common issues found when generating DOOM maps from real-world data:
322
+
323
+ | Issue | Symptom | Fix |
324
+ |-------|---------|-----|
325
+ | Duplicate linedefs (same vertex pair) | Flickering/transparent walls | Use a single polygon for complex shapes; deduplicate in `addInnerSector` |
326
+ | Collinear overlapping linedefs | See-through walls, BSP errors | Never let two linedefs share the same 2D line segment |
327
+ | Inner sector outside parent bounds | Rendering void, hall-of-mirrors | Ensure all inner sector vertices are strictly inside the outer polygon |
328
+ | Separate rooms at same crossing | Duplicate shared edges | Use ONE polygon for the union shape (e.g., a cross), not overlapping rectangles |
329
+ | Underground areas sharing x,y with upper | DOOM 2.5D sector conflict | Place underground areas at different x,y coords; connect via teleporter |
330
+ | Invisible walls on two-sided linedefs | Side walls transparent where floor heights match | Set `wrapmidtex = true` + `blocking = true` + `texturemiddle` on the two-sided linedef |
331
+ | Floating mid-textures on promoted linedefs | Choppy half-height walls | Clear `texturemiddle` when promoting one-sided to two-sided; use upper/lower instead |
332
+ | Zero-height pillar sectors (floor = ceiling) | Player stuck, node builder errors | Use Thing-based pillars (type 30) instead of sector-based pillars |
333
+
334
+ ### Repeatable pattern for future OSM meshes
335
+
336
+ 1. Run `node src/cli.js build-place ...` for the grid-room WAD
337
+ 2. Run `node scripts/diagnose-udmf.js output/<name>/TEXTMAP.udmf` to check geometry
338
+ 3. Run `npm run playtest -- output/<name>/MAP01.wad` for engine validation
339
+ 4. If the grid rooms are too abstract, create a hand-crafted script (see `scripts/build-galway-cathedral.js`)
340
+ 5. Always run self-validation before writing the WAD
341
+
342
+ ## Notes
343
+
344
+ - Network commands use public OSM infrastructure (Nominatim, Overpass). Keep requests reasonable.
345
+ - Only polygon features become rooms. Roads and linear features are not yet carved into sectors.
346
+ - The layout is a blockout interpretation — connected rooms reflecting real feature hierarchy, not pixel-perfect street geometry.
347
+
348
+ ## Roadmap
349
+
350
+ - exact polygon-to-sector carving (replace grid rooms with real building outlines)
351
+ - road and canal line buffering into traversable sectors
352
+ - Doom encounter placement (monsters, ammo, weapons)
353
+ - texture themes per location style
354
+ - multi-map episode generation
355
+ - freeform agent-described layouts (no OSM needed)
356
+ - automatic duplicate linedef detection in the OSM pipeline
357
+
358
+ ## Contributing
359
+
360
+ PRs welcome. Run `npm test` and `npm run check` before submitting.
361
+
362
+ ## License
363
+
364
+ MIT — see [LICENSE](LICENSE)