Spaces:
Running
Running
Sync from GitHub 507fb4c
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- .gitattributes+2
- CHANGELOG.md+48
- README.md+18-4
- assets/buildings/castle.pngAdded
- assets/buildings/house.pngAdded
- assets/buildings/shop.pngAdded
- assets/buildings/tavern.pngAdded
- assets/buildings/temple.pngAdded
- assets/buildings/tower.pngAdded
- docs/README.md+1
- docs/configuration.md+2-1
- docs/images/preview-crossroads-village.pngAdded
- docs/map-format.md+67-9
- docs/sprite-generation.md+27-4
- docs/tools.md+88-6
- docs/troubleshooting.md+4-2
- docs/worlds-and-buildings.mdAdded+200
- huggingface/space-card.md+10-2
- maps/README.md+8-1
- maps/caverne-aquatique.tmj
- maps/crossroads-village/chandler-shop-interior.tmjAdded+314
- maps/crossroads-village/crossroads-tavern-interior.tmjAdded+314
- maps/crossroads-village/crossroads-village.tmjAdded+1008
- maps/crossroads-village/greystone-keep-interior.tmjAdded+588
- maps/crossroads-village/keep-cellar.tmjAdded+345
- maps/crossroads-village/miller-house-interior.tmjAdded+314
- maps/crossroads-village/old-chapel-interior.tmjAdded+314
- maps/crossroads-village/watchtower-interior.tmjAdded+332
- maps/forteresse-glace-etage.tmj
- maps/reseau-electronique-repaire-hacker.tmj
- package-lock.json+3-3
- package.json+2-2
- scripts/README.md+5-2
- scripts/create-village-world.mjsAdded+56
- scripts/gen-building-sprites.mjsAdded+153
- scripts/smoke-http.mjs+16-6
- scripts/smoke-test.mjs+66-1
- skills/map-builder/SKILL.md+25-2
- tiled-mcp/.env.example+2-1
- tiled-mcp/package.json+1-1
- tiled-mcp/src/agent.ts+38-8
- tiled-mcp/src/builder.ts+173-10
- tiled-mcp/src/buildings.tsAdded+97
- tiled-mcp/src/downloads.ts+61-24
- tiled-mcp/src/names.tsAdded+22
- tiled-mcp/src/render.ts+199-54
- tiled-mcp/src/server.ts+3-1
- tiled-mcp/src/themes/prompts.ts+24
- tiled-mcp/src/tmj.ts+23-1
- tiled-mcp/src/tools/export.ts+12-9
36 unmodified lines37383936 unmodified linesdocs/images/preview-crypt-preset.png filter=lfs diff=lfs merge=lfs -textdocs/images/preview-hacker-lair.png filter=lfs diff=lfs merge=lfs -textdocs/images/preview-ice-fortress.png filter=lfs diff=lfs merge=lfs -text36 unmodified lines373839404136 unmodified linesdocs/images/preview-crypt-preset.png filter=lfs diff=lfs merge=lfs -textdocs/images/preview-hacker-lair.png filter=lfs diff=lfs merge=lfs -textdocs/images/preview-ice-fortress.png filter=lfs diff=lfs merge=lfs -textassets/buildings/castle.png filter=lfs diff=lfs merge=lfs -textdocs/images/preview-crossroads-village.png filter=lfs diff=lfs merge=lfs -text
12345# Changelog## 0.3.0A hosted mode, published as a Hugging Face Space.1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253# Changelog## 0.4.0Large outdoor maps with buildings you can enter. Each building's interior is its own map,linked both ways. See [docs/worlds-and-buildings.md](docs/worlds-and-buildings.md).### Added- `place_building`: puts a house, shop, tavern, temple, tower or castle on an outdoor map. Itcreates the interior map, an `entrance` on the door, an `exit` inside, and an `arrival` spawnon each side.- `link_maps`: joins any two maps both ways with a door or stairs pair, for example castle floors.- `validate_world`: checks that every link leads to a map of the session and to an arrival spawnthere, that every link has a way back, and that every map can be entered.- `save_world`: writes every linked map into one folder under the file names its links use (one`.zip` on the hosted server).- `generate_building_sprite` (paid) and `scripts/gen-building-sprites.mjs`: FLUX buildingsprites in `assets/buildings/`, fitted to their footprint.- Transitions carry `targetMap`, a Tiled `file` property that opens the target map onright-click, and `targetSpawn`. Spawns gain the `arrival` role.- A Godot 4 loader for the transitions, in the new guide.### Changed- Maps go up to 256x256 cells (128x128 in hosted mode); `TILED_MAX_MAP_SIZE` changes the limit.- Saved and exported maps write each tile layer's `data` on one line, so large maps stay small.- The preview renderer draws large maps directly at reduced scale (a 256x256 map renders in abouta second) and draws building sprites, with placeholders when they are missing.- `validate_map` accepts an arrival point instead of a player spawn, as on interiors.- The castle preset is reusable: `generate_castle_floor` behaves as before.- The web page's agent can place buildings: the preview shows the map the player starts on andthe `.zip` holds it with every linked interior. A **Village (enter buildings)** example shows it.- Sample world `maps/crossroads-village/` (`scripts/create-village-world.mjs`, part of`npm run examples`), with building sprites for all six types in `assets/buildings/`.- The scripted sample maps are saved again in the compact format: same content, a quarter of thesize.### Fixed- Sprite generation failed with "We have not been able to find inference provider information"because Replicate no longer serves FLUX.1-dev. By default the server now uses the firstprovider Hugging Face lists as live for the model (fal-ai today) and sends the image size inthe form that provider reads. `TILED_HF_PROVIDER` still forces one, and a provider error nownames the providers that serve the model.- Building sprites kept a translucent veil or grey specks when the provider did not paint aclean magenta background. Generation now isolates the building from what remains around itand refills enclosed see-through spots such as windows;`node scripts/gen-building-sprites.mjs --clean` repairs existing sprites for free.## 0.3.0A hosted mode, published as a Hugging Face Space.
65 unmodified lines6667686970717211 unmodified lines84858687888917 unmodified lines10710810911011111281 unmodified lines19419519619719819920020196 unmodified lines29829930030130230330430530630730830931031165 unmodified lines## ✨ Features- 🗺️ **30 MCP tools** to create maps, paint tiles, generate rooms and corridors, and place doors, chests, traps, levers, stairs and spawns.- 🏰 **3 layout presets**: a crypt, a castle floor and a werewolf den, each built in one call.- 🎨 **20 themes**, 12 of them with bundled isometric sprites ready to use.- 🛡️ **Guard rails for agents**: placing a chest on a wall, outside a room or on another object fails with a message that says how to fix it, and `validate_map` checks the map before export.11 unmodified linescredits, usually a few cents per map; the Space owner pays nothing for your use and never seesyour token.AI agents can use the same Space as a remote MCP server with their own token:```bash17 unmodified lines<br><sub>Sample maps in <a href="maps/"><code>maps/</code></a>: an ice fortress and a flooded cavern, both 64x64.</sub></p>## 🧱 Tech stack| | Technology | Role in this project |81 unmodified lines| Layout presets | `generate_crypt_layout` (27x18+) · `generate_castle_floor` (27x20+) · `generate_werewolf_den` (22x16+) || Objects | `place_door` · `place_chest` · `place_stairs_object` · `place_trap` · `place_lever` || Spawns | `place_spawn_player` · `place_spawn_enemy` · `place_spawn_npc` || Validation and export | `validate_map` · `export_json` · `save_to_disk` || Sprites | `preview_sprite_prompt` (free) · `generate_tile_sprite` 💸 · `generate_theme_sprite_set` 💸 · `override_tile_image` |Full parameters, generated from the server itself: **[docs/tools.md](docs/tools.md)**.96 unmodified lines| Command | What it does ||---|---|| `npm run build` | Compile the server || `npm run smoke` | Start the server and run 38 offline end-to-end checks || `npm run start:web` | Start the hosted mode (web page and MCP over HTTP) on port 7860 || `npm run smoke:http` | Test the hosted mode offline, with a stand-in for the AI model || `npm run inspect` | Open the server in the [MCP Inspector](https://github.com/modelcontextprotocol/inspector) || `npm run preview -- <map.tmj>` | Render a map to PNG without Tiled || `npm run examples` | Rebuild the three scripted sample maps in `maps/` || `npm run docs` | Regenerate `docs/tools.md` and `docs/themes.md` from the server || `node scripts/gen-theme-set.mjs <THEME> --yes` | Generate a theme's missing sprites (paid) |## 🤝 Contributing65 unmodified lines666768697071727311 unmodified lines8586878889909192939417 unmodified lines11211311411511611711811912012112212312481 unmodified lines20620720820921021121221321496 unmodified lines31131231331431531631731831932032132232332432565 unmodified lines## ✨ Features- 🗺️ **35 MCP tools** to create maps up to 256x256, paint tiles, generate rooms and corridors, and place doors, chests, traps, levers, stairs and spawns.- 🏘️ **Buildings you can enter**: put houses, taverns, temples, towers or castles on an outdoor map; each gets its own interior map, linked both ways, ready to load in a game ([guide with a Godot loader](docs/worlds-and-buildings.md)).- 🏰 **3 layout presets**: a crypt, a castle floor and a werewolf den, each built in one call.- 🎨 **20 themes**, 12 of them with bundled isometric sprites ready to use.- 🛡️ **Guard rails for agents**: placing a chest on a wall, outside a room or on another object fails with a message that says how to fix it, and `validate_map` checks the map before export.11 unmodified linescredits, usually a few cents per map; the Space owner pays nothing for your use and never seesyour token.New: try the **Village (enter buildings)** example. The model builds an outdoor map with houses,a tavern, a chapel, a tower and a castle; each building gets its own interior map, and the`.zip` holds them all, linked both ways.AI agents can use the same Space as a remote MCP server with their own token:```bash17 unmodified lines<br><sub>Sample maps in <a href="maps/"><code>maps/</code></a>: an ice fortress and a flooded cavern, both 64x64.</sub></p><p align="center"><img src="docs/images/preview-crossroads-village.png" alt="40x40 village with a house, a shop, a tavern, a chapel, a watchtower and a castle, each with an entrance and an arrival point" width="85%"><br><sub>The sample world <a href="maps/crossroads-village/"><code>maps/crossroads-village/</code></a>: six buildings from <code>place_building</code>.Walking onto an entrance (<b>I</b>) loads the building's interior map; its exit brings you back to the arrival point (<b>A</b>).See <a href="docs/worlds-and-buildings.md">worlds and buildings</a>.</sub></p>## 🧱 Tech stack| | Technology | Role in this project |81 unmodified lines| Layout presets | `generate_crypt_layout` (27x18+) · `generate_castle_floor` (27x20+) · `generate_werewolf_den` (22x16+) || Objects | `place_door` · `place_chest` · `place_stairs_object` · `place_trap` · `place_lever` || Spawns | `place_spawn_player` · `place_spawn_enemy` · `place_spawn_npc` || Buildings and linked maps | `place_building` · `link_maps` · `validate_world` · `save_world` || Validation and export | `validate_map` · `export_json` · `save_to_disk` || Sprites | `preview_sprite_prompt` (free) · `generate_tile_sprite` 💸 · `generate_theme_sprite_set` 💸 · `generate_building_sprite` 💸 · `override_tile_image` |Full parameters, generated from the server itself: **[docs/tools.md](docs/tools.md)**.96 unmodified lines| Command | What it does ||---|---|| `npm run build` | Compile the server || `npm run smoke` | Start the server and run 62 offline end-to-end checks || `npm run start:web` | Start the hosted mode (web page and MCP over HTTP) on port 7860 || `npm run smoke:http` | Test the hosted mode offline, with a stand-in for the AI model || `npm run inspect` | Open the server in the [MCP Inspector](https://github.com/modelcontextprotocol/inspector) || `npm run preview -- <map.tmj>` | Render a map to PNG without Tiled || `npm run examples` | Rebuild the scripted sample maps and the sample world in `maps/` || `npm run docs` | Regenerate `docs/tools.md` and `docs/themes.md` from the server || `node scripts/gen-theme-set.mjs <THEME> --yes` | Generate a theme's missing sprites (paid) || `node scripts/gen-building-sprites.mjs --yes` | Generate missing building sprites (paid); `--clean` re-cuts existing ones for free |## 🤝 Contributing
5 unmodified lines678910115 unmodified lines| [hugging-face.md](hugging-face.md) | The hosted web page and remote MCP endpoint on Hugging Face: costs, sign-in, Docker, updating the Space || [tools.md](tools.md) | Every tool and its parameters (generated from the server) || [map-format.md](map-format.md) | Layers, tile and object properties, coordinates, formulas for importers || [themes.md](themes.md) | The 20 themes, their roles and sprite availability (generated) || [configuration.md](configuration.md) | Environment variables, `.env`, hosted mode, paths, secrets || [sprite-generation.md](sprite-generation.md) | Optional paid sprite generation with FLUX.1-dev |5 unmodified lines67891011125 unmodified lines| [hugging-face.md](hugging-face.md) | The hosted web page and remote MCP endpoint on Hugging Face: costs, sign-in, Docker, updating the Space || [tools.md](tools.md) | Every tool and its parameters (generated from the server) || [map-format.md](map-format.md) | Layers, tile and object properties, coordinates, formulas for importers || [worlds-and-buildings.md](worlds-and-buildings.md) | Large outdoor maps with buildings you can enter, linked maps, loading them in Godot 4 || [themes.md](themes.md) | The 20 themes, their roles and sprite availability (generated) || [configuration.md](configuration.md) | Environment variables, `.env`, hosted mode, paths, secrets || [sprite-generation.md](sprite-generation.md) | Optional paid sprite generation with FLUX.1-dev |
24 unmodified lines2526272829303132333424 unmodified lines| `TILED_MAPS_DIR` | `<repo>/maps` | `save_to_disk` | Folder for relative output paths || `TILED_ASSETS_DIR` | `<repo>/assets` | sprites, `list_themes`, `save_to_disk` | Sprite root holding `<theme_lowercase>/<role>.png` || `TILED_OBJECT_COORDS` | `tiled` | object and spawn placement | `tiled` writes Tiled's native isometric object positions; `screen` writes the legacy screen-space encoding (see [map-format.md](map-format.md#object-coordinates)) || `TILED_SKILL_FILE` | `<repo>/skills/map-builder/SKILL.md` | `map_builder` prompt | Skill text served by the prompt || `TILED_ENV_FILE` | `<repo>/tiled-mcp/.env` | startup | Alternative `.env` file to load || `HUGGINGFACE_API_KEY` or `HF_TOKEN` | none | sprite generation | Hugging Face token. **Paid usage**, see [sprite-generation.md](sprite-generation.md) || `TILED_HF_PROVIDER` | `replicate` | sprite generation | Hugging Face Inference Provider serving FLUX.1-dev |`NVIDIA_API_KEY` is **not** read by this server. It belongs to the agent that drives it, forexample OpenCode running Nemotron (see [nemotron.md](nemotron.md)).24 unmodified lines252627282930313233343524 unmodified lines| `TILED_MAPS_DIR` | `<repo>/maps` | `save_to_disk` | Folder for relative output paths || `TILED_ASSETS_DIR` | `<repo>/assets` | sprites, `list_themes`, `save_to_disk` | Sprite root holding `<theme_lowercase>/<role>.png` || `TILED_OBJECT_COORDS` | `tiled` | object and spawn placement | `tiled` writes Tiled's native isometric object positions; `screen` writes the legacy screen-space encoding (see [map-format.md](map-format.md#object-coordinates)) || `TILED_MAX_MAP_SIZE` | `256` (`128` in hosted mode) | `create_map`, `place_building` | Largest map side in cells, 16 to 1024. Large maps cost memory and longer previews, so keep the hosted value modest || `TILED_SKILL_FILE` | `<repo>/skills/map-builder/SKILL.md` | `map_builder` prompt | Skill text served by the prompt || `TILED_ENV_FILE` | `<repo>/tiled-mcp/.env` | startup | Alternative `.env` file to load || `HUGGINGFACE_API_KEY` or `HF_TOKEN` | none | sprite generation | Hugging Face token. **Paid usage**, see [sprite-generation.md](sprite-generation.md) || `TILED_HF_PROVIDER` | `auto` | sprite generation | Hugging Face Inference Provider serving FLUX.1-dev. `auto` uses the first provider Hugging Face lists as live for the model (fal-ai in November 2026) |`NVIDIA_API_KEY` is **not** read by this server. It belongs to the agent that drives it, forexample OpenCode running Nemotron (see [nemotron.md](nemotron.md)).
9 unmodified lines1011121314151617181920 unmodified lines404142434445464737 unmodified lines858687888990919293944 unmodified lines9910010110210310410510610710840 unmodified lines1491501511521531541559 unmodified lines|---|---|| `orientation` | `isometric` (default) or `orthogonal` || `renderorder` | `right-down` || `width`, `height` | 1 to 64 cells each (tools accept 4 to 64) || `tilewidth`, `tileheight` | 64 x 32 pixels for every bundled theme || `infinite` | `false` || map properties | `theme` (theme key), `mapName` (display name) |## Coordinates20 unmodified lines| 1 | `ground` | tile layer | floors, hazards, difficult terrain || 2 | `walls` | tile layer | walls; a cell with a wall is impassable even though it also has a floor || 3 | `decorations` | tile layer | props drawn above the ground; `OBSTACLE` props block movement || 4 | `objects` | object group | doors, chests, traps, levers, zone stairs || 5 | `spawns` | object group | player, enemy and NPC spawn points |## Tilesets and tile properties37 unmodified lines| Property | Type | Present on | Meaning ||---|---|---|---|| `kind` | string | all | `door`, `chest`, `trap`, `lever`, `stairs` || `state` | string | all | `closed`, `open`, `locked` (`stairs` objects are `open`) || `pickDC` | int | locked doors and chests | lock difficulty, 5 to 30 || `targetZoneId` | string | doors, stairs | id of the zone it leads to || `trapType` | string | traps | damage type || `trapNotation` | string | traps | damage dice, e.g. `2d6` || `trapSaveDC` | int | traps | saving throw difficulty, 5 to 30 |4 unmodified lines| Property | Type | Meaning ||---|---|---|| `role` | string | `player`, `enemy` or `npc` || `npcName` | string | display name (optional) || `encounterId` | string | id of an encounter in your engine (optional, enemies) |## Object coordinatesTiled stores object positions in pixels, but on **isometric** maps those pixels are not screen40 unmodified lines`validate_map` returns:- **errors**: structural problems (missing fields, invalid size or orientation).- **warnings**: no player spawn, an object or spawn on a wall or outside the painted ground,a door still inside a wall.Your engine should still validate the map on import.9 unmodified lines101112131415161718192020 unmodified lines41424344454647484950515237 unmodified lines909192939495969798991001011024 unmodified lines10710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116240 unmodified lines2032042052062072082092102112122139 unmodified lines|---|---|| `orientation` | `isometric` (default) or `orthogonal` || `renderorder` | `right-down` || `width`, `height` | 4 to 256 cells each (128 on the hosted server; `TILED_MAX_MAP_SIZE` changes the limit, see [configuration.md](configuration.md)) || `tilewidth`, `tileheight` | 64 x 32 pixels for every bundled theme || `infinite` | `false` || map properties | `theme` (theme key), `mapName` (display name); interiors made by `place_building` add `buildingId` and `parentMap` (file) || layer `data` | plain arrays (no encoding or compression), written on one line per layer |## Coordinates20 unmodified lines| 1 | `ground` | tile layer | floors, hazards, difficult terrain || 2 | `walls` | tile layer | walls; a cell with a wall is impassable even though it also has a floor || 3 | `decorations` | tile layer | props drawn above the ground; `OBSTACLE` props block movement || 4 | `objects` | object group | doors, chests, traps, levers, zone stairs, entrances and exits || 5 | `spawns` | object group | player, enemy, NPC and arrival spawn points |A map with buildings has a sixth layer, `buildings` (id 6, object group), placed between`decorations` and `objects` so markers stay on top. See[Buildings and transitions](#buildings-and-transitions).## Tilesets and tile properties37 unmodified lines| Property | Type | Present on | Meaning ||---|---|---|---|| `kind` | string | all | `door`, `chest`, `trap`, `lever`, `stairs`, `entrance`, `exit` || `state` | string | all | `closed`, `open`, `locked` (`stairs` objects are `open`) || `pickDC` | int | locked doors and chests | lock difficulty, 5 to 30 || `targetZoneId` | string | doors, stairs | id of the zone it leads to, defined by your engine || `targetMap` | file | transitions: entrances, exits, linked doors and stairs | `.tmj` file of the map it leads to, relative to this map || `targetSpawn` | string | transitions | name of the `arrival` spawn where the player lands in `targetMap` || `buildingId` | string | entrances and exits | id of the building they belong to || `trapType` | string | traps | damage type || `trapNotation` | string | traps | damage dice, e.g. `2d6` || `trapSaveDC` | int | traps | saving throw difficulty, 5 to 30 |4 unmodified lines| Property | Type | Meaning ||---|---|---|| `role` | string | `player`, `enemy`, `npc` or `arrival` || `npcName` | string | display name (optional) || `encounterId` | string | id of an encounter in your engine (optional, enemies) |An `arrival` spawn is where a player lands when coming through a transition; its `name` is whatthe transition's `targetSpawn` refers to. It sits next to the transition leading back, never onit, so arriving does not send the player straight back.## Buildings and transitions`place_building` and `link_maps` connect maps of one session; `save_world` writes them side byside under the file names the links use. A full guide, with a Godot loader, is in[worlds-and-buildings.md](worlds-and-buildings.md).### Building spritesBuildings are **tile objects** on the `buildings` layer, drawn from a second tileset named`buildings` (a collection of images, `firstgid` right after the theme tileset,`objectalignment: "bottom"`). Each tile carries `tileType: BUILDING` and `buildingType`.A building covers a square footprint of `n x n` cells starting at `(fx, fy)`. Its object isanchored at its bottom centre on the footprint's bottom corner, tile point `(fx + n, fy + n)`:| | Isometric (`tiled` coordinates) | Isometric (`screen`) | Orthogonal ||---|---|---|---|| `x` | `(fx + n) * th` | `tw/2 * ((fx + n) - (fy + n))` | `(fx + n/2) * tw` || `y` | `(fy + n) * th` | `th/2 * ((fx + n) + (fy + n))` | `(fy + n) * th` |`width` and `height` are the image size: `n * 64` pixels wide (house and shop 192x192, tavernand temple 256x256, tower 128x192, castle 384x384). Building object properties:| Property | Type | Meaning ||---|---|---|| `kind` | string | `building` || `buildingType` | string | `house`, `shop`, `tavern`, `temple`, `tower`, `castle` || `buildingId` | string | id shared with its entrance, exit and arrival spawns || `footprintX`, `footprintY`, `footprintSize` | int | the cells it covers; treat them as blocked except the entrance cell || `interiorMap` | file | its interior `.tmj` (absent for buildings without one) |### Following a transitionAn object with a `targetMap` property is a transition. When the player steps on its cell:1. load the map named by `targetMap`, resolved relative to the current map's file;2. find the spawn whose `name` equals `targetSpawn` in that map's `spawns` layer;3. put the player on that spawn's cell.`targetMap` is a Tiled **file** property (`"type": "file"`): Tiled stores it relative to the mapand opens the target when you right-click it in the Properties panel.## Object coordinatesTiled stores object positions in pixels, but on **isometric** maps those pixels are not screen40 unmodified lines`validate_map` returns:- **errors**: structural problems (missing fields, invalid size or orientation).- **warnings**: no player spawn (or arrival point), an object or spawn on a wall or outsidethe painted ground, a door still inside a wall.`validate_world` checks the links between maps: every transition leads to a map of the sessionand to an arrival spawn that exists there (errors), every link has a way back, every map can beentered, and building sprites exist (warnings).Your engine should still validate the map on import.
18 unmodified lines192021222324252627282930313228 unmodified lines61626364656618 unmodified lines1. Create a Hugging Face account and an access token with permission to call InferenceProviders: https://huggingface.co/settings/tokens2. Make sure the provider you use (default `replicate`) is enabled for your account and thatbilling is set up.3. Put the token in `tiled-mcp/.env` or your MCP client's `env` block:```HUGGINGFACE_API_KEY=hf_xxx# optional: another provider that serves black-forest-labs/FLUX.1-devTILED_HF_PROVIDER=replicate```## Generate a whole theme (recommended)28 unmodified lines-> only this map uses the variant```## What the pipeline does1. Builds a prompt from the theme's material and lighting for that role18 unmodified lines19202122232425262728293031323328 unmodified lines6263646566676869707172737475767778798081828384858687888918 unmodified lines1. Create a Hugging Face account and an access token with permission to call InferenceProviders: https://huggingface.co/settings/tokens2. Make sure billing is set up. By default the server asks Hugging Face which providers serve`black-forest-labs/FLUX.1-dev` right now and uses the first live one (fal-ai in November2026; Replicate no longer serves it). The model page lists them under "Inference Providers".3. Put the token in `tiled-mcp/.env` or your MCP client's `env` block:```HUGGINGFACE_API_KEY=hf_xxx# optional: force one provider that serves black-forest-labs/FLUX.1-devTILED_HF_PROVIDER=fal-ai```## Generate a whole theme (recommended)28 unmodified lines-> only this map uses the variant```## Building sprites`place_building` draws houses, shops, taverns, temples, towers and castles with one large imageeach, `assets/buildings/<type>.png`, sized to the building's footprint (192x192 up to 384x384).They are generated the same way, one paid call per building:```bashnode scripts/gen-building-sprites.mjs --dry-run # free: prompts and sizesnode scripts/gen-building-sprites.mjs --yes # every missing building spritenode scripts/gen-building-sprites.mjs --clean # free: re-cut the background of existing sprites```Providers do not always paint the clean magenta background the prompt asks for (fal-ai oftenreturns pale pink or grey noise). Generation therefore isolates the building from whatever isleft around it and refills windows the key erased. `--clean` runs the same cleanup on spritesalready on disk, for example older ones or images you drew yourself.From an agent, `generate_building_sprite(buildingType, variant?, material?, extraDetail?)`does one; `dryRun: true` returns the prompt for free. The image is trimmed and fitted standingon its bottom edge, which is where the map anchors it. See[worlds-and-buildings.md](worlds-and-buildings.md).## What the pipeline does1. Builds a prompt from the theme's material and lighting for that role
1 unmodified line234567814 unmodified lines23242526272810 unmodified lines39404142434445464748495051303 unmodified lines3553563573583593603613 unmodified lines36536636736836937037161 unmodified lines4334344354364374381 unmodified line<!-- Generated by scripts/gen-docs.mjs from the server's tools/list. Do not edit by hand. -->The server exposes **30 tools** and **1 prompt**. Every tool returns a JSON document as text.Invalid input or an impossible action (unknown `mapId`, a cell outside the grid, a chest on a wall)comes back as a tool error whose message says how to fix the call.14 unmodified lines- **Spawns**: [`place_spawn_player`](#place_spawn_player), [`place_spawn_enemy`](#place_spawn_enemy), [`place_spawn_npc`](#place_spawn_npc)- **Validation and export**: [`validate_map`](#validate_map), [`export_json`](#export_json), [`save_to_disk`](#save_to_disk)- **Sprites (optional, generation is paid)**: [`preview_sprite_prompt`](#preview_sprite_prompt), [`generate_tile_sprite`](#generate_tile_sprite), [`generate_theme_sprite_set`](#generate_theme_sprite_set), [`override_tile_image`](#override_tile_image)- **Prompt**: [`map_builder`](#prompt-map_builder)## Map lifecycle10 unmodified lines`writes map`Creates an empty isometric (default) or orthogonal Tiled map in the given theme and returns its mapId, which every other tool needs. The map has three tile layers (ground, walls, decorations) and two object layers (objects, spawns). Maps live in server memory until saved with save_to_disk or exported with export_json; they are lost when the server restarts.| Parameter | Type | Required | Notes ||---|---|---|---|| `name` | string | yes | Display name of the map, e.g. 'Crypt under the abandoned chapel'. 1..120 chars || `width` | integer | yes | Width in cells (1 cell = 5 ft in tabletop terms). 4..64 || `height` | integer | yes | Height in cells. 4..64 || `theme` | `CRYPT`, `CASTLE`, `WEREWOLF_DEN`, `TAVERN_BLOOD_PRINCE`, `VILLAGE`, `HAUNTED_FOREST`, `MAUSOLEUM`, `BLOOD_TOMB`, `AQUATIC`, `GLACIAIRE`, `INONDE`, `VOLCAN`, `FORET`, `HIVER`, `PRINTEMPS`, `ETE`, `AUTOMNE`, `DESOLATION`, `FUTURISTE`, `ELECTRONIQUE` | yes | Theme key from list_themes, e.g. CRYPT || `orientation` | `isometric`, `orthogonal` | no | Defaults to isometric |303 unmodified lines`read-only`Returns the full Tiled JSON (.tmj content) of a map as text. Sprite paths are written as './assets/<theme>/<role>.png' relative to the repository root; use save_to_disk to get a file whose sprite paths resolve from where it is saved.| Parameter | Type | Required | Notes ||---|---|---|---|3 unmodified lines`destructive` `idempotent`Writes the map to a .tmj file that opens directly in the Tiled editor. A relative path is resolved against the maps folder (the repository's maps/ by default, or TILED_MAPS_DIR); an absolute path is used as is. Missing folders are created and an existing file is overwritten. Sprite paths inside the file are rewritten relative to its location so Tiled finds the PNGs.| Parameter | Type | Required | Notes ||---|---|---|---|61 unmodified lines| `imageHeight` | integer | no | Image height in pixels if it differs from the default. -9007199254740991..9007199254740991 || `customPath` | string | no | Use this image path verbatim instead of the './assets/<theme>/<role>__<variant>.png' convention |## Prompts### Prompt: map_builder1 unmodified line234567814 unmodified lines2324252627282910 unmodified lines40414243444546474849505152303 unmodified lines3563573583593603613623 unmodified lines36636736836937037137261 unmodified lines4344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195201 unmodified line<!-- Generated by scripts/gen-docs.mjs from the server's tools/list. Do not edit by hand. -->The server exposes **35 tools** and **1 prompt**. Every tool returns a JSON document as text.Invalid input or an impossible action (unknown `mapId`, a cell outside the grid, a chest on a wall)comes back as a tool error whose message says how to fix the call.14 unmodified lines- **Spawns**: [`place_spawn_player`](#place_spawn_player), [`place_spawn_enemy`](#place_spawn_enemy), [`place_spawn_npc`](#place_spawn_npc)- **Validation and export**: [`validate_map`](#validate_map), [`export_json`](#export_json), [`save_to_disk`](#save_to_disk)- **Sprites (optional, generation is paid)**: [`preview_sprite_prompt`](#preview_sprite_prompt), [`generate_tile_sprite`](#generate_tile_sprite), [`generate_theme_sprite_set`](#generate_theme_sprite_set), [`override_tile_image`](#override_tile_image)- **Other**: [`generate_building_sprite`](#generate_building_sprite), [`place_building`](#place_building), [`link_maps`](#link_maps), [`validate_world`](#validate_world), [`save_world`](#save_world)- **Prompt**: [`map_builder`](#prompt-map_builder)## Map lifecycle10 unmodified lines`writes map`Creates an empty isometric (default) or orthogonal Tiled map in the given theme and returns its mapId, which every other tool needs. Sides go up to 256 cells, so one map can hold a whole village or region with buildings (place_building). The map has three tile layers (ground, walls, decorations) and two object layers (objects, spawns). Maps live in server memory until saved with save_to_disk or save_world, or exported with export_json; they are lost when the server restarts.| Parameter | Type | Required | Notes ||---|---|---|---|| `name` | string | yes | Display name of the map, e.g. 'Crypt under the abandoned chapel'. 1..120 chars || `width` | integer | yes | Width in cells, 4..256 (1 cell = 5 ft in tabletop terms). 4..256 || `height` | integer | yes | Height in cells, 4..256. 4..256 || `theme` | `CRYPT`, `CASTLE`, `WEREWOLF_DEN`, `TAVERN_BLOOD_PRINCE`, `VILLAGE`, `HAUNTED_FOREST`, `MAUSOLEUM`, `BLOOD_TOMB`, `AQUATIC`, `GLACIAIRE`, `INONDE`, `VOLCAN`, `FORET`, `HIVER`, `PRINTEMPS`, `ETE`, `AUTOMNE`, `DESOLATION`, `FUTURISTE`, `ELECTRONIQUE` | yes | Theme key from list_themes, e.g. CRYPT || `orientation` | `isometric`, `orthogonal` | no | Defaults to isometric |303 unmodified lines`read-only`Returns the full Tiled JSON (.tmj content) of a map as text, each tile layer's data on one line. Sprite paths are written as './assets/<theme>/<role>.png' relative to the repository root; use save_to_disk to get a file whose sprite paths resolve from where it is saved. Large maps make long answers: prefer save_to_disk or save_world above 64x64.| Parameter | Type | Required | Notes ||---|---|---|---|3 unmodified lines`destructive` `idempotent`Writes the map to a .tmj file that opens directly in the Tiled editor. A relative path is resolved against the maps folder (the repository's maps/ by default, or TILED_MAPS_DIR); an absolute path is used as is. Missing folders are created and an existing file is overwritten. Sprite paths inside the file are rewritten relative to its location so Tiled finds the PNGs. For maps linked by place_building or link_maps, use save_world so the linked files land side by side under the names their links use.| Parameter | Type | Required | Notes ||---|---|---|---|61 unmodified lines| `imageHeight` | integer | no | Image height in pixels if it differs from the default. -9007199254740991..9007199254740991 || `customPath` | string | no | Use this image path verbatim instead of the './assets/<theme>/<role>__<variant>.png' convention |## Other### generate_building_sprite`network`PAID unless dryRun is true: generates the sprite place_building draws for a building type (house, shop, tavern, temple, tower, castle) with FLUX.1-dev via Hugging Face Inference Providers, removes the magenta background and fits the building into its footprint size (house and shop 192x192, tavern and temple 256x256, tower 128x192, castle 384x384). Saves <assets>/buildings/<type>.png, or <type>__<variant>.png when variant is set. Takes 20-40 s and costs money per call; dryRun returns the prompt for free. An existing sprite is kept unless force is true.| Parameter | Type | Required | Notes ||---|---|---|---|| `buildingType` | `house`, `shop`, `tavern`, `temple`, `tower`, `castle` | yes | Building type, as in place_building || `variant` | string | no | Variant slug, e.g. 'snowy': saved as <type>__<variant>.png and used with place_building spriteVariant. pattern `^[a-z0-9_]+$` || `material` | string | no | Override of the building description || `lighting` | string | no | Override of the lighting description || `extraDetail` | string | no | Free text appended to the prompt || `seed` | integer | no | Seed for reproducibility. -9007199254740991..9007199254740991 || `force` | boolean | no | Regenerate even if the sprite already exists (paid again) || `dryRun` | boolean | no | Return the prompt and target size without generating anything (free) |### place_building`writes map`Puts a building on an outdoor map and, by default, creates its interior as a new map linked both ways. Footprints are square: house 3x3, shop 3x3, tavern 4x4, temple 4x4, tower 2x2, castle 6x6 cells, starting at (x, y), the footprint's top corner; every footprint cell needs painted ground, no wall and no object (props on the decorations layer are cleared). The building is drawn by a large sprite (assets/buildings/<type>.png, made with generate_building_sprite) on a 'buildings' layer; until it exists Tiled and the preview show a placeholder. With an interior, the call adds an 'entrance' on the door cell of the footprint edge (door=south, the default, or east), an 'arrival' spawn on the free cell in front of it, and in the interior map an 'exit' in the wall and an 'arrival' spawn just inside. Interiors default to a furnished single room (house, shop, tavern, temple, tower) or a full castle floor (castle, needs 27x20); edit them afterwards with the usual tools using the returned interior mapId. A transition is an object with targetMap (a 'file' property: the .tmj file of the other map) and targetSpawn (the name of an 'arrival' spawn in that map). In the game, stepping on it loads targetMap and puts the player on targetSpawn. Coordinates are grid cells: x is the column (0..width-1), y is the row (0..height-1), (0,0) is the top corner of an isometric map (top-left of an orthogonal one).| Parameter | Type | Required | Notes ||---|---|---|---|| `mapId` | string | yes | The outdoor map || `buildingType` | `house`, `shop`, `tavern`, `temple`, `tower`, `castle` | yes | || `x` | integer | yes | Column of the footprint's top corner. 0..9007199254740991 || `y` | integer | yes | Row of the footprint's top corner. 0..9007199254740991 || `name` | string | no | Display name, e.g. 'Miller house'; also the base of the building id. 1..80 chars || `door` | `south`, `east` | no | Footprint edge with the door: south (default, bottom-left face) or east (bottom-right face) || `interior` | boolean | no | Create and link an interior map (default true); false places a building that cannot be entered || `interiorTheme` | `CRYPT`, `CASTLE`, `WEREWOLF_DEN`, `TAVERN_BLOOD_PRINCE`, `VILLAGE`, `HAUNTED_FOREST`, `MAUSOLEUM`, `BLOOD_TOMB`, `AQUATIC`, `GLACIAIRE`, `INONDE`, `VOLCAN`, `FORET`, `HIVER`, `PRINTEMPS`, `ETE`, `AUTOMNE`, `DESOLATION`, `FUTURISTE`, `ELECTRONIQUE` | no | Theme of the interior (default per type: TAVERN_BLOOD_PRINCE, MAUSOLEUM or CASTLE) || `interiorWidth` | integer | no | Interior width in cells (default per type). 5..256 || `interiorHeight` | integer | no | Interior height in cells (default per type). 5..256 || `spriteVariant` | string | no | Use assets/buildings/<type>__<variant>.png instead of <type>.png. pattern `^[a-z0-9_]+$` |### link_maps`writes map`Joins two maps both ways with a door or stairs object on each side, for example the floors of a castle or a cave under a house. Each object leads to the other map; an 'arrival' spawn is put on a free floor cell next to each object (or on the arrival cell you pass). A door cell may be in a wall: the wall is opened. A transition is an object with targetMap (a 'file' property: the .tmj file of the other map) and targetSpawn (the name of an 'arrival' spawn in that map). In the game, stepping on it loads targetMap and puts the player on targetSpawn. Coordinates are grid cells: x is the column (0..width-1), y is the row (0..height-1), (0,0) is the top corner of an isometric map (top-left of an orthogonal one).| Parameter | Type | Required | Notes ||---|---|---|---|| `fromMapId` | string | yes | || `fromX` | integer | yes | 0..9007199254740991 || `fromY` | integer | yes | 0..9007199254740991 || `toMapId` | string | yes | || `toX` | integer | yes | 0..9007199254740991 || `toY` | integer | yes | 0..9007199254740991 || `kind` | `door`, `stairs` | yes | Object placed on both sides || `name` | string | no | Base name of the two objects (default '<kind>-to-<map name>'). 1..80 chars || `fromArrivalX` | integer | no | 0..9007199254740991 || `fromArrivalY` | integer | no | 0..9007199254740991 || `toArrivalX` | integer | no | 0..9007199254740991 || `toArrivalY` | integer | no | 0..9007199254740991 |### validate_world`read-only`Checks the maps linked to mapId (or every map of the session): each transition leads to a map of this session and to an arrival spawn that exists there (errors), every link has a way back, every map can be entered, some map has a player spawn, and building sprites exist (warnings). Also lists the maps with their file names and every link. Run validate_map on each map too.| Parameter | Type | Required | Notes ||---|---|---|---|| `mapId` | string | no | Any map of the world; omit to check every map of the session |### save_world`destructive` `idempotent`Writes mapId and every map linked to it (buildings' interiors, linked floors) into one folder, each under the file name its links use (describe_map and validate_world show them), with sprite paths relative to the folder. A relative folder is resolved against the maps folder (the repository's maps/ by default, or TILED_MAPS_DIR); default: a folder named after the map. Existing files are overwritten.| Parameter | Type | Required | Notes ||---|---|---|---|| `mapId` | string | yes | Any map of the world, usually the outdoor map || `folder` | string | no | Target folder, e.g. 'village-world' or an absolute path. min 1 chars |## Prompts### Prompt: map_builder
54 unmodified lines555657585960616254 unmodified lines- `HUGGINGFACE_API_KEY (or HF_TOKEN) is not set`: add the token to `tiled-mcp/.env` or to theclient's `env` block. See [sprite-generation.md](sprite-generation.md).- `The sprite already exists`: nothing was billed. Pass `force: true` to regenerate.- Provider or billing errors come from Hugging Face. Check that the provider (`TILED_HF_PROVIDER`,default `replicate`) is enabled for your account.- `'sharp' could not be loaded`: run `npm install` again. Map editing works without it; onlysprite generation and previews need it.- The client times out on `generate_theme_sprite_set`: use `node scripts/gen-theme-set.mjs <THEME> --yes`.54 unmodified lines5556575859606162636454 unmodified lines- `HUGGINGFACE_API_KEY (or HF_TOKEN) is not set`: add the token to `tiled-mcp/.env` or to theclient's `env` block. See [sprite-generation.md](sprite-generation.md).- `The sprite already exists`: nothing was billed. Pass `force: true` to regenerate.- Provider or billing errors come from Hugging Face. `We have not been able to find inferenceprovider information` means the provider in use no longer serves FLUX.1-dev: the error liststhe ones that do. Remove `TILED_HF_PROVIDER` to pick one automatically, or set it to one ofthem.- `'sharp' could not be loaded`: run `npm install` again. Map editing works without it; onlysprite generation and previews need it.- The client times out on `generate_theme_sprite_set`: use `node scripts/gen-theme-set.mjs <THEME> --yes`.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200# Worlds and buildings
Large outdoor maps with buildings the player can walk into. `place_building` puts a house,shop, tavern, temple, tower or castle on an outdoor map and creates its interior as a separatemap; walking onto the entrance loads the interior, and its exit brings the player back outside.`link_maps` joins any other pair of maps the same way, for example the floors of a castle.
``` outdoor map (village.tmj) interior map (miller-house-interior.tmj) +-----------------------------+ +-------------------------+ | ____ | targetMap | # # # # # # # # # # # | | / \ house | -----------> | # . . . . . . . . . # | | |______| | targetSpawn | # . . . . . . . . . # | | I <- entrance | | # . . . . A . . . . # | A = "...-inside" | A <- "...-outside"| <----------- | # # # # # O # # # # # | O = exit +-----------------------------+ +-------------------------+```

The sample world in [`maps/crossroads-village/`](../maps/crossroads-village/) has six buildings,their interiors and a cellar under the castle; `node scripts/create-village-world.mjs` rebuilds it.On the Hugging Face Space, the web page's **Village (enter buildings)** example builds one like it.
## How it works
A **transition** is an object with two properties:
| Property | Type | Meaning ||---|---|---|| `targetMap` | file | the `.tmj` file of the other map, relative to this one || `targetSpawn` | string | the name of an `arrival` spawn in that map |
When the player steps on a transition, the game loads `targetMap` and puts the player on thespawn named `targetSpawn`. Every arrival spawn stands next to the transition leading back, not onit, so arriving never bounces the player straight back. All of it is plain Tiled data: any enginecan follow it, and Tiled opens the target map when you right-click `targetMap`.
`place_building` writes, in one call:
| Where | What ||---|---|| outdoor map, `buildings` layer | the building sprite, a tile object over its square footprint || outdoor map, `objects` layer | an `entrance` on the door cell of the footprint edge || outdoor map, `spawns` layer | an `arrival` spawn `<buildingId>-outside` in front of the door || new interior map | a furnished layout, an `exit` in the wall, an `arrival` spawn `<buildingId>-inside` |
The full list of properties is in [map-format.md](map-format.md#buildings-and-transitions).
## Build a world
From any MCP client (Claude Code, Cursor, ...), or with the `map_builder` prompt, which knowsthese steps:
```textcreate_map(name="Crossroads village", width=96, height=96, theme="VILLAGE") -> mapIdpaint_rect(mapId, layer="ground", x1=0, y1=0, x2=95, y2=95, role="walkable_floor")paint_rect(mapId, layer="ground", x1=0, y1=47, x2=95, y2=48, role="walkable_floor_alt") # a roadplace_building(mapId, buildingType="house", x=20, y=40, name="Miller house")place_building(mapId, buildingType="tavern", x=40, y=42, name="Crossroads tavern")place_building(mapId, buildingType="castle", x=70, y=20, door="south")link_maps(fromMapId=<castle interior>, fromX=12, fromY=8, toMapId=<a cellar map>, toX=5, toY=4, kind="stairs") # optionalplace_spawn_player(mapId, x=10, y=48)validate_world(mapId) # every link leads somewhere real, every map can be enteredsave_world(mapId, folder="crossroads") # all maps, side by side```
Rules the tools enforce:
- Maps go up to **256x256** cells (128x128 on the hosted server; `TILED_MAX_MAP_SIZE` changes it).- The footprint must be painted ground with no wall and no object; props on it are cleared.- The cell in front of the door must be free floor: it holds the outside arrival point.- `door` is `south` (default, the bottom-left face on screen) or `east` (the bottom-right face).- One theme per map: an outdoor map is one theme, each interior can use another.
| Type | Footprint | Sprite | Default interior ||---|---|---|---|| `house` | 3x3 | 192x192 | 12x10 room, `TAVERN_BLOOD_PRINCE` || `shop` | 3x3 | 192x192 | 10x8 room, `TAVERN_BLOOD_PRINCE` || `tavern` | 4x4 | 256x256 | 16x12 room, `TAVERN_BLOOD_PRINCE` || `temple` | 4x4 | 256x256 | 14x12 room, `MAUSOLEUM` || `tower` | 2x2 | 128x192 | 9x9 room, `CASTLE` || `castle` | 6x6 | 384x384 | 27x20 castle floor, `CASTLE` |
Override the interior with `interiorTheme`, `interiorWidth` and `interiorHeight`, then reshape itwith the usual tools: its `mapId` is in the result. `interior: false` places a building thatcannot be entered.
`save_world` writes the outdoor map and every map linked to it into one folder, each under thefile name its links use (`describe_map` shows it). On the hosted server it returns one `.zip`.Use `save_to_disk` only for maps without links.
## Building sprites (FLUX, paid)
The buildings are large images in `assets/buildings/<type>.png`. Until they exist, the map worksand Tiled and the preview show placeholders. Generate them once with FLUX.1-dev, billed to yourHugging Face account, one call each (see [sprite-generation.md](sprite-generation.md)):
```bashnode scripts/gen-building-sprites.mjs --dry-run # free: the 6 prompts and sizesnode scripts/gen-building-sprites.mjs --yes # generates the missing ones```
or from an agent: `generate_building_sprite(buildingType="castle")`. A variant such as a snowyhouse is `generate_building_sprite(buildingType="house", variant="snowy", extraDetail="roof covered in snow")`,then `place_building(..., spriteVariant="snowy")`.
## Open it in Tiled
Open the outdoor map's `.tmj`. Select an entrance on the `objects` layer: in the Propertiespanel, right-click `targetMap` to open the interior. The `buildings` layer holds the sprites;hide it to see the footprints underneath.
## Load it in Godot 4
Draw the maps with whatever you already use: a Tiled importer add-on from the Godot Asset Library(for example YATI) or your own `TileMapLayer`. For an isometric `TileMapLayer`, use a `TileSet`with tile shape **Isometric**, tile layout **Diamond Down** and tile size 64x32, so Godot cellsmatch Tiled cells.
The transitions only need the `.tmj` JSON. This script follows them:
```gdscript# world_loader.gd: follows the transitions of maps written by save_world.extends Node
signal map_changed(file_name: String, map: Dictionary, arrival: Vector2i)
@export_dir var world_dir := "res://maps/crossroads"
var map: Dictionary = {}var transitions: Dictionary = {} # Vector2i cell -> {"map": String, "spawn": String}var spawns: Dictionary = {} # spawn name -> Vector2i cellvar blocked: Dictionary = {} # Vector2i cell -> true (building footprints)
func load_map(file_name: String, spawn_name := "") -> void: map = JSON.parse_string(FileAccess.get_file_as_string(world_dir.path_join(file_name))) transitions.clear() spawns.clear() blocked.clear() var iso: bool = map["orientation"] == "isometric" var unit_x: float = map["tileheight"] if iso else map["tilewidth"] var unit_y: float = map["tileheight"] var start := Vector2i.ZERO for layer in map["layers"]: if layer["type"] != "objectgroup": continue for obj in layer["objects"]: var props := {} for p in obj.get("properties", []): props[p["name"]] = p["value"] if layer["name"] == "buildings": var fx := int(props["footprintX"]) var fy := int(props["footprintY"]) var n := int(props["footprintSize"]) for y in range(fy, fy + n): for x in range(fx, fx + n): blocked[Vector2i(x, y)] = true continue var cell := Vector2i(floori(obj["x"] / unit_x), floori(obj["y"] / unit_y)) if props.get("targetMap", "") != "": transitions[cell] = {"map": props["targetMap"], "spawn": props.get("targetSpawn", "")} blocked.erase(cell) # the entrance cell of a footprint stays walkable if layer["name"] == "spawns": spawns[obj["name"]] = cell if props.get("role", "") == "player": start = cell map_changed.emit(file_name, map, spawns.get(spawn_name, start))
## Call after the player moved onto `cell`.func on_player_moved(cell: Vector2i) -> void: if transitions.has(cell): var t: Dictionary = transitions[cell] load_map(t["map"], t["spawn"])
## Movement check: building footprints are solid.func is_blocked(cell: Vector2i) -> bool: return blocked.has(cell)```
Start with `load_map("crossroads-village.tmj")`, the map holding the player spawn(`validate_world` lists it under `startMaps`). In `map_changed`, swap the displayed map and movethe player to `arrival` (`TileMapLayer.map_to_local(arrival)` gives its position).
`save_world` writes sprite paths relative to the repository's `assets/` folder (for example`../../assets/village/wall.png` from `maps/crossroads/`). Copy `assets/` and the world folder intoyour Godot project with the same relative layout (`res://assets/` and `res://maps/crossroads/`),or use the `.zip` from the hosted server, which bundles the sprites next to the maps.
## Limits
- On the Hugging Face web page, the AI agent can place buildings (each with its interior) but not generate new building sprites or save files: the page packs every linked map into its `.zip`. MCP clients get every tool.- Building footprints are square and the door is on the south or east face.- The interiors are starting points: one room per building, or a castle floor.4 unmodified lines56789101112131415161718192021224 unmodified linescolorTo: graysdk: dockerapp_port: 7860pinned: falselicense: mitshort_description: Describe a dungeon, get an isometric Tiled maphf_oauth: truehf_oauth_expiration_minutes: 480hf_oauth_scopes:- inference-apitags:- mcp-server- tiled- map-generator- isometric- procedural-generation---4 unmodified lines567891011121314151617181920212223242526272829304 unmodified linescolorTo: graysdk: dockerapp_port: 7860pinned: truelicense: mitshort_description: 'MCP server: describe a dungeon, get a Tiled map'thumbnail: >-https://huggingface.co/spaces/4math/tiled-map-builder/resolve/main/docs/images/preview-crypt-preset.pnghf_oauth: truehf_oauth_expiration_minutes: 480hf_oauth_scopes:- inference-apimodels:- openai/gpt-oss-120b- black-forest-labs/FLUX.1-devtags:- mcp-server- model-context-protocol- ai-agents- tiled- map-generator- isometric- procedural-generation- game-development---
11 unmodified lines121314151617181911 unmodified lines| `caverne-aquatique.tmj` | `AQUATIC` | 64x64 | `scripts/create-aquatic-map.mjs` || `forteresse-glace-etage.tmj` | `GLACIAIRE` | 64x64 | `scripts/create-glacier-map.mjs` || `reseau-electronique-repaire-hacker.tmj` | `ELECTRONIQUE` | 64x64 | `scripts/create-electronic-hacker-map.mjs` |The three scripted maps are deterministic: `npm run examples` rebuilds them identically.This folder is also the default output of `save_to_disk` for relative paths (change it with`TILED_MAPS_DIR`). Sprite paths in these files point to `../assets/`, so keep the maps inside the11 unmodified lines12131415161718192021222324252611 unmodified lines| `caverne-aquatique.tmj` | `AQUATIC` | 64x64 | `scripts/create-aquatic-map.mjs` || `forteresse-glace-etage.tmj` | `GLACIAIRE` | 64x64 | `scripts/create-glacier-map.mjs` || `reseau-electronique-repaire-hacker.tmj` | `ELECTRONIQUE` | 64x64 | `scripts/create-electronic-hacker-map.mjs` || `crossroads-village/` | `VILLAGE` and interiors | 40x40 + 7 maps | `scripts/create-village-world.mjs` |`crossroads-village/` is a sample **world**: an outdoor map with six buildings you can enter(house, shop, tavern, chapel, watchtower, castle), the interior map of each, and a cellar underthe castle reached by stairs. Open `crossroads-village/crossroads-village.tmj`; in Tiled, selectan entrance on the `objects` layer and right-click its `targetMap` property to open the interior.How the links work, and a Godot loader: [docs/worlds-and-buildings.md](../docs/worlds-and-buildings.md).The scripted maps and the world are deterministic: `npm run examples` rebuilds them identically.This folder is also the default output of `save_to_disk` for relative paths (change it with`TILED_MAPS_DIR`). Sprite paths in these files point to `../assets/`, so keep the maps inside the
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314{ "type": "map", "version": "1.10", "tiledversion": "1.10.2", "orientation": "isometric", "renderorder": "right-down", "width": 10, "height": 8, "tilewidth": 64, "tileheight": 32, "infinite": false, "nextlayerid": 6, "nextobjectid": 3, "tilesets": [ { "firstgid": 1, "name": "tavern-tileset", "tilewidth": 64, "tileheight": 32, "tilecount": 8, "columns": 0, "tiles": [ { "id": 0, "properties": [ { "name": "tileType", "value": "WALKABLE", "type": "string" }, { "name": "spriteId", "value": "tavern.plank_floor", "type": "string" } ], "image": "../../assets/tavern_blood_prince/walkable_floor.png", "imagewidth": 64, "imageheight": 32 }, { "id": 1, "properties": [ { "name": "tileType", "value": "WALKABLE", "type": "string" }, { "name": "spriteId", "value": "tavern.plank_floor_worn", "type": "string" } ], "image": "../../assets/tavern_blood_prince/walkable_floor_alt.png", "imagewidth": 64, "imageheight": 32 }, { "id": 2, "properties": [ { "name": "tileType", "value": "WALL", "type": "string" }, { "name": "spriteId", "value": "tavern.plaster_wall", "type": "string" } ], "image": "../../assets/tavern_blood_prince/wall.png", "imagewidth": 64, "imageheight": 64 }, { "id": 3, "properties": [ { "name": "tileType", "value": "DIFFICULT_TERRAIN", "type": "string" }, { "name": "spriteId", "value": "tavern.spilled_ale", "type": "string" } ], "image": "../../assets/tavern_blood_prince/difficult_terrain.png", "imagewidth": 64, "imageheight": 32 }, { "id": 4, "properties": [ { "name": "tileType", "value": "OBSTACLE", "type": "string" }, { "name": "spriteId", "value": "tavern.table", "type": "string" } ], "image": "../../assets/tavern_blood_prince/obstacle_decor.png", "imagewidth": 64, "imageheight": 64 }, { "id": 5, "properties": [ { "name": "tileType", "value": "WALKABLE", "type": "string" }, { "name": "spriteId", "value": "tavern.chair", "type": "string" } ], "image": "../../assets/tavern_blood_prince/decoration_minor.png", "imagewidth": 64, "imageheight": 32 }, { "id": 6, "properties": [ { "name": "tileType", "value": "DOOR", "type": "string" }, { "name": "spriteId", "value": "tavern.wood_door", "type": "string" } ], "image": "../../assets/tavern_blood_prince/door_closed.png", "imagewidth": 64, "imageheight": 64 }, { "id": 7, "properties": [ { "name": "tileType", "value": "STAIRS", "type": "string" }, { "name": "spriteId", "value": "tavern.wood_stairs", "type": "string" } ], "image": "../../assets/tavern_blood_prince/stairs.png", "imagewidth": 64, "imageheight": 64 } ], "grid": { "orientation": "isometric", "width": 64, "height": 32 } } ], "layers": [ { "id": 1, "name": "ground", "type": "tilelayer", "visible": true, "width": 10, "height": 8, "data": [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1], "opacity": 1, "x": 0, "y": 0 }, { "id": 2, "name": "walls", "type": "tilelayer", "visible": true, "width": 10, "height": 8, "data": [3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,3,3,3,3,3,3,0,3,3,3,3], "opacity": 1, "x": 0, "y": 0 }, { "id": 3, "name": "decorations", "type": "tilelayer", "visible": true, "width": 10, "height": 8, "data": [0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0], "opacity": 1, "x": 0, "y": 0 }, { "id": 4, "name": "objects", "type": "objectgroup", "visible": true, "objects": [ { "id": 1, "x": 160, "y": 224, "width": 32, "height": 32, "name": "chandler-shop-exit", "type": "exit", "visible": true, "rotation": 0, "properties": [ { "name": "kind", "value": "exit", "type": "string" }, { "name": "state", "value": "closed", "type": "string" }, { "name": "targetMap", "value": "crossroads-village.tmj", "type": "file" }, { "name": "targetSpawn", "value": "chandler-shop-outside", "type": "string" }, { "name": "buildingId", "value": "chandler-shop", "type": "string" } ] } ], "opacity": 1, "x": 0, "y": 0, "draworder": "topdown" }, { "id": 5, "name": "spawns", "type": "objectgroup", "visible": true, "objects": [ { "id": 2, "x": 176, "y": 208, "point": true, "name": "chandler-shop-inside", "type": "arrival", "visible": true, "rotation": 0, "properties": [ { "name": "role", "value": "arrival", "type": "string" } ] } ], "opacity": 1, "x": 0, "y": 0, "draworder": "topdown" } ], "properties": [ { "name": "theme", "value": "TAVERN_BLOOD_PRINCE", "type": "string" }, { "name": "mapName", "value": "Chandler shop interior", "type": "string" }, { "name": "buildingId", "value": "chandler-shop", "type": "string" }, { "name": "parentMap", "value": "crossroads-village.tmj", "type": "file" } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314{ "type": "map", "version": "1.10", "tiledversion": "1.10.2", "orientation": "isometric", "renderorder": "right-down", "width": 16, "height": 12, "tilewidth": 64, "tileheight": 32, "infinite": false, "nextlayerid": 6, "nextobjectid": 3, "tilesets": [ { "firstgid": 1, "name": "tavern-tileset", "tilewidth": 64, "tileheight": 32, "tilecount": 8, "columns": 0, "tiles": [ { "id": 0, "properties": [ { "name": "tileType", "value": "WALKABLE", "type": "string" }, { "name": "spriteId", "value": "tavern.plank_floor", "type": "string" } ], "image": "../../assets/tavern_blood_prince/walkable_floor.png", "imagewidth": 64, "imageheight": 32 }, { "id": 1, "properties": [ { "name": "tileType", "value": "WALKABLE", "type": "string" }, { "name": "spriteId", "value": "tavern.plank_floor_worn", "type": "string" } ], "image": "../../assets/tavern_blood_prince/walkable_floor_alt.png", "imagewidth": 64, "imageheight": 32 }, { "id": 2, "properties": [ { "name": "tileType", "value": "WALL", "type": "string" }, { "name": "spriteId", "value": "tavern.plaster_wall", "type": "string" } ], "image": "../../assets/tavern_blood_prince/wall.png", "imagewidth": 64, "imageheight": 64 }, { "id": 3, "properties": [ { "name": "tileType", "value": "DIFFICULT_TERRAIN", "type": "string" }, { "name": "spriteId", "value": "tavern.spilled_ale", "type": "string" } ], "image": "../../assets/tavern_blood_prince/difficult_terrain.png", "imagewidth": 64, "imageheight": 32 }, { "id": 4, "properties": [ { "name": "tileType", "value": "OBSTACLE", "type": "string" }, { "name": "spriteId", "value": "tavern.table", "type": "string" } ], "image": "../../assets/tavern_blood_prince/obstacle_decor.png", "imagewidth": 64, "imageheight": 64 }, { "id": 5, "properties": [ { "name": "tileType", "value": "WALKABLE", "type": "string" }, { "name": "spriteId", "value": "tavern.chair", "type": "string" } ], "image": "../../assets/tavern_blood_prince/decoration_minor.png", "imagewidth": 64, "imageheight": 32 }, { "id": 6, "properties": [ { "name": "tileType", "value": "DOOR", "type": "string" }, { "name": "spriteId", "value": "tavern.wood_door", "type": "string" } ], "image": "../../assets/tavern_blood_prince/door_closed.png", "imagewidth": 64, "imageheight": 64 }, { "id": 7, "properties": [ { "name": "tileType", "value": "STAIRS", "type": "string" }, { "name": "spriteId", "value": "tavern.wood_stairs", "type": "string" } ], "image": "../../assets/tavern_blood_prince/stairs.png", "imagewidth": 64, "imageheight": 64 } ], "grid": { "orientation": "isometric", "width": 64, "height": 32 } } ], "layers": [ { "id": 1, "name": "ground", "type": "tilelayer", "visible": true, "width": 16, "height": 12, "data": [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1], "opacity": 1, "x": 0, "y": 0 }, { "id": 2, "name": "walls", "type": "tilelayer", "visible": true, "width": 16, "height": 12, "data": [3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3,3,0,3,3,3,3,3,3,3], "opacity": 1, "x": 0, "y": 0 }, { "id": 3, "name": "decorations", "type": "tilelayer", "visible": true, "width": 16, "height": 12, "data": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], "opacity": 1, "x": 0, "y": 0 }, { "id": 4, "name": "objects", "type": "objectgroup", "visible": true, "objects": [ { "id": 1, "x": 256, "y": 352, "width": 32, "height": 32, "name": "crossroads-tavern-exit", "type": "exit", "visible": true, "rotation": 0, "properties": [ { "name": "kind", "value": "exit", "type": "string" }, { "name": "state", "value": "closed", "type": "string" }, { "name": "targetMap", "value": "crossroads-village.tmj", "type": "file" }, { "name": "targetSpawn", "value": "crossroads-tavern-outside", "type": "string" }, { "name": "buildingId", "value": "crossroads-tavern", "type": "string" } ] } ], "opacity": 1, "x": 0, "y": 0, "draworder": "topdown" }, { "id": 5, "name": "spawns", "type": "objectgroup", "visible": true, "objects": [ { "id": 2, "x": 272, "y": 336, "point": true, "name": "crossroads-tavern-inside", "type": "arrival", "visible": true, "rotation": 0, "properties": [ { "name": "role", "value": "arrival", "type": "string" } ] } ], "opacity": 1, "x": 0, "y": 0, "draworder": "topdown" } ], "properties": [ { "name": "theme", "value": "TAVERN_BLOOD_PRINCE", "type": "string" }, { "name": "mapName", "value": "Crossroads tavern interior", "type": "string" }, { "name": "buildingId", "value": "crossroads-tavern", "type": "string" }, { "name": "parentMap", "value": "crossroads-village.tmj", "type": "file" } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008{ "type": "map", "version": "1.10", "tiledversion": "1.10.2", "orientation": "isometric", "renderorder": "right-down", "width": 40, "height": 40, "tilewidth": 64, "tileheight": 32, "infinite": false, "nextlayerid": 7, "nextobjectid": 20, "tilesets": [ { "firstgid": 1, "name": "village-tileset", "tilewidth": 64, "tileheight": 32, "tilecount": 7, "columns": 0, "tiles": [ { "id": 0, "properties": [ { "name": "tileType", "value": "WALKABLE", "type": "string" }, { "name": "spriteId", "value": "village.cobblestone", "type": "string" } ], "image": "../../assets/village/walkable_floor.png", "imagewidth": 64, "imageheight": 32 }, { "id": 1, "properties": [ { "name": "tileType", "value": "WALKABLE", "type": "string" }, { "name": "spriteId", "value": "village.mud", "type": "string" } ], "image": "../../assets/village/walkable_floor_alt.png", "imagewidth": 64, "imageheight": 32 }, { "id": 2, "properties": [ { "name": "tileType", "value": "WALL", "type": "string" }, { "name": "spriteId", "value": "village.timber_wall", "type": "string" } ], "image": "../../assets/village/wall.png", "imagewidth": 64, "imageheight": 64 }, { "id": 3, "properties": [ { "name": "tileType", "value": "DIFFICULT_TERRAIN", "type": "string" }, { "name": "spriteId", "value": "village.mud_puddle", "type": "string" } ], "image": "../../assets/village/difficult_terrain.png", "imagewidth": 64, "imageheight": 32 }, { "id": 4, "properties": [ { "name": "tileType", "value": "OBSTACLE", "type": "string" }, { "name": "spriteId", "value": "village.well", "type": "string" } ], "image": "../../assets/village/obstacle_decor.png", "imagewidth": 64, "imageheight": 64 }, { "id": 5, "properties": [ { "name": "tileType", "value": "WALKABLE", "type": "string" }, { "name": "spriteId", "value": "village.market_stall", "type": "string" } ], "image": "../../assets/village/decoration_minor.png", "imagewidth": 64, "imageheight": 32 }, { "id": 6, "properties": [ { "name": "tileType", "value": "DOOR", "type": "string" }, { "name": "spriteId", "value": "village.house_door", "type": "string" } ], "image": "../../assets/village/door_closed.png", "imagewidth": 64, "imageheight": 64 } ], "grid": { "orientation": "isometric", "width": 64, "height": 32 } }, { "firstgid": 8, "name": "buildings", "tilewidth": 64, "tileheight": 32, "tilecount": 6, "columns": 0, "grid": { "orientation": "isometric", "width": 64, "height": 32 }, "objectalignment": "bottom", "tiles": [ { "id": 0, "image": "../../assets/buildings/house.png", "imagewidth": 192, "imageheight": 192, "properties": [ { "name": "tileType", "value": "BUILDING", "type": "string" }, { "name": "buildingType", "value": "house", "type": "string" } ] }, { "id": 1, "image": "../../assets/buildings/tavern.png", "imagewidth": 256, "imageheight": 256, "properties": [ { "name": "tileType", "value": "BUILDING", "type": "string" }, { "name": "buildingType", "value": "tavern", "type": "string" } ] }, { "id": 2, "image": "../../assets/buildings/shop.png", "imagewidth": 192, "imageheight": 192, "properties": [ { "name": "tileType", "value": "BUILDING", "type": "string" }, { "name": "buildingType", "value": "shop", "type": "string" } ] }, { "id": 3, "image": "../../assets/buildings/temple.png", "imagewidth": 256, "imageheight": 256, "properties": [ { "name": "tileType", "value": "BUILDING", "type": "string" }, { "name": "buildingType", "value": "temple", "type": "string" } ] }, { "id": 4, "image": "../../assets/buildings/tower.png", "imagewidth": 128, "imageheight": 192, "properties": [ { "name": "tileType", "value": "BUILDING", "type": "string" }, { "name": "buildingType", "value": "tower", "type": "string" } ] }, { "id": 5, "image": "../../assets/buildings/castle.png", "imagewidth": 384, "imageheight": 384, "properties": [ { "name": "tileType", "value": "BUILDING", "type": "string" }, { "name": "buildingType", "value": "castle", "type": "string" } ] } ] } ], "layers": [ { "id": 1, "name": "ground", "type": "tilelayer", "visible": true, "width": 40, "height": 40, "data": [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], "opacity": 1, "x": 0, "y": 0 }, { "id": 6, "name": "buildings", "type": "objectgroup", "visible": true, "objects": [ { "id": 1, "gid": 8, "x": 512, "y": 512, "width": 192, "height": 192, "name": "Miller house", "type": "building", "visible": true, "rotation": 0, "properties": [ { "name": "kind", "value": "building", "type": "string" }, { "name": "buildingType", "value": "house", "type": "string" }, { "name": "buildingId", "value": "miller-house", "type": "string" }, { "name": "footprintX", "value": 13, "type": "int" }, { "name": "footprintY", "value": 13, "type": "int" }, { "name": "footprintSize", "value": 3, "type": "int" }, { "name": "interiorMap", "value": "miller-house-interior.tmj", "type": "file" } ] }, { "id": 4, "gid": 9, "x": 832, "y": 512, "width": 256, "height": 256, "name": "Crossroads tavern", "type": "building", "visible": true, "rotation": 0, "properties": [ { "name": "kind", "value": "building", "type": "string" }, { "name": "buildingType", "value": "tavern", "type": "string" }, { "name": "buildingId", "value": "crossroads-tavern", "type": "string" }, { "name": "footprintX", "value": 22, "type": "int" }, { "name": "footprintY", "value": 12, "type": "int" }, { "name": "footprintSize", "value": 4, "type": "int" }, { "name": "interiorMap", "value": "crossroads-tavern-interior.tmj", "type": "file" } ] }, { "id": 7, "gid": 10, "x": 512, "y": 800, "width": 192, "height": 192, "name": "Chandler shop", "type": "building", "visible": true, "rotation": 0, "properties": [ { "name": "kind", "value": "building", "type": "string" }, { "name": "buildingType", "value": "shop", "type": "string" }, { "name": "buildingId", "value": "chandler-shop", "type": "string" }, { "name": "footprintX", "value": 13, "type": "int" }, { "name": "footprintY", "value": 22, "type": "int" }, { "name": "footprintSize", "value": 3, "type": "int" }, { "name": "interiorMap", "value": "chandler-shop-interior.tmj", "type": "file" } ] }, { "id": 10, "gid": 11, "x": 864, "y": 864, "width": 256, "height": 256, "name": "Old chapel", "type": "building", "visible": true, "rotation": 0, "properties": [ { "name": "kind", "value": "building", "type": "string" }, { "name": "buildingType", "value": "temple", "type": "string" }, { "name": "buildingId", "value": "old-chapel", "type": "string" }, { "name": "footprintX", "value": 23, "type": "int" }, { "name": "footprintY", "value": 23, "type": "int" }, { "name": "footprintSize", "value": 4, "type": "int" }, { "name": "interiorMap", "value": "old-chapel-interior.tmj", "type": "file" } ] }, { "id": 13, "gid": 12, "x": 256, "y": 256, "width": 128, "height": 192, "name": "Watchtower", "type": "building", "visible": true, "rotation": 0, "properties": [ { "name": "kind", "value": "building", "type": "string" }, { "name": "buildingType", "value": "tower", "type": "string" }, { "name": "buildingId", "value": "watchtower", "type": "string" }, { "name": "footprintX", "value": 6, "type": "int" }, { "name": "footprintY", "value": 6, "type": "int" }, { "name": "footprintSize", "value": 2, "type": "int" }, { "name": "interiorMap", "value": "watchtower-interior.tmj", "type": "file" } ] }, { "id": 16, "gid": 13, "x": 1088, "y": 256, "width": 384, "height": 384, "name": "Greystone keep", "type": "building", "visible": true, "rotation": 0, "properties": [ { "name": "kind", "value": "building", "type": "string" }, { "name": "buildingType", "value": "castle", "type": "string" }, { "name": "buildingId", "value": "greystone-keep", "type": "string" }, { "name": "footprintX", "value": 28, "type": "int" }, { "name": "footprintY", "value": 2, "type": "int" }, { "name": "footprintSize", "value": 6, "type": "int" }, { "name": "interiorMap", "value": "greystone-keep-interior.tmj", "type": "file" } ] } ], "opacity": 1, "x": 0, "y": 0, "draworder": "topdown" }, { "id": 4, "name": "objects", "type": "objectgroup", "visible": true, "objects": [ { "id": 2, "x": 448, "y": 480, "width": 32, "height": 32, "name": "miller-house-entrance", "type": "entrance", "visible": true, "rotation": 0, "properties": [ { "name": "kind", "value": "entrance", "type": "string" }, { "name": "state", "value": "closed", "type": "string" }, { "name": "targetMap", "value": "miller-house-interior.tmj", "type": "file" }, { "name": "targetSpawn", "value": "miller-house-inside", "type": "string" }, { "name": "buildingId", "value": "miller-house", "type": "string" } ] }, { "id": 5, "x": 768, "y": 480, "width": 32, "height": 32, "name": "crossroads-tavern-entrance", "type": "entrance", "visible": true, "rotation": 0, "properties": [ { "name": "kind", "value": "entrance", "type": "string" }, { "name": "state", "value": "closed", "type": "string" }, { "name": "targetMap", "value": "crossroads-tavern-interior.tmj", "type": "file" }, { "name": "targetSpawn", "value": "crossroads-tavern-inside", "type": "string" }, { "name": "buildingId", "value": "crossroads-tavern", "type": "string" } ] }, { "id": 8, "x": 480, "y": 736, "width": 32, "height": 32, "name": "chandler-shop-entrance", "type": "entrance", "visible": true, "rotation": 0, "properties": [ { "name": "kind", "value": "entrance", "type": "string" }, { "name": "state", "value": "closed", "type": "string" }, { "name": "targetMap", "value": "chandler-shop-interior.tmj", "type": "file" }, { "name": "targetSpawn", "value": "chandler-shop-inside", "type": "string" }, { "name": "buildingId", "value": "chandler-shop", "type": "string" } ] }, { "id": 11, "x": 800, "y": 832, "width": 32, "height": 32, "name": "old-chapel-entrance", "type": "entrance", "visible": true, "rotation": 0, "properties": [ { "name": "kind", "value": "entrance", "type": "string" }, { "name": "state", "value": "closed", "type": "string" }, { "name": "targetMap", "value": "old-chapel-interior.tmj", "type": "file" }, { "name": "targetSpawn", "value": "old-chapel-inside", "type": "string" }, { "name": "buildingId", "value": "old-chapel", "type": "string" } ] }, { "id": 14, "x": 224, "y": 224, "width": 32, "height": 32, "name": "watchtower-entrance", "type": "entrance", "visible": true, "rotation": 0, "properties": [ { "name": "kind", "value": "entrance", "type": "string" }, { "name": "state", "value": "closed", "type": "string" }, { "name": "targetMap", "value": "watchtower-interior.tmj", "type": "file" }, { "name": "targetSpawn", "value": "watchtower-inside", "type": "string" }, { "name": "buildingId", "value": "watchtower", "type": "string" } ] }, { "id": 17, "x": 992, "y": 224, "width": 32, "height": 32, "name": "greystone-keep-entrance", "type": "entrance", "visible": true, "rotation": 0, "properties": [ { "name": "kind", "value": "entrance", "type": "string" }, { "name": "state", "value": "closed", "type": "string" }, { "name": "targetMap", "value": "greystone-keep-interior.tmj", "type": "file" }, { "name": "targetSpawn", "value": "greystone-keep-inside", "type": "string" }, { "name": "buildingId", "value": "greystone-keep", "type": "string" } ] } ], "opacity": 1, "x": 0, "y": 0, "draworder": "topdown" }, { "id": 5, "name": "spawns", "type": "objectgroup", "visible": true, "objects": [ { "id": 3, "x": 464, "y": 528, "point": true, "name": "miller-house-outside", "type": "arrival", "visible": true, "rotation": 0, "properties": [ { "name": "role", "value": "arrival", "type": "string" } ] }, { "id": 6, "x": 784, "y": 528, "point": true, "name": "crossroads-tavern-outside", "type": "arrival", "visible": true, "rotation": 0, "properties": [ { "name": "role", "value": "arrival", "type": "string" } ] }, { "id": 9, "x": 528, "y": 752, "point": true, "name": "chandler-shop-outside", "type": "arrival", "visible": true, "rotation": 0, "properties": [ { "name": "role", "value": "arrival", "type": "string" } ] }, { "id": 12, "x": 816, "y": 880, "point": true, "name": "old-chapel-outside", "type": "arrival", "visible": true, "rotation": 0, "properties": [ { "name": "role", "value": "arrival", "type": "string" } ] }, { "id": 15, "x": 240, "y": 272, "point": true, "name": "watchtower-outside", "type": "arrival", "visible": true, "rotation": 0, "properties": [ { "name": "role", "value": "arrival", "type": "string" } ] }, { "id": 18, "x": 1008, "y": 272, "point": true, "name": "greystone-keep-outside", "type": "arrival", "visible": true, "rotation": 0, "properties": [ { "name": "role", "value": "arrival", "type": "string" } ] }, { "id": 19, "x": 624, "y": 1040, "point": true, "name": "start", "type": "player", "visible": true, "rotation": 0, "properties": [ { "name": "role", "value": "player", "type": "string" } ] } ], "opacity": 1, "x": 0, "y": 0, "draworder": "topdown" } ], "properties": [ { "name": "theme", "value": "VILLAGE", "type": "string" }, { "name": "mapName", "value": "Crossroads village", "type": "string" } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588{ "type": "map", "version": "1.10", "tiledversion": "1.10.2", "orientation": "isometric", "renderorder": "right-down", "width": 27, "height": 20, "tilewidth": 64, "tileheight": 32, "infinite": false, "nextlayerid": 6, "nextobjectid": 14, "tilesets": [ { "firstgid": 1, "name": "castle-tileset", "tilewidth": 64, "tileheight": 32, "tilecount": 9, "columns": 0, "tiles": [ { "id": 0, "properties": [ { "name": "tileType", "value": "WALKABLE", "type": "string" }, { "name": "spriteId", "value": "castle.black_marble", "type": "string" } ], "image": "../../assets/castle/walkable_floor.png", "imagewidth": 64, "imageheight": 32 }, { "id": 1, "properties": [ { "name": "tileType", "value": "WALKABLE", "type": "string" }, { "name": "spriteId", "value": "castle.red_carpet", "type": "string" } ], "image": "../../assets/castle/walkable_floor_alt.png", "imagewidth": 64, "imageheight": 32 }, { "id": 2, "properties": [ { "name": "tileType", "value": "WALL", "type": "string" }, { "name": "spriteId", "value": "castle.basalt_wall", "type": "string" } ], "image": "../../assets/castle/wall.png", "imagewidth": 64, "imageheight": 64 }, { "id": 3, "properties": [ { "name": "tileType", "value": "WALL", "type": "string" }, { "name": "spriteId", "value": "castle.basalt_corner", "type": "string" } ], "image": "../../assets/castle/wall_corner.png", "imagewidth": 64, "imageheight": 64 }, { "id": 4, "properties": [ { "name": "tileType", "value": "DIFFICULT_TERRAIN", "type": "string" }, { "name": "spriteId", "value": "castle.debris", "type": "string" } ], "image": "../../assets/castle/difficult_terrain.png", "imagewidth": 64, "imageheight": 32 }, { "id": 5, "properties": [ { "name": "tileType", "value": "OBSTACLE", "type": "string" }, { "name": "spriteId", "value": "castle.throne", "type": "string" } ], "image": "../../assets/castle/obstacle_decor.png", "imagewidth": 64, "imageheight": 64 }, { "id": 6, "properties": [ { "name": "tileType", "value": "WALKABLE", "type": "string" }, { "name": "spriteId", "value": "castle.banner", "type": "string" } ], "image": "../../assets/castle/decoration_minor.png", "imagewidth": 64, "imageheight": 32 }, { "id": 7, "properties": [ { "name": "tileType", "value": "DOOR", "type": "string" }, { "name": "spriteId", "value": "castle.oak_door", "type": "string" } ], "image": "../../assets/castle/door_closed.png", "imagewidth": 64, "imageheight": 64 }, { "id": 8, "properties": [ { "name": "tileType", "value": "STAIRS", "type": "string" }, { "name": "spriteId", "value": "castle.grand_stairs", "type": "string" } ], "image": "../../assets/castle/stairs.png", "imagewidth": 64, "imageheight": 64 } ], "grid": { "orientation": "isometric", "width": 64, "height": 32 } } ], "layers": [ { "id": 1, "name": "ground", "type": "tilelayer", "visible": true, "width": 27, "height": 20, "data": [0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1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objectgroup", "visible": true, "objects": [ { "id": 1, "x": 160, "y": 320, "width": 32, "height": 32, "name": "door-1", "type": "door", "visible": true, "rotation": 0, "properties": [ { "name": "kind", "value": "door", "type": "string" }, { "name": "state", "value": "closed", "type": "string" } ] }, { "id": 2, "x": 256, "y": 320, "width": 32, "height": 32, "name": "door-2", "type": "door", "visible": true, "rotation": 0, "properties": [ { "name": "kind", "value": "door", "type": "string" }, { "name": "state", "value": "closed", "type": "string" } ] }, { "id": 3, "x": 416, "y": 192, "width": 32, "height": 32, "name": "door-3", "type": "door", "visible": true, "rotation": 0, "properties": [ { "name": "kind", "value": "door", "type": "string" }, { "name": "state", "value": "closed", "type": "string" } ] }, { "id": 4, "x": 416, "y": 448, "width": 32, "height": 32, "name": "door-4", "type": "door", "visible": true, "rotation": 0, "properties": [ { "name": "kind", "value": "door", "type": "string" }, { "name": "state", "value": "closed", "type": "string" } ] }, { "id": 5, "x": 544, "y": 320, "width": 32, "height": 32, "name": "door-5", "type": "door", "visible": true, "rotation": 0, "properties": [ { "name": "kind", "value": "door", "type": "string" }, { "name": "state", "value": "closed", "type": "string" } ] }, { "id": 6, "x": 416, "y": 128, "width": 32, "height": 32, "name": "door-6", "type": "door", "visible": true, "rotation": 0, "properties": [ { "name": "kind", "value": "door", "type": "string" }, { "name": "state", "value": "closed", "type": "string" } ] }, { "id": 7, "x": 416, "y": 480, "width": 32, "height": 32, "name": "door-7", "type": "door", "visible": true, "rotation": 0, "properties": [ { "name": "kind", "value": "door", "type": "string" }, { "name": "state", "value": "closed", "type": "string" } ] }, { "id": 8, "x": 608, "y": 320, "width": 32, "height": 32, "name": "door-8", "type": "door", "visible": true, "rotation": 0, "properties": [ { "name": "kind", "value": "door", "type": "string" }, { "name": "state", "value": "closed", "type": "string" } ] }, { "id": 10, "x": 0, "y": 320, "width": 32, "height": 32, "name": "greystone-keep-exit", "type": "exit", "visible": true, "rotation": 0, "properties": [ { "name": "kind", "value": "exit", "type": "string" }, { "name": "state", "value": "closed", "type": "string" }, { "name": "targetMap", "value": "crossroads-village.tmj", "type": "file" }, { "name": "targetSpawn", "value": "greystone-keep-outside", "type": "string" }, { "name": "buildingId", "value": "greystone-keep", "type": "string" } ] }, { "id": 12, "x": 384, "y": 256, "width": 32, "height": 32, "name": "cellar-stairs", "type": "stairs", "visible": true, "rotation": 0, "properties": [ { "name": "kind", "value": "stairs", "type": "string" }, { "name": "state", "value": "open", "type": "string" }, { "name": "targetMap", "value": "keep-cellar.tmj", "type": "file" }, { "name": "targetSpawn", "value": "cellar-stairs-back-arrival", "type": "string" } ] } ], "opacity": 1, "x": 0, "y": 0, "draworder": "topdown" }, { "id": 5, "name": "spawns", "type": "objectgroup", "visible": true, "objects": [ { "id": 9, "x": 720, "y": 272, "point": true, "name": "enemy-9", "type": "enemy", "visible": true, "rotation": 0, "properties": [ { "name": "role", "value": "enemy", "type": "string" }, { "name": "npcName", "value": "Castle lord", "type": "string" } ] }, { "id": 11, "x": 48, "y": 336, "point": true, "name": "greystone-keep-inside", "type": "arrival", "visible": true, "rotation": 0, "properties": [ { "name": "role", "value": "arrival", "type": "string" } ] }, { "id": 13, "x": 400, "y": 304, "point": true, "name": "cellar-stairs-arrival", "type": "arrival", "visible": true, "rotation": 0, "properties": [ { "name": "role", "value": "arrival", "type": "string" } ] } ], "opacity": 1, "x": 0, "y": 0, "draworder": "topdown" } ], "properties": [ { "name": "theme", "value": "CASTLE", "type": "string" }, { "name": "mapName", "value": "Greystone keep interior", "type": "string" }, { "name": "buildingId", "value": "greystone-keep", "type": "string" }, { "name": "parentMap", "value": "crossroads-village.tmj", "type": "file" } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345{ "type": "map", "version": "1.10", "tiledversion": "1.10.2", "orientation": "isometric", "renderorder": "right-down", "width": 12, "height": 10, "tilewidth": 64, "tileheight": 32, "infinite": false, "nextlayerid": 6, "nextobjectid": 3, "tilesets": [ { "firstgid": 1, "name": "crypt-tileset", "tilewidth": 64, "tileheight": 32, "tilecount": 10, "columns": 0, "tiles": [ { "id": 0, "properties": [ { "name": "tileType", "value": "WALKABLE", "type": "string" }, { "name": "spriteId", "value": "crypt.flagstone", "type": "string" } ], "image": "../../assets/crypt/walkable_floor.png", "imagewidth": 64, "imageheight": 32 }, { "id": 1, "properties": [ { "name": "tileType", "value": "WALKABLE", "type": "string" }, { "name": "spriteId", "value": "crypt.flagstone_cracked", "type": "string" } ], "image": "../../assets/crypt/walkable_floor_alt.png", "imagewidth": 64, "imageheight": 32 }, { "id": 2, "properties": [ { "name": "tileType", "value": "WALL", "type": "string" }, { "name": "spriteId", "value": "crypt.wall_mossy", "type": "string" } ], "image": "../../assets/crypt/wall.png", "imagewidth": 64, "imageheight": 64 }, { "id": 3, "properties": [ { "name": "tileType", "value": "WALL", "type": "string" }, { "name": "spriteId", "value": "crypt.wall_corner", "type": "string" } ], "image": "../../assets/crypt/wall_corner.png", "imagewidth": 64, "imageheight": 64 }, { "id": 4, "properties": [ { "name": "tileType", "value": "DIFFICULT_TERRAIN", "type": "string" }, { "name": "spriteId", "value": "crypt.rubble", "type": "string" } ], "image": "../../assets/crypt/difficult_terrain.png", "imagewidth": 64, "imageheight": 32 }, { "id": 5, "properties": [ { "name": "tileType", "value": "HAZARD", "type": "string" }, { "name": "spriteId", "value": "crypt.poison_vent", "type": "string" }, { "name": "hazardType", "value": "poison", "type": "string" }, { "name": "hazardNotation", "value": "2d6", "type": "string" } ], "image": "../../assets/crypt/hazard_primary.png", "imagewidth": 64, "imageheight": 32 }, { "id": 6, "properties": [ { "name": "tileType", "value": "OBSTACLE", "type": "string" }, { "name": "spriteId", "value": "crypt.sarcophagus", "type": "string" } ], "image": "../../assets/crypt/obstacle_decor.png", "imagewidth": 64, "imageheight": 64 }, { "id": 7, "properties": [ { "name": "tileType", "value": "WALKABLE", "type": "string" }, { "name": "spriteId", "value": "crypt.bones", "type": "string" } ], "image": "../../assets/crypt/decoration_minor.png", "imagewidth": 64, "imageheight": 32 }, { "id": 8, "properties": [ { "name": "tileType", "value": "DOOR", "type": "string" }, { "name": "spriteId", "value": "crypt.iron_door", "type": "string" } ], "image": "../../assets/crypt/door_closed.png", "imagewidth": 64, "imageheight": 64 }, { "id": 9, "properties": [ { "name": "tileType", "value": "STAIRS", "type": "string" }, { "name": "spriteId", "value": "crypt.stone_stairs", "type": "string" } ], "image": "../../assets/crypt/stairs.png", "imagewidth": 64, "imageheight": 64 } ], "grid": { "orientation": "isometric", "width": 64, "height": 32 } } ], "layers": [ { "id": 1, "name": "ground", "type": "tilelayer", "visible": true, "width": 12, "height": 10, "data": [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1], "opacity": 1, "x": 0, "y": 0 }, { "id": 2, "name": "walls", "type": "tilelayer", "visible": true, "width": 12, "height": 10, "data": [3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3,3,3,3,3,3], "opacity": 1, "x": 0, "y": 0 }, { "id": 3, "name": "decorations", "type": "tilelayer", "visible": true, "width": 12, "height": 10, "data": [0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0], "opacity": 1, "x": 0, "y": 0 }, { "id": 4, "name": "objects", "type": "objectgroup", "visible": true, "objects": [ { "id": 1, "x": 160, "y": 128, "width": 32, "height": 32, "name": "cellar-stairs-back", "type": "stairs", "visible": true, "rotation": 0, "properties": [ { "name": "kind", "value": "stairs", "type": "string" }, { "name": "state", "value": "open", "type": "string" }, { "name": "targetMap", "value": "greystone-keep-interior.tmj", "type": "file" }, { "name": "targetSpawn", "value": "cellar-stairs-arrival", "type": "string" } ] } ], "opacity": 1, "x": 0, "y": 0, "draworder": "topdown" }, { "id": 5, "name": "spawns", "type": "objectgroup", "visible": true, "objects": [ { "id": 2, "x": 176, "y": 176, "point": true, "name": "cellar-stairs-back-arrival", "type": "arrival", "visible": true, "rotation": 0, "properties": [ { "name": "role", "value": "arrival", "type": "string" } ] } ], "opacity": 1, "x": 0, "y": 0, "draworder": "topdown" } ], "properties": [ { "name": "theme", "value": "CRYPT", "type": "string" }, { "name": "mapName", "value": "Keep cellar", "type": "string" } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314{ "type": "map", "version": "1.10", "tiledversion": "1.10.2", "orientation": "isometric", "renderorder": "right-down", "width": 12, "height": 10, "tilewidth": 64, "tileheight": 32, "infinite": false, "nextlayerid": 6, "nextobjectid": 3, "tilesets": [ { "firstgid": 1, "name": "tavern-tileset", "tilewidth": 64, "tileheight": 32, "tilecount": 8, "columns": 0, "tiles": [ { "id": 0, "properties": [ { "name": "tileType", "value": "WALKABLE", "type": "string" }, { "name": "spriteId", "value": "tavern.plank_floor", "type": "string" } ], "image": "../../assets/tavern_blood_prince/walkable_floor.png", "imagewidth": 64, "imageheight": 32 }, { "id": 1, "properties": [ { "name": "tileType", "value": "WALKABLE", "type": "string" }, { "name": "spriteId", "value": "tavern.plank_floor_worn", "type": "string" } ], "image": "../../assets/tavern_blood_prince/walkable_floor_alt.png", "imagewidth": 64, "imageheight": 32 }, { "id": 2, "properties": [ { "name": "tileType", "value": "WALL", "type": "string" }, { "name": "spriteId", "value": "tavern.plaster_wall", "type": "string" } ], "image": "../../assets/tavern_blood_prince/wall.png", "imagewidth": 64, "imageheight": 64 }, { "id": 3, "properties": [ { "name": "tileType", "value": "DIFFICULT_TERRAIN", "type": "string" }, { "name": "spriteId", "value": "tavern.spilled_ale", "type": "string" } ], "image": "../../assets/tavern_blood_prince/difficult_terrain.png", "imagewidth": 64, "imageheight": 32 }, { "id": 4, "properties": [ { "name": "tileType", "value": "OBSTACLE", "type": "string" }, { "name": "spriteId", "value": "tavern.table", "type": "string" } ], "image": "../../assets/tavern_blood_prince/obstacle_decor.png", "imagewidth": 64, "imageheight": 64 }, { "id": 5, "properties": [ { "name": "tileType", "value": "WALKABLE", "type": "string" }, { "name": "spriteId", "value": "tavern.chair", "type": "string" } ], "image": "../../assets/tavern_blood_prince/decoration_minor.png", "imagewidth": 64, "imageheight": 32 }, { "id": 6, "properties": [ { "name": "tileType", "value": "DOOR", "type": "string" }, { "name": "spriteId", "value": "tavern.wood_door", "type": "string" } ], "image": "../../assets/tavern_blood_prince/door_closed.png", "imagewidth": 64, "imageheight": 64 }, { "id": 7, "properties": [ { "name": "tileType", "value": "STAIRS", "type": "string" }, { "name": "spriteId", "value": "tavern.wood_stairs", "type": "string" } ], "image": "../../assets/tavern_blood_prince/stairs.png", "imagewidth": 64, "imageheight": 64 } ], "grid": { "orientation": "isometric", "width": 64, "height": 32 } } ], "layers": [ { "id": 1, "name": "ground", "type": "tilelayer", "visible": true, "width": 12, "height": 10, "data": [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1], "opacity": 1, "x": 0, "y": 0 }, { "id": 2, "name": "walls", "type": "tilelayer", "visible": true, "width": 12, "height": 10, "data": [3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,0,3,3,3,3,3], "opacity": 1, "x": 0, "y": 0 }, { "id": 3, "name": "decorations", "type": "tilelayer", "visible": true, "width": 12, "height": 10, "data": [0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0], "opacity": 1, "x": 0, "y": 0 }, { "id": 4, "name": "objects", "type": "objectgroup", "visible": true, "objects": [ { "id": 1, "x": 192, "y": 288, "width": 32, "height": 32, "name": "miller-house-exit", "type": "exit", "visible": true, "rotation": 0, "properties": [ { "name": "kind", "value": "exit", "type": "string" }, { "name": "state", "value": "closed", "type": "string" }, { "name": "targetMap", "value": "crossroads-village.tmj", "type": "file" }, { "name": "targetSpawn", "value": "miller-house-outside", "type": "string" }, { "name": "buildingId", "value": "miller-house", "type": "string" } ] } ], "opacity": 1, "x": 0, "y": 0, "draworder": "topdown" }, { "id": 5, "name": "spawns", "type": "objectgroup", "visible": true, "objects": [ { "id": 2, "x": 208, "y": 272, "point": true, "name": "miller-house-inside", "type": "arrival", "visible": true, "rotation": 0, "properties": [ { "name": "role", "value": "arrival", "type": "string" } ] } ], "opacity": 1, "x": 0, "y": 0, "draworder": "topdown" } ], "properties": [ { "name": "theme", "value": "TAVERN_BLOOD_PRINCE", "type": "string" }, { "name": "mapName", "value": "Miller house interior", "type": "string" }, { "name": "buildingId", "value": "miller-house", "type": "string" }, { "name": "parentMap", "value": "crossroads-village.tmj", "type": "file" } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314{ "type": "map", "version": "1.10", "tiledversion": "1.10.2", "orientation": "isometric", "renderorder": "right-down", "width": 14, "height": 12, "tilewidth": 64, "tileheight": 32, "infinite": false, "nextlayerid": 6, "nextobjectid": 3, "tilesets": [ { "firstgid": 1, "name": "mausoleum-tileset", "tilewidth": 64, "tileheight": 32, "tilecount": 8, "columns": 0, "tiles": [ { "id": 0, "properties": [ { "name": "tileType", "value": "WALKABLE", "type": "string" }, { "name": "spriteId", "value": "mausoleum.marble_floor", "type": "string" } ], "image": "../../assets/mausoleum/walkable_floor.png", "imagewidth": 64, "imageheight": 32 }, { "id": 1, "properties": [ { "name": "tileType", "value": "WALKABLE", "type": "string" }, { "name": "spriteId", "value": "mausoleum.marble_cracked", "type": "string" } ], "image": "../../assets/mausoleum/walkable_floor_alt.png", "imagewidth": 64, "imageheight": 32 }, { "id": 2, "properties": [ { "name": "tileType", "value": "WALL", "type": "string" }, { "name": "spriteId", "value": "mausoleum.granite_wall", "type": "string" } ], "image": "../../assets/mausoleum/wall.png", "imagewidth": 64, "imageheight": 64 }, { "id": 3, "properties": [ { "name": "tileType", "value": "DIFFICULT_TERRAIN", "type": "string" }, { "name": "spriteId", "value": "mausoleum.broken_urns", "type": "string" } ], "image": "../../assets/mausoleum/difficult_terrain.png", "imagewidth": 64, "imageheight": 32 }, { "id": 4, "properties": [ { "name": "tileType", "value": "OBSTACLE", "type": "string" }, { "name": "spriteId", "value": "mausoleum.fallen_angel", "type": "string" } ], "image": "../../assets/mausoleum/obstacle_decor.png", "imagewidth": 64, "imageheight": 64 }, { "id": 5, "properties": [ { "name": "tileType", "value": "WALKABLE", "type": "string" }, { "name": "spriteId", "value": "mausoleum.urn_niche", "type": "string" } ], "image": "../../assets/mausoleum/decoration_minor.png", "imagewidth": 64, "imageheight": 32 }, { "id": 6, "properties": [ { "name": "tileType", "value": "DOOR", "type": "string" }, { "name": "spriteId", "value": "mausoleum.bronze_door", "type": "string" } ], "image": "../../assets/mausoleum/door_closed.png", "imagewidth": 64, "imageheight": 64 }, { "id": 7, "properties": [ { "name": "tileType", "value": "STAIRS", "type": "string" }, { "name": "spriteId", "value": "mausoleum.marble_stairs", "type": "string" } ], "image": "../../assets/mausoleum/stairs.png", "imagewidth": 64, "imageheight": 64 } ], "grid": { "orientation": "isometric", "width": 64, "height": 32 } } ], "layers": [ { "id": 1, "name": "ground", "type": "tilelayer", "visible": true, "width": 14, "height": 12, "data": [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1], "opacity": 1, "x": 0, "y": 0 }, { "id": 2, "name": "walls", "type": "tilelayer", "visible": true, "width": 14, "height": 12, "data": [3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3,0,3,3,3,3,3,3], "opacity": 1, "x": 0, "y": 0 }, { "id": 3, "name": "decorations", "type": "tilelayer", "visible": true, "width": 14, "height": 12, "data": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], "opacity": 1, "x": 0, "y": 0 }, { "id": 4, "name": "objects", "type": "objectgroup", "visible": true, "objects": [ { "id": 1, "x": 224, "y": 352, "width": 32, "height": 32, "name": "old-chapel-exit", "type": "exit", "visible": true, "rotation": 0, "properties": [ { "name": "kind", "value": "exit", "type": "string" }, { "name": "state", "value": "closed", "type": "string" }, { "name": "targetMap", "value": "crossroads-village.tmj", "type": "file" }, { "name": "targetSpawn", "value": "old-chapel-outside", "type": "string" }, { "name": "buildingId", "value": "old-chapel", "type": "string" } ] } ], "opacity": 1, "x": 0, "y": 0, "draworder": "topdown" }, { "id": 5, "name": "spawns", "type": "objectgroup", "visible": true, "objects": [ { "id": 2, "x": 240, "y": 336, "point": true, "name": "old-chapel-inside", "type": "arrival", "visible": true, "rotation": 0, "properties": [ { "name": "role", "value": "arrival", "type": "string" } ] } ], "opacity": 1, "x": 0, "y": 0, "draworder": "topdown" } ], "properties": [ { "name": "theme", "value": "MAUSOLEUM", "type": "string" }, { "name": "mapName", "value": "Old chapel interior", "type": "string" }, { "name": "buildingId", "value": "old-chapel", "type": "string" }, { "name": "parentMap", "value": "crossroads-village.tmj", "type": "file" } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332{ "type": "map", "version": "1.10", "tiledversion": "1.10.2", "orientation": "isometric", "renderorder": "right-down", "width": 9, "height": 9, "tilewidth": 64, "tileheight": 32, "infinite": false, "nextlayerid": 6, "nextobjectid": 3, "tilesets": [ { "firstgid": 1, "name": "castle-tileset", "tilewidth": 64, "tileheight": 32, "tilecount": 9, "columns": 0, "tiles": [ { "id": 0, "properties": [ { "name": "tileType", "value": "WALKABLE", "type": "string" }, { "name": "spriteId", "value": "castle.black_marble", "type": "string" } ], "image": "../../assets/castle/walkable_floor.png", "imagewidth": 64, "imageheight": 32 }, { "id": 1, "properties": [ { "name": "tileType", "value": "WALKABLE", "type": "string" }, { "name": "spriteId", "value": "castle.red_carpet", "type": "string" } ], "image": "../../assets/castle/walkable_floor_alt.png", "imagewidth": 64, "imageheight": 32 }, { "id": 2, "properties": [ { "name": "tileType", "value": "WALL", "type": "string" }, { "name": "spriteId", "value": "castle.basalt_wall", "type": "string" } ], "image": "../../assets/castle/wall.png", "imagewidth": 64, "imageheight": 64 }, { "id": 3, "properties": [ { "name": "tileType", "value": "WALL", "type": "string" }, { "name": "spriteId", "value": "castle.basalt_corner", "type": "string" } ], "image": "../../assets/castle/wall_corner.png", "imagewidth": 64, "imageheight": 64 }, { "id": 4, "properties": [ { "name": "tileType", "value": "DIFFICULT_TERRAIN", "type": "string" }, { "name": "spriteId", "value": "castle.debris", "type": "string" } ], "image": "../../assets/castle/difficult_terrain.png", "imagewidth": 64, "imageheight": 32 }, { "id": 5, "properties": [ { "name": "tileType", "value": "OBSTACLE", "type": "string" }, { "name": "spriteId", "value": "castle.throne", "type": "string" } ], "image": "../../assets/castle/obstacle_decor.png", "imagewidth": 64, "imageheight": 64 }, { "id": 6, "properties": [ { "name": "tileType", "value": "WALKABLE", "type": "string" }, { "name": "spriteId", "value": "castle.banner", "type": "string" } ], "image": "../../assets/castle/decoration_minor.png", "imagewidth": 64, "imageheight": 32 }, { "id": 7, "properties": [ { "name": "tileType", "value": "DOOR", "type": "string" }, { "name": "spriteId", "value": "castle.oak_door", "type": "string" } ], "image": "../../assets/castle/door_closed.png", "imagewidth": 64, "imageheight": 64 }, { "id": 8, "properties": [ { "name": "tileType", "value": "STAIRS", "type": "string" }, { "name": "spriteId", "value": "castle.grand_stairs", "type": "string" } ], "image": "../../assets/castle/stairs.png", "imagewidth": 64, "imageheight": 64 } ], "grid": { "orientation": "isometric", "width": 64, "height": 32 } } ], "layers": [ { "id": 1, "name": "ground", "type": "tilelayer", "visible": true, "width": 9, "height": 9, "data": [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1], "opacity": 1, "x": 0, "y": 0 }, { "id": 2, "name": "walls", "type": "tilelayer", "visible": true, "width": 9, "height": 9, "data": [3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,3,3,3,3,3,0,3,3,3,3], "opacity": 1, "x": 0, "y": 0 }, { "id": 3, "name": "decorations", "type": "tilelayer", "visible": true, "width": 9, "height": 9, "data": [0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0], "opacity": 1, "x": 0, "y": 0 }, { "id": 4, "name": "objects", "type": "objectgroup", "visible": true, "objects": [ { "id": 1, "x": 128, "y": 256, "width": 32, "height": 32, "name": "watchtower-exit", "type": "exit", "visible": true, "rotation": 0, "properties": [ { "name": "kind", "value": "exit", "type": "string" }, { "name": "state", "value": "closed", "type": "string" }, { "name": "targetMap", "value": "crossroads-village.tmj", "type": "file" }, { "name": "targetSpawn", "value": "watchtower-outside", "type": "string" }, { "name": "buildingId", "value": "watchtower", "type": "string" } ] } ], "opacity": 1, "x": 0, "y": 0, "draworder": "topdown" }, { "id": 5, "name": "spawns", "type": "objectgroup", "visible": true, "objects": [ { "id": 2, "x": 144, "y": 240, "point": true, "name": "watchtower-inside", "type": "arrival", "visible": true, "rotation": 0, "properties": [ { "name": "role", "value": "arrival", "type": "string" } ] } ], "opacity": 1, "x": 0, "y": 0, "draworder": "topdown" } ], "properties": [ { "name": "theme", "value": "CASTLE", "type": "string" }, { "name": "mapName", "value": "Watchtower interior", "type": "string" }, { "name": "buildingId", "value": "watchtower", "type": "string" }, { "name": "parentMap", "value": "crossroads-village.tmj", "type": "file" } ]}1234567891011121710 unmodified lines1723172417251726172717281729{"name": "tiled-mcp-server","version": "0.3.0","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "tiled-mcp-server","version": "0.3.0","license": "MIT","workspaces": ["tiled-mcp"1710 unmodified lines},"tiled-mcp": {"name": "tiled-map-builder-mcp","version": "0.3.0","license": "MIT","dependencies": {"@huggingface/inference": "^4.13.15",1234567891011121710 unmodified lines1723172417251726172717281729{"name": "tiled-mcp-server","version": "0.4.0","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "tiled-mcp-server","version": "0.4.0","license": "MIT","workspaces": ["tiled-mcp"1710 unmodified lines},"tiled-mcp": {"name": "tiled-map-builder-mcp","version": "0.4.0","license": "MIT","dependencies": {"@huggingface/inference": "^4.13.15",
1234569 unmodified lines16171819202122{"name": "tiled-mcp-server","version": "0.3.0","description": "Tiled Map Builder MCP: an MCP server that lets AI agents compose isometric Tiled maps, with sample maps, sprites, an agent skill and docs.","private": true,"license": "MIT",9 unmodified lines"start": "npm run start --workspace tiled-mcp","start:web": "npm run start:web --workspace tiled-mcp","inspect": "npx @modelcontextprotocol/inspector node tiled-mcp/dist/index.js","examples": "node scripts/create-aquatic-map.mjs && node scripts/create-glacier-map.mjs && node scripts/create-electronic-hacker-map.mjs","preview": "node scripts/render-map-preview.mjs","smoke": "node scripts/smoke-test.mjs","smoke:http": "node scripts/smoke-http.mjs",1234569 unmodified lines16171819202122{"name": "tiled-mcp-server","version": "0.4.0","description": "Tiled Map Builder MCP: an MCP server that lets AI agents compose isometric Tiled maps, with sample maps, sprites, an agent skill and docs.","private": true,"license": "MIT",9 unmodified lines"start": "npm run start --workspace tiled-mcp","start:web": "npm run start:web --workspace tiled-mcp","inspect": "npx @modelcontextprotocol/inspector node tiled-mcp/dist/index.js","examples": "node scripts/create-aquatic-map.mjs && node scripts/create-glacier-map.mjs && node scripts/create-electronic-hacker-map.mjs && node scripts/create-village-world.mjs","preview": "node scripts/render-map-preview.mjs","smoke": "node scripts/smoke-test.mjs","smoke:http": "node scripts/smoke-http.mjs",
10 unmodified lines1112131415161710 unmodified lines| `create-aquatic-map.mjs` | `npm run examples` | free | Rebuilds `maps/caverne-aquatique.tmj` with the builder API. || `create-glacier-map.mjs` | `npm run examples` | free | Rebuilds `maps/forteresse-glace-etage.tmj`. || `create-electronic-hacker-map.mjs` | `npm run examples` | free | Rebuilds `maps/reseau-electronique-repaire-hacker.tmj`. || `gen-theme-set.mjs` | | **paid** | Generates a theme's missing sprites with FLUX.1-dev. Needs `--yes`; try `--dry-run` first. See [docs/sprite-generation.md](../docs/sprite-generation.md). |The three `create-*` scripts show how to build maps from code without an MCP client: they import`tiled-mcp/dist/builder.js` and `tiled-mcp/dist/tmj.js` directly.10 unmodified lines1112131415161718192010 unmodified lines| `create-aquatic-map.mjs` | `npm run examples` | free | Rebuilds `maps/caverne-aquatique.tmj` with the builder API. || `create-glacier-map.mjs` | `npm run examples` | free | Rebuilds `maps/forteresse-glace-etage.tmj`. || `create-electronic-hacker-map.mjs` | `npm run examples` | free | Rebuilds `maps/reseau-electronique-repaire-hacker.tmj`. || `create-village-world.mjs` | `npm run examples` | free | Rebuilds the sample world `maps/crossroads-village/`: an outdoor map, six buildings and their linked interiors. || `gen-theme-set.mjs` | | **paid** | Generates a theme's missing sprites with FLUX.1-dev. Needs `--yes`; try `--dry-run` first. See [docs/sprite-generation.md](../docs/sprite-generation.md). || `gen-building-sprites.mjs` | | **paid** (`--clean` free) | Generates missing building sprites with FLUX.1-dev (`--yes`, try `--dry-run` first); `--clean` removes leftover background from existing ones. |The `create-*` scripts show how to build maps from code without an MCP client: they import`tiled-mcp/dist/builder.js` and `tiled-mcp/dist/tmj.js` directly, and the world script`tiled-mcp/dist/world.js` too.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556// Example world script: builds maps/crossroads-village/ (VILLAGE theme, 40x40 outdoor map with six// buildings you can enter, their interiors and a cellar under the keep) by calling the builder// API directly, without an MCP client. It is deterministic: re-running it reproduces the// committed sample world. Run from the repository root after building the server// (npm run build):// node scripts/create-village-world.mjs// Then open maps/crossroads-village/crossroads-village.tmj in Tiled, or see// docs/worlds-and-buildings.md for loading it in Godot.import { createMap, paintRect, paintTile, placeSpawn } from '../tiled-mcp/dist/builder.js';import { placeBuilding, linkMaps, validateWorld, worldOf } from '../tiled-mcp/dist/world.js';import { applyRoom } from '../tiled-mcp/dist/tools/procedural.js';import { getTheme } from '../tiled-mcp/dist/themes/index.js';import { saveMapFile } from '../tiled-mcp/dist/tmj.js';import { fileURLToPath } from 'node:url';import { join } from 'node:path';
const outDir = fileURLToPath(new URL('../maps/crossroads-village/', import.meta.url));const SIZE = 40;
// ---------- Outdoor map: cobbled ground, two crossing roads, props ----------const { mapId } = createMap({ name: 'Crossroads village', width: SIZE, height: SIZE, theme: getTheme('VILLAGE') });paintRect(mapId, 'ground', 0, 0, SIZE - 1, SIZE - 1, 'walkable_floor');paintRect(mapId, 'ground', 0, 19, SIZE - 1, 20, 'walkable_floor_alt');paintRect(mapId, 'ground', 19, 0, 20, SIZE - 1, 'walkable_floor_alt');for (const [x, y] of [[3, 3], [9, 31], [33, 33], [26, 31], [10, 13], [36, 14], [4, 25], [30, 25], [16, 5], [24, 36], [35, 2], [2, 36]]) { paintTile(mapId, 'decorations', x, y, 'obstacle_decor');}for (const [x, y] of [[17, 17], [22, 17], [17, 22], [22, 22], [12, 28], [28, 11], [6, 18]]) { paintTile(mapId, 'decorations', x, y, 'decoration_minor');}
// ---------- Buildings: each one creates its interior map, linked both ways ----------placeBuilding(mapId, { type: 'house', x: 13, y: 13, name: 'Miller house' });placeBuilding(mapId, { type: 'tavern', x: 22, y: 12, name: 'Crossroads tavern' });placeBuilding(mapId, { type: 'shop', x: 13, y: 22, door: 'east', name: 'Chandler shop' });placeBuilding(mapId, { type: 'temple', x: 23, y: 23, name: 'Old chapel' });placeBuilding(mapId, { type: 'tower', x: 6, y: 6, name: 'Watchtower' });const keep = placeBuilding(mapId, { type: 'castle', x: 28, y: 2, name: 'Greystone keep' });placeSpawn(mapId, { x: 19, y: 32, role: 'player', name: 'start' });
// ---------- A cellar under the keep, reached by stairs from its great hall ----------const cellar = createMap({ name: 'Keep cellar', width: 12, height: 10, theme: getTheme('CRYPT') }).mapId;applyRoom(cellar, 0, 0, 12, 10, [], { obstacleCorners: true });linkMaps({ mapId: keep.interior.mapId, x: 12, y: 8 }, { mapId: cellar, x: 5, y: 4 }, 'stairs', 'cellar-stairs');
// ---------- Check and save every linked map side by side ----------const check = validateWorld(mapId);if (!check.ok || check.warnings.length) { console.error('World check failed:', JSON.stringify({ errors: check.errors, warnings: check.warnings }, null, 2)); process.exit(1);}for (const s of worldOf(mapId)) { const saved = await saveMapFile(s.id, join(outDir, s.fileName)); console.log(`Saved ${s.fileName.padEnd(32)} ${String(s.width).padStart(2)}x${s.height} ${(saved.bytes / 1024).toFixed(1)} KB`);}console.log(`Start map: ${check.startMaps.join(', ')}; ${check.links.length} transitions, all linked both ways.`);123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153// PAID: generate the building sprites place_building draws (house, shop, tavern, temple, tower,// castle) with FLUX.1-dev via Hugging Face. Runs the MCP server as a child process and calls its// generate_building_sprite tool, which skips sprites that already exist (unless --force).// Each generated sprite is one paid call.//// Usage (from the repository root, after npm install && npm run build):// node scripts/gen-building-sprites.mjs --dry-run # list sprites and prompts, free// node scripts/gen-building-sprites.mjs --yes # every missing building sprite// node scripts/gen-building-sprites.mjs house castle --yes # only these types// node scripts/gen-building-sprites.mjs castle --force --yes// node scripts/gen-building-sprites.mjs --clean # free: re-cut existing sprites//// --clean removes the background left around existing sprites (a pale veil or specks when the// provider did not paint a clean magenta) and refits them, without any paid call. Use it too// for building images you drew yourself.//// Needs HUGGINGFACE_API_KEY (or HF_TOKEN) in the environment or in tiled-mcp/.env.// See docs/sprite-generation.md for costs and providers.
import { spawn } from "node:child_process";import { existsSync, readFileSync, writeFileSync } from "node:fs";import { join, resolve } from "node:path";import { fileURLToPath } from "node:url";
const args = process.argv.slice(2);const yes = args.includes("--yes");const force = args.includes("--force");const dryRun = args.includes("--dry-run");const clean = args.includes("--clean");const requested = args.filter((a) => !a.startsWith("--")).map((a) => a.toLowerCase());
const repoRoot = fileURLToPath(new URL("..", import.meta.url));const assetsRoot = process.env.TILED_ASSETS_DIR ? resolve(repoRoot, process.env.TILED_ASSETS_DIR) : join(repoRoot, "assets");
if (clean) { const { BUILDINGS, BUILDING_TYPES, buildingSpriteFile } = await import("../tiled-mcp/dist/buildings.js"); const { cleanBuildingSprite } = await import("../tiled-mcp/dist/tools/generation.js"); const types = requested.length ? requested : BUILDING_TYPES; for (const type of types) { const def = BUILDINGS[type]; if (!def) { console.error(`Unknown building type: ${type}. Known: ${BUILDING_TYPES.join(", ")}`); process.exit(1); } const file = join(assetsRoot, buildingSpriteFile(type)); if (!existsSync(file)) { console.log(` ${type.padEnd(8)} no sprite yet, skipped`); continue; } writeFileSync(file, await cleanBuildingSprite(readFileSync(file), def.imageWidth, def.imageHeight)); console.log(` ${type.padEnd(8)} cleaned -> ${file}`); } process.exit(0);}const serverPath = fileURLToPath(new URL("../tiled-mcp/dist/index.js", import.meta.url));const server = spawn(process.execPath, [serverPath], { stdio: ["pipe", "pipe", "inherit"] });
let buffer = "";const pending = new Map();server.stdout.on("data", (chunk) => { buffer += chunk; let i; while ((i = buffer.indexOf("\n")) >= 0) { const line = buffer.slice(0, i).trim(); buffer = buffer.slice(i + 1); if (!line) continue; try { const msg = JSON.parse(line); if (msg.id !== undefined && pending.has(msg.id)) { pending.get(msg.id)(msg); pending.delete(msg.id); } } catch { // ignore non-JSON lines } }});
let nextId = 1;function request(method, params) { return new Promise((done) => { const id = nextId++; pending.set(id, done); server.stdin.write(JSON.stringify({ jsonrpc: "2.0", id, method, params }) + "\n"); });}async function callTool(name, toolArgs) { const res = await request("tools/call", { name, arguments: toolArgs }); if (res.error) throw new Error(res.error.message); const text = res.result.content?.[0]?.text ?? ""; try { return JSON.parse(text); } catch { throw new Error(text); }}
try { await request("initialize", { protocolVersion: "2025-06-18", capabilities: {}, clientInfo: { name: "gen-building-sprites", version: "1.0.0" }, }); server.stdin.write(JSON.stringify({ jsonrpc: "2.0", method: "notifications/initialized" }) + "\n");
const tools = (await request("tools/list", {})).result.tools; const types = tools.find((t) => t.name === "generate_building_sprite").inputSchema.properties.buildingType.enum; const unknown = requested.filter((t) => !types.includes(t)); if (unknown.length) throw new Error(`Unknown building type(s): ${unknown.join(", ")}. Known: ${types.join(", ")}`);
const plan = []; for (const type of requested.length ? requested : types) { const preview = await callTool("generate_building_sprite", { buildingType: type, dryRun: true }); const exists = existsSync(join(assetsRoot, preview.file)); plan.push({ type, file: preview.file, size: preview.size, prompt: preview.prompt, generate: force || !exists, exists }); } const total = plan.filter((p) => p.generate).length;
console.log("Building sprites (one paid call each):"); for (const p of plan) { console.log(` ${p.type.padEnd(8)} assets/${p.file.padEnd(24)} ${p.size.padEnd(8)} ${p.generate ? "to generate" : "exists"}`); } console.log(` total to generate: ${total}`);
if (dryRun) { for (const p of plan.filter((x) => x.generate)) console.log(`\n[${p.type}] ${p.prompt}`); console.log("\nDry run: nothing generated."); } else if (total === 0) { console.log("Nothing to generate."); } else if (!yes) { console.log("\nThis spends money on Hugging Face Inference Providers. Re-run with --yes to proceed."); } else { let ok = 0; let failed = 0; for (const p of plan.filter((x) => x.generate)) { const res = await callTool("generate_building_sprite", { buildingType: p.type, force }); if (res.ok) { ok++; console.log(` ${p.type.padEnd(8)} generated in ${Math.round(res.durationMs / 1000)}s -> ${res.outputPath}`); } else { failed++; console.log(` ${p.type.padEnd(8)} ${res.skipped ? "skipped (exists)" : `FAILED: ${res.error}`}`); if (/HUGGINGFACE_API_KEY|token/i.test(res.error ?? "")) break; } } console.log(`\nDone: ${ok} generated, ${failed} not generated.`); }} catch (err) { console.error(`Error: ${err instanceof Error ? err.message : String(err)}`); process.exitCode = 1;} finally { server.kill();}49 unmodified lines5051525354555640 unmodified lines97989910010110210349 unmodified lines15315415515615715815916016116216316416516616716816949 unmodified lines() => call("generate_crypt_layout", { mapId }),() => call("save_to_disk", { mapId, path: "../../escape.tmj" }),() => call("place_spawn_enemy", { mapId, x: 22, y: 9, npcName: "Ghoul lord" }),() => call("validate_map", { mapId }),];const message = step < script.length ? script[step]() : { role: "assistant", content: "Smoke crypt is ready." };res.writeHead(200, { "Content-Type": "application/json" });40 unmodified linesconst a = await connect();const b = await connect();const tools = (await a.client.listTools()).tools;check("30 tools over HTTP", tools.length === 30, tools.length);const created = data(await a.client.callTool({ name: "create_map", arguments: { name: "Session A", width: 28, height: 18, theme: "CRYPT" } }));const mapA = created.mapId;check("session A creates a map", typeof mapA === "string", created);49 unmodified linesconst done = events.find((e) => e.type === "done");const toolEvents = events.filter((e) => e.type === "tool");check("agent run streams NDJSON and finishes", run.headers.get("content-type")?.startsWith("application/x-ndjson") && !!done, events.filter((e) => e.type === "error"));check("agent ran the scripted tools", toolEvents.map((e) => e.name).join(",") === "create_map,generate_crypt_layout,save_to_disk,place_spawn_enemy,validate_map", toolEvents.map((e) => e.name));check("agent cannot call hidden tools", toolEvents.find((e) => e.name === "save_to_disk")?.ok === false);check("model only offered the web tool set", !seenTools.includes("save_to_disk") && !seenTools.includes("export_json") && !seenTools.includes("generate_tile_sprite") && seenTools.includes("create_map"), seenTools);check("every model call used the visitor's token, never the server's", seenAuth.size === 1 && seenAuth.has(`Bearer ${VISITOR_TOKEN}`), [...seenAuth]);if (done) {check("result has a PNG preview", done.previewPng.startsWith("data:image/png;base64,") && done.previewPng.length > 2000);check("result map is the crypt with one enemy", done.map.name === "Smoke crypt" && done.map.spawns === 2, done.map);check("result has no validation warnings", done.warnings.length === 0, done.warnings);check("result reports usage and the final answer", done.usage.modelCalls === 6 && done.usage.promptTokens === 6000 && /ready/.test(done.report), done.usage);const zip = unzipSync(new Uint8Array(await (await fetch(done.zipUrl)).arrayBuffer()));check("result zip downloads", Object.keys(zip).includes("smoke-crypt/smoke-crypt.tmj"), Object.keys(zip));}const health = await (await fetch(`${base}/healthz`)).json();49 unmodified lines5051525354555657585940 unmodified lines10010110210310410510649 unmodified lines15615715815916016116216316416516616716816917017117217317417517617717817949 unmodified lines() => call("generate_crypt_layout", { mapId }),() => call("save_to_disk", { mapId, path: "../../escape.tmj" }),() => call("place_spawn_enemy", { mapId, x: 22, y: 9, npcName: "Ghoul lord" }),// A building inside the nave: its interior becomes a second, linked map.() => call("place_building", { mapId, buildingType: "house", x: 11, y: 7, name: "Shrine" }),() => call("validate_map", { mapId }),() => call("validate_world", { mapId }),];const message = step < script.length ? script[step]() : { role: "assistant", content: "Smoke crypt is ready." };res.writeHead(200, { "Content-Type": "application/json" });40 unmodified linesconst a = await connect();const b = await connect();const tools = (await a.client.listTools()).tools;check("35 tools over HTTP", tools.length === 35, tools.length);const created = data(await a.client.callTool({ name: "create_map", arguments: { name: "Session A", width: 28, height: 18, theme: "CRYPT" } }));const mapA = created.mapId;check("session A creates a map", typeof mapA === "string", created);49 unmodified linesconst done = events.find((e) => e.type === "done");const toolEvents = events.filter((e) => e.type === "tool");check("agent run streams NDJSON and finishes", run.headers.get("content-type")?.startsWith("application/x-ndjson") && !!done, events.filter((e) => e.type === "error"));check("agent ran the scripted tools", toolEvents.map((e) => e.name).join(",") === "create_map,generate_crypt_layout,save_to_disk,place_spawn_enemy,place_building,validate_map,validate_world", toolEvents.map((e) => e.name));check("agent cannot call hidden tools", toolEvents.find((e) => e.name === "save_to_disk")?.ok === false);check("agent placed a building with its interior", toolEvents.find((e) => e.name === "place_building")?.ok === true, toolEvents.find((e) => e.name === "place_building"));check("model only offered the web tool set", !seenTools.includes("save_to_disk") && !seenTools.includes("save_world") && !seenTools.includes("export_json") && !seenTools.includes("generate_tile_sprite") && !seenTools.includes("generate_building_sprite") && seenTools.includes("create_map") && seenTools.includes("place_building") && seenTools.includes("validate_world"), seenTools);check("every model call used the visitor's token, never the server's", seenAuth.size === 1 && seenAuth.has(`Bearer ${VISITOR_TOKEN}`), [...seenAuth]);if (done) {check("result has a PNG preview", done.previewPng.startsWith("data:image/png;base64,") && done.previewPng.length > 2000);check("result map is the crypt (player, enemy, arrival point)", done.map.name === "Smoke crypt" && done.map.spawns === 3 && done.map.buildings === 1, done.map);check("result lists the main map then the interior", done.maps?.map((m) => m.fileName).join(",") === "smoke-crypt.tmj,shrine-interior.tmj", done.maps);check("result has no validation warnings", done.warnings.length === 0, done.warnings);check("result reports usage and the final answer", done.usage.modelCalls === 8 && done.usage.promptTokens === 8000 && /ready/.test(done.report), done.usage);const zip = unzipSync(new Uint8Array(await (await fetch(done.zipUrl)).arrayBuffer()));const names = Object.keys(zip);check("result zip holds both linked maps and the building sprite", ["smoke-crypt/smoke-crypt.tmj", "smoke-crypt/shrine-interior.tmj", "smoke-crypt/assets/buildings/house.png"].every((n) => names.includes(n)), names);const mainTmj = JSON.parse(new TextDecoder().decode(zip["smoke-crypt/smoke-crypt.tmj"]));const entrance = mainTmj.layers.find((l) => l.name === "objects").objects.find((o) => o.type === "entrance");check("entrance in the zip points at the interior file next to it", entrance?.properties.some((p) => p.name === "targetMap" && p.value === "shrine-interior.tmj"), entrance);check("bare .tmj link serves the main map", (await fetch(done.tmjUrl)).status === 200 && /smoke-crypt\.tmj$/.test(done.tmjUrl), done.tmjUrl);}const health = await (await fetch(`${base}/healthz`)).json();
53 unmodified lines5455565758596095 unmodified lines15615715815916016153 unmodified linesnotify("notifications/initialized", {});const tools = (await rpc("tools/list", {})).result.tools;check("30 tools listed", tools.length === 30, tools.length);const nonAscii = tools.filter((t) => /[^\x00-\x7F]/.test(JSON.stringify([t.title, t.description, t.inputSchema])));check("tool text is plain English/ASCII", nonAscii.length === 0, nonAscii.map((t) => t.name));check("every tool has annotations", tools.every((t) => t.annotations && typeof t.annotations.readOnlyHint === "boolean"), tools.filter((t) => !t.annotations).map((t) => t.name));95 unmodified linesconst badExit = await call("generate_room", { mapId: om.mapId, originX: 0, originY: 0, width: 5, height: 5, exits: [{ direction: "north", offset: 9 }] });check("exit offset past the wall rejected", badExit.isError, badExit);console.log(`\n${pass} passed, ${fail} failed`);if (stderr.trim()) console.log("SERVER STDERR:", stderr.slice(0, 500));child.kill();53 unmodified lines5455565758596095 unmodified lines15615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522653 unmodified linesnotify("notifications/initialized", {});const tools = (await rpc("tools/list", {})).result.tools;check("35 tools listed", tools.length === 35, tools.length);const nonAscii = tools.filter((t) => /[^\x00-\x7F]/.test(JSON.stringify([t.title, t.description, t.inputSchema])));check("tool text is plain English/ASCII", nonAscii.length === 0, nonAscii.map((t) => t.name));check("every tool has annotations", tools.every((t) => t.annotations && typeof t.annotations.readOnlyHint === "boolean"), tools.filter((t) => !t.annotations).map((t) => t.name));95 unmodified linesconst badExit = await call("generate_room", { mapId: om.mapId, originX: 0, originY: 0, width: 5, height: 5, exits: [{ direction: "north", offset: 9 }] });check("exit offset past the wall rejected", badExit.isError, badExit);// Worlds: a 256x256 outdoor map with buildings whose interiors are linked mapsconst tooBig = await call("create_map", { name: "too big", width: 300, height: 10, theme: "VILLAGE" });check("maps above 256 cells per side are rejected", tooBig.isError || tooBig.protocolError, tooBig);const out = (await call("create_map", { name: "Smoke village", width: 256, height: 256, theme: "VILLAGE" })).data;check("256x256 outdoor map created", out.mapId && out.summary.fileName === "smoke-village.tmj", out);await call("paint_rect", { mapId: out.mapId, layer: "ground", x1: 0, y1: 0, x2: 255, y2: 255, role: "walkable_floor" });await call("paint_tile", { mapId: out.mapId, layer: "decorations", x: 11, y: 11, role: "obstacle_decor" });const house = (await call("place_building", { mapId: out.mapId, buildingType: "house", x: 10, y: 10, name: "Miller house" })).data;check("house placed with a linked interior", house.ok && house.buildingId === "miller-house" && house.interior?.fileName === "miller-house-interior.tmj", house);check("house entrance on the south edge, arrival in front", house.entrance.x === 11 && house.entrance.y === 12 && house.outsideArrival.y === 13, house);check("props under the footprint are cleared", house.clearedProps === 1, house.clearedProps);const overlap = await call("place_building", { mapId: out.mapId, buildingType: "house", x: 11, y: 11 });check("overlapping footprint rejected", overlap.isError, overlap);const castle = (await call("place_building", { mapId: out.mapId, buildingType: "castle", x: 40, y: 40, door: "east" })).data;check("castle placed with a castle-floor interior", castle.ok && castle.interior.width === 27 && castle.entrance.x === 45, castle);const tower = (await call("place_building", { mapId: out.mapId, buildingType: "tower", x: 70, y: 20, interior: false })).data;check("building without interior has no entrance", tower.ok && tower.interior === null && !tower.entrance, tower);const cellar = (await call("create_map", { name: "Castle cellar", width: 12, height: 10, theme: "CRYPT" })).data;await call("generate_room", { mapId: cellar.mapId, originX: 0, originY: 0, width: 12, height: 10 });const link = (await call("link_maps", { fromMapId: castle.interior.mapId, fromX: 12, fromY: 8, toMapId: cellar.mapId, toX: 5, toY: 4, kind: "stairs" })).data;check("link_maps joins castle and cellar both ways", link.ok && link.from.arrival.name && link.to.object.name, link);await call("place_spawn_player", { mapId: out.mapId, x: 5, y: 5 });const interiorCheck = (await call("validate_map", { mapId: house.interior.mapId })).data;check("interior with an arrival point needs no player spawn", !interiorCheck.warnings.some((w) => /player/.test(w)), interiorCheck);const world = (await call("validate_world", { mapId: out.mapId })).data;check("world validates: 4 linked maps, no errors", world.ok && world.maps.length === 4 && world.errors.length === 0, world);check("world has no one-way links", !world.warnings.some((w) => /no way back/.test(w)), world.warnings);check("world start map is the outdoor map", world.startMaps.length === 1 && world.startMaps[0] === "smoke-village.tmj", world.startMaps);const savedWorld = (await call("save_world", { mapId: out.mapId, folder: "world" })).data;check("save_world writes the 4 maps side by side", savedWorld.ok && savedWorld.files.length === 4, savedWorld);const outText = readFileSync(resolve(outDir, "world/smoke-village.tmj"), "utf8");const outFile = JSON.parse(outText);check("tile layer data written on one line each", outText.split("\n").length < 600, outText.split("\n").length);const bTileset = outFile.tilesets.find((t) => t.name === "buildings");check("buildings tileset after the theme tileset, bottom aligned", bTileset && bTileset.firstgid === outFile.tilesets[0].tilecount + 1 && bTileset.objectalignment === "bottom", bTileset);const bLayer = outFile.layers.find((l) => l.name === "buildings");const houseObj = bLayer?.objects.find((o) => o.name === "Miller house");// Bottom corner of the footprint = tile point (13, 13): Tiled space (13*th, 13*th), legacy screen space (tw/2*(13-13), th/2*(13+13)).const anchor = mode === "screen" ? { x: 0, y: 13 * 32 } : { x: 13 * 32, y: 13 * 32 };check("house is a tile object anchored on the footprint's bottom corner", houseObj && houseObj.gid >= bTileset.firstgid && houseObj.x === anchor.x && houseObj.y === anchor.y && houseObj.width === 192, houseObj);check("buildings layer sits before objects and spawns", outFile.layers.map((l) => l.name).join(",") === "ground,walls,decorations,buildings,objects,spawns", outFile.layers.map((l) => l.name));const entrance = outFile.layers.find((l) => l.name === "objects").objects.find((o) => o.name === "miller-house-entrance");const targetMap = entrance?.properties.find((p) => p.name === "targetMap");const targetSpawn = entrance?.properties.find((p) => p.name === "targetSpawn")?.value;check("entrance targetMap is a file property naming the interior", targetMap?.type === "file" && targetMap.value === "miller-house-interior.tmj", entrance);const interiorFile = JSON.parse(readFileSync(resolve(outDir, "world", targetMap.value), "utf8"));check("interior holds the entrance's targetSpawn", interiorFile.layers.find((l) => l.name === "spawns").objects.some((o) => o.name === targetSpawn), targetSpawn);const exitObj = interiorFile.layers.find((l) => l.name === "objects").objects.find((o) => o.type === "exit");check("interior exit leads back to the outdoor map", exitObj?.properties.some((p) => p.name === "targetMap" && p.value === "smoke-village.tmj"), exitObj);check("interior records its parent map", interiorFile.properties.some((p) => p.name === "parentMap" && p.type === "file" && p.value === "smoke-village.tmj"), interiorFile.properties);const { renderMapPreview } = await import("../tiled-mcp/dist/render.js");const t0 = Date.now();const png = await renderMapPreview(outFile, (image) => {try { return readFileSync(resolve(outDir, "world", image)); } catch { return undefined; }}, { maxWidth: 1600 });const ms = Date.now() - t0;const width = png.readUInt32BE(16);check(`256x256 preview renders at 1600 px wide (${ms} ms)`, width === 1600 && ms < 60000, { width, ms });await call("discard_map", { mapId: house.interior.mapId });const broken = (await call("validate_world", { mapId: out.mapId })).data;check("a discarded interior is reported as a broken link", !broken.ok && broken.errors.some((e) => /miller-house-entrance/.test(e)), broken.errors);console.log(`\n${pass} passed, ${fail} failed`);if (stderr.trim()) console.log("SERVER STDERR:", stderr.slice(0, 500));child.kill();
61 unmodified lines6263646566676898 unmodified lines16716816917017117253 unmodified lines22622722822923023123261 unmodified lines- **Theme**: infer it from the vocabulary (table below). When unsure, call `list_themes` andpropose two options.- **Size**: default 20x15 for a custom layout, minimum 12x10, maximum 64x64. Presets need atleast: crypt 27x18, castle 27x20, werewolf den 22x16.- **Mood**: combat means an open map, infiltration means narrow corridors, a narrative scenemeans a small map with NPCs.98 unmodified lines`erase_tile(layer="walls")` first.- Corridors are straight; chain two corridors for an L shape.### Step 6: report```markdown53 unmodified lines- Skip `validate_map` before saving.- Leave the map without a player spawn.- Invent a theme: use only the keys returned by `list_themes`.- Exceed 64x64, or run a preset below its minimum size.- Generate paid sprites without the user's explicit agreement.- Copy published map layouts or text verbatim.- Use emojis in map, room or object names.61 unmodified lines62636465666768697098 unmodified lines16917017117217317417517617717817918018118218318418518618718818919019119219319419553 unmodified lines24925025125225325425561 unmodified lines- **Theme**: infer it from the vocabulary (table below). When unsure, call `list_themes` andpropose two options.- **Size**: default 20x15 for a custom layout, minimum 12x10. The maximum is the one`create_map` states (256x256 by default, 128x128 on the hosted server); above 64x64, buildwith rooms, presets, `paint_rect` and buildings rather than cell by cell. Presets need atleast: crypt 27x18, castle 27x20, werewolf den 22x16.- **Mood**: combat means an open map, infiltration means narrow corridors, a narrative scenemeans a small map with NPCs.98 unmodified lines`erase_tile(layer="walls")` first.- Corridors are straight; chain two corridors for an L shape.#### Outdoor maps with buildings you can enterWhen `place_building` is available and the request is a village, town, region or anythingwith houses, a tavern, a temple, a tower or a castle the player should walk into:```text1. create_map(outdoor theme, e.g. VILLAGE, up to the size limit) -> mapId2. paint_rect(layer=ground) over the whole map, then roads and props3. place_building(mapId, buildingType, x, y, name) per building: the footprint(house and shop 3x3, tavern and temple 4x4, tower 2x2, castle 6x6) must be free ground;it creates the interior map and links both ways. Keep the cell in front of the door free.4. Optional: edit an interior with the usual tools (its mapId is in the result), and joinextra levels with link_maps(kind="stairs"), e.g. a castle cellar or a tower top.5. place_spawn_player on the outdoor map only; interiors start on their arrival points.6. validate_map on each map, then validate_world(mapId): fix every error.7. save_world(mapId): writes every linked map side by side (the links use those file names).```Building sprites are large images made with `generate_building_sprite` (paid, ask first, asin Step 4); until they exist Tiled shows placeholders and the map still works.### Step 6: report```markdown53 unmodified lines- Skip `validate_map` before saving.- Leave the map without a player spawn.- Invent a theme: use only the keys returned by `list_themes`.- Exceed the size limit `create_map` states, or run a preset below its minimum size.- Generate paid sprites without the user's explicit agreement.- Copy published map layouts or text verbatim.- Use emojis in map, room or object names.
13 unmodified lines1415161718192013 unmodified lines# --- Paid sprite generation (FLUX.1-dev via Hugging Face). See docs/sprite-generation.md ---# HUGGINGFACE_API_KEY=hf_xxx# TILED_HF_PROVIDER=replicate# Note: NVIDIA_API_KEY is not read by this server. Configure it in the agent that uses# Nemotron (see docs/nemotron.md).13 unmodified lines141516171819202113 unmodified lines# --- Paid sprite generation (FLUX.1-dev via Hugging Face). See docs/sprite-generation.md ---# HUGGINGFACE_API_KEY=hf_xxx# Provider serving FLUX.1-dev (default: the first live one Hugging Face lists, e.g. fal-ai)# TILED_HF_PROVIDER=fal-ai# Note: NVIDIA_API_KEY is not read by this server. Configure it in the agent that uses# Nemotron (see docs/nemotron.md).
123456{"name": "tiled-map-builder-mcp","version": "0.3.0","description": "MCP server that composes isometric Tiled (.tmj) maps: themes, rooms, corridors, layout presets, objects, spawns, validation, export, optional FLUX sprite generation, and a hosted web mode where an AI model builds maps from a description.","license": "MIT","keywords": [123456{"name": "tiled-map-builder-mcp","version": "0.4.0","description": "MCP server that composes isometric Tiled (.tmj) maps: themes, rooms, corridors, layout presets, objects, spawns, validation, export, optional FLUX sprite generation, and a hosted web mode where an AI model builds maps from a description.","license": "MIT","keywords": [
5 unmodified lines6789101112131419 unmodified lines3435363738394014 unmodified lines555657585960125 unmodified lines1861871881891901911923 unmodified lines19619719819920020120220320420520620720820921021121213 unmodified lines2262272282292302312322335 unmodified linesimport { Client } from "@modelcontextprotocol/sdk/client/index.js";import { InMemoryTransport } from "@modelcontextprotocol/sdk/inMemory.js";import { readFile } from "node:fs/promises";import { describeMap, listMaps, serializeMap, type MapSummary } from "./builder.js";import { newWorkspace, runInScope } from "./context.js";import { publishMap, slugify } from "./downloads.js";import { skillFile } from "./paths.js";import { renderMapPreview } from "./render.js";import { createServer, SERVER_VERSION } from "./server.js";19 unmodified linesconst TOOL_RESULT_CHARS = 12_000;/** Tools the web agent never sees: the page handles the output, and one job builds one map. */const HIDDEN_TOOLS = new Set(["save_to_disk", "export_json", "list_maps", "discard_map", "generate_theme_sprite_set"]);/** Offered only when the visitor allows paid sprite generation. */const PAID_TOOLS = new Set(["generate_tile_sprite", "preview_sprite_prompt"]);14 unmodified lines| {type: "done";map: MapSummary;report: string;warnings: string[];previewPng: string;125 unmodified lines}}const built = listMaps().sort((a, b) => b.createdAt - a.createdAt)[0];if (!built) {throw new AgentError(`${model} stopped without creating a map. Try again with more detail, or pick another model.${report ? ` Its last answer: ${report.slice(0, 300)}` : ""}`,3 unmodified linesconst validation = JSON.parse(resultText((await client.callTool({ name: "validate_map", arguments: { mapId: built.mapId } })).content),) as { warnings?: string[] };const preview = await renderMapPreview(serializeMap(built.mapId),(image) => (image.startsWith(ASSET_PREFIX) ? readSprite(image.slice(ASSET_PREFIX.length)) : undefined),{ maxWidth: 1400 },);const links = publishMap(built.mapId, `${slugify(built.name)}.tmj`);ctx.emit({type: "done",map: describeMap(built.mapId),report: report || "The map is ready.",warnings: validation.warnings ?? [],previewPng: `data:image/png;base64,${preview.toString("base64")}`,zipUrl: links.zipUrl,tmjUrl: links.tmjUrl,13 unmodified lines"","This session differs from the skill below in these ways:","- The person cannot answer while you work. Never ask questions or wait for confirmation: make sensible choices and build the map right away. Sketch the layout for yourself if it helps, but do not ask for approval.","- Build exactly one map with create_map. When a call fails, read the error, fix the arguments and carry on.","- Finish with validate_map and fix every warning; the map needs at least one player spawn.","- Do not save or export the map: the web page offers the download.",'- Prefer themes whose sprites.status is "all" in list_themes. Themes without sprites still work but show grey placeholder tiles in the preview and in Tiled: use one only when the person asks for it or nothing else fits.',allowPaid5 unmodified lines678910111213141519 unmodified lines3536373839404142434445464748495014 unmodified lines6566676869707172125 unmodified lines1981992002012022032042052062072082092102112123 unmodified lines21621721821922022122222322422522622722822923023123223323423523623723823924024113 unmodified lines2552562572582592602612622635 unmodified linesimport { Client } from "@modelcontextprotocol/sdk/client/index.js";import { InMemoryTransport } from "@modelcontextprotocol/sdk/inMemory.js";import { readFile } from "node:fs/promises";import { allMaps, describeMap, listMaps, serializeMap, type MapSummary } from "./builder.js";import { newWorkspace, runInScope } from "./context.js";import { publishMap, publishTmj, publishWorld, slugify } from "./downloads.js";import { validateWorld, worldOf } from "./world.js";import { skillFile } from "./paths.js";import { renderMapPreview } from "./render.js";import { createServer, SERVER_VERSION } from "./server.js";19 unmodified linesconst TOOL_RESULT_CHARS = 12_000;/** Tools the web agent never sees: the page handles the output, and one job builds one map. */const HIDDEN_TOOLS = new Set(["save_to_disk","export_json","list_maps","discard_map","generate_theme_sprite_set","save_world",// Every building type already ships a sprite; generating new ones is for MCP clients."generate_building_sprite",]);/** Offered only when the visitor allows paid sprite generation. */const PAID_TOOLS = new Set(["generate_tile_sprite", "preview_sprite_prompt"]);14 unmodified lines| {type: "done";map: MapSummary;/** Every map in the download: the main map first, then linked interiors. */maps: Array<{ name: string; fileName: string }>;report: string;warnings: string[];previewPng: string;125 unmodified lines}}// The main map is the one the player starts on (place_building's interiors only have arrival// points); without any player spawn, the newest map.const byNewest = listMaps().sort((a, b) => b.createdAt - a.createdAt);const hasPlayer = new Set(allMaps().filter((s) => s.spawns.objects.some((o) => o.properties?.some((p) => p.name === "role" && p.value === "player"))).map((s) => s.id),);const built = byNewest.find((m) => hasPlayer.has(m.mapId)) ?? byNewest[0];if (!built) {throw new AgentError(`${model} stopped without creating a map. Try again with more detail, or pick another model.${report ? ` Its last answer: ${report.slice(0, 300)}` : ""}`,3 unmodified linesconst validation = JSON.parse(resultText((await client.callTool({ name: "validate_map", arguments: { mapId: built.mapId } })).content),) as { warnings?: string[] };const world = worldOf(built.mapId);const worldCheck = world.length > 1 ? validateWorld(built.mapId) : undefined;const preview = await renderMapPreview(serializeMap(built.mapId),(image) => (image.startsWith(ASSET_PREFIX) ? readSprite(image.slice(ASSET_PREFIX.length)) : undefined),{ maxWidth: 1400 },);// Linked maps (building interiors) travel together in one .zip, under the names their links use.const links = worldCheck? (() => {const packed = publishWorld(world.map((s) => s.id), built.name);return { zipUrl: packed.zipUrl, tmjUrl: publishTmj(built.mapId, built.fileName), expiresAt: packed.expiresAt };})(): publishMap(built.mapId, `${slugify(built.name)}.tmj`);ctx.emit({type: "done",map: describeMap(built.mapId),maps: world.map((s) => ({ name: s.name, fileName: s.fileName })),report: report || "The map is ready.",warnings: [...(validation.warnings ?? []), ...(worldCheck ? [...worldCheck.errors, ...worldCheck.warnings] : [])],previewPng: `data:image/png;base64,${preview.toString("base64")}`,zipUrl: links.zipUrl,tmjUrl: links.tmjUrl,13 unmodified lines"","This session differs from the skill below in these ways:","- The person cannot answer while you work. Never ask questions or wait for confirmation: make sensible choices and build the map right away. Sketch the layout for yourself if it helps, but do not ask for approval.","- Build exactly one map with create_map: the map the person asked for. When a call fails, read the error, fix the arguments and carry on.","- For a village, town, district or region with buildings people can enter (houses, shops, a tavern, a temple, a tower, a castle), make an outdoor map (VILLAGE theme unless the request says otherwise, about 40x40 to 64x64), paint its whole ground with paint_rect, add roads, then add each building with place_building. place_building creates and links the building's interior map by itself: never call create_map for an interior. Keep the cell in front of each door free.","- Finish with validate_map and fix every warning; the main map needs at least one player spawn. After place_building, also run validate_world and fix its errors.","- Do not save or export the map: the web page offers the download.",'- Prefer themes whose sprites.status is "all" in list_themes. Themes without sprites still work but show grey placeholder tiles in the preview and in Tiled: use one only when the person asks for it or nothing else fits.',allowPaid
4 unmodified lines567891011 unmodified lines222324252627283 unmodified lines3233343536378 unmodified lines46474849505120 unmodified lines7273747576777879808170 unmodified lines1521531541551561571581591607 unmodified lines1681691701711721736 unmodified lines1801811821831841859 unmodified lines19519619719819920020120220337 unmodified lines2412422432442452461 unmodified line24824925025125225325425525625730 unmodified lines288289290291292293294147 unmodified lines44244344444544644717 unmodified lines46546646746846947044 unmodified lines5155165175185195205215225235245255 unmodified lines5315325335345355365375385395405415425435445455464 unmodified linesimport { randomUUID } from "node:crypto";import { currentScope, isHosted } from "./context.js";import type {Theme,ThemeRole,11 unmodified linesexport type MapId = string;export const MAX_MAP_SIZE = 64;export interface Occupant {name: string;3 unmodified linesexport interface BuilderState {id: MapId;name: string;width: number;height: number;tilewidth: number;8 unmodified linesdecorations: TiledTileLayer;objects: TiledObjectGroup;spawns: TiledObjectGroup;// "x,y" -> object or spawn standing on that celloccupied: Map<string, Occupant>;nextObjectId: number;20 unmodified lines}export function createMap(opts: CreateOptions): { mapId: MapId; summary: MapSummary } {if (opts.width < 1 || opts.width > MAX_MAP_SIZE || opts.height < 1 || opts.height > MAX_MAP_SIZE) {throw new Error(`Map size out of range: ${opts.width}x${opts.height} (allowed 1..${MAX_MAP_SIZE} per side).`,);}if (isHosted() && maps().size >= MAX_HOSTED_MAPS) {throw new Error(70 unmodified linesdraworder: "topdown",});const state: BuilderState = {id,name: opts.name,width: opts.width,height: opts.height,tilewidth: theme.tilewidth,7 unmodified linesdecorations: mkTileLayer(3, "decorations"),objects: mkObjectGroup(4, "objects"),spawns: mkObjectGroup(5, "spawns"),occupied: new Map(),nextObjectId: 1,createdAt: Date.now(),6 unmodified linesexport interface MapSummary {mapId: MapId;name: string;width: number;height: number;orientation: "isometric" | "orthogonal";9 unmodified lines};objects: number;spawns: number;createdAt: number;}function summarize(state: BuilderState): MapSummary {const counts = {walkable: 0,37 unmodified linesreturn {mapId: state.id,name: state.name,width: state.width,height: state.height,orientation: state.orientation,1 unmodified linetileCount: counts,objects: state.objects.objects.length,spawns: state.spawns.objects.length,createdAt: state.createdAt,};}export function getMap(id: MapId): BuilderState {const m = maps().get(id);if (!m) {30 unmodified linesexport type LayerName = "ground" | "walls" | "decorations";function assertInGrid(state: BuilderState, x: number, y: number, what = "Cell"): void {if (x < 0 || x >= state.width || y < 0 || y >= state.height) {throw new Error(`${what} (${x}, ${y}) is outside the ${state.width}x${state.height} grid (valid x: 0..${state.width - 1}, y: 0..${state.height - 1}).`,147 unmodified linestrapType?: string;trapNotation?: string;trapSaveDC?: number;}export function placeObject(id: MapId, opts: PlaceObjectOptions): number {17 unmodified linesif (opts.trapSaveDC !== undefined) {properties.push({ name: "trapSaveDC", value: opts.trapSaveDC, type: "int" });}const name = opts.name ?? `${opts.kind}-${objectId}`;const obj: TiledObject = {id: objectId,44 unmodified linesreturn objectId;}// ---------- Serialization ----------/** Returns a deep copy of the map as Tiled JSON, safe for callers to modify. */export function serializeMap(id: MapId): TiledMap {const state = getMap(id);const map: TiledMap = {type: "map",version: FORMAT_VERSION,5 unmodified linestilewidth: state.tilewidth,tileheight: state.tileheight,infinite: false,nextlayerid: 6,nextobjectid: state.nextObjectId,tilesets: [state.tileset],layers: [state.ground, state.walls, state.decorations, state.objects, state.spawns],properties: [{ name: "theme", value: state.theme.key, type: "string" },{ name: "mapName", value: state.name, type: "string" },],};return structuredClone(map);}// ---------- Per-map sprite overrides & inspection ----------4 unmodified lines56789101111 unmodified lines2324252627282930313233343536373839404142434445464748495051525354553 unmodified lines59606162636465668 unmodified lines757677787980818283848586878820 unmodified lines10911011111211311411511611770 unmodified lines1881891901911921931941951961971987 unmodified lines2062072082092102112122136 unmodified lines2202212222232242252269 unmodified lines23623723823924024124224324424524624724824925025125237 unmodified lines2902912922932942952961 unmodified line29829930030130230330430530630730830931031131231331430 unmodified lines345346347348349350351147 unmodified lines49950050150250350450550617 unmodified lines52452552652752852953044 unmodified lines5755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816825 unmodified lines6886896906916926936946956966976986997007017027037047057067077087094 unmodified linesimport { randomUUID } from "node:crypto";import { currentScope, isHosted } from "./context.js";import { slugify, uniqueName } from "./names.js";import type {Theme,ThemeRole,11 unmodified linesexport type MapId = string;/** Largest map side when TILED_MAX_MAP_SIZE is not set: 256 locally, 128 on a shared server. */export const DEFAULT_MAX_MAP_SIZE = 256;export const DEFAULT_HOSTED_MAX_MAP_SIZE = 128;const MAX_MAP_SIZE_CEILING = 1024;/** Largest allowed map side in cells (TILED_MAX_MAP_SIZE, 16..1024, overrides the default). */export function maxMapSize(): number {const configured = Number(process.env.TILED_MAX_MAP_SIZE);if (Number.isInteger(configured) && configured >= 16) return Math.min(configured, MAX_MAP_SIZE_CEILING);return isHosted() ? DEFAULT_HOSTED_MAX_MAP_SIZE : DEFAULT_MAX_MAP_SIZE;}/*** Links between maps are stored as "map:<mapId>" in 'file' properties while the maps live in* memory, and written as the target's file name (e.g. "house-1.tmj") by serializeMap, so they* resolve when the linked maps are saved side by side (save_world).*/const MAP_REF_PREFIX = "map:";export function mapRef(id: MapId): string {return `${MAP_REF_PREFIX}${id}`;}/** mapId behind a stored link value, or undefined when the value is not a map link. */export function mapRefTarget(value: unknown): MapId | undefined {return typeof value === "string" && value.startsWith(MAP_REF_PREFIX) ? value.slice(MAP_REF_PREFIX.length) : undefined;}export interface Occupant {name: string;3 unmodified linesexport interface BuilderState {id: MapId;name: string;/** File name this map is written under by save_world and used by links pointing to it. */fileName: string;width: number;height: number;tilewidth: number;8 unmodified linesdecorations: TiledTileLayer;objects: TiledObjectGroup;spawns: TiledObjectGroup;/** Building sprites as tile objects; created with the first building (layer id 6). */buildings?: TiledObjectGroup;/** Image-collection tileset of the building sprites, after the theme tileset. */buildingTileset?: TiledTileset;/** sprite file ("buildings/house.png") -> gid in buildingTileset */buildingGids: Map<string, number>;/** Extra map properties, e.g. buildingId and parentMap on an interior. */properties: TiledProperty[];// "x,y" -> object or spawn standing on that celloccupied: Map<string, Occupant>;nextObjectId: number;20 unmodified lines}export function createMap(opts: CreateOptions): { mapId: MapId; summary: MapSummary } {const max = maxMapSize();if (opts.width < 1 || opts.width > max || opts.height < 1 || opts.height > max) {throw new Error(`Map size out of range: ${opts.width}x${opts.height} (allowed 1..${max} per side).`);}if (isHosted() && maps().size >= MAX_HOSTED_MAPS) {throw new Error(70 unmodified linesdraworder: "topdown",});const takenFiles = new Set(Array.from(maps().values(), (m) => m.fileName));const state: BuilderState = {id,name: opts.name,fileName: `${uniqueName(slugify(opts.name), (c) => takenFiles.has(`${c}.tmj`))}.tmj`,width: opts.width,height: opts.height,tilewidth: theme.tilewidth,7 unmodified linesdecorations: mkTileLayer(3, "decorations"),objects: mkObjectGroup(4, "objects"),spawns: mkObjectGroup(5, "spawns"),buildingGids: new Map(),properties: [],occupied: new Map(),nextObjectId: 1,createdAt: Date.now(),6 unmodified linesexport interface MapSummary {mapId: MapId;name: string;fileName: string;width: number;height: number;orientation: "isometric" | "orthogonal";9 unmodified lines};objects: number;spawns: number;buildings: number;/** Objects that lead to another map (entrances, exits, linked doors and stairs). */transitions: number;createdAt: number;}/** True when the object leads to another map. */export function isTransition(obj: TiledObject): boolean {return obj.properties?.some((p) => p.name === "targetMap") ?? false;}function summarize(state: BuilderState): MapSummary {const counts = {walkable: 0,37 unmodified linesreturn {mapId: state.id,name: state.name,fileName: state.fileName,width: state.width,height: state.height,orientation: state.orientation,1 unmodified linetileCount: counts,objects: state.objects.objects.length,spawns: state.spawns.objects.length,buildings: state.buildings?.objects.length ?? 0,transitions: state.objects.objects.filter(isTransition).length,createdAt: state.createdAt,};}/** Every map of the current caller's workspace (hosted: one MCP session). */export function allMaps(): BuilderState[] {return Array.from(maps().values());}export function getMap(id: MapId): BuilderState {const m = maps().get(id);if (!m) {30 unmodified linesexport type LayerName = "ground" | "walls" | "decorations";export function assertInGrid(state: BuilderState, x: number, y: number, what = "Cell"): void {if (x < 0 || x >= state.width || y < 0 || y >= state.height) {throw new Error(`${what} (${x}, ${y}) is outside the ${state.width}x${state.height} grid (valid x: 0..${state.width - 1}, y: 0..${state.height - 1}).`,147 unmodified linestrapType?: string;trapNotation?: string;trapSaveDC?: number;/** Extra properties written after the standard ones, e.g. targetMap and targetSpawn. */properties?: TiledProperty[];}export function placeObject(id: MapId, opts: PlaceObjectOptions): number {17 unmodified linesif (opts.trapSaveDC !== undefined) {properties.push({ name: "trapSaveDC", value: opts.trapSaveDC, type: "int" });}if (opts.properties) properties.push(...opts.properties);const name = opts.name ?? `${opts.kind}-${objectId}`;const obj: TiledObject = {id: objectId,44 unmodified linesreturn objectId;}/** True when any object, spawn or building of the map already uses `name`. */export function objectNameTaken(state: BuilderState, name: string): boolean {const groups = [state.objects, state.spawns, ...(state.buildings ? [state.buildings] : [])];return groups.some((g) => g.objects.some((o) => o.name === name));}// ---------- Buildings ----------/*** gid of a building sprite in this map's building tileset, adding the tileset (after the theme* tileset) and the 'buildings' layer the first time. `file` is below the assets root,* e.g. "buildings/house.png".*/export function buildingGid(state: BuilderState,file: string,imageWidth: number,imageHeight: number,buildingType: string,): number {const known = state.buildingGids.get(file);if (known) return known;if (!state.buildingTileset) {state.buildingTileset = {firstgid: state.tileset.firstgid + state.tileset.tilecount,name: "buildings",tilewidth: state.tilewidth,tileheight: state.tileheight,tilecount: 0,columns: 0,grid: { orientation: state.orientation, width: state.tilewidth, height: state.tileheight },objectalignment: "bottom",tiles: [],};}if (!state.buildings) {state.buildings = {id: 6,name: "buildings",type: "objectgroup",visible: true,objects: [],opacity: 1,x: 0,y: 0,draworder: "topdown",};}const ts = state.buildingTileset;const localId = ts.tilecount;ts.tiles!.push({id: localId,image: `./assets/${file}`,imagewidth: imageWidth,imageheight: imageHeight,properties: [{ name: "tileType", value: "BUILDING", type: "string" },{ name: "buildingType", value: buildingType, type: "string" },],});ts.tilecount++;const gid = ts.firstgid + localId;state.buildingGids.set(file, gid);return gid;}/*** Position of a building tile object whose square footprint starts at cell (x, y) and spans* `size` cells. The building tileset anchors images at their bottom centre, so the object sits* on the footprint's bottom corner (isometric) or the middle of its bottom edge (orthogonal).*/export function buildingPlacement(state: BuilderState, x: number, y: number, size: number): { x: number; y: number } {const tw = state.tilewidth;const th = state.tileheight;if (state.orientation === "orthogonal") return { x: (x + size / 2) * tw, y: (y + size) * th };const col = x + size;const row = y + size;if (objectCoordMode() === "screen") return { x: (tw / 2) * (col - row), y: (th / 2) * (col + row) };return { x: col * th, y: row * th };}// ---------- Serialization ----------/** Rewrite "map:<mapId>" link values as the target map's file name ("" if it was discarded). */function resolveMapRefs(objects: TiledObject[] | undefined, properties: TiledProperty[] | undefined): void {const fix = (props: TiledProperty[] | undefined) => {for (const p of props ?? []) {const target = mapRefTarget(p.value);if (target !== undefined) p.value = maps().get(target)?.fileName ?? "";}};for (const o of objects ?? []) fix(o.properties);fix(properties);}/** Returns a deep copy of the map as Tiled JSON, safe for callers to modify. */export function serializeMap(id: MapId): TiledMap {const state = getMap(id);const tilesets = state.buildingTileset ? [state.tileset, state.buildingTileset] : [state.tileset];const layers = state.buildings? [state.ground, state.walls, state.decorations, state.buildings, state.objects, state.spawns]: [state.ground, state.walls, state.decorations, state.objects, state.spawns];const map: TiledMap = {type: "map",version: FORMAT_VERSION,5 unmodified linestilewidth: state.tilewidth,tileheight: state.tileheight,infinite: false,nextlayerid: state.buildings ? 7 : 6,nextobjectid: state.nextObjectId,tilesets,layers,properties: [{ name: "theme", value: state.theme.key, type: "string" },{ name: "mapName", value: state.name, type: "string" },...state.properties,],};const copy = structuredClone(map);for (const layer of copy.layers) {if (layer.type === "objectgroup") resolveMapRefs(layer.objects, undefined);}resolveMapRefs(undefined, copy.properties);return copy;}// ---------- Per-map sprite overrides & inspection ----------
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697// Buildings that place_building puts on an outdoor map: a large sprite drawn as a Tiled tile// object over a square footprint, an entrance, and an interior map linked both ways.//// Sprites live in <assets>/buildings/<type>.png (or <type>__<variant>.png) and are generated// with FLUX (generate_building_sprite, paid). Their size matches the footprint on the 64x32// isometric grid every bundled theme uses: the image is footprint*64 pixels wide, so its left// and right edges meet the corners of the footprint diamond, and it is anchored at its bottom// centre on the footprint's bottom corner.
export const BUILDING_TYPES = ["house", "shop", "tavern", "temple", "tower", "castle"] as const;export type BuildingType = (typeof BUILDING_TYPES)[number];
export interface BuildingDef { label: string; /** Side of the square footprint, in cells. */ footprint: number; imageWidth: number; imageHeight: number; /** Theme and size of the interior map place_building creates. */ interiorTheme: string; interiorWidth: number; interiorHeight: number; /** FLUX subject description. */ material: string;}
export const BUILDINGS: Record<BuildingType, BuildingDef> = { house: { label: "House", footprint: 3, imageWidth: 192, imageHeight: 192, interiorTheme: "TAVERN_BLOOD_PRINCE", interiorWidth: 12, interiorHeight: 10, material: "small two-storey half-timbered village house with a steep slate roof, shuttered windows, a stone chimney and a wooden front door", }, shop: { label: "Shop", footprint: 3, imageWidth: 192, imageHeight: 192, interiorTheme: "TAVERN_BLOOD_PRINCE", interiorWidth: 10, interiorHeight: 8, material: "narrow timber-framed village shop with a hanging wooden sign, a cloth awning over the display window and a front door", }, tavern: { label: "Tavern", footprint: 4, imageWidth: 256, imageHeight: 256, interiorTheme: "TAVERN_BLOOD_PRINCE", interiorWidth: 16, interiorHeight: 12, material: "large timber-framed roadside tavern with two stone chimneys, a wooden balcony, a hanging sign and a wide front door", }, temple: { label: "Temple", footprint: 4, imageWidth: 256, imageHeight: 256, interiorTheme: "MAUSOLEUM", interiorWidth: 14, interiorHeight: 12, material: "small weathered stone chapel with a bell tower, a pointed arch doorway and tall narrow windows", }, tower: { label: "Tower", footprint: 2, imageWidth: 128, imageHeight: 192, interiorTheme: "CASTLE", interiorWidth: 9, interiorHeight: 9, material: "tall round stone watchtower with a conical slate roof, arrow slits and a heavy wooden door at its base", }, castle: { label: "Castle", footprint: 6, imageWidth: 384, imageHeight: 384, interiorTheme: "CASTLE", interiorWidth: 27, interiorHeight: 20, material: "fortified dark stone castle keep with four corner towers, crenellated walls and a gatehouse with a closed portcullis", },};
/** Sprite file of a building below the assets root, e.g. "buildings/house.png". */export function buildingSpriteFile(type: BuildingType, variant?: string): string { return `buildings/${variant ? `${type}__${variant}` : type}.png`;}3 unmodified lines4567891011121342 unmodified lines565758596061626364656667686970717273747576777879808182838485868788899091929394953 unmodified linesimport { randomBytes } from "node:crypto";import { zipSync } from "fflate";import { serializeMap, type MapId } from "./builder.js";import { currentScope } from "./context.js";import { readSprite } from "./sprites.js";import { ASSET_PREFIX } from "./tmj.js";const TTL_MS = 60 * 60 * 1000;const MAX_TOTAL_BYTES = 256 * 1024 * 1024;42 unmodified linesreturn `${currentScope().baseUrl ?? ""}/download/${id}/${encodeURIComponent(name)}`;}/** File-system friendly slug of a map name, e.g. "Crypt under the chapel" -> "crypt-under-the-chapel". */export function slugify(name: string): string {const slug = name.normalize("NFKD").replace(/[̀-ͯ]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60);return slug || "map";}/*** Pack a map as `<base>/<base>.tmj` plus `<base>/assets/<theme>/<sprite>.png`. The .tmj keeps its* "./assets/..." image paths, which resolve inside the archive.*/export function mapArchive(mapId: MapId, base: string): { zip: Buffer; tmj: Buffer; missingSprites: string[] } {const map = serializeMap(mapId);const tmj = Buffer.from(`${JSON.stringify(map, null, 2)}\n`, "utf8");const files: Record<string, [Uint8Array, { level: 0 | 6 }]> = { [`${base}/${base}.tmj`]: [tmj, { level: 6 }] };const missingSprites: string[] = [];for (const tileset of map.tilesets) {for (const tile of tileset.tiles ?? []) {if (!tile.image?.startsWith(ASSET_PREFIX)) continue;const rel = tile.image.slice(ASSET_PREFIX.length);const data = readSprite(rel);// PNGs are already compressed: store them as is.if (data) files[`${base}/assets/${rel}`] = [data, { level: 0 }];else missingSprites.push(rel);}}return { zip: Buffer.from(zipSync(files)), tmj, missingSprites };}/** Publish a map as a .zip (Tiled-ready, with sprites) and as a bare .tmj; returns both links. */export function publishMap(mapId: MapId, fileName: string) {const base = slugify(fileName.replace(/\.(tmj|json)$/i, ""));3 unmodified lines456789101112131415161742 unmodified lines606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311323 unmodified linesimport { randomBytes } from "node:crypto";import { zipSync } from "fflate";import { getMap, serializeMap, type MapId } from "./builder.js";import { currentScope } from "./context.js";import { slugify } from "./names.js";import { readSprite } from "./sprites.js";import { ASSET_PREFIX, stringifyMap } from "./tmj.js";import type { TiledMap } from "./types.js";export { slugify };const TTL_MS = 60 * 60 * 1000;const MAX_TOTAL_BYTES = 256 * 1024 * 1024;42 unmodified linesreturn `${currentScope().baseUrl ?? ""}/download/${id}/${encodeURIComponent(name)}`;}type ZipFiles = Record<string, [Uint8Array, { level: 0 | 6 }]>;/** Add the sprites a map uses below `<base>/assets/`; returns the ones that are missing. */function addSprites(files: ZipFiles, map: TiledMap, base: string): string[] {const missing: string[] = [];for (const tileset of map.tilesets) {for (const tile of tileset.tiles ?? []) {if (!tile.image?.startsWith(ASSET_PREFIX)) continue;const rel = tile.image.slice(ASSET_PREFIX.length);const key = `${base}/assets/${rel}`;if (files[key]) continue;const data = readSprite(rel);// PNGs are already compressed: store them as is.if (data) files[key] = [data, { level: 0 }];else missing.push(rel);}}return missing;}/*** Pack a map as `<base>/<base>.tmj` plus `<base>/assets/<theme>/<sprite>.png`. The .tmj keeps its* "./assets/..." image paths, which resolve inside the archive.*/export function mapArchive(mapId: MapId, base: string): { zip: Buffer; tmj: Buffer; missingSprites: string[] } {const map = serializeMap(mapId);const tmj = Buffer.from(stringifyMap(map), "utf8");const files: ZipFiles = { [`${base}/${base}.tmj`]: [tmj, { level: 6 }] };const missingSprites = addSprites(files, map, base);return { zip: Buffer.from(zipSync(files)), tmj, missingSprites };}/*** Pack linked maps side by side as `<base>/<fileName>` (the names their links use) with one* shared `<base>/assets/` folder.*/export function worldArchive(mapIds: MapId[], base: string): { zip: Buffer; files: string[]; missingSprites: string[] } {const files: ZipFiles = {};const missing = new Set<string>();const names: string[] = [];for (const id of mapIds) {const map = serializeMap(id);const fileName = getMap(id).fileName;files[`${base}/${fileName}`] = [Buffer.from(stringifyMap(map), "utf8"), { level: 6 }];names.push(fileName);for (const m of addSprites(files, map, base)) missing.add(m);}return { zip: Buffer.from(zipSync(files)), files: names, missingSprites: [...missing] };}/** Publish one map's bare .tmj (its links point at sibling files the world .zip holds). */export function publishTmj(mapId: MapId, fileName: string): string {return publish(fileName, "application/json", Buffer.from(stringifyMap(serializeMap(mapId)), "utf8"));}/** Publish linked maps as one .zip; returns its link. */export function publishWorld(mapIds: MapId[], name: string) {const base = slugify(name);const { zip, files, missingSprites } = worldArchive(mapIds, base);return {zipUrl: publish(`${base}.zip`, "application/zip", zip),files,expiresAt: new Date(Date.now() + TTL_MS).toISOString(),...(missingSprites.length ? { missingSprites } : {}),};}/** Publish a map as a .zip (Tiled-ready, with sprites) and as a bare .tmj; returns both links. */export function publishMap(mapId: MapId, fileName: string) {const base = slugify(fileName.replace(/\.(tmj|json)$/i, ""));
12345678910111213141516171819202122// File-system friendly names, shared by map files, downloads and building ids.
/** Slug of a display name, e.g. "Crypt under the chapel" -> "crypt-under-the-chapel". */export function slugify(name: string): string { const slug = name .normalize("NFKD") .replace(/[̀-ͯ]/g, "") .toLowerCase() .replace(/[^a-z0-9]+/g, "-") .replace(/^-+|-+$/g, "") .slice(0, 60); return slug || "map";}
/** `base`, or `base-2`, `base-3`... : the first candidate `taken` does not hold. */export function uniqueName(base: string, taken: (candidate: string) => boolean): string { if (!taken(base)) return base; for (let i = 2; ; i++) { const candidate = `${base}-${i}`; if (!taken(candidate)) return candidate; }}123456785 unmodified lines141516171819202122232425262728293028 unmodified lines5960616263646566676 unmodified lines74757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351364 unmodified lines141142143144145146147148149150151152153154155156157158159160161162163// Render a Tiled map produced by this server to a PNG preview, without the Tiled editor.// Draws the tile layers the way Tiled does (layer by layer, right-down order) and overlays a// marker on every object and spawn so you can check where they landed. Supports isometric and// orthogonal maps with image-collection tilesets (what this server writes); object positions// are decoded with Tiled's native convention.import { loadSharp } from "./sharp.js";import type { TiledMap, TiledObjectGroup, TiledTileLayer } from "./types.js";5 unmodified linesmarkers?: boolean;}const COLORS: Record<string, string> = {player: "#3ddc84",enemy: "#ff4d4f",npc: "#4da3ff",door: "#c08a4a",chest: "#ffd84d",trap: "#c77dff",lever: "#bbbbbb",stairs: "#4dd8e6",};const LETTER: Record<string, string> = { player: "P", enemy: "E", npc: "N", door: "D", chest: "C", trap: "T", lever: "L", stairs: "S" };const PLACEHOLDER: Record<string, { color: string; block: boolean }> = {WALKABLE: { color: "#4a5363", block: false },28 unmodified lines};}/*** @param readImage returns the bytes of a tile image given its path as written in the map* (e.g. "./assets/crypt/wall.png"), or undefined when it is missing (the tile is skipped).*/export async function renderMapPreview(map: TiledMap,6 unmodified linesconst { width: W, height: H, tilewidth: tw, tileheight: th } = map;const iso = map.orientation === "isometric";// gid -> image; tiles whose sprite is missing get a flat placeholder coloured by tile type,// so maps in themes without sprites still show their layout.const tiles = new Map<number, { buffer: Buffer; height: number }>();const placeholders = new Map<string, { buffer: Buffer; height: number }>();for (const ts of map.tilesets) {for (const t of ts.tiles ?? []) {const buffer = t.image ? readImage(t.image) : undefined;if (buffer) {tiles.set(ts.firstgid + t.id, { buffer, height: t.imageheight ?? th });continue;}const type = String(t.properties?.find((p) => p.name === "tileType")?.value ?? "WALKABLE");if (!placeholders.has(type)) {const svg = placeholderSvg(type, tw, th, iso);placeholders.set(type, { buffer: await sharp(Buffer.from(svg.markup)).png().toBuffer(), height: svg.height });}tiles.set(ts.firstgid + t.id, placeholders.get(type)!);}}const tallest = Math.max(th, ...[...tiles.values()].map((t) => t.height));const pad = tallest - th;const canvasW = iso ? ((W + H) * tw) / 2 : W * tw;const canvasH = (iso ? ((W + H) * th) / 2 : H * th) + pad;const originX = iso ? (H * tw) / 2 : 0;/** Top corner (iso) or top-left (ortho) of a cell, in canvas pixels. */const cellToScreen = (col: number, row: number) =>iso? { x: ((col - row) * tw) / 2 + originX, y: ((col + row) * th) / 2 + pad }: { x: col * tw, y: row * th + pad };const composites: Array<{ input: Buffer; left: number; top: number }> = [];for (const layer of map.layers) {if (layer.type !== "tilelayer" || !layer.visible) continue;const data = (layer as TiledTileLayer).data;for (let row = 0; row < H; row++) {for (let col = 0; col < W; col++) {const gid = data[row * W + col];const tile = gid ? tiles.get(gid) : undefined;if (!tile) continue;const p = cellToScreen(col, row);const left = Math.round(iso ? p.x - tw / 2 : p.x);const top = Math.round(p.y + th - tile.height);composites.push({ input: tile.buffer, left, top });}}}if (markers) {let svg = "";for (const layer of map.layers) {if (layer.type !== "objectgroup") continue;for (const o of (layer as TiledObjectGroup).objects) {const col = Math.floor(o.x / (iso ? th : tw));const row = Math.floor(o.y / th);const p = cellToScreen(col, row);const cx = iso ? p.x : p.x + tw / 2;const cy = p.y + th / 2;const kind = o.type ?? "";4 unmodified linessvg += `${shape}<circle cx="${cx}" cy="${cy}" r="${th * 0.36}" fill="#111" stroke="${color}" stroke-width="2"/><text x="${cx}" y="${cy + th * 0.17}" font-family="Arial, Helvetica, sans-serif" font-size="${th * 0.48}" font-weight="700" fill="${color}" text-anchor="middle">${LETTER[kind] ?? "?"}</text>`;}}composites.push({input: Buffer.from(`<svg xmlns="http://www.w3.org/2000/svg" width="${canvasW}" height="${canvasH}">${svg}</svg>`),left: 0,top: 0,});}const full = await sharp({create: { width: canvasW, height: canvasH, channels: 4, background: { r: 13, g: 17, b: 23, alpha: 1 } },}).composite(composites).png().toBuffer();const scale = Math.min(1, maxWidth / canvasW);return sharp(full).resize(Math.round(canvasW * scale), Math.round(canvasH * scale), { kernel: "lanczos3" }).png({ compressionLevel: 9, palette: true, quality: 90 }).toBuffer();}12345678910115 unmodified lines17181920212223242526272829303132333435363738394041424344454647484950515228 unmodified lines818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531546 unmodified lines1611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882894 unmodified lines294295296297298299300301302303304305306307308// Render a Tiled map produced by this server to a PNG preview, without the Tiled editor.// Draws the layers the way Tiled does (layer by layer, right-down order, tile objects such as// buildings anchored at their bottom centre) and overlays a marker on every object and spawn so// you can check where they landed. Supports isometric and orthogonal maps with image-collection// tilesets (what this server writes); object positions are decoded with Tiled's native convention.//// Large maps are drawn straight at a reduced scale into a raw pixel buffer, so a 256x256 map// never allocates its full-size canvas (16384 pixels wide) or hands sharp 200,000 overlays.import { loadSharp } from "./sharp.js";import type { TiledMap, TiledObjectGroup, TiledTileLayer } from "./types.js";5 unmodified linesmarkers?: boolean;}/** Above this many pixels the map is drawn at a reduced scale before the final resize. */const FULL_RES_PIXELS = 16_000_000;const BACKGROUND = [13, 17, 23] as const;const COLORS: Record<string, string> = {player: "#3ddc84",enemy: "#ff4d4f",npc: "#4da3ff",arrival: "#e6e6e6",door: "#c08a4a",chest: "#ffd84d",trap: "#c77dff",lever: "#bbbbbb",stairs: "#4dd8e6",entrance: "#ff9f1c",exit: "#ff9f1c",};const LETTER: Record<string, string> = {player: "P",enemy: "E",npc: "N",arrival: "A",door: "D",chest: "C",trap: "T",lever: "L",stairs: "S",entrance: "I",exit: "O",};const PLACEHOLDER: Record<string, { color: string; block: boolean }> = {WALKABLE: { color: "#4a5363", block: false },28 unmodified lines};}/** A walled box with a pitched roof over the footprint, standing in for a missing building sprite. */function buildingPlaceholderSvg(w: number, h: number): string {const dh = w / 2; // height of the footprint diamondconst k = Math.max(dh / 2, (h - dh) * 0.55); // wall heightconst by = h; // bottom cornerconst sy = h - dh / 2; // left and right cornersconst stroke = `stroke="#0d1117" stroke-opacity="0.6" stroke-width="2"`;const apex = `${w / 2},${Math.max(0, sy - k - dh / 2)}`;return (`<svg xmlns="http://www.w3.org/2000/svg" width="${w}" height="${h}">` +`<polygon points="0,${sy} ${w / 2},${by} ${w / 2},${by - k} 0,${sy - k}" fill="#8a6a48" ${stroke}/>` +`<polygon points="${w / 2},${by} ${w},${sy} ${w},${sy - k} ${w / 2},${by - k}" fill="#6e5238" ${stroke}/>` +`<polygon points="0,${sy - k} ${w / 2},${by - k} ${apex}" fill="#7a3b33" ${stroke}/>` +`<polygon points="${w / 2},${by - k} ${w},${sy - k} ${apex}" fill="#5e2c26" ${stroke}/>` +`</svg>`);}interface TileImage {buffer: Buffer;width: number;height: number;}interface Draw {gid: number;left: number;top: number;width: number;height: number;}interface Pixels {data: Buffer;w: number;h: number;}/** Alpha-blend `src` onto the opaque RGBA canvas `dst` at (x0, y0), clipped to the canvas. */function blend(dst: Buffer, dw: number, dh: number, src: Pixels, x0: number, y0: number): void {const xs = Math.max(0, -x0);const ys = Math.max(0, -y0);const xe = Math.min(src.w, dw - x0);const ye = Math.min(src.h, dh - y0);const s = src.data;for (let y = ys; y < ye; y++) {let si = (y * src.w + xs) * 4;let di = ((y0 + y) * dw + x0 + xs) * 4;for (let x = xs; x < xe; x++, si += 4, di += 4) {const a = s[si + 3];if (a === 0) continue;if (a === 255) {dst[di] = s[si];dst[di + 1] = s[si + 1];dst[di + 2] = s[si + 2];continue;}const k = a / 255;dst[di] = (s[si] * k + dst[di] * (1 - k) + 0.5) | 0;dst[di + 1] = (s[si + 1] * k + dst[di + 1] * (1 - k) + 0.5) | 0;dst[di + 2] = (s[si + 2] * k + dst[di + 2] * (1 - k) + 0.5) | 0;}}}/*** @param readImage returns the bytes of a tile image given its path as written in the map* (e.g. "./assets/crypt/wall.png"), or undefined when it is missing (a placeholder is drawn).*/export async function renderMapPreview(map: TiledMap,6 unmodified linesconst { width: W, height: H, tilewidth: tw, tileheight: th } = map;const iso = map.orientation === "isometric";// gid -> image; tiles whose sprite is missing get a placeholder coloured by tile type, so maps// in themes without sprites still show their layout.const images = new Map<number, TileImage>();const bottomAligned = new Set<number>();const placeholders = new Map<string, TileImage>();for (const ts of map.tilesets) {for (const t of ts.tiles ?? []) {const gid = ts.firstgid + t.id;if (ts.objectalignment === "bottom") bottomAligned.add(gid);const width = t.imagewidth ?? tw;const height = t.imageheight ?? th;const buffer = t.image ? readImage(t.image) : undefined;if (buffer) {images.set(gid, { buffer, width, height });continue;}const type = String(t.properties?.find((p) => p.name === "tileType")?.value ?? "WALKABLE");const key = type === "BUILDING" ? `BUILDING:${width}x${height}` : type;if (!placeholders.has(key)) {if (type === "BUILDING") {const png = await sharp(Buffer.from(buildingPlaceholderSvg(width, height))).png().toBuffer();placeholders.set(key, { buffer: png, width, height });} else {const svg = placeholderSvg(type, tw, th, iso);const png = await sharp(Buffer.from(svg.markup)).png().toBuffer();placeholders.set(key, { buffer: png, width: tw, height: svg.height });}}images.set(gid, placeholders.get(key)!);}}/** Top corner (iso) or top-left (ortho) of a cell, in map pixels (cell (0,0) at x = 0). */const cellTop = (col: number, row: number) =>iso ? { x: ((col - row) * tw) / 2, y: ((col + row) * th) / 2 } : { x: col * tw, y: row * th };const draws: Draw[] = [];for (const layer of map.layers) {if (!layer.visible) continue;if (layer.type === "tilelayer") {const data = (layer as TiledTileLayer).data;for (let row = 0; row < H; row++) {for (let col = 0; col < W; col++) {const gid = data[row * W + col];const img = gid ? images.get(gid) : undefined;if (!img) continue;const p = cellTop(col, row);draws.push({ gid, left: iso ? p.x - tw / 2 : p.x, top: p.y + th - img.height, width: img.width, height: img.height });}}continue;}// Tile objects (building sprites), back to front.const tileObjects = (layer as TiledObjectGroup).objects.filter((o) => o.gid && o.visible !== false).sort((a, b) => a.x + a.y - (b.x + b.y));for (const o of tileObjects) {const gid = o.gid! & 0x1fffffff;const img = images.get(gid);if (!img) continue;const w = o.width ?? img.width;const h = o.height ?? img.height;const p = iso ? { x: ((o.x - o.y) / th) * (tw / 2), y: (o.x + o.y) / 2 } : { x: o.x, y: o.y };const centred = iso || bottomAligned.has(gid);draws.push({ gid, left: centred ? p.x - w / 2 : p.x, top: p.y - h, width: w, height: h });}}// Canvas bounds in map pixels: the whole grid plus anything drawn outside it.let minX = iso ? -(H * tw) / 2 : 0;let minY = 0;let maxX = iso ? (W * tw) / 2 : W * tw;let maxY = iso ? ((W + H) * th) / 2 : H * th;for (const d of draws) {minX = Math.min(minX, d.left);minY = Math.min(minY, d.top);maxX = Math.max(maxX, d.left + d.width);maxY = Math.max(maxY, d.top + d.height);}const fullW = Math.ceil(maxX - minX);const fullH = Math.ceil(maxY - minY);const target = Math.min(1, maxWidth / fullW);const scale = fullW * fullH <= FULL_RES_PIXELS ? 1 : Math.max(target, Math.sqrt(FULL_RES_PIXELS / (fullW * fullH)));const cw = Math.max(1, Math.round(fullW * scale));const ch = Math.max(1, Math.round(fullH * scale));// Decode every distinct (image, size) once at the drawing scale.const sizeOf = (d: Draw) => ({ w: Math.max(1, Math.round(d.width * scale)), h: Math.max(1, Math.round(d.height * scale)) });const pixels = new Map<string, Pixels>();for (const d of draws) {const { w, h } = sizeOf(d);const key = `${d.gid}:${w}x${h}`;if (pixels.has(key)) continue;const data = await sharp(images.get(d.gid)!.buffer).resize(w, h, { fit: "fill", kernel: "lanczos3" }).ensureAlpha().raw().toBuffer();pixels.set(key, { data, w, h });}const canvas = Buffer.alloc(cw * ch * 4);for (let i = 0; i < canvas.length; i += 4) {canvas[i] = BACKGROUND[0];canvas[i + 1] = BACKGROUND[1];canvas[i + 2] = BACKGROUND[2];canvas[i + 3] = 255;}for (const d of draws) {const { w, h } = sizeOf(d);blend(canvas, cw, ch, pixels.get(`${d.gid}:${w}x${h}`)!, Math.round((d.left - minX) * scale), Math.round((d.top - minY) * scale));}let image = sharp(canvas, { raw: { width: cw, height: ch, channels: 4 } });if (markers) {let svg = "";for (const layer of map.layers) {if (layer.type !== "objectgroup") continue;for (const o of (layer as TiledObjectGroup).objects) {if (o.gid) continue; // building sprites are drawn, not markedconst col = Math.floor(o.x / (iso ? th : tw));const row = Math.floor(o.y / th);const p = cellTop(col, row);const cx = iso ? p.x : p.x + tw / 2;const cy = p.y + th / 2;const kind = o.type ?? "";4 unmodified linessvg += `${shape}<circle cx="${cx}" cy="${cy}" r="${th * 0.36}" fill="#111" stroke="${color}" stroke-width="2"/><text x="${cx}" y="${cy + th * 0.17}" font-family="Arial, Helvetica, sans-serif" font-size="${th * 0.48}" font-weight="700" fill="${color}" text-anchor="middle">${LETTER[kind] ?? "?"}</text>`;}}if (svg) {const overlay = `<svg xmlns="http://www.w3.org/2000/svg" width="${cw}" height="${ch}" viewBox="${minX} ${minY} ${fullW} ${fullH}" preserveAspectRatio="none">${svg}</svg>`;image = sharp(await image.composite([{ input: Buffer.from(overlay), left: 0, top: 0 }]).png().toBuffer());}}const finalScale = Math.min(1, target / scale);return image.resize(Math.max(1, Math.round(cw * finalScale)), Math.max(1, Math.round(ch * finalScale)), { kernel: "lanczos3" }).png({ compressionLevel: 9, palette: true, quality: 90 }).toBuffer();}
8 unmodified lines91011121314151617184 unmodified lines2324252627288 unmodified linesimport { registerLayoutPresetTools } from "./tools/layout-presets.js";import { registerExportTools } from "./tools/export.js";import { registerGenerationTools } from "./tools/generation.js";import { registerPrompts } from "./prompts.js";export const SERVER_NAME = "tiled-map-builder";export const SERVER_VERSION = "0.3.0";export function createServer(): McpServer {const server = new McpServer({ name: SERVER_NAME, version: SERVER_VERSION });4 unmodified linesregisterLayoutPresetTools(server);registerExportTools(server);registerGenerationTools(server);registerPrompts(server);return server;}8 unmodified lines9101112131415161718194 unmodified lines242526272829308 unmodified linesimport { registerLayoutPresetTools } from "./tools/layout-presets.js";import { registerExportTools } from "./tools/export.js";import { registerGenerationTools } from "./tools/generation.js";import { registerWorldTools } from "./tools/world.js";import { registerPrompts } from "./prompts.js";export const SERVER_NAME = "tiled-map-builder";export const SERVER_VERSION = "0.4.0";export function createServer(): McpServer {const server = new McpServer({ name: SERVER_NAME, version: SERVER_VERSION });4 unmodified linesregisterLayoutPresetTools(server);registerExportTools(server);registerGenerationTools(server);registerWorldTools(server);registerPrompts(server);return server;}
1118 unmodified lines1119112011211122112311241118 unmodified linesdimensions: { width: number; height: number };}/*** Build a final prompt string for FLUX-dev based on theme + role + optional* overrides. Returns the prompt plus the target geometry (used to set the1118 unmodified lines1119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481118 unmodified linesdimensions: { width: number; height: number };}const BUILDING_TEMPLATE = (material: string, lighting: string) =>`isometric view at 30 degree angle of a single ${material}, seen from the south with two walls visible, ` +`hand-painted digital illustration, painterly oil paint style, ${lighting}, ` +`gothic horror dark fantasy palette, decayed elegance, faded grandeur, brooding melancholy, ` +`the whole building fully visible from roof to base and centered, standing on a small flat diamond-shaped patch of ground, ` +`smooth lines no 3D ray-traced effects, no depth-of-field, ` +`single isolated building on pure bright magenta solid background, ` +`chroma key background #FF00FF, ` +`${POSITIVE_FRAMING}, game asset for 2D tactical RPG`;export const BUILDING_LIGHTING = "soft overcast daylight from the upper left, muted desaturated colours";/** FLUX prompt for a building sprite (see src/buildings.ts for the subjects and sizes). */export function buildBuildingPrompt(material: string,overrides?: { lighting?: string; extraDetail?: string },): { prompt: string; dimensions: { width: number; height: number } } {const base = BUILDING_TEMPLATE(material, overrides?.lighting ?? BUILDING_LIGHTING);return {prompt: overrides?.extraDetail ? `${base}, ${overrides.extraDetail}` : base,dimensions: { width: 1024, height: 1024 },};}/*** Build a final prompt string for FLUX-dev based on theme + role + optional* overrides. Returns the prompt plus the target geometry (used to set the
28 unmodified lines2930313233343536373828 unmodified linesreturn map;}/** Serialize a map and write it as a .tmj file whose sprite paths resolve from its location. */export async function saveMapFile(id: MapId, outFile: string): Promise<{ path: string; bytes: number }> {const map = relativizeImagePaths(serializeMap(id), outFile);const text = `${JSON.stringify(map, null, 2)}\n`;await mkdir(dirname(outFile), { recursive: true });await writeFile(outFile, text, "utf8");return { path: outFile, bytes: Buffer.byteLength(text) };28 unmodified lines293031323334353637383940414243444546474849505152535455565758596028 unmodified linesreturn map;}/*** Map JSON as written to .tmj files: indented like Tiled's own output, but every tile layer's* `data` array on a single line. A 256x256 map then stays a few hundred kilobytes instead of* hundreds of thousands of one-number lines.*/export function stringifyMap(map: TiledMap): string {const rows: string[] = [];const marker = `__tiled_layer_data_${Date.now().toString(36)}_`;const text = JSON.stringify(map,(key, value) => {if (key === "data" && Array.isArray(value)) {rows.push(value.join(","));return `${marker}${rows.length - 1}`;}return value;},2,);return `${text.replace(new RegExp(`"${marker}(\\d+)"`, "g"), (_, i: string) => `[${rows[Number(i)]}]`)}\n`;}/** Serialize a map and write it as a .tmj file whose sprite paths resolve from its location. */export async function saveMapFile(id: MapId, outFile: string): Promise<{ path: string; bytes: number }> {const map = relativizeImagePaths(serializeMap(id), outFile);const text = stringifyMap(map);await mkdir(dirname(outFile), { recursive: true });await writeFile(outFile, text, "utf8");return { path: outFile, bytes: Buffer.byteLength(text) };
4 unmodified lines56789101128 unmodified lines404142434445464748495051525354555610 unmodified lines676869707172737475767728 unmodified lines1061071081091101111124 unmodified linesimport { isHosted } from "../context.js";import { publishMap } from "../downloads.js";import { mapsRoot, resolveUserPath } from "../paths.js";import { saveMapFile } from "../tmj.js";import { asText } from "./util.js";/** Structural check of the Tiled JSON. The game engine that imports the map should re-validate. */28 unmodified linesconst errors = validateTiledShape(serializeMap(mapId));const warnings: string[] = [];const hasPlayer = state.spawns.objects.some((o) =>o.properties?.some((p) => p.name === "role" && p.value === "player"),);if (!hasPlayer) warnings.push("No 'player' spawn: the map is not playable until one is placed (place_spawn_player).");for (const [key, who] of state.occupied) {const [x, y] = key.split(",").map(Number);const i = y * state.width + x;const onWall = state.walls.data[i] !== 0;const onGround = state.ground.data[i] !== 0;if (who.type === "door") {if (onWall) warnings.push(`Door "${who.name}" at (${x}, ${y}) is still inside a wall: erase the wall tile (erase_tile layer=walls).`);continue;}10 unmodified lines{title: "Export as Tiled JSON",description:"Returns the full Tiled JSON (.tmj content) of a map as text. Sprite paths are written as './assets/<theme>/<role>.png' relative to the repository root; use save_to_disk to get a file whose sprite paths resolve from where it is saved.",inputSchema: { mapId: z.string() },annotations: { readOnlyHint: true, openWorldHint: false },},async ({ mapId }) => asText(serializeMap(mapId)),);if (isHosted()) {28 unmodified lines{title: "Save to disk",description:"Writes the map to a .tmj file that opens directly in the Tiled editor. A relative path is resolved against the maps folder (the repository's maps/ by default, or TILED_MAPS_DIR); an absolute path is used as is. Missing folders are created and an existing file is overwritten. Sprite paths inside the file are rewritten relative to its location so Tiled finds the PNGs.",inputSchema: {mapId: z.string(),path: z4 unmodified lines56789101128 unmodified lines404142434445464748495051525354555657585910 unmodified lines707172737475767778798028 unmodified lines1091101111121131141154 unmodified linesimport { isHosted } from "../context.js";import { publishMap } from "../downloads.js";import { mapsRoot, resolveUserPath } from "../paths.js";import { saveMapFile, stringifyMap } from "../tmj.js";import { asText } from "./util.js";/** Structural check of the Tiled JSON. The game engine that imports the map should re-validate. */28 unmodified linesconst errors = validateTiledShape(serializeMap(mapId));const warnings: string[] = [];const hasRole = (role: string) =>state.spawns.objects.some((o) => o.properties?.some((p) => p.name === "role" && p.value === role));// A map entered through a transition (an interior) starts the player on an arrival point.if (!hasRole("player") && !hasRole("arrival")) {warnings.push("No 'player' spawn: the map is not playable until one is placed (place_spawn_player).");}for (const [key, who] of state.occupied) {if (who.type === "building") continue; // footprint cells, checked by place_buildingconst [x, y] = key.split(",").map(Number);const i = y * state.width + x;const onWall = state.walls.data[i] !== 0;const onGround = state.ground.data[i] !== 0;if (who.type === "door" || who.type === "exit") {if (onWall) warnings.push(`Door "${who.name}" at (${x}, ${y}) is still inside a wall: erase the wall tile (erase_tile layer=walls).`);continue;}10 unmodified lines{title: "Export as Tiled JSON",description:"Returns the full Tiled JSON (.tmj content) of a map as text, each tile layer's data on one line. Sprite paths are written as './assets/<theme>/<role>.png' relative to the repository root; use save_to_disk to get a file whose sprite paths resolve from where it is saved. Large maps make long answers: prefer save_to_disk or save_world above 64x64.",inputSchema: { mapId: z.string() },annotations: { readOnlyHint: true, openWorldHint: false },},async ({ mapId }) => ({ content: [{ type: "text" as const, text: stringifyMap(serializeMap(mapId)) }] }),);if (isHosted()) {28 unmodified lines{title: "Save to disk",description:"Writes the map to a .tmj file that opens directly in the Tiled editor. A relative path is resolved against the maps folder (the repository's maps/ by default, or TILED_MAPS_DIR); an absolute path is used as is. Missing folders are created and an existing file is overwritten. Sprite paths inside the file are rewritten relative to its location so Tiled finds the PNGs. For maps linked by place_building or link_maps, use save_world so the linked files land side by side under the names their links use.",inputSchema: {mapId: z.string(),path: z
.gitattributes+2
CHANGELOG.md+48
README.md+18-4
assets/buildings/castle.pngAdded

Large File Pointer Details
- SHA256: d1ef0c1a5381951dfee8e5797b27955ec58a8345efa1f5e7db6583c8f70bf5a0
- Pointer size: 131 Bytes
- Size of remote file: 183 kB
assets/buildings/house.pngAdded

assets/buildings/shop.pngAdded

assets/buildings/tavern.pngAdded

assets/buildings/temple.pngAdded

assets/buildings/tower.pngAdded

docs/README.md+1
docs/configuration.md+2-1
docs/images/preview-crossroads-village.pngAdded

Large File Pointer Details
- SHA256: ea28b98e93c3fd76250d9e8a12c66a8527230ec66c539b3b3860ac835643cf4a
- Pointer size: 131 Bytes
- Size of remote file: 122 kB
docs/map-format.md+67-9
docs/sprite-generation.md+27-4
docs/tools.md+88-6
docs/troubleshooting.md+4-2
docs/worlds-and-buildings.mdAdded+200
huggingface/space-card.md+10-2
maps/README.md+8-1
maps/caverne-aquatique.tmj
maps/crossroads-village/chandler-shop-interior.tmjAdded+314
maps/crossroads-village/crossroads-tavern-interior.tmjAdded+314
maps/crossroads-village/crossroads-village.tmjAdded+1008
maps/crossroads-village/greystone-keep-interior.tmjAdded+588
maps/crossroads-village/keep-cellar.tmjAdded+345
maps/crossroads-village/miller-house-interior.tmjAdded+314
maps/crossroads-village/old-chapel-interior.tmjAdded+314
maps/crossroads-village/watchtower-interior.tmjAdded+332
maps/forteresse-glace-etage.tmj
maps/reseau-electronique-repaire-hacker.tmj
package-lock.json+3-3
package.json+2-2
scripts/README.md+5-2
scripts/create-village-world.mjsAdded+56
scripts/gen-building-sprites.mjsAdded+153
scripts/smoke-http.mjs+16-6
scripts/smoke-test.mjs+66-1
skills/map-builder/SKILL.md+25-2
tiled-mcp/.env.example+2-1
tiled-mcp/package.json+1-1
tiled-mcp/src/agent.ts+38-8
tiled-mcp/src/builder.ts+173-10
tiled-mcp/src/buildings.tsAdded+97
tiled-mcp/src/downloads.ts+61-24
tiled-mcp/src/names.tsAdded+22
tiled-mcp/src/render.ts+199-54
tiled-mcp/src/server.ts+3-1
tiled-mcp/src/themes/prompts.ts+24
tiled-mcp/src/tmj.ts+23-1
tiled-mcp/src/tools/export.ts+12-9