diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..a6eb29a3c63ff6ed3ae7c0b6aa3ed14caa06df70 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +.git +node_modules +tiled-mcp/node_modules +tiled-mcp/dist +**/.env +**/.env.local +*.log +maps/*.png diff --git a/.gitattributes b/.gitattributes index a6344aac8c09253b3b630fb776ae94478aa0275b..29d2a2063a4852192ebae8bc117e8b7a2c73e739 100644 --- a/.gitattributes +++ b/.gitattributes @@ -33,3 +33,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text *.zip filter=lfs diff=lfs merge=lfs -text *.zst filter=lfs diff=lfs merge=lfs -text *tfevents* filter=lfs diff=lfs merge=lfs -text +docs/images/preview-aquatic-cavern.png filter=lfs diff=lfs merge=lfs -text +docs/images/preview-crypt-preset.png filter=lfs diff=lfs merge=lfs -text +docs/images/preview-hacker-lair.png filter=lfs diff=lfs merge=lfs -text +docs/images/preview-ice-fortress.png filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..0d2beccf86d78d009ff7008e9fa12dd807f3d9d6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +node_modules/ +dist/ +*.tsbuildinfo +.env +.env.local +*.log +.DS_Store + +# PNG previews rendered next to maps by scripts/render-map-preview.mjs +maps/*.png diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..f9d00b2b2bbf99799b5314a9b6fbef4bf7ed9333 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,94 @@ +# Changelog + +## 0.3.0 + +A hosted mode, published as a Hugging Face Space. + +### Added + +- Hosted mode (`npm run start:web`, `tiled-mcp/dist/http.js`), on one port: + - a web page where an open AI model on Hugging Face Inference Providers builds a map from a + description, with live progress, a PNG preview and a Tiled-ready `.zip`; + - every MCP tool over Streamable HTTP at `/mcp`, one isolated workspace per session; + - "Sign in with Hugging Face" when it runs on a Space. + + Paid calls only ever use the caller's own token. See [docs/hugging-face.md](docs/hugging-face.md). +- `Dockerfile` and the `huggingface/` folder (Space card and publishing script). +- `npm run smoke:http`: offline end-to-end test of the hosted mode with a stand-in AI model. +- Map previews draw grey placeholder tiles where a theme has no sprite yet. + +### Changed + +- The preview renderer moved to `tiled-mcp/src/render.ts`, shared by `npm run preview` and the + web page. `npm run preview` now needs `npm run build` first. +- In hosted mode `save_to_disk` returns download links, and generated sprites stay in the + caller's session instead of the server's disk. + +## 0.2.0 + +Usable by anyone from a fresh clone, with English documentation. + +### Breaking + +- **Object and spawn coordinates now follow Tiled's isometric convention** + (`x = col * tileheight`, `y = row * tileheight`). Objects are one-tile rectangles and spawns are + point objects at the tile centre, so everything opens on the right tiles in Tiled. The previous + encoding added a half-map origin offset that neither Tiled nor existing importers decoded + correctly. Importers that expect the older screen-space encoding can set + `TILED_OBJECT_COORDS=screen`. See [docs/map-format.md](docs/map-format.md#object-coordinates). +- Node.js 20.9 or newer is required (sharp 0.35). +- The server identifies itself as `tiled-map-builder`, and the package is `tiled-map-builder-mcp`. +- Layout presets enforce the sizes they need to avoid overlapping rooms: crypt 27x18, castle + 27x20, werewolf den 22x16. +- Tool titles, descriptions and errors are in English. +- Three theme keys and their sprite folders were renamed to generic names: `CASTLE` + (`assets/castle`), `VILLAGE` (`assets/village`) and `HAUNTED_FOREST` + (`assets/haunted_forest`). +- The map properties holding the theme key and display name are now `theme` and `mapName`. + +### Fixed + +- The `map_builder` prompt loads `skills/map-builder/SKILL.md`, which is now in the repository. +- Sprite tools accept all 20 themes instead of 8. +- Default folders and the `.env` file are resolved inside the repository instead of the + author's machine. +- Example scripts import the server and write maps with repository-relative paths. +- `save_to_disk` writes sprite paths relative to the saved file, so maps open in Tiled with + their images; the sample maps were updated accordingly. +- The castle preset opens the wall under its locked main door. +- `paint_rect` and `paint_wall_border` reject rectangles outside the grid instead of painting + part of them. +- `generate_room` rejects an exit offset beyond the wall. +- Declared dependency ranges match the APIs used (MCP SDK 1.23+, zod 4, sharp 0.35); a fresh + install reports no known vulnerabilities. + +### Added + +- Placement checks: spawns, chests, traps, levers and zone stairs cannot go on a wall, outside + the ground, on an obstacle prop or on an occupied cell. `get_tile_info` reports occupants. +- `validate_map` warns about objects on walls or outside the ground and doors left inside a wall. +- `list_themes` reports which sprites are present. +- `generate_tile_sprite` no longer overwrites an existing sprite unless `force: true`. +- MCP tool annotations (read-only, destructive, idempotent, network). +- Configuration: `TILED_MAPS_DIR`, `TILED_OBJECT_COORDS`, `TILED_HF_PROVIDER`, automatic + `tiled-mcp/.env` loading. +- Scripts: `npm run smoke` (end-to-end checks), `npm run preview` (PNG renderer), + `npm run docs` (generated tool and theme references), `gen-theme-set.mjs` with + `--dry-run` and a required `--yes`. +- Documentation: client setup for seven clients and the MCP Inspector, tool reference, map format, themes, + configuration, sprite generation, Nemotron, troubleshooting, contributing. MIT `LICENSE` file. +- The map-builder skill rewritten in English for any user, keeping the original workflow and + design heuristics. + +### Removed + +- Superseded script drafts: the first aquatic script and glacier drafts 1 to 3 were removed, and + the versions that produced the sample maps (aquatic v2, glacier v4) became + `create-aquatic-map.mjs` and `create-glacier-map.mjs`. +- `gen-assets.mjs`, covered by `gen-theme-set.mjs`. +- The `upload_to_dungeon` tool and its environment variables. It only served one private web + app; save maps with `save_to_disk` instead. + +## 0.1.0 + +Initial public version. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000000000000000000000000000000000..7b14f7d2cc699dc4ff07c2264b4855f7de0569cf --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,46 @@ +# Contributing + +Thanks for helping. Bug reports, new themes, better presets and documentation fixes are all +welcome. + +## Development loop + +```bash +npm install +npm run build # compile tiled-mcp/src to tiled-mcp/dist +npm run smoke # 38 offline end-to-end checks; must stay green +npm run smoke:http # hosted mode checks; must stay green +npm run docs # regenerate docs/tools.md and docs/themes.md after changing tools or themes +npm run inspect # try tools by hand in the MCP Inspector +npm run preview -- maps/.tmj # look at a map without Tiled +``` + +Node.js 20.9 or newer is required. + +## Guidelines + +- **Tool descriptions are documentation for agents.** Write them in English and say what the + tool needs first (for example "call create_map first"), units, and what happens on failure. + Add MCP annotations (`readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint`). +- **Fail with a useful message.** Throw an `Error` that tells the caller how to fix the call; + the SDK returns it as a tool error. +- **Never write to stdout** from the server: stdout carries the MCP protocol. Use stderr. +- **Keep the output Tiled-correct.** Object positions follow + [docs/map-format.md](docs/map-format.md#object-coordinates); check new output in Tiled or with + `npm run preview`. +- **No machine-specific paths.** Resolve paths through `tiled-mcp/src/paths.ts`. +- **Paid calls stay opt-in.** Anything that spends money must be explicit and must not repeat + work that already exists on disk. +- **Do not rename theme keys**: they name the asset folders and appear in existing maps. + +## Adding a theme + +See [docs/themes.md](docs/themes.md#adding-a-theme). + +## Pull requests + +1. One topic per pull request. +2. `npm run build && npm run smoke && npm run smoke:http` passes, and `npm run docs` shows no unexpected diff. +3. Update the README or `docs/` when behaviour changes, and add a line to `CHANGELOG.md`. + +By contributing you agree that your contribution is licensed under the [MIT license](LICENSE). diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..b49943d4017b5d580cca1bd427585ca6309cf326 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +# Hosted mode of Tiled Map Builder: the web page and the MCP tools over HTTP on one port. +# This is what runs on the Hugging Face Space (docs/hugging-face.md); it also runs anywhere: +# docker build -t tiled-map-builder . +# docker run -p 7860:7860 tiled-map-builder # then open http://localhost:7860 +# The image holds no token: every paid call uses the caller's own Hugging Face token. +FROM node:22-bookworm-slim + +WORKDIR /app +COPY package.json package-lock.json ./ +COPY tiled-mcp/package.json tiled-mcp/ +RUN npm ci --no-audit --no-fund + +COPY . . +RUN npm run build && npm prune --omit=dev --no-audit --no-fund + +ENV NODE_ENV=production HOST=0.0.0.0 PORT=7860 +# Spaces run containers as uid 1000, which is the image's "node" user. +USER node +EXPOSE 7860 +CMD ["node", "tiled-mcp/dist/http.js"] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..207420114bcd0f811588c852a99614b6ea0131bb --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Sinien Rahma + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index a4b6f340dde7a2ee8dcf01ef32c243298d4071d9..2dc6be53555b4607eb7be752bee601a6d2a2a0a2 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,308 @@ --- title: Tiled Map Builder -emoji: 👁 -colorFrom: pink -colorTo: purple +emoji: 🗺️ +colorFrom: indigo +colorTo: gray sdk: docker +app_port: 7860 pinned: false +license: mit +short_description: Describe a dungeon, get an isometric Tiled map +hf_oauth: true +hf_oauth_expiration_minutes: 480 +hf_oauth_scopes: + - inference-api +tags: + - mcp-server + - tiled + - map-generator + - isometric + - procedural-generation --- -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference +

+ Tiled Map Builder MCP: an isometric crypt room built from the project's sprites +

+ +

+ Node.js 20.9+ + TypeScript + Model Context Protocol + Tiled 1.10+ + Zod 4 + Hugging Face FLUX (optional) + Works with NVIDIA Nemotron + MIT license +

+ +

+ An MCP server that lets AI agents build isometric Tiled maps
+ rooms, corridors, doors, traps, chests and spawns, validated and saved as .tmj files you open in Tiled. +

+ +

+ Open in Hugging Face Spaces +

+ +

+ Try it online · + Quick start · + Connect a client · + Tool reference · + Map format · + Themes · + Troubleshooting +

+ +--- + +## ✨ 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. +- 📐 **Correct Tiled output**: object positions follow Tiled's isometric convention, and saved files point at their sprites with relative paths, so they open directly in Tiled. +- 🧠 **Agent skill and MCP prompt** (`map_builder`): a step-by-step workflow with an ASCII sketch confirmation, theme heuristics and tactical rules. +- 🖌️ **Optional sprite generation** with FLUX.1-dev through Hugging Face. It is paid, opt-in, and never runs by accident. +- 🔌 Works with **any MCP client**: Claude Code, Claude Desktop, Cursor, VS Code, Zed, OpenCode, and agents running NVIDIA Nemotron. +- 🤗 **Hosted on Hugging Face**: a web page where an open AI model builds a map from your description, and a remote MCP endpoint. Paid calls always run on the visitor's own Hugging Face account. + +## 🤗 Try it online + +No install: open the **[Tiled Map Builder Space](https://huggingface.co/spaces/4math/tiled-map-builder)**, +sign in with Hugging Face, describe a map in any language and download a `.zip` that opens in +Tiled. The AI model (default `openai/gpt-oss-120b`) runs on **your** Hugging Face inference +credits, usually a few cents per map; the Space owner pays nothing for your use and never sees +your token. + +AI agents can use the same Space as a remote MCP server with their own token: + +```bash +claude mcp add --transport http tiled-map-builder https://4math-tiled-map-builder.hf.space/mcp \ + --header "Authorization: Bearer hf_YOUR_TOKEN" +``` + +How it works, costs, other clients, and running your own copy: **[docs/hugging-face.md](docs/hugging-face.md)**. + +## 🖼️ Preview + +

+ Crypt built with generate_crypt_layout: entrance, nave, two side chambers and a deep crypt, with player, enemy, chest and trap markers +
A 28x18 crypt from generate_crypt_layout plus a few place_* calls. + Markers: P player, E enemy, D door, C chest, T trap. Rendered with npm run preview. +

+ +

+ 64x64 ice fortress sample map + 64x64 flooded cavern sample map +
Sample maps in maps/: an ice fortress and a flooded cavern, both 64x64. +

+ +## 🧱 Tech stack + +| | Technology | Role in this project | +|---|---|---| +| | [Model Context Protocol](https://modelcontextprotocol.io) | How agents discover and call the map tools (stdio locally, Streamable HTTP when hosted) | +| | [TypeScript](https://www.typescriptlang.org) | Server source in `tiled-mcp/src` | +| | [Node.js](https://nodejs.org) 20.9+ | Runtime for the server and the scripts | +| | [Zod](https://zod.dev) | Validates every tool input and generates the JSON schemas agents see | +| 🗺️ | [Tiled](https://www.mapeditor.org) | Map editor that opens the generated `.tmj` files | +| | [Hugging Face Inference Providers](https://huggingface.co/docs/inference-providers) | The hosted page's AI model (open LLMs with tool calling) and optional FLUX.1-dev sprites, billed to each user | +| | [Hugging Face Spaces](https://huggingface.co/docs/hub/spaces) | Hosts the web page and remote MCP endpoint (Docker Space with "Sign in with Hugging Face") | +| | [Docker](https://www.docker.com) | Image of the hosted mode, used by the Space and for self-hosting | +| 🖼️ | [sharp](https://sharp.pixelplumbing.com) | Background removal and resizing of generated sprites, PNG previews | +| | [NVIDIA Nemotron](https://build.nvidia.com) | One of the agent models this server was designed and tested with | + +## 🚀 Quick start + +**Requirements**: [Node.js](https://nodejs.org) 20.9 or newer and git. [Tiled](https://www.mapeditor.org) is optional, to view and edit the maps. + +```bash +git clone https://github.com/4math2379/Tiled-MCP-Server.git +cd Tiled-MCP-Server +npm install # installs the server workspace +npm run build # compiles tiled-mcp/src to tiled-mcp/dist +npm run smoke # optional: 38 offline end-to-end checks +``` + +Then register the server with your MCP client. With **Claude Code**, from the repository folder: + +```bash +claude mcp add tiled-map-builder -- node "$(pwd)/tiled-mcp/dist/index.js" +``` + +Most other clients take the same JSON block (replace the path with your absolute path): + +```json +{ + "mcpServers": { + "tiled-map-builder": { + "command": "node", + "args": ["/absolute/path/to/Tiled-MCP-Server/tiled-mcp/dist/index.js"] + } + } +} +``` + +👉 Per-client instructions for Claude Desktop, Cursor, VS Code, Zed, OpenCode, Windsurf and the MCP Inspector are in **[docs/client-setup.md](docs/client-setup.md)**. + +Now ask your agent: + +> Build a 28x18 crypt under an abandoned chapel with two skeletons in the nave, a locked chest in the north chamber and a dart trap before the deep crypt. Save it as crypt-chapel.tmj. + +The map lands in `maps/crypt-chapel.tmj`. Open it in Tiled, or render a preview without Tiled: + +```bash +npm run preview -- maps/crypt-chapel.tmj +``` + +## 🧭 How it works + +```mermaid +flowchart LR + A["AI agent
(Claude, Nemotron, ...)"] -- MCP tools --> S["tiled-map-builder
server"] + S --> M[("Maps in memory
ground · walls · decorations
objects · spawns")] + M --> V{"validate_map"} + V --> F["save_to_disk
maps/*.tmj"] + F --> T["Tiled editor
or a game engine"] +``` + +1. `create_map` makes an empty map in a **theme** and returns a `mapId`. +2. Tiles are painted by **role** (`walkable_floor`, `wall`, `hazard_primary`, `obstacle_decor`, ...) and the theme picks the sprite. +3. Each map has three tile layers, **ground**, **walls** and **decorations**, and two object layers, **objects** (doors, chests, traps, levers, stairs) and **spawns** (player, enemy, NPC). +4. Coordinates are grid cells: `x` is the column and `y` the row; (0,0) is the top corner of an isometric map. +5. Maps live in server memory until you call `save_to_disk` or `export_json`. + +Details, properties and importer formulas: **[docs/map-format.md](docs/map-format.md)**. + +## 🧰 Tools + +| Group | Tools | +|---|---| +| Map lifecycle | `list_themes` · `create_map` · `list_maps` · `describe_map` · `discard_map` | +| Painting | `paint_tile` · `paint_rect` · `paint_wall_border` · `erase_tile` · `get_tile_info` | +| Rooms and corridors | `generate_room` · `generate_corridor` | +| 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)**. + +## 🎨 Themes + +| Theme key | Display name | Setting | Sprites | +|---|---|---|---| +| `CRYPT` | Crypte mournevaldienne | Burial vaults, cracked flagstones, poison vents | ✅ | +| `CASTLE` | Castel Von Drak | Black marble halls, throne room, grand stairs | ✅ | +| `WEREWOLF_DEN` | Tanière de loups-garous | Damp caves, bones, blood pools | ✅ | +| `TAVERN_BLOOD_PRINCE` | Auberge du Prince Sanglant | Tavern interior, oak tables, hearth | ✅ | +| `VILLAGE` | Village mournevaldien | Wet cobblestones, half-timbered houses, well | ✅ | +| `HAUNTED_FOREST` | Forêt de Drakenmark | Dark undergrowth, brambles, parasitic mist | ✅ | +| `MAUSOLEUM` | Mausolée | Veined marble, fallen-angel statues, urns | ✅ | +| `BLOOD_TOMB` | Tombeau de sang | Ritual sanctuary, bleeding runes, altar | ✅ | +| `AQUATIC` | Eaux Croupies | Stagnant water, water lilies, sunken ruins | ✅ | +| `GLACIAIRE` | Toundra Glacée | Black ice, frozen statues, thin ice | ✅ | +| `INONDE` | Cote Inondee | Drowned city, kelp, deep currents | ✅ | +| `ELECTRONIQUE` | Reseau Electronique | Circuit boards, cables, mainframe cores | ✅ | +| `VOLCAN` | Pente Volcanique | Lava flows, obsidian, ash | ➖ | +| `FORET` | Foret Sombre | Twisted woods, quicksand, standing stones | ➖ | +| `HIVER` | Plaine Enneigee | Snowfields, frozen lakes, cairns | ➖ | +| `PRINTEMPS` | Prairie Printaniere | Flowering meadows, streams, maypole | ➖ | +| `ETE` | Plaine Estivale | Golden wheat, cracked earth, scarecrows | ➖ | +| `AUTOMNE` | Foret d'Automne | Russet leaves, bog mire, mushrooms | ➖ | +| `DESOLATION` | Terre Desolee | Ash pits, charred trees, ruins | ➖ | +| `FUTURISTE` | Cite Futuriste | Chrome, neon, plasma leaks, server racks | ➖ | + +✅ sprites bundled in `assets/` · ➖ no sprites yet: the maps are valid and Tiled shows placeholders until you [generate the sprites](docs/sprite-generation.md). + +

+ crypt floor + crypt wall + sarcophagus + throne + castle stairs + boulder + deep water + frozen statue + mainframe core + fallen angel statue +

+ +More about each theme's roles and hazards: **[docs/themes.md](docs/themes.md)**. + +## 🤖 Agent skill and prompt + +[`skills/map-builder/SKILL.md`](skills/map-builder/SKILL.md) teaches an agent the whole workflow: infer the theme, sketch the layout in ASCII and ask for confirmation, build, validate, save. + +- **Claude Code**: copy the folder to `~/.claude/skills/map-builder/` (all projects) or `.claude/skills/map-builder/` (one project), then type `/map-builder crypt 28x18 ...`. +- **Any MCP client**: the server exposes the same workflow as the prompt **`map_builder`**, which takes a free-form `description`. + +## ⚙️ Configuration + +Nothing is required for map building. Optional settings go in `tiled-mcp/.env` (copy [`tiled-mcp/.env.example`](tiled-mcp/.env.example)) or in the `env` block of your MCP client: + +| Variable | Default | Purpose | +|---|---|---| +| `TILED_MAPS_DIR` | `maps/` | Where `save_to_disk` writes relative paths | +| `TILED_ASSETS_DIR` | `assets/` | Sprite folder (`/.png`) | +| `TILED_OBJECT_COORDS` | `tiled` | `screen` restores the legacy object encoding for older importers | +| `HUGGINGFACE_API_KEY` or `HF_TOKEN` | none | Only for paid sprite generation | + +All variables, the hosted-mode settings, the `.env` lookup order and security notes: **[docs/configuration.md](docs/configuration.md)**. + +## 💸 Sprite generation (optional, paid) + +Map building is free and offline. Generating new sprites calls FLUX.1-dev through Hugging Face Inference Providers and **costs money per sprite**. The tools never overwrite an existing sprite unless you pass `force`, and the batch script asks for `--yes`: + +```bash +node scripts/gen-theme-set.mjs VOLCAN --dry-run # free: shows what would be generated +node scripts/gen-theme-set.mjs VOLCAN --yes # paid: about 10 sprites +``` + +Read **[docs/sprite-generation.md](docs/sprite-generation.md)** before you start. + +## 🟩 Using it with NVIDIA Nemotron + +The server works with any model that supports tool calling. It was built alongside agents running **Nemotron 3.5 Super-VL** on the NVIDIA API free tier, for example through OpenCode. The NVIDIA key belongs to your agent, not to this server. Setup: **[docs/nemotron.md](docs/nemotron.md)**. + +## 🗂️ Repository layout + +``` +tiled-mcp/ MCP server (TypeScript): src/, package.json, tsconfig.json, .env.example + src/tools/ tool groups: lifecycle, paint, procedural, layout-presets, objects, export, generation + src/themes/ 20 theme definitions and the FLUX prompt catalog + src/http.ts hosted mode: web page, web AI agent, MCP over HTTP, Hugging Face sign-in + web/ the hosted web page (HTML, CSS, JS) +huggingface/ Space card and the script that publishes this repository to the Space +Dockerfile image of the hosted mode (used by the Space) +skills/map-builder/ agent skill, also served as the map_builder MCP prompt +maps/ sample .tmj maps (default output folder of save_to_disk) +assets/ isometric sprites per theme: /.png +scripts/ example map scripts, preview renderer, sprite batch, docs generator, smoke test +docs/ documentation, banner and preview images +``` + +## 🛠️ Scripts + +| 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 -- ` | 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 --yes` | Generate a theme's missing sprites (paid) | + +## 🤝 Contributing + +Issues and pull requests are welcome. See **[CONTRIBUTING.md](CONTRIBUTING.md)** for the development loop and **[CHANGELOG.md](CHANGELOG.md)** for what changed. + +## 📄 License + +[MIT](LICENSE). Tiled is an independent project by Thorbjørn Lindeijer. Some theme names evoke classic gothic-horror settings; this project is not affiliated with or endorsed by their rights holders. diff --git a/assets/aquatic/decoration_minor.png b/assets/aquatic/decoration_minor.png new file mode 100644 index 0000000000000000000000000000000000000000..0ef0e29d13ed56bba2582ea0ea641c4ad163f4e8 Binary files /dev/null and b/assets/aquatic/decoration_minor.png differ diff --git a/assets/aquatic/difficult_terrain.png b/assets/aquatic/difficult_terrain.png new file mode 100644 index 0000000000000000000000000000000000000000..6a4a3cf6a0c872c4ef0b613aefa70630c0f2ea3f Binary files /dev/null and b/assets/aquatic/difficult_terrain.png differ diff --git a/assets/aquatic/door_closed.png b/assets/aquatic/door_closed.png new file mode 100644 index 0000000000000000000000000000000000000000..1789ec4743a8b9e5455a5c0c339282bd33a1edca Binary files /dev/null and b/assets/aquatic/door_closed.png differ diff --git a/assets/aquatic/hazard_primary.png b/assets/aquatic/hazard_primary.png new file mode 100644 index 0000000000000000000000000000000000000000..7cb8d05cd0c4177d8b3e87e56acca5120425752f Binary files /dev/null and b/assets/aquatic/hazard_primary.png differ diff --git a/assets/aquatic/obstacle_decor.png b/assets/aquatic/obstacle_decor.png new file mode 100644 index 0000000000000000000000000000000000000000..f3cabd8de34a6044d2d0299a80af2617bde4ec84 Binary files /dev/null and b/assets/aquatic/obstacle_decor.png differ diff --git a/assets/aquatic/stairs.png b/assets/aquatic/stairs.png new file mode 100644 index 0000000000000000000000000000000000000000..07252905d151a425806e0af72c70e764a2cee85d Binary files /dev/null and b/assets/aquatic/stairs.png differ diff --git a/assets/aquatic/walkable_floor.png b/assets/aquatic/walkable_floor.png new file mode 100644 index 0000000000000000000000000000000000000000..2ac9e07a7c87908dbbec7b5b7529530188699546 Binary files /dev/null and b/assets/aquatic/walkable_floor.png differ diff --git a/assets/aquatic/walkable_floor_alt.png b/assets/aquatic/walkable_floor_alt.png new file mode 100644 index 0000000000000000000000000000000000000000..6fc9e7814c8940f3b449e930c9d090484b197a08 Binary files /dev/null and b/assets/aquatic/walkable_floor_alt.png differ diff --git a/assets/aquatic/wall.png b/assets/aquatic/wall.png new file mode 100644 index 0000000000000000000000000000000000000000..d45df7c16d8cd2f9a7a466aa13542e7245406939 Binary files /dev/null and b/assets/aquatic/wall.png differ diff --git a/assets/aquatic/wall_corner.png b/assets/aquatic/wall_corner.png new file mode 100644 index 0000000000000000000000000000000000000000..4a74aec72f06b3f7795592471509e1e53521a3d3 Binary files /dev/null and b/assets/aquatic/wall_corner.png differ diff --git a/assets/blood_tomb/decoration_minor.png b/assets/blood_tomb/decoration_minor.png new file mode 100644 index 0000000000000000000000000000000000000000..8f00f4a02e40dfcb16632eb2cd8dcfbee4c5d519 Binary files /dev/null and b/assets/blood_tomb/decoration_minor.png differ diff --git a/assets/blood_tomb/difficult_terrain.png b/assets/blood_tomb/difficult_terrain.png new file mode 100644 index 0000000000000000000000000000000000000000..1d33ed001321b64fb6338a7251da4d55f0eb7906 Binary files /dev/null and b/assets/blood_tomb/difficult_terrain.png differ diff --git a/assets/blood_tomb/door_closed.png b/assets/blood_tomb/door_closed.png new file mode 100644 index 0000000000000000000000000000000000000000..41dea00d9538eaa4eb07af813fab8dcab9b97c6f Binary files /dev/null and b/assets/blood_tomb/door_closed.png differ diff --git a/assets/blood_tomb/hazard_primary.png b/assets/blood_tomb/hazard_primary.png new file mode 100644 index 0000000000000000000000000000000000000000..98ef0167661079cb6def0536794f7eee8d328749 Binary files /dev/null and b/assets/blood_tomb/hazard_primary.png differ diff --git a/assets/blood_tomb/obstacle_decor.png b/assets/blood_tomb/obstacle_decor.png new file mode 100644 index 0000000000000000000000000000000000000000..50dbd1be9e973c3565cc737fa42dac820dd9332b Binary files /dev/null and b/assets/blood_tomb/obstacle_decor.png differ diff --git a/assets/blood_tomb/walkable_floor.png b/assets/blood_tomb/walkable_floor.png new file mode 100644 index 0000000000000000000000000000000000000000..5ba5aa76e11bc863aa1c810ea97ffcbb7e35ae19 Binary files /dev/null and b/assets/blood_tomb/walkable_floor.png differ diff --git a/assets/blood_tomb/walkable_floor_alt.png b/assets/blood_tomb/walkable_floor_alt.png new file mode 100644 index 0000000000000000000000000000000000000000..ad60cb0b73d058ae54f8cd1789fdd67966cc750f Binary files /dev/null and b/assets/blood_tomb/walkable_floor_alt.png differ diff --git a/assets/blood_tomb/wall.png b/assets/blood_tomb/wall.png new file mode 100644 index 0000000000000000000000000000000000000000..584d0fe03f237e0f25f60968d417eccc410c8c79 Binary files /dev/null and b/assets/blood_tomb/wall.png differ diff --git a/assets/castle/decoration_minor.png b/assets/castle/decoration_minor.png new file mode 100644 index 0000000000000000000000000000000000000000..ce89f0b8cc5e9c4698fce2dd5a7a80b0b91ff15c Binary files /dev/null and b/assets/castle/decoration_minor.png differ diff --git a/assets/castle/decoration_minor__fine_china.png b/assets/castle/decoration_minor__fine_china.png new file mode 100644 index 0000000000000000000000000000000000000000..6f2211f5e6e8be24f9d1ea3d891a486fb785f600 Binary files /dev/null and b/assets/castle/decoration_minor__fine_china.png differ diff --git a/assets/castle/difficult_terrain.png b/assets/castle/difficult_terrain.png new file mode 100644 index 0000000000000000000000000000000000000000..74f690022c673d2e667f071b09c5f9cc1c83c6ad Binary files /dev/null and b/assets/castle/difficult_terrain.png differ diff --git a/assets/castle/door_closed.png b/assets/castle/door_closed.png new file mode 100644 index 0000000000000000000000000000000000000000..72fcd79bd4e18e3371376be335f90c09d6689576 Binary files /dev/null and b/assets/castle/door_closed.png differ diff --git a/assets/castle/obstacle_decor.png b/assets/castle/obstacle_decor.png new file mode 100644 index 0000000000000000000000000000000000000000..907595f9178cbbc1e9d72385432755c7bb5acba9 Binary files /dev/null and b/assets/castle/obstacle_decor.png differ diff --git a/assets/castle/obstacle_decor__banquet_table.png b/assets/castle/obstacle_decor__banquet_table.png new file mode 100644 index 0000000000000000000000000000000000000000..a48cb5152bbdd2e8d050f2ccba473db8804873a8 Binary files /dev/null and b/assets/castle/obstacle_decor__banquet_table.png differ diff --git a/assets/castle/stairs.png b/assets/castle/stairs.png new file mode 100644 index 0000000000000000000000000000000000000000..cb24aae0fb09e97e83edb34d669b713c02ffbd15 Binary files /dev/null and b/assets/castle/stairs.png differ diff --git a/assets/castle/walkable_floor.png b/assets/castle/walkable_floor.png new file mode 100644 index 0000000000000000000000000000000000000000..0629ddd47e19789ae695aff5998b3b5b496a66d4 Binary files /dev/null and b/assets/castle/walkable_floor.png differ diff --git a/assets/castle/walkable_floor_alt.png b/assets/castle/walkable_floor_alt.png new file mode 100644 index 0000000000000000000000000000000000000000..ffedd2c1a7bfe07d516a62668a8852866a1f2f98 Binary files /dev/null and b/assets/castle/walkable_floor_alt.png differ diff --git a/assets/castle/wall.png b/assets/castle/wall.png new file mode 100644 index 0000000000000000000000000000000000000000..c1e286947664f1b724c86adfd21c40e40174dea6 Binary files /dev/null and b/assets/castle/wall.png differ diff --git a/assets/castle/wall_corner.png b/assets/castle/wall_corner.png new file mode 100644 index 0000000000000000000000000000000000000000..1267adade06606ad1c7e0f57c63e3269cdf582a6 Binary files /dev/null and b/assets/castle/wall_corner.png differ diff --git a/assets/crypt/decoration_minor.png b/assets/crypt/decoration_minor.png new file mode 100644 index 0000000000000000000000000000000000000000..45ba93988f010abce28aaf3118cdf5e063c0c1ce Binary files /dev/null and b/assets/crypt/decoration_minor.png differ diff --git a/assets/crypt/difficult_terrain.png b/assets/crypt/difficult_terrain.png new file mode 100644 index 0000000000000000000000000000000000000000..4e076d431fa30b6e962ad70a1b590566787250b8 Binary files /dev/null and b/assets/crypt/difficult_terrain.png differ diff --git a/assets/crypt/door_closed.png b/assets/crypt/door_closed.png new file mode 100644 index 0000000000000000000000000000000000000000..0f59a86ac94494027523a3e13d1040a40415aefa Binary files /dev/null and b/assets/crypt/door_closed.png differ diff --git a/assets/crypt/hazard_primary.png b/assets/crypt/hazard_primary.png new file mode 100644 index 0000000000000000000000000000000000000000..69af26f72624f06cab67a56ecdc2a77269a1463a Binary files /dev/null and b/assets/crypt/hazard_primary.png differ diff --git a/assets/crypt/obstacle_decor.png b/assets/crypt/obstacle_decor.png new file mode 100644 index 0000000000000000000000000000000000000000..8a8e020449a105b29bfd1dc824f82bc5843e6b6f Binary files /dev/null and b/assets/crypt/obstacle_decor.png differ diff --git a/assets/crypt/stairs.png b/assets/crypt/stairs.png new file mode 100644 index 0000000000000000000000000000000000000000..b4286245f8b775b09f28f8c4f60ae19e3971d379 Binary files /dev/null and b/assets/crypt/stairs.png differ diff --git a/assets/crypt/walkable_floor.png b/assets/crypt/walkable_floor.png new file mode 100644 index 0000000000000000000000000000000000000000..c2e2870a63f0285a48535e6a1d8cf1438de7e88e Binary files /dev/null and b/assets/crypt/walkable_floor.png differ diff --git a/assets/crypt/walkable_floor_alt.png b/assets/crypt/walkable_floor_alt.png new file mode 100644 index 0000000000000000000000000000000000000000..efc9ad5152cbe18e167d90cb28e81e3feca6910d Binary files /dev/null and b/assets/crypt/walkable_floor_alt.png differ diff --git a/assets/crypt/wall.png b/assets/crypt/wall.png new file mode 100644 index 0000000000000000000000000000000000000000..df990d7be7417e84b58215dac1ab31d300584533 Binary files /dev/null and b/assets/crypt/wall.png differ diff --git a/assets/crypt/wall_corner.png b/assets/crypt/wall_corner.png new file mode 100644 index 0000000000000000000000000000000000000000..261c495fbb62334228da60c570484037200fd046 Binary files /dev/null and b/assets/crypt/wall_corner.png differ diff --git a/assets/electronique/decoration_minor.png b/assets/electronique/decoration_minor.png new file mode 100644 index 0000000000000000000000000000000000000000..930235d66905e06d2ef2f38d7aa538bf968ccbe1 Binary files /dev/null and b/assets/electronique/decoration_minor.png differ diff --git a/assets/electronique/difficult_terrain.png b/assets/electronique/difficult_terrain.png new file mode 100644 index 0000000000000000000000000000000000000000..0f68dd48d6974e0fc084649325fe119df35fa80d Binary files /dev/null and b/assets/electronique/difficult_terrain.png differ diff --git a/assets/electronique/door_closed.png b/assets/electronique/door_closed.png new file mode 100644 index 0000000000000000000000000000000000000000..9b880c546038f5e264d2286a2cc9b0b5e4dbe14d Binary files /dev/null and b/assets/electronique/door_closed.png differ diff --git a/assets/electronique/hazard_primary.png b/assets/electronique/hazard_primary.png new file mode 100644 index 0000000000000000000000000000000000000000..954f4dc2d1ffee47f1021dd8595b66c4ddada6fd Binary files /dev/null and b/assets/electronique/hazard_primary.png differ diff --git a/assets/electronique/obstacle_decor.png b/assets/electronique/obstacle_decor.png new file mode 100644 index 0000000000000000000000000000000000000000..451ece9d2a5ecaafb60ff72aaca2214385202cc7 Binary files /dev/null and b/assets/electronique/obstacle_decor.png differ diff --git a/assets/electronique/stairs.png b/assets/electronique/stairs.png new file mode 100644 index 0000000000000000000000000000000000000000..f49a6accb7f444d8fc6ab8039ed3884adeac3b3b Binary files /dev/null and b/assets/electronique/stairs.png differ diff --git a/assets/electronique/walkable_floor.png b/assets/electronique/walkable_floor.png new file mode 100644 index 0000000000000000000000000000000000000000..57d397cb3b0da4f66b5359aba51ec75b0ba91e7d Binary files /dev/null and b/assets/electronique/walkable_floor.png differ diff --git a/assets/electronique/walkable_floor_alt.png b/assets/electronique/walkable_floor_alt.png new file mode 100644 index 0000000000000000000000000000000000000000..fc1d0c1015b1c1b989fc453bdcc5d26fa066e7d2 Binary files /dev/null and b/assets/electronique/walkable_floor_alt.png differ diff --git a/assets/electronique/wall.png b/assets/electronique/wall.png new file mode 100644 index 0000000000000000000000000000000000000000..75ab6fdeaf674b337cc190ffbb3ccec8695a9bd1 Binary files /dev/null and b/assets/electronique/wall.png differ diff --git a/assets/electronique/wall_corner.png b/assets/electronique/wall_corner.png new file mode 100644 index 0000000000000000000000000000000000000000..14e6f2e37c126b41eb68afc269b7a3b97894d811 Binary files /dev/null and b/assets/electronique/wall_corner.png differ diff --git a/assets/glaciaire/decoration_minor.png b/assets/glaciaire/decoration_minor.png new file mode 100644 index 0000000000000000000000000000000000000000..a5bd3f6ac4479c2f52a516110e5d3d95857264ee Binary files /dev/null and b/assets/glaciaire/decoration_minor.png differ diff --git a/assets/glaciaire/difficult_terrain.png b/assets/glaciaire/difficult_terrain.png new file mode 100644 index 0000000000000000000000000000000000000000..f1112e00ea6895db9d94a7e7d654465d8d306c2c Binary files /dev/null and b/assets/glaciaire/difficult_terrain.png differ diff --git a/assets/glaciaire/door_closed.png b/assets/glaciaire/door_closed.png new file mode 100644 index 0000000000000000000000000000000000000000..d7731c80e4e8426fd4d2c59d32dd22c6f65cf872 Binary files /dev/null and b/assets/glaciaire/door_closed.png differ diff --git a/assets/glaciaire/hazard_primary.png b/assets/glaciaire/hazard_primary.png new file mode 100644 index 0000000000000000000000000000000000000000..d5c18d713fbf101120df4587dd0007ffa9298b9c Binary files /dev/null and b/assets/glaciaire/hazard_primary.png differ diff --git a/assets/glaciaire/obstacle_decor.png b/assets/glaciaire/obstacle_decor.png new file mode 100644 index 0000000000000000000000000000000000000000..c1277c4f241609e2602bcd6c2d5ebe8272e36311 Binary files /dev/null and b/assets/glaciaire/obstacle_decor.png differ diff --git a/assets/glaciaire/stairs.png b/assets/glaciaire/stairs.png new file mode 100644 index 0000000000000000000000000000000000000000..16a288fc3050ec7b2ff822b425c22d3b93e47fd5 Binary files /dev/null and b/assets/glaciaire/stairs.png differ diff --git a/assets/glaciaire/walkable_floor.png b/assets/glaciaire/walkable_floor.png new file mode 100644 index 0000000000000000000000000000000000000000..dba5b1a99cc12f10415afc79b5f9c74b0a7d70ee Binary files /dev/null and b/assets/glaciaire/walkable_floor.png differ diff --git a/assets/glaciaire/walkable_floor_alt.png b/assets/glaciaire/walkable_floor_alt.png new file mode 100644 index 0000000000000000000000000000000000000000..f5ddecd86592f89279d2f826cb14ca49bc2a006f Binary files /dev/null and b/assets/glaciaire/walkable_floor_alt.png differ diff --git a/assets/glaciaire/wall.png b/assets/glaciaire/wall.png new file mode 100644 index 0000000000000000000000000000000000000000..836caec5c546faca200e3037dfdb12e263c8b738 Binary files /dev/null and b/assets/glaciaire/wall.png differ diff --git a/assets/glaciaire/wall_corner.png b/assets/glaciaire/wall_corner.png new file mode 100644 index 0000000000000000000000000000000000000000..184bf59c15f9998831d1193066da17720a838a48 Binary files /dev/null and b/assets/glaciaire/wall_corner.png differ diff --git a/assets/haunted_forest/decoration_minor.png b/assets/haunted_forest/decoration_minor.png new file mode 100644 index 0000000000000000000000000000000000000000..ddc23f26466c9c7ab6a74035167139517642608e Binary files /dev/null and b/assets/haunted_forest/decoration_minor.png differ diff --git a/assets/haunted_forest/difficult_terrain.png b/assets/haunted_forest/difficult_terrain.png new file mode 100644 index 0000000000000000000000000000000000000000..e7340c9b907aafb4bd2419f7e0555a79cc9f12b8 Binary files /dev/null and b/assets/haunted_forest/difficult_terrain.png differ diff --git a/assets/haunted_forest/hazard_primary.png b/assets/haunted_forest/hazard_primary.png new file mode 100644 index 0000000000000000000000000000000000000000..e8c9e95441bcb98f9c073171ea77a831906b201f Binary files /dev/null and b/assets/haunted_forest/hazard_primary.png differ diff --git a/assets/haunted_forest/obstacle_decor.png b/assets/haunted_forest/obstacle_decor.png new file mode 100644 index 0000000000000000000000000000000000000000..4e68b3bfc329f985ffc2bd964d515ba7f8e50725 Binary files /dev/null and b/assets/haunted_forest/obstacle_decor.png differ diff --git a/assets/haunted_forest/walkable_floor.png b/assets/haunted_forest/walkable_floor.png new file mode 100644 index 0000000000000000000000000000000000000000..b4a0c78f6dafb5b6b6d6c2035a4218f74e70b100 Binary files /dev/null and b/assets/haunted_forest/walkable_floor.png differ diff --git a/assets/haunted_forest/walkable_floor_alt.png b/assets/haunted_forest/walkable_floor_alt.png new file mode 100644 index 0000000000000000000000000000000000000000..a94f85b8d1043563fdcf0459d0e0b2939c62bec5 Binary files /dev/null and b/assets/haunted_forest/walkable_floor_alt.png differ diff --git a/assets/haunted_forest/wall.png b/assets/haunted_forest/wall.png new file mode 100644 index 0000000000000000000000000000000000000000..5cb1d5b6da7b7adf7fcd76dfbfb2894e617ac345 Binary files /dev/null and b/assets/haunted_forest/wall.png differ diff --git a/assets/inonde/decoration_minor.png b/assets/inonde/decoration_minor.png new file mode 100644 index 0000000000000000000000000000000000000000..994379eae2c1676a1f480306d38a6f272d9d3b24 Binary files /dev/null and b/assets/inonde/decoration_minor.png differ diff --git a/assets/inonde/difficult_terrain.png b/assets/inonde/difficult_terrain.png new file mode 100644 index 0000000000000000000000000000000000000000..dbee1a1e3a80d93c36441992daadc0913598e172 Binary files /dev/null and b/assets/inonde/difficult_terrain.png differ diff --git a/assets/inonde/door_closed.png b/assets/inonde/door_closed.png new file mode 100644 index 0000000000000000000000000000000000000000..91c5b5cc5f31f40e81a15da598869fd5398ccbd2 Binary files /dev/null and b/assets/inonde/door_closed.png differ diff --git a/assets/inonde/hazard_primary.png b/assets/inonde/hazard_primary.png new file mode 100644 index 0000000000000000000000000000000000000000..228fe65e26d1b3c906d10621cfc90df088e35729 Binary files /dev/null and b/assets/inonde/hazard_primary.png differ diff --git a/assets/inonde/obstacle_decor.png b/assets/inonde/obstacle_decor.png new file mode 100644 index 0000000000000000000000000000000000000000..adc358f3e93371d7d92e8096b9674fa88fc141c8 Binary files /dev/null and b/assets/inonde/obstacle_decor.png differ diff --git a/assets/inonde/stairs.png b/assets/inonde/stairs.png new file mode 100644 index 0000000000000000000000000000000000000000..ab4c986663ff8f3f10e6e60edd36856b626c2133 Binary files /dev/null and b/assets/inonde/stairs.png differ diff --git a/assets/inonde/walkable_floor.png b/assets/inonde/walkable_floor.png new file mode 100644 index 0000000000000000000000000000000000000000..0d901255a65d81ff36c3540c71593858952089cb Binary files /dev/null and b/assets/inonde/walkable_floor.png differ diff --git a/assets/inonde/walkable_floor_alt.png b/assets/inonde/walkable_floor_alt.png new file mode 100644 index 0000000000000000000000000000000000000000..376a00f554675e1a1095c1afc656217cfd00a853 Binary files /dev/null and b/assets/inonde/walkable_floor_alt.png differ diff --git a/assets/inonde/wall.png b/assets/inonde/wall.png new file mode 100644 index 0000000000000000000000000000000000000000..2a561b5891a6e096b9b2006ecfc8d5f13785f476 Binary files /dev/null and b/assets/inonde/wall.png differ diff --git a/assets/inonde/wall_corner.png b/assets/inonde/wall_corner.png new file mode 100644 index 0000000000000000000000000000000000000000..6a3e54d65f74599bbf0e9fee318359b31624b252 Binary files /dev/null and b/assets/inonde/wall_corner.png differ diff --git a/assets/mausoleum/decoration_minor.png b/assets/mausoleum/decoration_minor.png new file mode 100644 index 0000000000000000000000000000000000000000..a294e04bc33bdc71895997ed43b0fa6b8c34a797 Binary files /dev/null and b/assets/mausoleum/decoration_minor.png differ diff --git a/assets/mausoleum/difficult_terrain.png b/assets/mausoleum/difficult_terrain.png new file mode 100644 index 0000000000000000000000000000000000000000..43ddf678b42cb6c27c21bb9162762e20123293c0 Binary files /dev/null and b/assets/mausoleum/difficult_terrain.png differ diff --git a/assets/mausoleum/door_closed.png b/assets/mausoleum/door_closed.png new file mode 100644 index 0000000000000000000000000000000000000000..476e424a76555952a339818a5bfc735febd84141 Binary files /dev/null and b/assets/mausoleum/door_closed.png differ diff --git a/assets/mausoleum/obstacle_decor.png b/assets/mausoleum/obstacle_decor.png new file mode 100644 index 0000000000000000000000000000000000000000..c87cb0775a2f76791346da5fcddf752f6ec73a64 Binary files /dev/null and b/assets/mausoleum/obstacle_decor.png differ diff --git a/assets/mausoleum/stairs.png b/assets/mausoleum/stairs.png new file mode 100644 index 0000000000000000000000000000000000000000..79242b0b470412ef132d31332aae4246fd367371 Binary files /dev/null and b/assets/mausoleum/stairs.png differ diff --git a/assets/mausoleum/walkable_floor.png b/assets/mausoleum/walkable_floor.png new file mode 100644 index 0000000000000000000000000000000000000000..108a4d1beb077ef7078d26baab44a5e4dbbf6682 Binary files /dev/null and b/assets/mausoleum/walkable_floor.png differ diff --git a/assets/mausoleum/walkable_floor_alt.png b/assets/mausoleum/walkable_floor_alt.png new file mode 100644 index 0000000000000000000000000000000000000000..9083bd4fbfe053bdd932883ac1fb0eb4f4ebde9b Binary files /dev/null and b/assets/mausoleum/walkable_floor_alt.png differ diff --git a/assets/mausoleum/wall.png b/assets/mausoleum/wall.png new file mode 100644 index 0000000000000000000000000000000000000000..c33c013dfdbadf74f06b54fafb12fa261ded3285 Binary files /dev/null and b/assets/mausoleum/wall.png differ diff --git a/assets/tavern_blood_prince/decoration_minor.png b/assets/tavern_blood_prince/decoration_minor.png new file mode 100644 index 0000000000000000000000000000000000000000..3239b7d3725d812f50fd10a871c7f225b7de7495 Binary files /dev/null and b/assets/tavern_blood_prince/decoration_minor.png differ diff --git a/assets/tavern_blood_prince/difficult_terrain.png b/assets/tavern_blood_prince/difficult_terrain.png new file mode 100644 index 0000000000000000000000000000000000000000..900ade8119e21754501c88f532c80fbed1f2dbef Binary files /dev/null and b/assets/tavern_blood_prince/difficult_terrain.png differ diff --git a/assets/tavern_blood_prince/door_closed.png b/assets/tavern_blood_prince/door_closed.png new file mode 100644 index 0000000000000000000000000000000000000000..b98ec18f2fda922f62b7ea6ac0f3e84bf1996f09 Binary files /dev/null and b/assets/tavern_blood_prince/door_closed.png differ diff --git a/assets/tavern_blood_prince/obstacle_decor.png b/assets/tavern_blood_prince/obstacle_decor.png new file mode 100644 index 0000000000000000000000000000000000000000..e9f3ddd0490831063f815b334ed6781d8e48c4db Binary files /dev/null and b/assets/tavern_blood_prince/obstacle_decor.png differ diff --git a/assets/tavern_blood_prince/stairs.png b/assets/tavern_blood_prince/stairs.png new file mode 100644 index 0000000000000000000000000000000000000000..9bad31d7f191a702a4954dfc87971de8d7dc69cd Binary files /dev/null and b/assets/tavern_blood_prince/stairs.png differ diff --git a/assets/tavern_blood_prince/walkable_floor.png b/assets/tavern_blood_prince/walkable_floor.png new file mode 100644 index 0000000000000000000000000000000000000000..60a25c9a5322328e17d0d710b716ad594955fbf0 Binary files /dev/null and b/assets/tavern_blood_prince/walkable_floor.png differ diff --git a/assets/tavern_blood_prince/walkable_floor_alt.png b/assets/tavern_blood_prince/walkable_floor_alt.png new file mode 100644 index 0000000000000000000000000000000000000000..4b3c4a2ed61228adf516b1f936effafd42581ce2 Binary files /dev/null and b/assets/tavern_blood_prince/walkable_floor_alt.png differ diff --git a/assets/tavern_blood_prince/wall.png b/assets/tavern_blood_prince/wall.png new file mode 100644 index 0000000000000000000000000000000000000000..7ea5283571147b6402151a133c7881ffd1c462ea Binary files /dev/null and b/assets/tavern_blood_prince/wall.png differ diff --git a/assets/village/decoration_minor.png b/assets/village/decoration_minor.png new file mode 100644 index 0000000000000000000000000000000000000000..fe76c8beb4d5e9df10daeb212ee3873bd114868d Binary files /dev/null and b/assets/village/decoration_minor.png differ diff --git a/assets/village/difficult_terrain.png b/assets/village/difficult_terrain.png new file mode 100644 index 0000000000000000000000000000000000000000..e95352e73444dca1942f1ad5d5b390b4657c8560 Binary files /dev/null and b/assets/village/difficult_terrain.png differ diff --git a/assets/village/door_closed.png b/assets/village/door_closed.png new file mode 100644 index 0000000000000000000000000000000000000000..7f8d5c5697aa6606351a39d350f44571498f7da4 Binary files /dev/null and b/assets/village/door_closed.png differ diff --git a/assets/village/obstacle_decor.png b/assets/village/obstacle_decor.png new file mode 100644 index 0000000000000000000000000000000000000000..e0cf1a26df387cbf9e12a54d7b55ba6513614c21 Binary files /dev/null and b/assets/village/obstacle_decor.png differ diff --git a/assets/village/walkable_floor.png b/assets/village/walkable_floor.png new file mode 100644 index 0000000000000000000000000000000000000000..4e4d2360bd38136719858fb6cb3175aba03cb5fe Binary files /dev/null and b/assets/village/walkable_floor.png differ diff --git a/assets/village/walkable_floor_alt.png b/assets/village/walkable_floor_alt.png new file mode 100644 index 0000000000000000000000000000000000000000..5aa6c0d8e980d63c94f3694355d94891b147f7b0 Binary files /dev/null and b/assets/village/walkable_floor_alt.png differ diff --git a/assets/village/wall.png b/assets/village/wall.png new file mode 100644 index 0000000000000000000000000000000000000000..dd03d317c71bb17e28de86db1b965d1171223483 Binary files /dev/null and b/assets/village/wall.png differ diff --git a/assets/werewolf_den/decoration_minor.png b/assets/werewolf_den/decoration_minor.png new file mode 100644 index 0000000000000000000000000000000000000000..41d4ee7f8e89cada3e51d7e35c616d539f1d3b51 Binary files /dev/null and b/assets/werewolf_den/decoration_minor.png differ diff --git a/assets/werewolf_den/difficult_terrain.png b/assets/werewolf_den/difficult_terrain.png new file mode 100644 index 0000000000000000000000000000000000000000..9bda27a4714fafa4c1927add2d129ce164403096 Binary files /dev/null and b/assets/werewolf_den/difficult_terrain.png differ diff --git a/assets/werewolf_den/door_closed.png b/assets/werewolf_den/door_closed.png new file mode 100644 index 0000000000000000000000000000000000000000..71c662495984e64c2b7267e024dbbb49baa62547 Binary files /dev/null and b/assets/werewolf_den/door_closed.png differ diff --git a/assets/werewolf_den/hazard_primary.png b/assets/werewolf_den/hazard_primary.png new file mode 100644 index 0000000000000000000000000000000000000000..e8387bda2d571418599f93053d689e1c9db453f3 Binary files /dev/null and b/assets/werewolf_den/hazard_primary.png differ diff --git a/assets/werewolf_den/obstacle_decor.png b/assets/werewolf_den/obstacle_decor.png new file mode 100644 index 0000000000000000000000000000000000000000..02d862ca02ee14bd7b9314e52069c7f12adf6c36 Binary files /dev/null and b/assets/werewolf_den/obstacle_decor.png differ diff --git a/assets/werewolf_den/walkable_floor.png b/assets/werewolf_den/walkable_floor.png new file mode 100644 index 0000000000000000000000000000000000000000..e75a694df4d5957dade0163966a5eb70797b4eee Binary files /dev/null and b/assets/werewolf_den/walkable_floor.png differ diff --git a/assets/werewolf_den/walkable_floor_alt.png b/assets/werewolf_den/walkable_floor_alt.png new file mode 100644 index 0000000000000000000000000000000000000000..1709ae80bbbc99a1a7429102f6f6ee50c070e904 Binary files /dev/null and b/assets/werewolf_den/walkable_floor_alt.png differ diff --git a/assets/werewolf_den/wall.png b/assets/werewolf_den/wall.png new file mode 100644 index 0000000000000000000000000000000000000000..7e893cff719b8a49ba692c61caab8b6179fd26da Binary files /dev/null and b/assets/werewolf_den/wall.png differ diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000000000000000000000000000000000000..ec21ebc467c3166ea2a9c95414c2591d3d0c9c44 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,17 @@ +# Documentation + +| Page | What you find there | +|---|---| +| [client-setup.md](client-setup.md) | Connect the server to Claude Code, Claude Desktop, Cursor, VS Code, Windsurf, Zed, OpenCode, the MCP Inspector | +| [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 | +| [nemotron.md](nemotron.md) | Driving the server with NVIDIA Nemotron (OpenCode example) | +| [troubleshooting.md](troubleshooting.md) | Common problems and fixes | + +The agent workflow itself is in [`skills/map-builder/SKILL.md`](../skills/map-builder/SKILL.md). + +Map editor: [Tiled](https://www.mapeditor.org). diff --git a/docs/assets/banner.svg b/docs/assets/banner.svg new file mode 100644 index 0000000000000000000000000000000000000000..c20d13e0631479cb0616af00b32d2dbee948e83d --- /dev/null +++ b/docs/assets/banner.svg @@ -0,0 +1,30 @@ + +Tiled Map Builder MCP +Banner: an isometric crypt room built from the project's sprites, with the project title and its technologies: TypeScript, Node.js, Model Context Protocol, Tiled, Zod, Hugging Face FLUX, NVIDIA Nemotron. + + + + + + + + + + + + +PEC +Tiled Map Builder MCP +Let AI agents compose isometric Tiled maps: +rooms, corridors, traps and spawns, saved as .tmj. +BUILT WITH +TypeScriptNode.jsModel Context ProtocolTiledZodHugging Face FLUXNVIDIA Nemotron + diff --git a/docs/client-setup.md b/docs/client-setup.md new file mode 100644 index 0000000000000000000000000000000000000000..a88cfcbf9e535e5fca56c82e9aeb52c8a9a162c8 --- /dev/null +++ b/docs/client-setup.md @@ -0,0 +1,193 @@ +# Connect an MCP client + +The server speaks MCP over **stdio**: the client starts `node tiled-mcp/dist/index.js` and +talks to it through stdin and stdout. Build it once first: + +```bash +npm install +npm run build +``` + +Every example below uses the name **`tiled-map-builder`** and a placeholder path. Replace +`/absolute/path/to/Tiled-MCP-Server` with the folder you cloned. On Windows, write paths with +forward slashes (`C:/Users/me/Tiled-MCP-Server/...`) or doubled backslashes in JSON. + +Optional settings go in an `env` block or in `tiled-mcp/.env`; see +[configuration.md](configuration.md). Restart the client after changing its configuration. + +> **No install?** The same tools run as a remote MCP server on Hugging Face. Give your client +> the URL `https://4math-tiled-map-builder.hf.space/mcp` and the header +> `Authorization: Bearer hf_YOUR_TOKEN` instead of a command; see +> [hugging-face.md](hugging-face.md#connect-an-ai-agent-to-the-mcp-endpoint). + +## Claude Code + +From the repository folder: + +```bash +claude mcp add tiled-map-builder -- node "$(pwd)/tiled-mcp/dist/index.js" +``` + +Add `--scope project` to write a shareable `.mcp.json` in the current project, or +`--scope user` to make it available everywhere. The equivalent `.mcp.json`: + +```json +{ + "mcpServers": { + "tiled-map-builder": { + "command": "node", + "args": ["/absolute/path/to/Tiled-MCP-Server/tiled-mcp/dist/index.js"] + } + } +} +``` + +Install the skill so `/map-builder` is available: + +```bash +mkdir -p ~/.claude/skills +cp -r skills/map-builder ~/.claude/skills/ +``` + +The tools appear as `mcp__tiled-map-builder__`. Check the connection with `/mcp`. + +## Claude Desktop + +Edit `claude_desktop_config.json` (Settings, Developer, Edit Config): + +- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json` +- Windows: `%APPDATA%\Claude\claude_desktop_config.json` + +```json +{ + "mcpServers": { + "tiled-map-builder": { + "command": "node", + "args": ["/absolute/path/to/Tiled-MCP-Server/tiled-mcp/dist/index.js"] + } + } +} +``` + +Use the `map_builder` prompt from the attachment menu to load the workflow. + +## Cursor + +`~/.cursor/mcp.json` (all projects) or `.cursor/mcp.json` (one project): + +```json +{ + "mcpServers": { + "tiled-map-builder": { + "command": "node", + "args": ["/absolute/path/to/Tiled-MCP-Server/tiled-mcp/dist/index.js"] + } + } +} +``` + +## VS Code (GitHub Copilot agent mode) + +`.vscode/mcp.json` in your workspace: + +```json +{ + "servers": { + "tiled-map-builder": { + "type": "stdio", + "command": "node", + "args": ["/absolute/path/to/Tiled-MCP-Server/tiled-mcp/dist/index.js"] + } + } +} +``` + +## Windsurf + +`~/.codeium/windsurf/mcp_config.json`: + +```json +{ + "mcpServers": { + "tiled-map-builder": { + "command": "node", + "args": ["/absolute/path/to/Tiled-MCP-Server/tiled-mcp/dist/index.js"] + } + } +} +``` + +## Zed + +In Zed's `settings.json`: + +```json +{ + "context_servers": { + "tiled-map-builder": { + "command": "node", + "args": ["/absolute/path/to/Tiled-MCP-Server/tiled-mcp/dist/index.js"], + "env": {} + } + } +} +``` + +### Windows with the server inside WSL + +If Node is installed in WSL rather than on Windows, let `wsl.exe` start it. Environment +variables can be passed through `env`: + +```json +{ + "context_servers": { + "tiled-map-builder": { + "command": "wsl.exe", + "args": ["-e", "env", "TILED_MAPS_DIR=D:/maps", "node", "/mnt/d/Tiled-MCP-Server/tiled-mcp/dist/index.js"] + } + } +} +``` + +Windows-style paths such as `D:/maps` are translated to `/mnt/d/maps` by the server. + +## OpenCode + +In `opencode.json`: + +```json +{ + "$schema": "https://opencode.ai/config.json", + "mcp": { + "tiled-map-builder": { + "type": "local", + "command": ["node", "/absolute/path/to/Tiled-MCP-Server/tiled-mcp/dist/index.js"], + "enabled": true + } + } +} +``` + +To run it with NVIDIA Nemotron, see [nemotron.md](nemotron.md). + +## Any other client + +Any MCP client that can start a stdio server works. It needs: + +| Field | Value | +|---|---| +| command | `node` | +| args | `/tiled-mcp/dist/index.js` | +| env | optional, see [configuration.md](configuration.md) | + +## Test without an agent: MCP Inspector + +```bash +npm run inspect +``` + +This opens the official [MCP Inspector](https://github.com/modelcontextprotocol/inspector) in +your browser, connected to the server. You can list the tools, call `create_map`, then +`generate_crypt_layout`, then `save_to_disk`, and open the file in Tiled. + +For an automated check, `npm run smoke` runs 39 end-to-end checks without any network access. diff --git a/docs/configuration.md b/docs/configuration.md new file mode 100644 index 0000000000000000000000000000000000000000..7d4e614aaddf3d10102ad0a42bd24efb85ff2ebd --- /dev/null +++ b/docs/configuration.md @@ -0,0 +1,70 @@ +# Configuration + +Map building needs **no configuration**: clone, build, connect a client. Everything below is +optional. + +## Where settings come from + +The server reads environment variables. You can set them in two places: + +1. The `env` block of your MCP client configuration (see [client-setup.md](client-setup.md)). +2. A `.env` file. At startup the server loads `tiled-mcp/.env`, or the file named by + `TILED_ENV_FILE`. Start from the template: + + ```bash + cp tiled-mcp/.env.example tiled-mcp/.env + ``` + +A variable that is already set in the environment always wins over the `.env` file. +Relative paths in variables are resolved against the repository root. + +## Variables + +| Variable | Default | Used by | Purpose | +|---|---|---|---| +| `TILED_MAPS_DIR` | `/maps` | `save_to_disk` | Folder for relative output paths | +| `TILED_ASSETS_DIR` | `/assets` | sprites, `list_themes`, `save_to_disk` | Sprite root holding `/.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` | `/skills/map-builder/SKILL.md` | `map_builder` prompt | Skill text served by the prompt | +| `TILED_ENV_FILE` | `/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, for +example OpenCode running Nemotron (see [nemotron.md](nemotron.md)). + +## Hosted mode + +`npm run start:web` (`node tiled-mcp/dist/http.js`, the Docker image, the Hugging Face Space) +serves the web page and the MCP tools over HTTP. See [hugging-face.md](hugging-face.md). In this +mode paid calls only use the token each caller sends, so `HF_TOKEN` and `HUGGINGFACE_API_KEY` +are ignored. + +| Variable | Default | Purpose | +|---|---|---| +| `PORT` | `7860` | HTTP port | +| `HOST` | `127.0.0.1` (`0.0.0.0` in Docker) | Interface to listen on | +| `PUBLIC_URL` | from `SPACE_HOST` or the request | Public base URL used in download links, e.g. `https://maps.example.com` | +| `TILED_AGENT_MODEL` | `openai/gpt-oss-120b` | Default model of the web page's AI agent (any Inference Providers model with tool calling) | +| `TILED_MAX_JOBS` | `4` | Web agent runs allowed at the same time; extra visitors get "busy, try again" | +| `TILED_INFERENCE_URL` | `https://router.huggingface.co/v1` | OpenAI-compatible endpoint the agent calls; the HTTP smoke test points it at a local stand-in | + +A Hugging Face Space sets these itself; do not set them by hand: + +| Variable | Purpose | +|---|---| +| `SPACE_HOST` | The Space's public host name, used for links and the sign-in redirect | +| `OAUTH_CLIENT_ID`, `OAUTH_CLIENT_SECRET`, `OAUTH_SCOPES`, `OPENID_PROVIDER_URL` | "Sign in with Hugging Face", enabled by `hf_oauth: true` in the Space card | + +## Paths on Windows and WSL + +Paths can use forward or back slashes. When the server runs on Linux, for example a client +that launches it inside WSL, Windows paths such as `D:/maps/crypt.tmj` are translated to +`/mnt/d/maps/crypt.tmj` automatically. + +## Secrets + +- `.env` and `.env.local` are git-ignored. Never commit real keys, and never paste them into + issues or chat transcripts. +- Prefer the client's `env` block or your shell profile for keys on shared machines. +- If a key ever lands in git history, rotate it at the provider; deleting the file is not enough. diff --git a/docs/hugging-face.md b/docs/hugging-face.md new file mode 100644 index 0000000000000000000000000000000000000000..390c1619eaf4c16b75d545317c0fdfad635ea0de --- /dev/null +++ b/docs/hugging-face.md @@ -0,0 +1,123 @@ +# Use it on Hugging Face + +The project runs as a public Hugging Face Space: +**[huggingface.co/spaces/4math/tiled-map-builder](https://huggingface.co/spaces/4math/tiled-map-builder)**. +The Space is the same code as this repository, built from the [`Dockerfile`](../Dockerfile), +and offers two things on one address: + +| | Address | For | +|---|---|---| +| Web page | `https://4math-tiled-map-builder.hf.space/` | Anyone: describe a map, an AI model builds it, preview and download it | +| MCP endpoint | `https://4math-tiled-map-builder.hf.space/mcp` | AI agents (Claude, Cursor, VS Code, ...) that call the 30 map tools themselves | + +## Who pays for what + +The Space owner pays for nothing a visitor does. Everything that costs money runs on the +**visitor's own Hugging Face account**: + +| Action | Cost | Billed to | +|---|---|---| +| Map tools (create, paint, rooms, objects, validate, download) | free | nobody: they run on the Space's free CPU | +| The AI model behind the web page | a few cents per map with the default model | the signed-in visitor, through [Inference Providers](https://huggingface.co/docs/inference-providers) | +| FLUX sprite generation (opt-in) | per image | the visitor, through Inference Providers | + +Hugging Face accounts get monthly inference credits (more with PRO), which usually cover a few +maps. The server holds no token of its own: it reads `Authorization: Bearer ` from each +request and uses that token for that request only. It never reads `HF_TOKEN` from its environment +in hosted mode, writes nothing to disk, and forgets a visitor's maps when their session ends. + +## The web page + +1. Open the Space and click **Sign in with Hugging Face**. Inside the huggingface.co page the + sign-in opens the app in a new tab; carry on there. The Space asks for one permission, + *make calls to Inference Providers on your behalf*. + Instead of signing in you can paste an access token created at + [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens) with the permission + "Make calls to Inference Providers". Either way the token stays in that browser tab + (`sessionStorage`) and is sent only with your own requests. +2. Describe the map in any language. Optionally pick a theme and a model. +3. Click **Build the map**. The page streams each tool call the model makes. A map usually takes + 20 to 40 tool calls and 30 to 90 seconds. +4. Download the **.zip**: it holds the `.tmj` and every sprite it uses, laid out so the `.tmj` + opens directly in [Tiled](https://www.mapeditor.org). Links last one hour. + +The default model is `openai/gpt-oss-120b`, which is cheap and good at tool calling. The page +offers a few other open models with tool calling, and **Other model...** takes any model id +served by Inference Providers with tool support (append `:provider` to force a provider). +Themes without bundled sprites still work; the preview and Tiled show grey placeholder tiles. + +## Connect an AI agent to the MCP endpoint + +Send your own token in the `Authorization` header. The map tools are free; only +`generate_tile_sprite` and `generate_theme_sprite_set` spend money, on that token. + +Claude Code: + +```bash +claude mcp add --transport http tiled-map-builder https://4math-tiled-map-builder.hf.space/mcp \ + --header "Authorization: Bearer hf_YOUR_TOKEN" +``` + +Clients configured with JSON (Cursor, VS Code, Windsurf, ...): + +```json +{ + "mcpServers": { + "tiled-map-builder": { + "url": "https://4math-tiled-map-builder.hf.space/mcp", + "headers": { "Authorization": "Bearer hf_YOUR_TOKEN" } + } + } +} +``` + +Differences from the local server: + +- `save_to_disk` cannot write on your machine. It returns `zipUrl` (the `.tmj` plus its sprites) + and `tmjUrl`, valid for one hour. +- Generated sprites stay with your MCP session: they are returned as images and included in + your downloads. `outputDir` is refused. +- Each MCP session has its own maps (at most 20) and is closed after 30 minutes without + requests. Other sessions cannot see them. +- The map tools work without a token; the header is only needed for sprite generation. + +## Run your own copy + +- **Duplicate the Space**: on the Space page, open the menu and choose *Duplicate this Space*. + Your copy runs under your account with the same sign-in flow. +- **Docker** anywhere: + + ```bash + docker build -t tiled-map-builder . + docker run -p 7860:7860 tiled-map-builder + ``` + + Then open `http://localhost:7860`. Without the Space sign-in, the page asks for an access + token. +- **Node** from a clone: `npm install && npm run build && npm run start:web`, then open + `http://127.0.0.1:7860`. + +Settings for the hosted mode (`PORT`, `HOST`, `TILED_AGENT_MODEL`, `TILED_MAX_JOBS`, ...) are in +[configuration.md](configuration.md#hosted-mode). + +## Update the Space + +The Space repository is a copy of this one: same files, plus the Space card at the top of its +`README.md` (from [`huggingface/space-card.md`](../huggingface/space-card.md)). After a change +lands on `main`: + +```bash +pip install -U huggingface_hub # provides the hf command +hf auth login # a token with write access to the Space +huggingface/sync-space.sh # or: huggingface/sync-space.sh OWNER/SPACE +``` + +The script uploads the current commit, removes files that no longer exist, and the Space +rebuilds by itself (a few minutes). Anyone can clone the Space's code with +`git clone https://huggingface.co/spaces/4math/tiled-map-builder`. + +## Test it without spending anything + +`npm run smoke:http` starts the hosted server against a scripted stand-in for the AI model and +checks the web routes, MCP sessions, downloads, session isolation, and that every model call +uses the caller's token. It is free and offline. diff --git a/docs/images/preview-aquatic-cavern.png b/docs/images/preview-aquatic-cavern.png new file mode 100644 index 0000000000000000000000000000000000000000..df5823b45241457f0e388dfb31519c57dd9ed356 --- /dev/null +++ b/docs/images/preview-aquatic-cavern.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3dd95bee89196dffd8fd55fdd2c9992ffff9236b0ec5811d376e7835813e5a48 +size 132297 diff --git a/docs/images/preview-crypt-preset.png b/docs/images/preview-crypt-preset.png new file mode 100644 index 0000000000000000000000000000000000000000..0ba4d91ea8fe612abd7cdc0430404f629da63b78 --- /dev/null +++ b/docs/images/preview-crypt-preset.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f71178bf83f2fe57f56376139eb4595080593385c30997f74e646b9f7e9b4c28 +size 105624 diff --git a/docs/images/preview-hacker-lair.png b/docs/images/preview-hacker-lair.png new file mode 100644 index 0000000000000000000000000000000000000000..60414ac15a5aec418df294c4cff9e5c2426b7e7b --- /dev/null +++ b/docs/images/preview-hacker-lair.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:74517400cd89a575f8e15d067704ff60c7e4d00823a4a4ecb70531b373a84c91 +size 106298 diff --git a/docs/images/preview-ice-fortress.png b/docs/images/preview-ice-fortress.png new file mode 100644 index 0000000000000000000000000000000000000000..ff48ce0821c2715afdb14203f12c17fe43554baa --- /dev/null +++ b/docs/images/preview-ice-fortress.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b4fb93e11ce8e5a995601d17a9d871ec9b87bb02de179de8b9cba12f301c4bf7 +size 161914 diff --git a/docs/map-format.md b/docs/map-format.md new file mode 100644 index 0000000000000000000000000000000000000000..d1bba56f2fd1750507bf1f512d4890aa1acdd4f1 --- /dev/null +++ b/docs/map-format.md @@ -0,0 +1,155 @@ +# Map format + +The server writes standard [Tiled JSON maps](https://doc.mapeditor.org/en/stable/reference/json-map-format/) +(`.tmj`, format 1.10). This page describes what is inside, so you can read the maps from a game +engine or write an importer. + +## Overview + +| Field | Value | +|---|---| +| `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) | + +## Coordinates + +Tools take **grid cells**: `x` is the column from 0 to width-1, `y` the row from 0 to height-1. +Cell `(x, y)` is stored at index `y * width + x` in every tile layer. + +On an isometric map, cell (0,0) is the top corner of the diamond. `x` grows toward the lower +right and `y` toward the lower left: + +``` + (0,0) + (0,1) (1,0) + (0,2) (1,1) (2,0) + (1,2) (2,1) + (2,2) +``` + +## Layers + +Every map has the same five layers, in this order: + +| id | Name | Type | Contents | +|---|---|---|---| +| 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 properties + +Each map embeds one **collection-of-images** tileset (`columns: 0`, one image per tile) built +from its theme. Every tile carries: + +| Property | Type | Values | +|---|---|---| +| `tileType` | string | `WALKABLE`, `WALL`, `DIFFICULT_TERRAIN`, `HAZARD`, `DOOR`, `OBSTACLE`, `STAIRS` | +| `spriteId` | string | stable id such as `crypt.sarcophagus` | +| `hazardType` | string | damage type, `HAZARD` tiles only (e.g. `poison`) | +| `hazardNotation` | string | damage dice, `HAZARD` tiles only (e.g. `2d6`) | + +Tools paint tiles by **role**; the theme maps each role to one tile: + +| Role | Usual tile type | Image size | +|---|---|---| +| `walkable_floor`, `walkable_floor_alt` | `WALKABLE` | 64x32 | +| `wall`, `wall_corner` | `WALL` | 64x64 | +| `difficult_terrain` | `DIFFICULT_TERRAIN` | 64x32 | +| `hazard_primary` | `HAZARD` | 64x32 or 64x64 | +| `obstacle_decor` | `OBSTACLE` | 64x64 | +| `decoration_minor` | `WALKABLE` | 64x32 | +| `door_closed` | `DOOR` | 64x64 | +| `stairs` | `STAIRS` | 64x64 | + +Not every theme defines every role; `list_themes` lists them. See [themes.md](themes.md). + +### Image paths + +Tiled resolves each tile `image` relative to the `.tmj` file. + +- `save_to_disk` rewrites the paths relative to the file it writes, so a map saved anywhere + finds the sprites in `assets/` (for example `../assets/crypt/wall.png` from `maps/`). +- `export_json` keeps the canonical form `./assets//.png`, + relative to the repository root. + +## Objects + +Objects live in the `objects` group. `type` repeats the kind. + +| 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 | + +## Spawns + +Spawns live in the `spawns` group. `type` repeats the role. + +| 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 coordinates + +Tiled stores object positions in pixels, but on **isometric** maps those pixels are not screen +pixels. Tiled uses an unprojected space where both axes are measured in **tile height** units +([source](https://github.com/mapeditor/tiled/blob/master/src/libtiled/isometricrenderer.cpp), +`tileToPixelCoords`). + +With the default `TILED_OBJECT_COORDS=tiled`, the server writes: + +| | Isometric | Orthogonal | +|---|---|---| +| object (door, chest, ...) | rectangle `x = col*th`, `y = row*th`, `width = height = th` | rectangle `x = col*tw`, `y = row*th`, `width = tw`, `height = th` | +| spawn | point (`"point": true`) at `x = (col+0.5)*th`, `y = (row+0.5)*th` | point at `x = (col+0.5)*tw`, `y = (row+0.5)*th` | + +`tw` and `th` are `tilewidth` and `tileheight`. To read a cell back: + +```js +// isometric +const col = Math.floor(obj.x / map.tileheight); +const row = Math.floor(obj.y / map.tileheight); +// orthogonal +const col = Math.floor(obj.x / map.tilewidth); +const row = Math.floor(obj.y / map.tileheight); +``` + +Objects then open on the right tiles in Tiled, and moving them there keeps the formulas valid. + +### Legacy encoding (`TILED_OBJECT_COORDS=screen`) + +Versions before 0.2.0 wrote isometric objects in **screen space** without an origin offset: +`x = tw/2 * (col - row)`, `y = th/2 * (col + row)`, objects `tw x th`, spawns without size. +Importers written for that encoding decode with: + +```js +const col = Math.floor((x / (tw / 2) + y / (th / 2)) / 2); +const row = Math.floor((y / (th / 2) - x / (tw / 2)) / 2); +``` + +Set `TILED_OBJECT_COORDS=screen` if your importer still expects it. Tiled does not display +legacy positions on the right tiles, so prefer migrating the importer to the formulas above. + +## Validation + +`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. diff --git a/docs/nemotron.md b/docs/nemotron.md new file mode 100644 index 0000000000000000000000000000000000000000..a4f9470b99ad0cd1837addac7d40eccd3b9b5667 --- /dev/null +++ b/docs/nemotron.md @@ -0,0 +1,76 @@ +# Using the server with NVIDIA Nemotron + +The MCP server does not talk to any model itself. An **agent** (a coding assistant or chat +client that supports MCP and tool calling) calls the map tools, and that agent can run on any +model. This server was developed alongside agents running **NVIDIA Nemotron** on the NVIDIA +API, which has a free tier. + +So the NVIDIA key goes into your agent's configuration, not into this server. + +## 1. Get an NVIDIA API key + +1. Sign in at https://build.nvidia.com. +2. Open a Nemotron model page, for example **Nemotron 3.5 Super-VL**, and choose **Get API Key**. + Keys start with `nvapi-`. +3. Export it in the shell that starts your agent: + + ```bash + export NVIDIA_API_KEY="nvapi-..." # macOS / Linux + ``` + + ```powershell + $env:NVIDIA_API_KEY = "nvapi-..." # Windows PowerShell + ``` + +The NVIDIA API exposes an OpenAI-compatible endpoint at `https://integrate.api.nvidia.com/v1`. +The free tier is rate limited (about 40 requests per minute at the time of writing), and one +map typically takes 10 to 40 tool calls. + +## 2. Example: OpenCode + +[OpenCode](https://opencode.ai) can use any OpenAI-compatible provider and local MCP servers. +In `opencode.json`: + +```json +{ + "$schema": "https://opencode.ai/config.json", + "provider": { + "nvidia-build": { + "npm": "@ai-sdk/openai-compatible", + "name": "NVIDIA API", + "options": { + "baseURL": "https://integrate.api.nvidia.com/v1", + "apiKey": "{env:NVIDIA_API_KEY}" + }, + "models": { + "nvidia/nemotron-3.5-super-vl-120b-a12b": { "name": "Nemotron 3.5 Super-VL" } + } + } + }, + "model": "nvidia-build/nvidia/nemotron-3.5-super-vl-120b-a12b", + "mcp": { + "tiled-map-builder": { + "type": "local", + "command": ["node", "/absolute/path/to/Tiled-MCP-Server/tiled-mcp/dist/index.js"], + "enabled": true + } + } +} +``` + +Check the model catalog at https://build.nvidia.com for current model ids. + +## 3. Give the agent the workflow + +Nemotron follows the map-builder workflow best when it has it in context: + +- OpenCode and other clients with prompt support: use the server's **`map_builder`** prompt. +- Otherwise, add `skills/map-builder/SKILL.md` to the agent's instructions (OpenCode: + `"instructions": ["/absolute/path/to/skills/map-builder/SKILL.md"]`). + +## Tips for smaller or faster models + +- Ask for a preset first (`generate_crypt_layout` on a 28x18 map), then refine. +- Ask the agent to call `get_tile_info(layer="walls")` before placing objects; the tool errors + explain any rejected placement, and the agent can retry with a neighbouring cell. +- Always finish with `validate_map`. diff --git a/docs/sprite-generation.md b/docs/sprite-generation.md new file mode 100644 index 0000000000000000000000000000000000000000..7cd6deab22065b251d38fca9ced89ddc1f3fbca5 --- /dev/null +++ b/docs/sprite-generation.md @@ -0,0 +1,80 @@ +# Sprite generation (optional, paid) + +> [!WARNING] +> Generating sprites calls **FLUX.1-dev through Hugging Face Inference Providers and costs +> money for every sprite**. Map building, validation, export and previews are free and +> offline. Nothing in this project enforces a spending cap: set a budget on your provider +> account. You are responsible for the costs you incur. + +## When you need it + +12 of the 20 themes ship with sprites in `assets/`. The other 8 (`VOLCAN`, `FORET`, `HIVER`, +`PRINTEMPS`, `ETE`, `AUTOMNE`, `DESOLATION`, `FUTURISTE`) produce valid maps, but Tiled shows +placeholders until their PNGs exist. `list_themes` reports the status of every theme. + +You also need generation for **contextual variants**, such as an alembic instead of the default +throne for a castle laboratory. + +## Setup + +1. Create a Hugging Face account and an access token with permission to call Inference + Providers: https://huggingface.co/settings/tokens +2. Make sure the provider you use (default `replicate`) is enabled for your account and that + billing 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-dev + TILED_HF_PROVIDER=replicate + ``` + +## Generate a whole theme (recommended) + +A full theme is about 8 to 10 sprites and takes several minutes, longer than many MCP clients +wait for a single tool call. Use the script: + +```bash +npm run build +node scripts/gen-theme-set.mjs VOLCAN --dry-run # free: lists the sprites it would generate +node scripts/gen-theme-set.mjs VOLCAN --yes # paid +node scripts/gen-theme-set.mjs --missing --dry-run # every theme that lacks sprites +``` + +Existing files are skipped. `--force` regenerates them and is billed again. + +## Generate one sprite from an agent + +1. `preview_sprite_prompt(theme, role, material?, lighting?, extraDetail?)` returns the exact + prompt. It is free, so iterate on the wording there first. +2. `generate_tile_sprite(theme, role, ...)` generates and saves `assets//.png`. + If the file already exists, nothing is generated or billed unless `force: true`. + +### Contextual variants + +```text +generate_tile_sprite(theme="CASTLE", role="obstacle_decor", variant="alembic", + material="alchemical workbench with brass alembics and dusty tomes") + -> assets/castle/obstacle_decor__alembic.png + +override_tile_image(mapId, role="obstacle_decor", variant="alembic") + -> only this map uses the variant +``` + +## What the pipeline does + +1. Builds a prompt from the theme's material and lighting for that role + (`tiled-mcp/src/themes/prompts.ts`), in a flat 2D painterly gothic style on a pure magenta + background, with a strong negative prompt against candles, torches and fire. +2. Requests a 1024x1024 image from FLUX.1-dev. +3. Removes the magenta background with a chroma key that also catches desaturated magenta at + the edges. +4. Crops and resizes: floors and small decorations to **64x32**, walls, doors, stairs and + obstacles to **64x64**. + +## Cost control checklist + +- Reuse the bundled sprites whenever they fit. +- Always run `--dry-run` or `preview_sprite_prompt` first. +- Keep variants to one or two per map. +- Watch your provider dashboard; this project cannot see or cap your spending. diff --git a/docs/themes.md b/docs/themes.md new file mode 100644 index 0000000000000000000000000000000000000000..a17dc54d99bfeb59d638997c01f607511f55a4d3 --- /dev/null +++ b/docs/themes.md @@ -0,0 +1,112 @@ +# Themes + + + +A theme is a tile palette: it maps each **role** used by the tools (`walkable_floor`, `wall`, +`hazard_primary`, ...) to one sprite and one tile type. Pass its key to `create_map`. +Display names and descriptions are in French, the language the themes were written in. + +**20 themes**, 12 with bundled sprites. Themes without sprites still produce valid +maps; Tiled shows placeholders until the PNGs exist (see [sprite-generation.md](sprite-generation.md)). +Sprites live in `assets//.png`. + +| Key | Display name | Setting | Roles | Sprites | +|---|---|---|---|---| +| `CRYPT` | Crypte mournevaldienne | Burial vaults under chapels, cracked flagstones, poison vents from broken sarcophagi. | 10 | bundled (10/10) | +| `CASTLE` | Castel Von Drak | Black marble and basalt halls, broken stained glass, throne room, grand stairs. | 9 | bundled (9/9) | +| `WEREWOLF_DEN` | Tanière de loups-garous | Damp caves dug into the forest, bone-strewn earth floor, claw-marked rock, blood pools. | 8 | bundled (8/8) | +| `TAVERN_BLOOD_PRINCE` | Auberge du Prince Sanglant | Dark floorboards, heavy beams, oak tables, crackling hearth. No active traps. | 8 | bundled (8/8) | +| `VILLAGE` | Village mournevaldien | Rain-soaked cobblestones, shuttered half-timbered houses, abandoned stalls, well and gallows. | 7 | bundled (7/7) | +| `HAUNTED_FOREST` | Forêt de Drakenmark | Stifling undergrowth of black moss, fallen trunks, parasitic mist that slows walkers. | 7 | bundled (7/7) | +| `MAUSOLEUM` | Mausolée | Grey-veined marble, fallen-angel statues, funeral urns in niches. No hazards. | 8 | bundled (8/8) | +| `BLOOD_TOMB` | Tombeau de sang | Deep ritual sanctuary, pulsing bleeding runes, central altar. | 8 | bundled (8/8) | +| `AQUATIC` | Eaux Croupies | Black stagnant water, water lilies, sunken ruins, haunted marsh. | 10 | bundled (10/10) | +| `GLACIAIRE` | Toundra Glacée | Black ice, figures frozen in the ice, frost, haunted tundra. | 10 | bundled (10/10) | +| `INONDE` | Cote Inondee | Drowned city under the waves, hanging kelp, broken bridges, deep currents. | 10 | bundled (10/10) | +| `VOLCAN` | Pente Volcanique | Lava flows, cooled black rock, flying ash, active caldera. | 10 | not generated yet (0/10) | +| `FORET` | Foret Sombre | Twisted woods, thick moss, exposed roots, misty clearings, quicksand. | 10 | not generated yet (0/10) | +| `HIVER` | Plaine Enneigee | Powder snow, frozen lakes, frosted branches, trappers' huts. | 10 | not generated yet (0/10) | +| `PRINTEMPS` | Prairie Printaniere | Flowering meadows, clear streams, budding trees, druid circles. | 10 | not generated yet (0/10) | +| `ETE` | Plaine Estivale | Golden grass, ripe wheat, cloudless heat, abandoned granaries. | 10 | not generated yet (0/10) | +| `AUTOMNE` | Foret d'Automne | Russet leaves, mushrooms, morning mist, bog mire. | 10 | not generated yet (0/10) | +| `DESOLATION` | Terre Desolee | Cold ash, charred trees, barren ground, post-cataclysm ruins. | 10 | not generated yet (0/10) | +| `FUTURISTE` | Cite Futuriste | Chrome, cold neon, holographic panels, dystopian megacity. | 10 | not generated yet (0/10) | +| `ELECTRONIQUE` | Reseau Electronique | Circuit boards, optic fibre, silent servers, AI cores. | 10 | bundled (10/10) | + +## Roles per theme + +| Key | Roles | +|---|---| +| `CRYPT` | `walkable_floor`, `walkable_floor_alt`, `wall`, `wall_corner`, `difficult_terrain`, `hazard_primary`, `obstacle_decor`, `decoration_minor`, `door_closed`, `stairs` | +| `CASTLE` | `walkable_floor`, `walkable_floor_alt`, `wall`, `wall_corner`, `difficult_terrain`, `obstacle_decor`, `decoration_minor`, `door_closed`, `stairs` | +| `WEREWOLF_DEN` | `walkable_floor`, `walkable_floor_alt`, `wall`, `difficult_terrain`, `hazard_primary`, `obstacle_decor`, `decoration_minor`, `door_closed` | +| `TAVERN_BLOOD_PRINCE` | `walkable_floor`, `walkable_floor_alt`, `wall`, `difficult_terrain`, `obstacle_decor`, `decoration_minor`, `door_closed`, `stairs` | +| `VILLAGE` | `walkable_floor`, `walkable_floor_alt`, `wall`, `difficult_terrain`, `obstacle_decor`, `decoration_minor`, `door_closed` | +| `HAUNTED_FOREST` | `walkable_floor`, `walkable_floor_alt`, `wall`, `difficult_terrain`, `hazard_primary`, `obstacle_decor`, `decoration_minor` | +| `MAUSOLEUM` | `walkable_floor`, `walkable_floor_alt`, `wall`, `difficult_terrain`, `obstacle_decor`, `decoration_minor`, `door_closed`, `stairs` | +| `BLOOD_TOMB` | `walkable_floor`, `walkable_floor_alt`, `wall`, `difficult_terrain`, `hazard_primary`, `obstacle_decor`, `decoration_minor`, `door_closed` | +| `AQUATIC` | `walkable_floor`, `walkable_floor_alt`, `wall`, `wall_corner`, `difficult_terrain`, `hazard_primary`, `obstacle_decor`, `decoration_minor`, `door_closed`, `stairs` | +| `GLACIAIRE` | `walkable_floor`, `walkable_floor_alt`, `wall`, `wall_corner`, `difficult_terrain`, `hazard_primary`, `obstacle_decor`, `decoration_minor`, `door_closed`, `stairs` | +| `INONDE` | `walkable_floor`, `walkable_floor_alt`, `wall`, `wall_corner`, `difficult_terrain`, `hazard_primary`, `obstacle_decor`, `decoration_minor`, `door_closed`, `stairs` | +| `VOLCAN` | `walkable_floor`, `walkable_floor_alt`, `wall`, `wall_corner`, `difficult_terrain`, `hazard_primary`, `obstacle_decor`, `decoration_minor`, `door_closed`, `stairs` | +| `FORET` | `walkable_floor`, `walkable_floor_alt`, `wall`, `wall_corner`, `difficult_terrain`, `hazard_primary`, `obstacle_decor`, `decoration_minor`, `door_closed`, `stairs` | +| `HIVER` | `walkable_floor`, `walkable_floor_alt`, `wall`, `wall_corner`, `difficult_terrain`, `hazard_primary`, `obstacle_decor`, `decoration_minor`, `door_closed`, `stairs` | +| `PRINTEMPS` | `walkable_floor`, `walkable_floor_alt`, `wall`, `wall_corner`, `difficult_terrain`, `hazard_primary`, `obstacle_decor`, `decoration_minor`, `door_closed`, `stairs` | +| `ETE` | `walkable_floor`, `walkable_floor_alt`, `wall`, `wall_corner`, `difficult_terrain`, `hazard_primary`, `obstacle_decor`, `decoration_minor`, `door_closed`, `stairs` | +| `AUTOMNE` | `walkable_floor`, `walkable_floor_alt`, `wall`, `wall_corner`, `difficult_terrain`, `hazard_primary`, `obstacle_decor`, `decoration_minor`, `door_closed`, `stairs` | +| `DESOLATION` | `walkable_floor`, `walkable_floor_alt`, `wall`, `wall_corner`, `difficult_terrain`, `hazard_primary`, `obstacle_decor`, `decoration_minor`, `door_closed`, `stairs` | +| `FUTURISTE` | `walkable_floor`, `walkable_floor_alt`, `wall`, `wall_corner`, `difficult_terrain`, `hazard_primary`, `obstacle_decor`, `decoration_minor`, `door_closed`, `stairs` | +| `ELECTRONIQUE` | `walkable_floor`, `walkable_floor_alt`, `wall`, `wall_corner`, `difficult_terrain`, `hazard_primary`, `obstacle_decor`, `decoration_minor`, `door_closed`, `stairs` | + +## Original descriptions + +**CRYPT** (Crypte mournevaldienne): Caveaux funéraires sous les chapelles, dalles fissurées, runes mortuaires, gaz toxiques émanant des sarcophages disjoints. + +**CASTLE** (Castel Von Drak): Marbres noirs, basalte poli, vitraux brisés, bannières frappées du blason des Von Drak. Salle du trône, escaliers grandioses, candélabres en fer noir. + +**WEREWOLF_DEN** (Tanière de loups-garous): Cavernes humides creusées dans la forêt de Drakenmark, sol en terre battue jonché d'ossements, parois rocheuses entaillées par les griffes, mares de sang frénétique près des proies récentes. + +**TAVERN_BLOOD_PRINCE** (Auberge du Prince Sanglant): Parquet sombre, enduit fissuré, lourde charpente apparente. Tables rondes en chêne, âtre crépitant, bar marbré de taches anciennes. Pas de pièges actifs — la peur suffit. + +**VILLAGE** (Village mournevaldien): Pavés humides luisant sous la pluie perpétuelle, maisons à colombages aux fenêtres closes, étals de marché abandonnés, puits central et potence rouillée sur la place. + +**HAUNTED_FOREST** (Forêt de Drakenmark): Sous-bois étouffant de mousses noires, troncs morts couchés, brumes parasitaires qui s'enroulent autour des chevilles et ralentissent la marche. + +**MAUSOLEUM** (Mausolée): Marbre veiné de gris, statues d'anges déchus aux ailes brisées, urnes funéraires alignées dans les niches, chuchotements à la limite de l'audible. + +**BLOOD_TOMB** (Tombeau de sang): Sanctuaire profond consacré aux pactes anciens. Dalles rituelles, runes saignantes qui pulsent au passage, autel central, candélabres en fer noir. Le sang ne sèche jamais sur ce sol. + +**AQUATIC** (Eaux Croupies): Eaux noires stagnantes, nénuphars, ruines submergées, brume sur l'eau. Marais hanté, pontons pourris, cryptes inondées. + +**GLACIAIRE** (Toundra Glacée): Glace noire, figures gelées prises dans la glace, givre, stalactites de pierre. Toundra hantée, pontons de gel, cryptes sous pergélisol. + +**INONDE** (Cote Inondee): Villes englouties sous les flots, ruines submergees, algues pendantes, eaux saumustres. Quartiers noyés, ponts rompus, cryptes immergees. + +**VOLCAN** (Pente Volcanique): Coulées de lave, roches noires refroidies, cendres volantes, chaleur étouffante. Caldera active, ponts de basalte, cryptes de cendre. + +**FORET** (Foret Sombre): Bois sylvains tordus, mousse épaisse, racines apparentes, clairières brumeuses. Foret hantée, huttes de bûcherons, tombes sous les chênes. + +**HIVER** (Plaine Enneigee): Neige poudreuse, lacs gelés, branches givrées, brouillard glacial. Toundra hivernale, refuges de trappeurs, tombeaux sous la neige. + +**PRINTEMPS** (Prairie Printaniere): Champs en fleurs, herbe tendre, ruisseaux clairs, arbres en bourgeon. Prairies ouvertes, cercles de druides, fontaines sacrées. + +**ETE** (Plaine Estivale): Herbe dorée, blés mûrs, ciel sans nuage, chaleur accablante. Moissons, greniers abandonnés, ossuaires sous le soleil. + +**AUTOMNE** (Foret d'Automne): Feuilles rousses, champignons, brume matinale, gibier traqué. Bois automnal, sentiers couverts, tombes sous les érables. + +**DESOLATION** (Terre Desolee): Cendres froides, arbres carbonisés, sols stériles, ciel gris. Paysage post-cataclysmique, ruines calcinées, ossuaires à ciel ouvert. + +**FUTURISTE** (Cite Futuriste): Métal chromé, néons froids, panneaux holographiques, gratte-ciel en ruine. Megalopole dystopique, laboratoires secrets, cités volantes. + +**ELECTRONIQUE** (Reseau Electronique): Circuits imprimés, fibres optiques, données en flux, serveurs silencieux. Matrice numérique, nœuds de calcul, foyers d'IA. + +## Adding a theme + +1. Create `tiled-mcp/src/themes/.ts` exporting a `Theme` (copy an existing one). It must + define at least `walkable_floor` and `wall`. +2. Register it in `tiled-mcp/src/themes/index.ts`. +3. Add its prompt entries to `ROLE_VISUALS` and its key to `ThemeKey` in + `tiled-mcp/src/themes/prompts.ts` if you want sprite generation. +4. Put sprites in `assets//.png` (64x32 floors, 64x64 walls and props), + or generate them. +5. `npm run build && npm run docs && npm run smoke`. diff --git a/docs/tools.md b/docs/tools.md new file mode 100644 index 0000000000000000000000000000000000000000..8ae995088a23f08047bbf5ccd7a78bd127ef3b0a --- /dev/null +++ b/docs/tools.md @@ -0,0 +1,444 @@ +# Tool reference + + + +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. + +Coordinates are grid cells: `x` is the column (0..width-1) and `y` the row (0..height-1). +On an isometric map, cell (0,0) is the top corner of the diamond; `x` grows toward the lower right +and `y` toward the lower left. See [map-format.md](map-format.md) for the layers and properties. + +Tags: `read-only` never changes anything, `destructive` can delete or overwrite, `idempotent` is safe +to repeat, `network` calls an external service. + +## Contents + +- **Map lifecycle**: [`list_themes`](#list_themes), [`create_map`](#create_map), [`list_maps`](#list_maps), [`describe_map`](#describe_map), [`discard_map`](#discard_map) +- **Painting tiles**: [`paint_tile`](#paint_tile), [`paint_rect`](#paint_rect), [`paint_wall_border`](#paint_wall_border), [`erase_tile`](#erase_tile), [`get_tile_info`](#get_tile_info) +- **Rooms and corridors**: [`generate_room`](#generate_room), [`generate_corridor`](#generate_corridor) +- **Layout presets**: [`generate_crypt_layout`](#generate_crypt_layout), [`generate_castle_floor`](#generate_castle_floor), [`generate_werewolf_den`](#generate_werewolf_den) +- **Objects**: [`place_door`](#place_door), [`place_chest`](#place_chest), [`place_stairs_object`](#place_stairs_object), [`place_trap`](#place_trap), [`place_lever`](#place_lever) +- **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 lifecycle + +### list_themes + +`read-only` + +Lists the available map themes (tile palettes): key, display name, description, the tile roles each theme provides, and whether its sprite PNGs are present locally (sprites.status: all, partial or none). Themes without sprites still produce valid maps; Tiled shows placeholders until the sprites exist. + +No parameters. + +### create_map + +`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 | + +### list_maps + +`read-only` + +Lists the maps held in memory by this server session, with their summaries. + +No parameters. + +### describe_map + +`read-only` + +Returns a summary of one map: size, orientation, theme, tile counts per tile type, and number of objects and spawns. + +| Parameter | Type | Required | Notes | +|---|---|---|---| +| `mapId` | string | yes | mapId returned by create_map | + +### discard_map + +`destructive` `idempotent` + +Deletes a map from server memory. Irreversible unless it was saved or exported first. + +| Parameter | Type | Required | Notes | +|---|---|---|---| +| `mapId` | string | yes | mapId returned by create_map | + +## Painting tiles + +### paint_tile + +`idempotent` + +Paints a single cell of a tile layer with a tile role. 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 | | +| `layer` | `ground`, `walls`, `decorations` | yes | ground = floors, hazards and difficult terrain; walls = wall tiles drawn above the ground (a cell with a wall is impassable); decorations = props above the ground (obstacle_decor blocks movement, decoration_minor is walkable) | +| `x` | integer | yes | 0..9007199254740991 | +| `y` | integer | yes | 0..9007199254740991 | +| `role` | `walkable_floor`, `walkable_floor_alt`, `wall`, `wall_corner`, `difficult_terrain`, `hazard_primary`, `obstacle_decor`, `decoration_minor`, `door_closed`, `stairs` | yes | Tile role, resolved to a sprite by the map's theme | + +### paint_rect + +`idempotent` + +Paints every cell of the rectangle between two opposite corners (inclusive) on one layer. Typical use: paint_rect on 'ground' with walkable_floor for a room's floor. 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 | | +| `layer` | `ground`, `walls`, `decorations` | yes | ground = floors, hazards and difficult terrain; walls = wall tiles drawn above the ground (a cell with a wall is impassable); decorations = props above the ground (obstacle_decor blocks movement, decoration_minor is walkable) | +| `x1` | integer | yes | 0..9007199254740991 | +| `y1` | integer | yes | 0..9007199254740991 | +| `x2` | integer | yes | 0..9007199254740991 | +| `y2` | integer | yes | 0..9007199254740991 | +| `role` | `walkable_floor`, `walkable_floor_alt`, `wall`, `wall_corner`, `difficult_terrain`, `hazard_primary`, `obstacle_decor`, `decoration_minor`, `door_closed`, `stairs` | yes | Tile role, resolved to a sprite by the map's theme | + +### paint_wall_border + +`idempotent` + +Paints walls on the outline of a rectangle (inclusive corners) on the 'walls' layer, to enclose a room quickly. Erase single wall cells afterwards (erase_tile layer=walls) to open doorways. 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 | | +| `x1` | integer | yes | 0..9007199254740991 | +| `y1` | integer | yes | 0..9007199254740991 | +| `x2` | integer | yes | 0..9007199254740991 | +| `y2` | integer | yes | 0..9007199254740991 | + +### erase_tile + +`destructive` `idempotent` + +Clears one cell of a tile layer (for example to open a doorway in a wall). 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 | | +| `layer` | `ground`, `walls`, `decorations` | yes | ground = floors, hazards and difficult terrain; walls = wall tiles drawn above the ground (a cell with a wall is impassable); decorations = props above the ground (obstacle_decor blocks movement, decoration_minor is walkable) | +| `x` | integer | yes | 0..9007199254740991 | +| `y` | integer | yes | 0..9007199254740991 | + +### get_tile_info + +`read-only` + +Returns the tile on one layer at (x, y): gid (0 = empty), role, tile type and sprite id, plus the object or spawn standing on that cell if any. Check layer=walls before placing objects: a wall sits on top of a walkable ground tile. 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 | | +| `layer` | `ground`, `walls`, `decorations` | yes | ground = floors, hazards and difficult terrain; walls = wall tiles drawn above the ground (a cell with a wall is impassable); decorations = props above the ground (obstacle_decor blocks movement, decoration_minor is walkable) | +| `x` | integer | yes | 0..9007199254740991 | +| `y` | integer | yes | 0..9007199254740991 | + +## Rooms and corridors + +### generate_room + +`writes map` + +Builds a rectangular room in one call: walkable floor, a wall border, and a doorway with a closed door for each exit. Options add a hazard tile in the centre and obstacle props in the four inner corners (only if the theme defines those roles). originX/originY is the room's top-left cell; the walls are part of the room's width and height. 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 | | +| `originX` | integer | yes | 0..9007199254740991 | +| `originY` | integer | yes | 0..9007199254740991 | +| `width` | integer | yes | Outer width including walls. 3..40 | +| `height` | integer | yes | Outer height including walls. 3..40 | +| `exits` | array of { direction: `north`, `south`, `east`, `west`; offset: integer } | no | max 4 items | +| `hazardCenter` | boolean | no | Paint the theme's hazard_primary tile at the room centre | +| `obstacleCorners` | boolean | no | Paint obstacle_decor props in the four inner corners | + +### generate_corridor + +`writes map` + +Draws a straight, axis-aligned corridor between (fromX,fromY) and (toX,toY): walkable floor plus side walls. Interior width defaults to 1 (3 cells including both walls). Side walls that cross an existing room are painted too, so connect corridors to doorways. 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 | | +| `fromX` | integer | yes | 0..9007199254740991 | +| `fromY` | integer | yes | 0..9007199254740991 | +| `toX` | integer | yes | 0..9007199254740991 | +| `toY` | integer | yes | 0..9007199254740991 | +| `width` | integer | no | Interior width in cells (default 1). 1..4 | + +## Layout presets + +### generate_crypt_layout + +`writes map` + +Fills a map with a crypt: entrance hall (west), central nave, north and south burial chambers, and a deep crypt (east) with a hazard tile and corner obstacles, all connected by doors and corridors. Needs a map of at least 27x18. Suited to the CRYPT, BLOOD_TOMB and MAUSOLEUM themes. Adds a player spawn in the entrance unless addPlayerSpawn is false. + +| Parameter | Type | Required | Notes | +|---|---|---|---| +| `mapId` | string | yes | | +| `addPlayerSpawn` | boolean | no | Place a player spawn in the entrance (default true) | + +### generate_castle_floor + +`writes map` + +Fills a map with a castle floor: antechamber (west) behind a locked main door (pick DC 18), a great hall, north and south wings, and a far room (east) whose content depends on floorVariant. The 'throne' variant adds a throne prop and an enemy 'Castle lord' spawn. Needs a map of at least 27x20. Suited to the CASTLE theme. + +| Parameter | Type | Required | Notes | +|---|---|---|---| +| `mapId` | string | yes | | +| `floorVariant` | `entrance`, `throne`, `private_chambers` | no | entrance = inner courtyard, throne = throne room (default), private_chambers = private apartments | +| `addPlayerSpawn` | boolean | no | Place a player spawn in the antechamber (default true) | + +### generate_werewolf_den + +`writes map` + +Fills a map with a cave den: cave mouth (west), hunting hall with bone obstacles, a nest of young wolves (north), a bone store (south) and the alpha's lair (east) with a hazard tile. Adds enemy spawns 'Alpha werewolf' and 'Werewolf cub'. Needs a map of at least 22x16. Suited to the WEREWOLF_DEN theme. + +| Parameter | Type | Required | Notes | +|---|---|---|---| +| `mapId` | string | yes | | +| `addPlayerSpawn` | boolean | no | Place a player spawn at the cave mouth (default true) | + +## Objects + +### place_door + +`writes map` + +Adds a door to the 'objects' layer. Put doors in a wall opening: erase the wall at that cell first (erase_tile layer=walls) and keep a ground tile under it; generate_room does this for its exits. A locked door needs pickDC to be picked open. 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 | | +| `x` | integer | yes | 0..9007199254740991 | +| `y` | integer | yes | 0..9007199254740991 | +| `locked` | boolean | no | Defaults to false (closed but unlocked) | +| `pickDC` | integer | no | Difficulty class to pick the lock (5..30). 5..30 | +| `targetZoneId` | string | no | Optional id of the zone this door leads to (for multi-zone dungeons) | +| `name` | string | no | | + +### place_chest + +`writes map` + +Adds a chest to the 'objects' layer. A locked chest needs pickDC to be opened. The cell must be painted ground without a wall and without another object or spawn; otherwise the call fails with an explanation. 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 | | +| `x` | integer | yes | 0..9007199254740991 | +| `y` | integer | yes | 0..9007199254740991 | +| `locked` | boolean | no | | +| `pickDC` | integer | no | Difficulty class to pick the lock (5..30). 5..30 | +| `name` | string | no | | + +### place_stairs_object + +`writes map` + +Adds a stairs object that moves the party to another zone (targetZoneId). Unlike the decorative 'stairs' tile role, this object carries the zone link. The cell must be painted ground without a wall and without another object or spawn; otherwise the call fails with an explanation. 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 | | +| `x` | integer | yes | 0..9007199254740991 | +| `y` | integer | yes | 0..9007199254740991 | +| `targetZoneId` | string | yes | Id of the destination zone | +| `name` | string | no | | + +### place_trap + +`writes map` + +Adds a trap to the 'objects' layer. Entering the cell triggers a saving throw when trapSaveDC is set, otherwise the damage applies automatically. The cell must be painted ground without a wall and without another object or spawn; otherwise the call fails with an explanation. 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 | | +| `x` | integer | yes | 0..9007199254740991 | +| `y` | integer | yes | 0..9007199254740991 | +| `trapType` | string | yes | Damage type, e.g. piercing, fire, poison, lightning | +| `trapNotation` | string | yes | Damage dice, e.g. 2d6 or 3d4+1. pattern `^\d+[dD]\d+([+-]\d+)?$` | +| `trapSaveDC` | integer | no | Saving throw difficulty class (5..30). 5..30 | +| `name` | string | no | | + +### place_lever + +`writes map` + +Adds a lever players can pull. Its effect is up to the game engine that loads the map. The cell must be painted ground without a wall and without another object or spawn; otherwise the call fails with an explanation. 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 | | +| `x` | integer | yes | 0..9007199254740991 | +| `y` | integer | yes | 0..9007199254740991 | +| `name` | string | no | | + +## Spawns + +### place_spawn_player + +`writes map` + +Adds a player start point to the 'spawns' layer. Every playable map needs at least one (validate_map warns otherwise). The cell must be painted ground without a wall and without another object or spawn; otherwise the call fails with an explanation. 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 | | +| `x` | integer | yes | 0..9007199254740991 | +| `y` | integer | yes | 0..9007199254740991 | +| `name` | string | no | | + +### place_spawn_enemy + +`writes map` + +Adds an enemy spawn point to the 'spawns' layer. encounterId links it to an encounter defined by the game engine; npcName is the creature's display name. The cell must be painted ground without a wall and without another object or spawn; otherwise the call fails with an explanation. 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 | | +| `x` | integer | yes | 0..9007199254740991 | +| `y` | integer | yes | 0..9007199254740991 | +| `encounterId` | string | no | Id of an existing encounter in the game engine | +| `npcName` | string | no | Display name, e.g. 'Alpha werewolf' | +| `name` | string | no | | + +### place_spawn_npc + +`writes map` + +Adds a non-hostile NPC spawn point (merchant, quest giver, ally) to the 'spawns' layer. The cell must be painted ground without a wall and without another object or spawn; otherwise the call fails with an explanation. 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 | | +| `x` | integer | yes | 0..9007199254740991 | +| `y` | integer | yes | 0..9007199254740991 | +| `npcName` | string | no | Display name, e.g. 'Old innkeeper' | +| `name` | string | no | | + +## Validation and export + +### validate_map + +`read-only` + +Checks the map before export: Tiled structure (errors) and gameplay sanity (warnings): at least one player spawn, no object or spawn on a wall or outside the painted ground, no door left inside a wall. Returns { ok, errors, warnings }. + +| Parameter | Type | Required | Notes | +|---|---|---|---| +| `mapId` | string | yes | | + +### export_json + +`read-only` + +Returns the full Tiled JSON (.tmj content) of a map as text. Sprite paths are written as './assets//.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 | +|---|---|---|---| +| `mapId` | string | yes | | + +### save_to_disk + +`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 | +|---|---|---|---| +| `mapId` | string | yes | | +| `path` | string | yes | File path ending in .tmj or .json, e.g. 'crypt-chapel.tmj' (goes to the maps folder) or an absolute path. min 1 chars | + +## Sprites (optional, generation is paid) + +### preview_sprite_prompt + +`read-only` + +Free: returns the exact FLUX prompt, geometry and size generate_tile_sprite would use for (theme, role) with optional overrides, without calling any service. Use it to iterate on wording before paying for a generation. + +| Parameter | Type | Required | Notes | +|---|---|---|---| +| `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 | +| `role` | `walkable_floor`, `walkable_floor_alt`, `wall`, `wall_corner`, `difficult_terrain`, `hazard_primary`, `obstacle_decor`, `decoration_minor`, `door_closed`, `stairs` | yes | Tile role, e.g. walkable_floor, wall, obstacle_decor | +| `material` | string | no | | +| `lighting` | string | no | | +| `extraDetail` | string | no | | + +### generate_tile_sprite + +`network` + +PAID: generates one isometric sprite for (theme, role) with FLUX.1-dev via Hugging Face Inference Providers, removes the magenta background and resizes it to 64x32 (floors) or 64x64 (walls, props). Saves //.png, or __.png when variant is set. Takes 20-40 s and costs money per call; check that the file is missing first (list_themes shows missing sprites) and preview the prompt with preview_sprite_prompt. An existing file is kept unless force is true. + +| Parameter | Type | Required | Notes | +|---|---|---|---| +| `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 | +| `role` | `walkable_floor`, `walkable_floor_alt`, `wall`, `wall_corner`, `difficult_terrain`, `hazard_primary`, `obstacle_decor`, `decoration_minor`, `door_closed`, `stairs` | yes | Tile role, e.g. walkable_floor, wall, obstacle_decor | +| `variant` | string | no | Contextual variant slug, e.g. 'alembic' for a laboratory: saved as __.png and bound to a map with override_tile_image. pattern `^[a-z0-9_]+$` | +| `material` | string | no | Override of the material description, e.g. 'alchemical workbench with brass alembics' | +| `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 file already exists (paid again) | +| `outputDir` | string | no | Output folder; relative paths resolve against the assets folder. Defaults to // | + +### generate_theme_sprite_set + +`network` + +PAID and slow: generates every sprite of a theme that is missing on disk (about 30 s and one paid call per sprite, typically 8-10 sprites, so 4-5 minutes). Existing sprites are skipped unless force is true. Many MCP clients time out on calls this long; for a whole theme prefer the command line script: node scripts/gen-theme-set.mjs --yes. + +| Parameter | Type | Required | Notes | +|---|---|---|---| +| `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 | +| `force` | boolean | no | Regenerate sprites that already exist (paid again) | +| `seed` | integer | no | -9007199254740991..9007199254740991 | + +### override_tile_image + +`idempotent` + +Points one role of a single map's tileset at a variant image, e.g. obstacle_decor__alembic.png instead of obstacle_decor.png. Only that map changes; other maps and the theme keep their defaults. Call after create_map and before saving or exporting. + +| Parameter | Type | Required | Notes | +|---|---|---|---| +| `mapId` | string | yes | | +| `role` | `walkable_floor`, `walkable_floor_alt`, `wall`, `wall_corner`, `difficult_terrain`, `hazard_primary`, `obstacle_decor`, `decoration_minor`, `door_closed`, `stairs` | yes | Tile role, e.g. walkable_floor, wall, obstacle_decor | +| `variant` | string | yes | Variant slug: the file //__.png should exist. pattern `^[a-z0-9_]+$` | +| `imageWidth` | integer | no | Image width in pixels if it differs from the default. -9007199254740991..9007199254740991 | +| `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//__.png' convention | + +## Prompts + +### Prompt: map_builder + +Loads the map-builder skill and applies it to your description of the map: theme, size, encounters, traps, output. + +| Argument | Required | Notes | +|---|---|---| +| `description` | yes | Free-form description, e.g. 'crypt 28x18 under a chapel, two skeletons, a locked chest DC 15' | diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md new file mode 100644 index 0000000000000000000000000000000000000000..7a1455993e13de4dc8df804b2c4864c290da621a --- /dev/null +++ b/docs/troubleshooting.md @@ -0,0 +1,67 @@ +# Troubleshooting + +Start with the automated check. It starts the server and exercises it end to end, offline: + +```bash +npm run build && npm run smoke +``` + +If it prints `39 passed, 0 failed`, the server works and the problem is in the client setup. + +## The tools do not appear in my client + +- Run `npm run build`: the client starts `tiled-mcp/dist/index.js`, which only exists after a build. +- Use an **absolute** path in the client configuration. +- Check the Node version with `node --version`; it must be 20.9 or newer. If your client starts + a different Node than your terminal, put the full path to `node` in `command`. +- Restart the client after editing its configuration. +- Try `npm run inspect`: if the MCP Inspector lists the tools, the server is fine. + +## `Unknown mapId` + +Maps live in server memory. They disappear when the client restarts the server, and every +client session has its own server process. Call `list_maps`, or create the map again. Save with +`save_to_disk` before closing the session. + +## Tiled shows red placeholder tiles + +- The theme has no sprites yet: `list_themes` shows `sprites.status: "none"`. Use a theme with + bundled sprites, or [generate them](sprite-generation.md). +- The file was produced by `export_json` and saved by hand somewhere else. Its image paths are + relative to the repository root (`./assets/...`). Use `save_to_disk`, which writes paths + relative to the file, or move the file to the repository root. +- You moved a saved `.tmj` to another folder. Save it again from the server, or fix the paths in + Tiled (Map, Tileset properties). + +## Objects or spawns are on the wrong tiles in my engine + +Since 0.2.0, objects use Tiled's native isometric encoding. If your importer was written for the +older screen-space encoding, either update it with the formulas in +[map-format.md](map-format.md#object-coordinates) or set `TILED_OBJECT_COORDS=screen`. + +## "Map too small for generate_crypt_layout" + +Presets need room for their rooms not to overlap: crypt 27x18, castle 27x20, werewolf den 22x16. +Create a larger map, or build the layout with `generate_room` and `generate_corridor`. + +## A placement is rejected + +The error says why: a wall on that cell, no ground (outside the rooms), an obstacle prop, or +another object or spawn already there. Use `get_tile_info` on the `walls` and `ground` layers +and pick a free floor cell. Doors are the exception: they go in wall openings. + +## Sprite generation fails + +- `HUGGINGFACE_API_KEY (or HF_TOKEN) is not set`: add the token to `tiled-mcp/.env` or to the + client'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; only + sprite generation and previews need it. +- The client times out on `generate_theme_sprite_set`: use `node scripts/gen-theme-set.mjs --yes`. + +## Running the server on WSL from a Windows client + +See [client-setup.md](client-setup.md#windows-with-the-server-inside-wsl). Windows paths passed to +tools, such as `D:/maps/crypt.tmj`, are translated to `/mnt/d/...` automatically. diff --git a/huggingface/space-card.md b/huggingface/space-card.md new file mode 100644 index 0000000000000000000000000000000000000000..c9746f82daae50230fe38865da4b735ad1b0b8e3 --- /dev/null +++ b/huggingface/space-card.md @@ -0,0 +1,22 @@ +--- +title: Tiled Map Builder +emoji: 🗺️ +colorFrom: indigo +colorTo: gray +sdk: docker +app_port: 7860 +pinned: false +license: mit +short_description: Describe a dungeon, get an isometric Tiled map +hf_oauth: true +hf_oauth_expiration_minutes: 480 +hf_oauth_scopes: + - inference-api +tags: + - mcp-server + - tiled + - map-generator + - isometric + - procedural-generation +--- + diff --git a/huggingface/sync-space.sh b/huggingface/sync-space.sh new file mode 100644 index 0000000000000000000000000000000000000000..280f625e424b07c00f559a595a7cf48155cab65b --- /dev/null +++ b/huggingface/sync-space.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# Publish the current commit of this repository to its Hugging Face Space. +# +# huggingface/sync-space.sh [OWNER/SPACE] default: 4math/tiled-map-builder +# +# Needs git and the hf CLI (pip install -U huggingface_hub), logged in with write access to the +# Space: run "hf auth login" or set HF_TOKEN. The Space then rebuilds from the Dockerfile. +# +# The Space's README.md must start with its YAML card, so the uploaded README is +# huggingface/space-card.md followed by the repository README. Files deleted from the +# repository are deleted from the Space too. +set -eu + +SPACE="${1:-4math/tiled-map-builder}" +ROOT="$(cd "$(dirname "$0")/.." && pwd)" +STAGE="$(mktemp -d)" +trap 'rm -rf "$STAGE"' EXIT + +git -C "$ROOT" archive HEAD | tar -x -C "$STAGE" +cat "$ROOT/huggingface/space-card.md" "$ROOT/README.md" > "$STAGE/README.md" + +hf upload "$SPACE" "$STAGE" . \ + --repo-type space \ + --delete "*" \ + --commit-message "Sync from GitHub $(git -C "$ROOT" rev-parse --short HEAD)" diff --git a/maps/README.md b/maps/README.md new file mode 100644 index 0000000000000000000000000000000000000000..1cf9e8aa844ed66a8f2f558392e7eef8269f7cda --- /dev/null +++ b/maps/README.md @@ -0,0 +1,20 @@ +# Sample maps + +Open any of these in [Tiled](https://www.mapeditor.org) (File, Open) or render a PNG preview: + +```bash +npm run preview -- maps/forteresse-glace-etage.tmj +``` + +| File | Theme | Size | How it was made | +|---|---|---|---| +| `exemple-crypte-nemotron.tmj` | `CRYPT` | 20x14 | Built by a Nemotron agent through the MCP tools with an early version of the server. The crypt preset ran on a map smaller than it needs, so some rooms overlap and two doors share a cell; current versions refuse that size (the crypt preset needs 27x18). Kept as a real agent-made example. | +| `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 the +repository or save them again with `save_to_disk`. diff --git a/maps/caverne-aquatique.tmj b/maps/caverne-aquatique.tmj new file mode 100644 index 0000000000000000000000000000000000000000..b3745089fd86ef5fecf4de179f3bca1e35fb43a3 --- /dev/null +++ b/maps/caverne-aquatique.tmj @@ -0,0 +1,12770 @@ +{ + "type": "map", + "version": "1.10", + "tiledversion": "1.10.2", + "orientation": "isometric", + "renderorder": "right-down", + "width": 64, + "height": 64, + "tilewidth": 64, + "tileheight": 32, + "infinite": false, + "nextlayerid": 6, + "nextobjectid": 10, + "tilesets": [ + { + "firstgid": 1, + "name": "aquatic-tileset", + "tilewidth": 64, + "tileheight": 32, + "tilecount": 10, + "columns": 0, + "tiles": [ + { + "id": 0, + "properties": [ + { + "name": "tileType", + "value": "WALKABLE", + "type": "string" + }, + { + "name": "spriteId", + "value": "aquatic.black_water", + "type": "string" + } + ], + "image": "../assets/aquatic/walkable_floor.png", + "imagewidth": 64, + "imageheight": 32 + }, + { + "id": 1, + "properties": [ + { + "name": "tileType", + "value": "WALKABLE", + "type": "string" + }, + { + "name": "spriteId", + "value": "aquatic.murky_water", + "type": "string" + } + ], + "image": "../assets/aquatic/walkable_floor_alt.png", + "imagewidth": 64, + "imageheight": 32 + }, + { + "id": 2, + "properties": [ + { + "name": "tileType", + "value": "WALL", + "type": "string" + }, + { + "name": "spriteId", + "value": "aquatic.weeping_stone", + "type": "string" + } + ], + "image": "../assets/aquatic/wall.png", + "imagewidth": 64, + "imageheight": 64 + }, + { + "id": 3, + "properties": [ + { + "name": "tileType", + "value": "WALL", + "type": "string" + }, + { + "name": "spriteId", + "value": "aquatic.damp_corner", + "type": "string" + } + ], + "image": "../assets/aquatic/wall_corner.png", + "imagewidth": 64, + "imageheight": 64 + }, + { + "id": 4, + "properties": [ + { + "name": "tileType", + "value": "DIFFICULT_TERRAIN", + "type": "string" + }, + { + "name": "spriteId", + "value": "aquatic.algae_flagstone", + "type": "string" + } + ], + "image": "../assets/aquatic/difficult_terrain.png", + "imagewidth": 64, + "imageheight": 32 + }, + { + "id": 5, + "properties": [ + { + "name": "tileType", + "value": "HAZARD", + "type": "string" + }, + { + "name": "spriteId", + "value": "aquatic.deep_water", + "type": "string" + } + ], + "image": "../assets/aquatic/hazard_primary.png", + "imagewidth": 64, + "imageheight": 64 + }, + { + "id": 6, + "properties": [ + { + "name": "tileType", + "value": "OBSTACLE", + "type": "string" + }, + { + "name": "spriteId", + "value": "aquatic.submerged_sarcophagus", + "type": "string" + } + ], + "image": "../assets/aquatic/obstacle_decor.png", + "imagewidth": 64, + "imageheight": 64 + }, + { + "id": 7, + "properties": [ + { + "name": "tileType", + "value": "WALKABLE", + "type": "string" + }, + { + "name": "spriteId", + "value": "aquatic.water_lily", + "type": "string" + } + ], + "image": "../assets/aquatic/decoration_minor.png", + "imagewidth": 64, + "imageheight": 32 + }, + { + "id": 8, + "properties": [ + { + "name": "tileType", + "value": "DOOR", + "type": "string" + }, + { + "name": "spriteId", + "value": "aquatic.barnacled_door", + "type": "string" + } + ], + "image": "../assets/aquatic/door_closed.png", + "imagewidth": 64, + "imageheight": 64 + }, + { + "id": 9, + "properties": [ + { + "name": "tileType", + "value": "STAIRS", + "type": "string" + }, + { + "name": "spriteId", + "value": "aquatic.slimy_stairs", + "type": "string" + } + ], + "image": "../assets/aquatic/stairs.png", + "imagewidth": 64, + "imageheight": 64 + } + ], + "grid": { + "orientation": "isometric", + "width": 64, + "height": 32 + } + } + ], + "layers": [ + { + "id": 1, + "name": "ground", + "type": "tilelayer", + "visible": true, + "width": 64, + "height": 64, + "data": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 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, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 5, + 9, + 5, + 5, + 5, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 5, + 5, + 5, + 5, + 5, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 5, + 5, + 5, + 5, + 5, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 5, + 5, + 5, + 5, + 5, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 5, + 5, + 5, + 5, + 5, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 5, + 5, + 5, + 5, + 5, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 5, + 5, + 5, + 5, + 5, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 5, + 5, + 5, + 5, + 5, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 5, + 5, + 5, + 5, + 5, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 6, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 2, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 2, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 2, + 6, + 6, + 6, + 6, + 1, + 6, + 6, + 6, + 6, + 2, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 6, + 6, + 6, + 1, + 1, + 1, + 1, + 1, + 6, + 6, + 6, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 1, + 1, + 6, + 6, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 6, + 6, + 1, + 1, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 9, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 1, + 1, + 6, + 6, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 6, + 6, + 1, + 1, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 9, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 1, + 6, + 6, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 6, + 6, + 1, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 1, + 1, + 6, + 6, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 6, + 6, + 1, + 1, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 1, + 1, + 6, + 6, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 6, + 6, + 1, + 1, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 6, + 6, + 6, + 1, + 1, + 1, + 1, + 1, + 6, + 6, + 6, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 2, + 6, + 6, + 6, + 6, + 1, + 6, + 6, + 6, + 6, + 2, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 2, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 2, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 6, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 5, + 5, + 5, + 5, + 5, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 5, + 5, + 5, + 5, + 5, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 5, + 5, + 5, + 5, + 5, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 5, + 5, + 5, + 5, + 5, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 5, + 5, + 5, + 5, + 5, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 5, + 5, + 5, + 5, + 5, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 5, + 5, + 5, + 5, + 5, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 5, + 9, + 5, + 5, + 5, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 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, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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": 2, + "name": "walls", + "type": "tilelayer", + "visible": true, + "width": 64, + "height": 64, + "data": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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": 3, + "name": "decorations", + "type": "tilelayer", + "visible": true, + "width": 64, + "height": 64, + "data": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 7, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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": 4, + "name": "objects", + "type": "objectgroup", + "visible": true, + "objects": [ + { + "id": 9, + "x": 1024, + "y": 1024, + "width": 32, + "height": 32, + "name": "sarcophage-submerge", + "type": "chest", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "kind", + "value": "chest", + "type": "string" + }, + { + "name": "state", + "value": "closed", + "type": "string" + } + ] + } + ], + "opacity": 1, + "x": 0, + "y": 0, + "draworder": "topdown" + }, + { + "id": 5, + "name": "spawns", + "type": "objectgroup", + "visible": true, + "objects": [ + { + "id": 1, + "x": 1008, + "y": 272, + "point": true, + "name": "boss-final", + "type": "enemy", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "role", + "value": "enemy", + "type": "string" + }, + { + "name": "npcName", + "value": "Seigneur des Abysses", + "type": "string" + } + ] + }, + { + "id": 2, + "x": 1008, + "y": 1776, + "point": true, + "name": "player-start", + "type": "player", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "role", + "value": "player", + "type": "string" + } + ] + }, + { + "id": 3, + "x": 1744, + "y": 1008, + "point": true, + "name": "water-creature-east", + "type": "enemy", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "role", + "value": "enemy", + "type": "string" + }, + { + "name": "npcName", + "value": "Rampant des Eaux", + "type": "string" + } + ] + }, + { + "id": 4, + "x": 336, + "y": 1008, + "point": true, + "name": "water-creature-west", + "type": "enemy", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "role", + "value": "enemy", + "type": "string" + }, + { + "name": "npcName", + "value": "Rampant des Eaux", + "type": "string" + } + ] + }, + { + "id": 5, + "x": 1712, + "y": 368, + "point": true, + "name": "water-creature-ne", + "type": "enemy", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "role", + "value": "enemy", + "type": "string" + }, + { + "name": "npcName", + "value": "Esprit de l'Onde", + "type": "string" + } + ] + }, + { + "id": 6, + "x": 368, + "y": 368, + "point": true, + "name": "water-creature-nw", + "type": "enemy", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "role", + "value": "enemy", + "type": "string" + }, + { + "name": "npcName", + "value": "Esprit de l'Onde", + "type": "string" + } + ] + }, + { + "id": 7, + "x": 1744, + "y": 1776, + "point": true, + "name": "water-creature-se", + "type": "enemy", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "role", + "value": "enemy", + "type": "string" + }, + { + "name": "npcName", + "value": "Rampant des Eaux", + "type": "string" + } + ] + }, + { + "id": 8, + "x": 336, + "y": 1776, + "point": true, + "name": "water-creature-sw", + "type": "enemy", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "role", + "value": "enemy", + "type": "string" + }, + { + "name": "npcName", + "value": "Rampant des Eaux", + "type": "string" + } + ] + } + ], + "opacity": 1, + "x": 0, + "y": 0, + "draworder": "topdown" + } + ], + "properties": [ + { + "name": "theme", + "value": "AQUATIC", + "type": "string" + }, + { + "name": "mapName", + "value": "Caverne Aquatique Souterraine", + "type": "string" + } + ] +} diff --git a/maps/exemple-crypte-nemotron.tmj b/maps/exemple-crypte-nemotron.tmj new file mode 100644 index 0000000000000000000000000000000000000000..f95f3bd492ea3981f3340be3c14d7cbc976f5098 --- /dev/null +++ b/maps/exemple-crypte-nemotron.tmj @@ -0,0 +1,1471 @@ +{ + "type": "map", + "version": "1.10", + "tiledversion": "1.10.2", + "orientation": "isometric", + "renderorder": "right-down", + "width": 20, + "height": 14, + "tilewidth": 64, + "tileheight": 32, + "infinite": false, + "nextlayerid": 6, + "nextobjectid": 15, + "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": 20, + "height": 14, + "data": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0 + ], + "opacity": 1, + "x": 0, + "y": 0 + }, + { + "id": 2, + "name": "walls", + "type": "tilelayer", + "visible": true, + "width": 20, + "height": 14, + "data": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 3, + 0, + 3, + 3, + 3, + 0, + 3, + 3, + 0, + 3, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 0, + 0 + ], + "opacity": 1, + "x": 0, + "y": 0 + }, + { + "id": 3, + "name": "decorations", + "type": "tilelayer", + "visible": true, + "width": 20, + "height": 14, + "data": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 7, + 0, + 0, + 7, + 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, + 7, + 0, + 0, + 0, + 7, + 0, + 0, + 7, + 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, + 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": "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": 224, + "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": 128, + "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": 320, + "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": 224, + "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": 288, + "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": 384, + "y": 224, + "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": 12, + "x": 128, + "y": 192, + "width": 32, + "height": 32, + "name": "Coffre verrouillé (chambre nord)", + "type": "chest", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "kind", + "value": "chest", + "type": "string" + }, + { + "name": "state", + "value": "locked", + "type": "string" + }, + { + "name": "pickDC", + "value": 15, + "type": "int" + } + ] + }, + { + "id": 13, + "x": 320, + "y": 256, + "width": 32, + "height": 32, + "name": "Piège à fléchettes devant la crypte", + "type": "trap", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "kind", + "value": "trap", + "type": "string" + }, + { + "name": "state", + "value": "closed", + "type": "string" + }, + { + "name": "trapType", + "value": "perforant", + "type": "string" + }, + { + "name": "trapNotation", + "value": "2d6", + "type": "string" + }, + { + "name": "trapSaveDC", + "value": 13, + "type": "int" + } + ] + } + ], + "opacity": 1, + "x": 0, + "y": 0, + "draworder": "topdown" + }, + { + "id": 5, + "name": "spawns", + "type": "objectgroup", + "visible": true, + "objects": [ + { + "id": 9, + "x": 48.0, + "y": 240.0, + "point": true, + "name": "player-9", + "type": "player", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "role", + "value": "player", + "type": "string" + } + ] + }, + { + "id": 10, + "x": 304.0, + "y": 208.0, + "point": true, + "name": "Squelette patrouille nef (gauche)", + "type": "enemy", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "role", + "value": "enemy", + "type": "string" + }, + { + "name": "npcName", + "value": "Squelette", + "type": "string" + } + ] + }, + { + "id": 11, + "x": 368.0, + "y": 208.0, + "point": true, + "name": "Squelette patrouille nef (droite)", + "type": "enemy", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "role", + "value": "enemy", + "type": "string" + }, + { + "name": "npcName", + "value": "Squelette", + "type": "string" + } + ] + }, + { + "id": 14, + "x": 400.0, + "y": 400.0, + "point": true, + "name": "Bastellus (dort dans la crypte centrale)", + "type": "enemy", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "role", + "value": "enemy", + "type": "string" + }, + { + "name": "npcName", + "value": "Bastellus", + "type": "string" + } + ] + } + ], + "opacity": 1, + "x": 0, + "y": 0, + "draworder": "topdown" + } + ], + "properties": [ + { + "name": "theme", + "value": "CRYPT", + "type": "string" + }, + { + "name": "mapName", + "value": "Crypte sous la chapelle abandonnée", + "type": "string" + } + ] +} diff --git a/maps/forteresse-glace-etage.tmj b/maps/forteresse-glace-etage.tmj new file mode 100644 index 0000000000000000000000000000000000000000..ad166707ea58f895f5c8fdb81b2fff76afd0c207 --- /dev/null +++ b/maps/forteresse-glace-etage.tmj @@ -0,0 +1,12816 @@ +{ + "type": "map", + "version": "1.10", + "tiledversion": "1.10.2", + "orientation": "isometric", + "renderorder": "right-down", + "width": 64, + "height": 64, + "tilewidth": 64, + "tileheight": 32, + "infinite": false, + "nextlayerid": 6, + "nextobjectid": 12, + "tilesets": [ + { + "firstgid": 1, + "name": "glaciaire-tileset", + "tilewidth": 64, + "tileheight": 32, + "tilecount": 10, + "columns": 0, + "tiles": [ + { + "id": 0, + "properties": [ + { + "name": "tileType", + "value": "WALKABLE", + "type": "string" + }, + { + "name": "spriteId", + "value": "glaciaire.black_ice", + "type": "string" + } + ], + "image": "../assets/glaciaire/walkable_floor.png", + "imagewidth": 64, + "imageheight": 32 + }, + { + "id": 1, + "properties": [ + { + "name": "tileType", + "value": "WALKABLE", + "type": "string" + }, + { + "name": "spriteId", + "value": "glaciaire.frost_flagstone", + "type": "string" + } + ], + "image": "../assets/glaciaire/walkable_floor_alt.png", + "imagewidth": 64, + "imageheight": 32 + }, + { + "id": 2, + "properties": [ + { + "name": "tileType", + "value": "WALL", + "type": "string" + }, + { + "name": "spriteId", + "value": "glaciaire.glacial_ice", + "type": "string" + } + ], + "image": "../assets/glaciaire/wall.png", + "imagewidth": 64, + "imageheight": 64 + }, + { + "id": 3, + "properties": [ + { + "name": "tileType", + "value": "WALL", + "type": "string" + }, + { + "name": "spriteId", + "value": "glaciaire.frost_corner", + "type": "string" + } + ], + "image": "../assets/glaciaire/wall_corner.png", + "imagewidth": 64, + "imageheight": 64 + }, + { + "id": 4, + "properties": [ + { + "name": "tileType", + "value": "DIFFICULT_TERRAIN", + "type": "string" + }, + { + "name": "spriteId", + "value": "glaciaire.cracked_ice", + "type": "string" + } + ], + "image": "../assets/glaciaire/difficult_terrain.png", + "imagewidth": 64, + "imageheight": 32 + }, + { + "id": 5, + "properties": [ + { + "name": "tileType", + "value": "HAZARD", + "type": "string" + }, + { + "name": "spriteId", + "value": "glaciaire.thin_ice", + "type": "string" + } + ], + "image": "../assets/glaciaire/hazard_primary.png", + "imagewidth": 64, + "imageheight": 64 + }, + { + "id": 6, + "properties": [ + { + "name": "tileType", + "value": "OBSTACLE", + "type": "string" + }, + { + "name": "spriteId", + "value": "glaciaire.frozen_statue", + "type": "string" + } + ], + "image": "../assets/glaciaire/obstacle_decor.png", + "imagewidth": 64, + "imageheight": 64 + }, + { + "id": 7, + "properties": [ + { + "name": "tileType", + "value": "WALKABLE", + "type": "string" + }, + { + "name": "spriteId", + "value": "glaciaire.icicles", + "type": "string" + } + ], + "image": "../assets/glaciaire/decoration_minor.png", + "imagewidth": 64, + "imageheight": 32 + }, + { + "id": 8, + "properties": [ + { + "name": "tileType", + "value": "DOOR", + "type": "string" + }, + { + "name": "spriteId", + "value": "glaciaire.frosted_door", + "type": "string" + } + ], + "image": "../assets/glaciaire/door_closed.png", + "imagewidth": 64, + "imageheight": 64 + }, + { + "id": 9, + "properties": [ + { + "name": "tileType", + "value": "STAIRS", + "type": "string" + }, + { + "name": "spriteId", + "value": "glaciaire.ice_stairs", + "type": "string" + } + ], + "image": "../assets/glaciaire/stairs.png", + "imagewidth": 64, + "imageheight": 64 + } + ], + "grid": { + "orientation": "isometric", + "width": 64, + "height": 32 + } + } + ], + "layers": [ + { + "id": 1, + "name": "ground", + "type": "tilelayer", + "visible": true, + "width": 64, + "height": 64, + "data": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 10, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 5, + 5, + 9, + 5, + 5, + 5, + 5, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 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, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 6, + 2, + 2, + 2, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 2, + 2, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 2, + 2, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 2, + 2, + 6, + 6, + 6, + 6, + 2, + 6, + 6, + 6, + 6, + 2, + 2, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 2, + 6, + 6, + 6, + 6, + 6, + 2, + 6, + 6, + 6, + 6, + 6, + 2, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 5, + 5, + 5, + 5, + 5, + 1, + 1, + 1, + 2, + 6, + 6, + 6, + 6, + 6, + 6, + 2, + 6, + 6, + 6, + 6, + 6, + 6, + 2, + 1, + 1, + 1, + 5, + 5, + 5, + 5, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 5, + 5, + 5, + 5, + 5, + 1, + 1, + 1, + 2, + 6, + 6, + 6, + 6, + 6, + 6, + 2, + 6, + 6, + 6, + 6, + 6, + 6, + 2, + 1, + 1, + 1, + 5, + 5, + 5, + 5, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 9, + 5, + 5, + 5, + 5, + 1, + 1, + 1, + 2, + 6, + 6, + 6, + 6, + 6, + 6, + 2, + 6, + 6, + 6, + 6, + 6, + 6, + 2, + 1, + 1, + 1, + 5, + 5, + 5, + 9, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 5, + 5, + 5, + 5, + 5, + 1, + 1, + 2, + 6, + 6, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 6, + 6, + 2, + 1, + 1, + 5, + 5, + 5, + 5, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 5, + 5, + 5, + 5, + 5, + 1, + 1, + 1, + 2, + 6, + 6, + 6, + 6, + 6, + 6, + 2, + 6, + 6, + 6, + 6, + 6, + 6, + 2, + 1, + 1, + 1, + 5, + 5, + 5, + 5, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 5, + 5, + 5, + 5, + 5, + 1, + 1, + 1, + 2, + 6, + 6, + 6, + 6, + 6, + 6, + 2, + 6, + 6, + 6, + 6, + 6, + 6, + 2, + 1, + 1, + 1, + 5, + 5, + 5, + 5, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 5, + 5, + 5, + 5, + 5, + 1, + 1, + 1, + 2, + 6, + 6, + 6, + 6, + 6, + 6, + 2, + 6, + 6, + 6, + 6, + 6, + 6, + 2, + 1, + 1, + 1, + 5, + 5, + 5, + 5, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 2, + 6, + 6, + 6, + 6, + 6, + 2, + 6, + 6, + 6, + 6, + 6, + 2, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 2, + 2, + 6, + 6, + 6, + 6, + 2, + 6, + 6, + 6, + 6, + 2, + 2, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 2, + 2, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 2, + 2, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 6, + 2, + 2, + 2, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 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, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 5, + 5, + 5, + 5, + 5, + 5, + 5, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 5, + 5, + 9, + 5, + 5, + 5, + 5, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 10, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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": 2, + "name": "walls", + "type": "tilelayer", + "visible": true, + "width": 64, + "height": 64, + "data": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 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, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 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, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 3, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 3, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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": 3, + "name": "decorations", + "type": "tilelayer", + "visible": true, + "width": 64, + "height": 64, + "data": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 8, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 8, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 7, + 8, + 8, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 8, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 8, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 7, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 7, + 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, + 7, + 0, + 0, + 7, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 7, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 8, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 8, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 7, + 8, + 8, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 8, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 8, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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": 4, + "name": "objects", + "type": "objectgroup", + "visible": true, + "objects": [ + { + "id": 1, + "x": 1024, + "y": 1024, + "width": 32, + "height": 32, + "name": "coffre-sur-le-lac", + "type": "chest", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "kind", + "value": "chest", + "type": "string" + }, + { + "name": "state", + "value": "closed", + "type": "string" + } + ] + }, + { + "id": 7, + "x": 1728, + "y": 192, + "width": 32, + "height": 32, + "name": "coffre-ne", + "type": "chest", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "kind", + "value": "chest", + "type": "string" + }, + { + "name": "state", + "value": "closed", + "type": "string" + } + ] + }, + { + "id": 11, + "x": 1280, + "y": 1024, + "width": 32, + "height": 32, + "name": "levier-pont-levis", + "type": "lever", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "kind", + "value": "lever", + "type": "string" + }, + { + "name": "state", + "value": "closed", + "type": "string" + } + ] + } + ], + "opacity": 1, + "x": 0, + "y": 0, + "draworder": "topdown" + }, + { + "id": 5, + "name": "spawns", + "type": "objectgroup", + "visible": true, + "objects": [ + { + "id": 2, + "x": 1008, + "y": 208, + "point": true, + "name": "boss-final", + "type": "enemy", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "role", + "value": "enemy", + "type": "string" + }, + { + "name": "npcName", + "value": "Seigneur des Glaces", + "type": "string" + } + ] + }, + { + "id": 3, + "x": 1008, + "y": 1744, + "point": true, + "name": "player-start", + "type": "player", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "role", + "value": "player", + "type": "string" + } + ] + }, + { + "id": 4, + "x": 1744, + "y": 1008, + "point": true, + "name": "ice-creature-east", + "type": "enemy", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "role", + "value": "enemy", + "type": "string" + }, + { + "name": "npcName", + "value": "Givre-Rôdeur", + "type": "string" + } + ] + }, + { + "id": 5, + "x": 336, + "y": 1008, + "point": true, + "name": "ice-creature-west", + "type": "enemy", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "role", + "value": "enemy", + "type": "string" + }, + { + "name": "npcName", + "value": "Givre-Rôdeur", + "type": "string" + } + ] + }, + { + "id": 6, + "x": 1744, + "y": 336, + "point": true, + "name": "ice-creature-ne", + "type": "enemy", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "role", + "value": "enemy", + "type": "string" + }, + { + "name": "npcName", + "value": "Esprit de Glace", + "type": "string" + } + ] + }, + { + "id": 8, + "x": 336, + "y": 336, + "point": true, + "name": "ice-creature-nw", + "type": "enemy", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "role", + "value": "enemy", + "type": "string" + }, + { + "name": "npcName", + "value": "Esprit de Glace", + "type": "string" + } + ] + }, + { + "id": 9, + "x": 1744, + "y": 1808, + "point": true, + "name": "ice-creature-se", + "type": "enemy", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "role", + "value": "enemy", + "type": "string" + }, + { + "name": "npcName", + "value": "Givre-Rôdeur", + "type": "string" + } + ] + }, + { + "id": 10, + "x": 336, + "y": 1808, + "point": true, + "name": "ice-creature-sw", + "type": "enemy", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "role", + "value": "enemy", + "type": "string" + }, + { + "name": "npcName", + "value": "Givre-Rôdeur", + "type": "string" + } + ] + } + ], + "opacity": 1, + "x": 0, + "y": 0, + "draworder": "topdown" + } + ], + "properties": [ + { + "name": "theme", + "value": "GLACIAIRE", + "type": "string" + }, + { + "name": "mapName", + "value": "Forteresse de Glace - Donjon Principal v4", + "type": "string" + } + ] +} diff --git a/maps/reseau-electronique-repaire-hacker.tmj b/maps/reseau-electronique-repaire-hacker.tmj new file mode 100644 index 0000000000000000000000000000000000000000..c8ac82b0c36e6539f68209df5c676e2faa7a1784 --- /dev/null +++ b/maps/reseau-electronique-repaire-hacker.tmj @@ -0,0 +1,12726 @@ +{ + "type": "map", + "version": "1.10", + "tiledversion": "1.10.2", + "orientation": "isometric", + "renderorder": "right-down", + "width": 64, + "height": 64, + "tilewidth": 64, + "tileheight": 32, + "infinite": false, + "nextlayerid": 6, + "nextobjectid": 8, + "tilesets": [ + { + "firstgid": 1, + "name": "electronique-tileset", + "tilewidth": 64, + "tileheight": 32, + "tilecount": 10, + "columns": 0, + "tiles": [ + { + "id": 0, + "properties": [ + { + "name": "tileType", + "value": "WALKABLE", + "type": "string" + }, + { + "name": "spriteId", + "value": "electronique.pcb_trace", + "type": "string" + } + ], + "image": "../assets/electronique/walkable_floor.png", + "imagewidth": 64, + "imageheight": 32 + }, + { + "id": 1, + "properties": [ + { + "name": "tileType", + "value": "WALKABLE", + "type": "string" + }, + { + "name": "spriteId", + "value": "electronique.chip_substrate", + "type": "string" + } + ], + "image": "../assets/electronique/walkable_floor_alt.png", + "imagewidth": 64, + "imageheight": 32 + }, + { + "id": 2, + "properties": [ + { + "name": "tileType", + "value": "WALL", + "type": "string" + }, + { + "name": "spriteId", + "value": "electronique.server_casing", + "type": "string" + } + ], + "image": "../assets/electronique/wall.png", + "imagewidth": 64, + "imageheight": 64 + }, + { + "id": 3, + "properties": [ + { + "name": "tileType", + "value": "WALL", + "type": "string" + }, + { + "name": "spriteId", + "value": "electronique.circuit_corner", + "type": "string" + } + ], + "image": "../assets/electronique/wall_corner.png", + "imagewidth": 64, + "imageheight": 64 + }, + { + "id": 4, + "properties": [ + { + "name": "tileType", + "value": "DIFFICULT_TERRAIN", + "type": "string" + }, + { + "name": "spriteId", + "value": "electronique.tangled_cable", + "type": "string" + } + ], + "image": "../assets/electronique/difficult_terrain.png", + "imagewidth": 64, + "imageheight": 32 + }, + { + "id": 5, + "properties": [ + { + "name": "tileType", + "value": "HAZARD", + "type": "string" + }, + { + "name": "spriteId", + "value": "electronique.power_surge", + "type": "string" + } + ], + "image": "../assets/electronique/hazard_primary.png", + "imagewidth": 64, + "imageheight": 64 + }, + { + "id": 6, + "properties": [ + { + "name": "tileType", + "value": "OBSTACLE", + "type": "string" + }, + { + "name": "spriteId", + "value": "electronique.mainframe_core", + "type": "string" + } + ], + "image": "../assets/electronique/obstacle_decor.png", + "imagewidth": 64, + "imageheight": 64 + }, + { + "id": 7, + "properties": [ + { + "name": "tileType", + "value": "WALKABLE", + "type": "string" + }, + { + "name": "spriteId", + "value": "electronique.blinking_led", + "type": "string" + } + ], + "image": "../assets/electronique/decoration_minor.png", + "imagewidth": 64, + "imageheight": 32 + }, + { + "id": 8, + "properties": [ + { + "name": "tileType", + "value": "DOOR", + "type": "string" + }, + { + "name": "spriteId", + "value": "electronique.biometric_door", + "type": "string" + } + ], + "image": "../assets/electronique/door_closed.png", + "imagewidth": 64, + "imageheight": 64 + }, + { + "id": 9, + "properties": [ + { + "name": "tileType", + "value": "STAIRS", + "type": "string" + }, + { + "name": "spriteId", + "value": "electronique.access_ladder", + "type": "string" + } + ], + "image": "../assets/electronique/stairs.png", + "imagewidth": 64, + "imageheight": 64 + } + ], + "grid": { + "orientation": "isometric", + "width": 64, + "height": 32 + } + } + ], + "layers": [ + { + "id": 1, + "name": "ground", + "type": "tilelayer", + "visible": true, + "width": 64, + "height": 64, + "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, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 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, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 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, + 2, + 2, + 2, + 6, + 2, + 2, + 2, + 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, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 5, + 2, + 2, + 2, + 2, + 2, + 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, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 5, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 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, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 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, + 1, + 1, + 1, + 1, + 6, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 6, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 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, + 5, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 5, + 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, + 2, + 1, + 5, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 1, + 1, + 1, + 5, + 1, + 2, + 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, + 2, + 2, + 1, + 1, + 1, + 2, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 2, + 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, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 2, + 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, + 2, + 2, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 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, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 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, + 2, + 2, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 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, + 2, + 2, + 1, + 1, + 1, + 1, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 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, + 2, + 2, + 1, + 1, + 1, + 1, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 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, + 2, + 2, + 1, + 1, + 1, + 1, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 5, + 5, + 5, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 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, + 2, + 6, + 5, + 5, + 2, + 2, + 2, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 5, + 7, + 5, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 2, + 2, + 5, + 5, + 6, + 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, + 2, + 2, + 1, + 1, + 1, + 1, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 5, + 5, + 5, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 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, + 2, + 2, + 1, + 1, + 1, + 1, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 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, + 2, + 2, + 1, + 1, + 1, + 1, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 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, + 2, + 2, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 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, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 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, + 2, + 2, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 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, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 2, + 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, + 2, + 2, + 1, + 1, + 1, + 2, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 2, + 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, + 2, + 2, + 2, + 1, + 5, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 1, + 1, + 1, + 5, + 1, + 2, + 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, + 5, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 5, + 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, + 1, + 1, + 6, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 6, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 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, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 9, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 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, + 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, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 10, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 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": 64, + "height": 64, + "data": [ + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 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": 64, + "height": 64, + "data": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 8, + 0, + 0, + 8, + 0, + 0, + 8, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 7, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 7, + 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, + 8, + 0, + 0, + 8, + 0, + 0, + 8, + 0, + 0, + 8, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 7, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 7, + 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, + 7, + 7, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 7, + 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, + 8, + 0, + 0, + 8, + 0, + 0, + 8, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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, + 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, + 8, + 0, + 0, + 8, + 0, + 0, + 8, + 0, + 0, + 8, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 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": 4, + "name": "objects", + "type": "objectgroup", + "visible": true, + "objects": [ + { + "id": 7, + "x": 960, + "y": 1856, + "width": 32, + "height": 32, + "name": "coffre-donnees-hacker", + "type": "chest", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "kind", + "value": "chest", + "type": "string" + }, + { + "name": "state", + "value": "closed", + "type": "string" + } + ] + } + ], + "opacity": 1, + "x": 0, + "y": 0, + "draworder": "topdown" + }, + { + "id": 5, + "name": "spawns", + "type": "objectgroup", + "visible": true, + "objects": [ + { + "id": 1, + "x": 1008, + "y": 1360, + "point": true, + "name": "player-start", + "type": "player", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "role", + "value": "player", + "type": "string" + } + ] + }, + { + "id": 2, + "x": 848, + "y": 1616, + "point": true, + "name": "hacker-terminal-1", + "type": "enemy", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "role", + "value": "enemy", + "type": "string" + }, + { + "name": "npcName", + "value": "Hacker-reseau", + "type": "string" + } + ] + }, + { + "id": 3, + "x": 1200, + "y": 1616, + "point": true, + "name": "hacker-terminal-2", + "type": "enemy", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "role", + "value": "enemy", + "type": "string" + }, + { + "name": "npcName", + "value": "Hacker-reseau", + "type": "string" + } + ] + }, + { + "id": 4, + "x": 1008, + "y": 1808, + "point": true, + "name": "hacker-central", + "type": "enemy", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "role", + "value": "enemy", + "type": "string" + }, + { + "name": "npcName", + "value": "Hacker-reseau", + "type": "string" + } + ] + }, + { + "id": 5, + "x": 784, + "y": 1776, + "point": true, + "name": "securite-1", + "type": "enemy", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "role", + "value": "enemy", + "type": "string" + }, + { + "name": "npcName", + "value": "Securite-numerique", + "type": "string" + } + ] + }, + { + "id": 6, + "x": 1040, + "y": 656, + "point": true, + "name": "ai-core-guardian", + "type": "enemy", + "visible": true, + "rotation": 0, + "properties": [ + { + "name": "role", + "value": "enemy", + "type": "string" + }, + { + "name": "npcName", + "value": "IA-rogue", + "type": "string" + } + ] + } + ], + "opacity": 1, + "x": 0, + "y": 0, + "draworder": "topdown" + } + ], + "properties": [ + { + "name": "theme", + "value": "ELECTRONIQUE", + "type": "string" + }, + { + "name": "mapName", + "value": "Reseau Electronique - Repaire Hacker", + "type": "string" + } + ] +} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000000000000000000000000000000000000..27c9fd277d0c8000c47918d271be03fb7f5bbe19 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1748 @@ +{ + "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" + ], + "engines": { + "node": ">=20.9" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.11.3", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.3.tgz", + "integrity": "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==", + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@hono/node-server": { + "version": "2.1.6", + "license": "MIT", + "engines": { + "node": ">=20" + }, + "peerDependencies": { + "hono": "^4 || ^5.0.0-0" + } + }, + "node_modules/@huggingface/inference": { + "version": "4.13.32", + "license": "MIT", + "dependencies": { + "@huggingface/jinja": "^0.5.10", + "@huggingface/tasks": "^0.21.58" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@huggingface/jinja": { + "version": "0.5.11", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/@huggingface/tasks": { + "version": "0.21.61", + "license": "MIT" + }, + "node_modules/@img/colour": { + "version": "1.1.0", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/@img/sharp-darwin-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.35.5.tgz", + "integrity": "sha512-QRUlFQ0WxvdWyqqG/WtI3iupfD5rBzmCHXSdPsY91sAtVtTo7Q4cb6zOccZ3gqEqkr0f1As1ehLqmEpDsRf+lg==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-arm64": "1.3.4" + } + }, + "node_modules/@img/sharp-darwin-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.35.5.tgz", + "integrity": "sha512-+BR255RhDlpygUpOc/Jdt1nT6DQ3XG/ERo5wbcdOf5Q320dKtPCKPLR1LJs9VGXRaMa8l1uUa0tkCNOXiAxZUw==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-x64": "1.3.4" + } + }, + "node_modules/@img/sharp-freebsd-wasm32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-freebsd-wasm32/-/sharp-freebsd-wasm32-0.35.5.tgz", + "integrity": "sha512-Y/z91nEZ4uIBX5X3nfTovjU9lHNKFYbL2lpHCLVNmXQK03VIZvXBBt0KxbPGp2SdGSF+2mQU4e+hQaWOt86iAw==", + "license": "Apache-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "dependencies": { + "@img/sharp-wasm32": "0.35.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-arm64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.3.4.tgz", + "integrity": "sha512-5R89nBYiRdUlSWJxPhO+GVtaXzXSxKnRu/xqMn3KTA3L9EB9Oy/P+Nn2f2vlhPuUdy/Zusb2DarbyTpGCfEDuw==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-x64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.3.4.tgz", + "integrity": "sha512-iR2OKH80yi0U+dUplyh3/xdpFvps6YkCwsXenIJxqxR1v9o+xtKTGbS9H7cps+2Vxjc8B1j96p75NmTGjIhtpQ==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.3.4.tgz", + "integrity": "sha512-LmRtTsOHuvM2+wlO2Db37dx5MiZhB0FvSunciw48YjdOkZz9KAiRbm8ujeMOA1INqmei5NapFxYEK1D1ZSidmw==", + "cpu": [ + "arm" + ], + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.3.4.tgz", + "integrity": "sha512-Y3dgX/6lE2QhQb+Gxy0WZxfg9MEm/JBjamZpS2IklP7xIQoKN4hzAm7KcMVGtaVDt3neE9OKBC7vAfonA/Lr1A==", + "cpu": [ + "arm64" + ], + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-ppc64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.3.4.tgz", + "integrity": "sha512-Le6boB8Tai0Nis+gIxIpKx68UDVVIqdR8Tin5Yf1z2LJJQLDJvCDRqRu+jC2qCoD+eIomonmOwB4smBRxfVpYQ==", + "cpu": [ + "ppc64" + ], + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-riscv64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-riscv64/-/sharp-libvips-linux-riscv64-1.3.4.tgz", + "integrity": "sha512-aHkkIEHPRdQEegJN20MLmGtxYD9R2wQr3Cwpddnu5+YKMt6Uzax7S9h5gpZTo8wyrGuZSlfQ63OevL5mTyOC7Q==", + "cpu": [ + "riscv64" + ], + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-s390x": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.3.4.tgz", + "integrity": "sha512-ra/mB6MikESDUO7Yg+Mi95bFBb9GsObURuhnOv3OqknjGe9sZrG8tCe9q0xSIGrtLgvgw0gKnFWcK4blSgQOuQ==", + "cpu": [ + "s390x" + ], + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-x64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.3.4.tgz", + "integrity": "sha512-GJ//SSXbnwSDes02umB3nDJLFcQzw8a18V8fyhqr6tV515tOEMdImjjxj1AoafMRz56F3PHgftnj1QEKSU1zkw==", + "cpu": [ + "x64" + ], + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-arm64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.3.4.tgz", + "integrity": "sha512-hvulFwtjUcagsis6BBxHwGFwWoNZjgYmULGVrZcyfNbjA8hKILbRxGg15/7w5HDyXHXUos/j6baAWqnCyQ2DWA==", + "cpu": [ + "arm64" + ], + "libc": [ + "musl" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-x64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.3.4.tgz", + "integrity": "sha512-6zXKeE/p39I1AmA3cJG35eyBGNqNddLnUXjhwBnsGjFPWqf5VKkDBEqaEkPDoTEtkxwi2vv8Tcr2mDyP4So7Fg==", + "cpu": [ + "x64" + ], + "libc": [ + "musl" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-linux-arm": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.35.5.tgz", + "integrity": "sha512-LEaXK2WdXVK5ykcw0buWyPMsmLLL2vpHLD6yrNSW+JGEL3BZPA4tpKN6iaMc4AxTTAoaX/sU1rOL51lcIz48ZQ==", + "cpu": [ + "arm" + ], + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.35.5.tgz", + "integrity": "sha512-LYVx5JTsOM2CBzmxreh+nl64/3H6Xb09iSLknqH47z2T2DFFxDeFLP5y4dJwe6H7uGQlHPyEEtIqyo3DYsRwdQ==", + "cpu": [ + "arm64" + ], + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm64": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-ppc64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.35.5.tgz", + "integrity": "sha512-QVxAAq8evVRI9ia2vqgwrmWucn5Dfv+JdWzj75pD8omHLPSP7f8p20O8jxzjCcuCEQEOtYOZUmX1hkiZ0kdevA==", + "cpu": [ + "ppc64" + ], + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-ppc64": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-riscv64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-riscv64/-/sharp-linux-riscv64-0.35.5.tgz", + "integrity": "sha512-LtdreXguaavKODPIfzJ4kffx7UNt1omwtK0rch4EBbbSTXPnxWmYSayXdLJw0fJzQ97kHt1gL/yh4tvU+nCyRQ==", + "cpu": [ + "riscv64" + ], + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-riscv64": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-s390x": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.35.5.tgz", + "integrity": "sha512-UZasTOFiYzotTsGOCu42BfUzP6Tu6Do/947iRm1RsLKvlllxwGcn4RN27LibGWceix4Y+Pmw3jsnTcCQIgWjqA==", + "cpu": [ + "s390x" + ], + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-s390x": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.35.5.tgz", + "integrity": "sha512-SxFtLTeJInhAA9Q836kux2vZNeOBQEx658qvbboZScr0wIARym3IcGmW7KpVD5sbVg0Ojy+udFQdayYIZyoNog==", + "cpu": [ + "x64" + ], + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-x64": "1.3.4" + } + }, + "node_modules/@img/sharp-linuxmusl-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.35.5.tgz", + "integrity": "sha512-9HbMclmI1zlNkFRs3z9/eBtDjfD0sGlrX1z6b1qwmiFY5ElDLh4BC0LPBdVp7z1DXFiKlIcznf+ZlsuZzLxQqg==", + "cpu": [ + "arm64" + ], + "libc": [ + "musl" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-arm64": "1.3.4" + } + }, + "node_modules/@img/sharp-linuxmusl-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.35.5.tgz", + "integrity": "sha512-4KOphqB035HrVdqLZfCgMzzERrQkkzOwRhl4OAkRO1YCldbaFjySXMaK534Mo0V+LndnlJk+sbUyLeU0ULyD1A==", + "cpu": [ + "x64" + ], + "libc": [ + "musl" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-x64": "1.3.4" + } + }, + "node_modules/@img/sharp-wasm32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.35.5.tgz", + "integrity": "sha512-Ptsga1su4tQx+LLF1ECS9U6nz5kmrXKo6XVbtR48Ke3ZRxxgaWBu7IDtEe1quo8hiupwm6WFqxVlXaSf7IINGQ==", + "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT", + "optional": true, + "dependencies": { + "@emnapi/runtime": "^1.11.3" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-webcontainers-wasm32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-webcontainers-wasm32/-/sharp-webcontainers-wasm32-0.35.5.tgz", + "integrity": "sha512-hfhF/FmoQyTUkA0bIKFOtw536BQSeBMe6BF6QyWlrPxT754+TFLaZ7sKKTfvvM0yJgKgaYTwnFCIZ/GuDw5SUA==", + "cpu": [ + "wasm32" + ], + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@img/sharp-wasm32": "0.35.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.35.5.tgz", + "integrity": "sha512-X4t7g+7ZA5DKblCBEXGjUqqemj4vczING/5viFwAL8h4N3qYeyjwdCvRLHi4EdOUI+2Z7UFlp1VM+p/AuEtm6Q==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-ia32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.35.5.tgz", + "integrity": "sha512-5Zm82LoBc43nhwNybZlG7Y1KO//Zhsn306fQl29ZOuStHLGTo3BWL83q3cznX0poxSAMuYL1On/BHBxkBeKr6A==", + "cpu": [ + "ia32" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.35.5.tgz", + "integrity": "sha512-x76eH0vEiHlcMQu8Y8IenntaACtddpT6W0wmXtWrnKcnKI7ME5DdgqhAD6SEWOEl1v2zDvkZDhFA9KnURwpfqg==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@modelcontextprotocol/sdk": { + "version": "1.32.2", + "license": "MIT", + "dependencies": { + "@hono/node-server": "^1.19.9 || ^2.0.5", + "ajv": "^8.17.1", + "ajv-formats": "^3.0.1", + "content-type": "^1.0.5", + "cors": "^2.8.5", + "cross-spawn": "^7.0.5", + "eventsource": "^3.0.2", + "eventsource-parser": "^3.0.0", + "express": "^5.2.1", + "express-rate-limit": "^8.2.1", + "hono": "^4.11.4", + "jose": "^6.1.3", + "json-schema-typed": "^8.0.2", + "pkce-challenge": "^5.0.0", + "raw-body": "^3.0.0", + "zod": "^3.25 || ^4.0", + "zod-to-json-schema": "^3.25.1" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@cfworker/json-schema": "^4.1.1", + "zod": "^3.25 || ^4.0" + }, + "peerDependenciesMeta": { + "@cfworker/json-schema": { + "optional": true + }, + "zod": { + "optional": false + } + } + }, + "node_modules/@types/node": { + "version": "20.19.43", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/accepts": { + "version": "2.0.0", + "license": "MIT", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ajv": { + "version": "8.20.0", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats": { + "version": "3.0.1", + "license": "MIT", + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/body-parser": { + "version": "2.4.0", + "license": "MIT", + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^2.1.0", + "debug": "^4.4.3", + "http-errors": "^2.0.1", + "iconv-lite": "^0.7.3", + "on-finished": "^2.4.1", + "qs": "^6.16.1", + "raw-body": "^3.0.2", + "type-is": "^2.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/body-parser/node_modules/content-type": { + "version": "2.1.0", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/content-disposition": { + "version": "2.0.1", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.2.2", + "license": "MIT", + "engines": { + "node": ">=6.6.0" + } + }, + "node_modules/cors": { + "version": "2.8.6", + "license": "MIT", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/depd": { + "version": "2.0.0", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.1", + "license": "MIT", + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.2", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "license": "MIT" + }, + "node_modules/etag": { + "version": "1.8.1", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/eventsource": { + "version": "3.0.7", + "license": "MIT", + "dependencies": { + "eventsource-parser": "^3.0.1" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/eventsource-parser": { + "version": "3.1.1", + "license": "MIT", + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/express": { + "version": "5.3.0", + "license": "MIT", + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.3.0", + "content-disposition": "^2.0.1", + "content-type": "^2.0.0", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "depd": "^2.0.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.8", + "qs": "^6.16.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.1.0", + "vary": "^1.1.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/express-rate-limit": { + "version": "8.7.3", + "license": "MIT", + "dependencies": { + "debug": "^4.4.3", + "ip-address": "^10.2.0" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/express-rate-limit" + }, + "peerDependencies": { + "express": ">= 4.11" + } + }, + "node_modules/express/node_modules/content-type": { + "version": "2.1.0", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "license": "MIT" + }, + "node_modules/fast-uri": { + "version": "3.1.9", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/fflate": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.2.tgz", + "integrity": "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==", + "license": "MIT" + }, + "node_modules/finalhandler": { + "version": "2.1.1", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "2.0.0", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.4", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/hono": { + "version": "4.13.16", + "license": "MIT", + "engines": { + "node": ">=16.9.0" + } + }, + "node_modules/http-errors": { + "version": "2.0.1", + "license": "MIT", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/iconv-lite": { + "version": "0.7.3", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "license": "ISC" + }, + "node_modules/ip-address": { + "version": "10.7.6", + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-promise": { + "version": "4.0.0", + "license": "MIT" + }, + "node_modules/isexe": { + "version": "2.0.0", + "license": "ISC" + }, + "node_modules/jose": { + "version": "6.2.15", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "license": "MIT" + }, + "node_modules/json-schema-typed": { + "version": "8.0.2", + "license": "BSD-2-Clause" + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "1.1.1", + "license": "MIT", + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/merge-descriptors": { + "version": "2.0.0", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mime-db": { + "version": "1.54.0", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "3.0.2", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "license": "MIT" + }, + "node_modules/negotiator": { + "version": "1.1.0", + "license": "MIT", + "dependencies": { + "content-type": "^2.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/negotiator/node_modules/content-type": { + "version": "2.1.0", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.2", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/once": { + "version": "1.4.0", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-to-regexp": { + "version": "8.4.2", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/pkce-challenge": { + "version": "5.0.1", + "license": "MIT", + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.8", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/qs": { + "version": "6.17.1", + "license": "BSD-3-Clause", + "dependencies": { + "es-define-property": "^1.0.1", + "side-channel": "^1.1.1" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.3.0", + "license": "MIT", + "engines": { + "node": ">= 0.6" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/raw-body": { + "version": "3.0.2", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.7.0", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/router": { + "version": "2.2.0", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "license": "MIT" + }, + "node_modules/semver": { + "version": "7.8.6", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/send": { + "version": "1.2.1", + "license": "MIT", + "dependencies": { + "debug": "^4.4.3", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.1", + "mime-types": "^3.0.2", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/serve-static": { + "version": "2.2.1", + "license": "MIT", + "dependencies": { + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "license": "ISC" + }, + "node_modules/sharp": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.35.5.tgz", + "integrity": "sha512-Ywn4OnzGukp7CDMrp08RQ50YKmuwG47brZgIVPTvBaaAfQlRlygrRqSrxdCiL9M+LlzLBiJ68IR1QqvzHyjC7g==", + "license": "Apache-2.0", + "dependencies": { + "@img/colour": "^1.1.0", + "detect-libc": "^2.1.2", + "semver": "^7.8.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-darwin-arm64": "0.35.5", + "@img/sharp-darwin-x64": "0.35.5", + "@img/sharp-freebsd-wasm32": "0.35.5", + "@img/sharp-libvips-darwin-arm64": "1.3.4", + "@img/sharp-libvips-darwin-x64": "1.3.4", + "@img/sharp-libvips-linux-arm": "1.3.4", + "@img/sharp-libvips-linux-arm64": "1.3.4", + "@img/sharp-libvips-linux-ppc64": "1.3.4", + "@img/sharp-libvips-linux-riscv64": "1.3.4", + "@img/sharp-libvips-linux-s390x": "1.3.4", + "@img/sharp-libvips-linux-x64": "1.3.4", + "@img/sharp-libvips-linuxmusl-arm64": "1.3.4", + "@img/sharp-libvips-linuxmusl-x64": "1.3.4", + "@img/sharp-linux-arm": "0.35.5", + "@img/sharp-linux-arm64": "0.35.5", + "@img/sharp-linux-ppc64": "0.35.5", + "@img/sharp-linux-riscv64": "0.35.5", + "@img/sharp-linux-s390x": "0.35.5", + "@img/sharp-linux-x64": "0.35.5", + "@img/sharp-linuxmusl-arm64": "0.35.5", + "@img/sharp-linuxmusl-x64": "0.35.5", + "@img/sharp-webcontainers-wasm32": "0.35.5", + "@img/sharp-win32-arm64": "0.35.5", + "@img/sharp-win32-ia32": "0.35.5", + "@img/sharp-win32-x64": "0.35.5" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/side-channel": { + "version": "1.1.1", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4", + "side-channel-list": "^1.0.1", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.1", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/statuses": { + "version": "2.0.2", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/tiled-map-builder-mcp": { + "resolved": "tiled-mcp", + "link": true + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/tslib": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.9.1.tgz", + "integrity": "sha512-a4Ux9VKuIMHsOS7ENbEq6hK2ZGYIT27Rtl0E4eD9KqwxhKiQeMZE/9xb3IdYwWaSOyIBQLExhQgXDTYoiCxnWA==", + "license": "0BSD", + "optional": true + }, + "node_modules/type-is": { + "version": "2.1.0", + "license": "MIT", + "dependencies": { + "content-type": "^2.0.0", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/type-is/node_modules/content-type": { + "version": "2.1.0", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "6.21.0", + "dev": true, + "license": "MIT" + }, + "node_modules/unpipe": { + "version": "1.0.0", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/which": { + "version": "2.0.2", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "license": "ISC" + }, + "node_modules/zod": { + "version": "4.6.7", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz", + "integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "node_modules/zod-to-json-schema": { + "version": "3.25.2", + "license": "ISC", + "peerDependencies": { + "zod": "^3.25.28 || ^4" + } + }, + "tiled-mcp": { + "name": "tiled-map-builder-mcp", + "version": "0.3.0", + "license": "MIT", + "dependencies": { + "@huggingface/inference": "^4.13.15", + "@modelcontextprotocol/sdk": "^1.23.0", + "fflate": "^0.8.2", + "sharp": "^0.35.5", + "zod": "^4.6.7" + }, + "bin": { + "tiled-map-builder-mcp": "dist/index.js", + "tiled-map-builder-web": "dist/http.js" + }, + "devDependencies": { + "@types/node": "^20.11.0", + "typescript": "^5.4.0" + }, + "engines": { + "node": ">=20.9" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000000000000000000000000000000000000..504742be150a0dfff3ed13eb28bc93270ca89ff0 --- /dev/null +++ b/package.json @@ -0,0 +1,28 @@ +{ + "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", + "repository": { + "type": "git", + "url": "git+https://github.com/4math2379/Tiled-MCP-Server.git" + }, + "workspaces": [ + "tiled-mcp" + ], + "scripts": { + "build": "npm run build --workspace tiled-mcp", + "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", + "docs": "node scripts/gen-docs.mjs" + }, + "engines": { + "node": ">=20.9" + } +} diff --git a/scripts/README.md b/scripts/README.md new file mode 100644 index 0000000000000000000000000000000000000000..f8467d5839816cb817b64d552bffa36d479b7186 --- /dev/null +++ b/scripts/README.md @@ -0,0 +1,17 @@ +# Scripts + +Run them from the repository root after `npm install && npm run build`. + +| Script | npm shortcut | Cost | What it does | +|---|---|---|---| +| `smoke-test.mjs` | `npm run smoke` | free, offline | Starts the server and runs 38 end-to-end checks over stdio. Pass `screen` to test the legacy coordinate mode. | +| `smoke-http.mjs` | `npm run smoke:http` | free, offline | Starts the hosted mode with a scripted stand-in for the AI model: web routes, MCP sessions over HTTP, downloads, isolation, and that every paid call uses the caller's token. | +| `render-map-preview.mjs` | `npm run preview -- ` | free | Renders a `.tmj` to PNG with object markers. Options: `[out.png] [--width 1600] [--no-markers]`. | +| `gen-docs.mjs` | `npm run docs` | free | Regenerates `docs/tools.md` and `docs/themes.md` from the server. | +| `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. diff --git a/scripts/create-aquatic-map.mjs b/scripts/create-aquatic-map.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b2572515619c8610cf4cbd0479ff98c1d6836582 --- /dev/null +++ b/scripts/create-aquatic-map.mjs @@ -0,0 +1,203 @@ +// Example map script: builds maps/caverne-aquatique.tmj (AQUATIC theme, 64x64: flooded cavern with a central lake) +// by calling the builder API directly, without an MCP client. It is deterministic: +// re-running it reproduces the committed sample map. Run from the repository root +// after building the server (npm run build): +// node scripts/create-aquatic-map.mjs +import { createMap, paintRect, paintWallBorder, eraseTile, placeObject, placeSpawn, serializeMap } from '../tiled-mcp/dist/builder.js'; +import { getTheme } from '../tiled-mcp/dist/themes/index.js'; +import { saveMapFile } from '../tiled-mcp/dist/tmj.js'; +import { fileURLToPath } from 'node:url'; +import fs from 'node:fs'; + +const theme = getTheme("AQUATIC"); + +const { mapId } = createMap({ + name: "Caverne Aquatique Souterraine", + width: 64, + height: 64, + theme: theme, +}); + +console.log("Map created:", mapId); + +// ---------- Helpers ---------- +function openWall(x, y) { + eraseTile(mapId, "walls", x, y); +} + +function paintCircleRoom(cx, cy, radius, floorRole = "walkable_floor") { + for (let y = cy - radius; y <= cy + radius; y++) { + for (let x = cx - radius; x <= cx + radius; x++) { + const dx = x - cx; + const dy = y - cy; + if (dx * dx + dy * dy <= radius * radius) { + paintRect(mapId, "ground", x, y, x, y, floorRole); + } + } + } + paintWallBorder(mapId, cx - radius, cy - radius, cx + radius, cy + radius); +} + +function paintLRoom(x1a, y1a, x2a, y2a, x1b, y1b, x2b, y2b, floorRole = "walkable_floor") { + paintRect(mapId, "ground", x1a, y1a, x2a, y2a, floorRole); + paintRect(mapId, "ground", x1b, y1b, x2b, y2b, floorRole); + const xa = Math.min(x1a, x1b), xb = Math.max(x2a, x2b); + const ya = Math.min(y1a, y1b), yb = Math.max(y2a, y2b); + paintWallBorder(mapId, xa, ya, xb, yb); +} + +// ---------- Central hall (circular, radius 9) ---------- +// Main floor: black water (walkable_floor) +paintCircleRoom(32, 32, 9, "walkable_floor"); +// Variant: murky water (walkable_floor_alt) as an inner ring for visual relief +for (let y = 27; y <= 37; y++) { + for (let x = 27; x <= 37; x++) { + const dx = x - 32; + const dy = y - 32; + const d2 = dx * dx + dy * dy; + if (d2 > 25 && d2 <= 49) { // ring between radius 5 and 7 + paintRect(mapId, "ground", x, y, x, y, "walkable_floor_alt"); + } + } +} + +// Deep water in the centre (hazard_primary, radius 4) +for (let y = 28; y <= 36; y++) { + for (let x = 28; x <= 36; x++) { + const dx = x - 32; + const dy = y - 32; + if (dx * dx + dy * dy <= 16) { + paintRect(mapId, "ground", x, y, x, y, "hazard_primary"); + } + } +} + +// Openings toward the 4 main corridors +openWall(32, 23); // north +openWall(32, 41); // south +openWall(23, 32); // west +openWall(41, 32); // east + +// Sunken sarcophagus in the centre (painted on the decorations layer, not an offset object) +paintRect(mapId, "decorations", 32, 32, 32, 32, "obstacle_decor"); + +// Sarcophagi around the lake (on the decorations layer) +paintRect(mapId, "decorations", 26, 26, 26, 26, "obstacle_decor"); +paintRect(mapId, "decorations", 38, 26, 38, 26, "obstacle_decor"); +paintRect(mapId, "decorations", 26, 38, 26, 38, "obstacle_decor"); +paintRect(mapId, "decorations", 38, 38, 38, 38, "obstacle_decor"); + +// ---------- Outer rooms (various shapes) ---------- + +// NORTH: rectangular room, final boss +paintRect(mapId, "ground", 20, 2, 42, 15, "walkable_floor"); +paintWallBorder(mapId, 20, 2, 42, 15); +openWall(31, 15); +placeSpawn(mapId, { x: 31, y: 8, role: "enemy", npcName: "Seigneur des Abysses", name: "boss-final" }); + +// SOUTH: rectangular room, player entrance +paintRect(mapId, "ground", 20, 48, 42, 61, "walkable_floor"); +paintWallBorder(mapId, 20, 48, 42, 61); +openWall(31, 48); +placeSpawn(mapId, { x: 31, y: 55, role: "player", name: "player-start" }); + +// EAST: L-shaped room +paintLRoom(46, 20, 62, 41, 46, 42, 58, 50, "walkable_floor"); +paintWallBorder(mapId, 46, 20, 62, 50); +openWall(46, 31); +placeSpawn(mapId, { x: 54, y: 31, role: "enemy", npcName: "Rampant des Eaux", name: "water-creature-east" }); + +// WEST: L-shaped room +paintLRoom(2, 20, 18, 41, 6, 42, 18, 50, "walkable_floor"); +paintWallBorder(mapId, 2, 20, 18, 50); +openWall(18, 31); +placeSpawn(mapId, { x: 10, y: 31, role: "enemy", npcName: "Rampant des Eaux", name: "water-creature-west" }); + +// NORTH-EAST: circular room (radius 7) +paintCircleRoom(53, 11, 7, "walkable_floor"); +paintWallBorder(mapId, 46, 4, 60, 18); +openWall(49, 18); +placeSpawn(mapId, { x: 53, y: 11, role: "enemy", npcName: "Esprit de l'Onde", name: "water-creature-ne" }); + +// NORTH-WEST: circular room (radius 7) +paintCircleRoom(11, 11, 7, "walkable_floor"); +paintWallBorder(mapId, 4, 4, 18, 18); +openWall(14, 18); +placeSpawn(mapId, { x: 11, y: 11, role: "enemy", npcName: "Esprit de l'Onde", name: "water-creature-nw" }); + +// SOUTH-EAST: T-shaped room +paintRect(mapId, "ground", 46, 44, 62, 52, "walkable_floor"); +paintRect(mapId, "ground", 52, 52, 56, 60, "walkable_floor"); +paintWallBorder(mapId, 46, 44, 62, 60); +openWall(49, 44); +placeSpawn(mapId, { x: 54, y: 55, role: "enemy", npcName: "Rampant des Eaux", name: "water-creature-se" }); + +// SOUTH-WEST: T-shaped room +paintRect(mapId, "ground", 2, 44, 18, 52, "walkable_floor"); +paintRect(mapId, "ground", 8, 52, 12, 60, "walkable_floor"); +paintWallBorder(mapId, 2, 44, 18, 60); +openWall(15, 44); +placeSpawn(mapId, { x: 10, y: 55, role: "enemy", npcName: "Rampant des Eaux", name: "water-creature-sw" }); + +// ---------- Wide corridors ---------- +paintRect(mapId, "ground", 30, 16, 34, 47, "walkable_floor"); // N-S +paintRect(mapId, "ground", 16, 30, 47, 34, "walkable_floor"); // E-W +paintRect(mapId, "ground", 42, 16, 46, 30, "walkable_floor"); // toward NE +paintRect(mapId, "ground", 18, 16, 22, 30, "walkable_floor"); // toward NW +paintRect(mapId, "ground", 42, 34, 46, 48, "walkable_floor"); // toward SE +paintRect(mapId, "ground", 18, 34, 22, 48, "walkable_floor"); // toward SW +paintRect(mapId, "ground", 2, 3, 62, 5, "walkable_floor"); // top +paintRect(mapId, "ground", 2, 58, 62, 60, "walkable_floor"); // bottom +paintRect(mapId, "ground", 2, 3, 4, 60, "walkable_floor"); // left +paintRect(mapId, "ground", 60, 3, 62, 60, "walkable_floor"); // right + +// ---------- Hazards ---------- +// Ring of deep water around the central lake (radius 4 to 6) +for (let y = 26; y <= 38; y++) { + for (let x = 26; x <= 38; x++) { + const dx = x - 32; + const dy = y - 32; + const d2 = dx * dx + dy * dy; + if (d2 > 16 && d2 <= 36) { + paintRect(mapId, "ground", x, y, x, y, "hazard_primary"); + } + } +} + +// Algae in the corridors (difficult_terrain) +paintRect(mapId, "ground", 30, 16, 34, 24, "difficult_terrain"); +paintRect(mapId, "ground", 30, 40, 34, 47, "difficult_terrain"); +paintRect(mapId, "ground", 16, 30, 24, 34, "difficult_terrain"); +paintRect(mapId, "ground", 40, 30, 47, 34, "difficult_terrain"); + +// ---------- Doors (painted on the ground for grid alignment) ---------- +paintRect(mapId, "ground", 31, 16, 31, 16, "door_closed"); +paintRect(mapId, "ground", 31, 47, 31, 47, "door_closed"); +paintRect(mapId, "ground", 16, 31, 16, 31, "door_closed"); +paintRect(mapId, "ground", 47, 31, 47, 31, "door_closed"); + +// ---------- Decorations: water lilies (painted on the decorations layer) ---------- +// Water lilies in the shallow water around the central lake +const lilyPads = [ + [29, 24], [30, 24], [31, 24], [32, 24], [33, 24], [34, 24], [35, 24], + [29, 40], [30, 40], [31, 40], [32, 40], [33, 40], [34, 40], [35, 40], + [24, 29], [24, 30], [24, 31], [24, 32], [24, 33], [24, 34], [24, 35], + [40, 29], [40, 30], [40, 31], [40, 32], [40, 33], [40, 34], [40, 35], +]; +for (const [lx, ly] of lilyPads) { + paintRect(mapId, "decorations", lx, ly, lx, ly, "decoration_minor"); +} + +// ---------- Objects: only the chest (interactable) ---------- +placeObject(mapId, { x: 32, y: 32, kind: "chest", name: "sarcophage-submerge" }); + +// ---------- Save the map ---------- +const mapData = serializeMap(mapId); +const outPath = fileURLToPath(new URL('../maps/caverne-aquatique.tmj', import.meta.url)); +await saveMapFile(mapId, outPath); + +console.log("Saved:", outPath); +console.log("Size:", (fs.statSync(outPath).size / 1024).toFixed(2), "KB"); +console.log("Spawns:", mapData.layers.find(l => l.name === "spawns").objects.length); +console.log("Objects:", mapData.layers.find(l => l.name === "objects").objects.length); +console.log("Decoration tiles:", mapData.layers.find(l => l.name === "decorations").data.filter(g => g !== 0).length); \ No newline at end of file diff --git a/scripts/create-electronic-hacker-map.mjs b/scripts/create-electronic-hacker-map.mjs new file mode 100644 index 0000000000000000000000000000000000000000..bdc00986929862a92fc5f25ee159e29e8fdab09b --- /dev/null +++ b/scripts/create-electronic-hacker-map.mjs @@ -0,0 +1,195 @@ +// Example map script: builds maps/reseau-electronique-repaire-hacker.tmj (ELECTRONIQUE theme, 64x64: hacker lair in a digital network) +// by calling the builder API directly, without an MCP client. It is deterministic: +// re-running it reproduces the committed sample map. Run from the repository root +// after building the server (npm run build): +// node scripts/create-electronic-hacker-map.mjs +import { createMap, paintRect, paintWallBorder, eraseTile, placeObject, placeSpawn, serializeMap } from '../tiled-mcp/dist/builder.js'; +import { getTheme } from '../tiled-mcp/dist/themes/index.js'; +import { saveMapFile } from '../tiled-mcp/dist/tmj.js'; +import { fileURLToPath } from 'node:url'; +import fs from 'node:fs'; + +const theme = getTheme("ELECTRONIQUE"); + +const { mapId } = createMap({ + name: "Reseau Electronique - Repaire Hacker", + width: 64, + height: 64, + theme: theme, + orientation: "isometric", +}); + +console.log("Map created:", mapId); + +// ---------- Helpers ---------- +function openWall(x, y) { + eraseTile(mapId, "walls", x, y); +} + +// ---------- Ground: the whole map in walkable_floor (outdoor electronic plaza) ---------- +for (let y = 0; y < 64; y++) { + for (let x = 0; x < 64; x++) { + paintRect(mapId, "ground", x, y, x, y, "walkable_floor"); + } +} + +// Outer wall +paintWallBorder(mapId, 0, 0, 63, 63); + +// ---------- Electronic rune symbol (centre 32,32) ---------- +const CX = 32, CY = 32; + +// Outer circle of circuit traces (radius 14-16) +for (let y = CY - 16; y <= CY + 16; y++) { + for (let x = CX - 16; x <= CX + 16; x++) { + const dx = x - CX; + const dy = y - CY; + const d2 = dx * dx + dy * dy; + if (d2 >= 196 && d2 <= 256) { + paintRect(mapId, "ground", x, y, x, y, "walkable_floor_alt"); + } + } +} + +// Inner circle of traces (radius 8-10) +for (let y = CY - 10; y <= CY + 10; y++) { + for (let x = CX - 10; x <= CX + 10; x++) { + const dx = x - CX; + const dy = y - CY; + const d2 = dx * dx + dy * dy; + if (d2 >= 64 && d2 <= 100) { + paintRect(mapId, "ground", x, y, x, y, "walkable_floor_alt"); + } + } +} + +// Radial traces linking both circles (8 directions) +for (let i = 0; i < 8; i++) { + const ang = i * 45; + const rad = ang * Math.PI / 180; + for (let r = 11; r <= 13; r++) { + const x = Math.round(CX + r * Math.cos(rad)); + const y = Math.round(CY + r * Math.sin(rad)); + if (x >= 0 && x < 64 && y >= 0 && y < 64) { + paintRect(mapId, "ground", x, y, x, y, "walkable_floor_alt"); + } + } +} + +// Circuit nodes on the outer circle (8 points) -> hazard +const nodeAngles = [0, 45, 90, 135, 180, 225, 270, 315]; +for (const ang of nodeAngles) { + const rad = ang * Math.PI / 180; + const x = Math.round(CX + 15 * Math.cos(rad)); + const y = Math.round(CY + 15 * Math.sin(rad)); + if (x >= 0 && x < 64 && y >= 0 && y < 64) { + paintRect(mapId, "ground", x, y, x, y, "hazard_primary"); + } +} + +// Central core (chip / system core) -> obstacle_decor +paintRect(mapId, "ground", CX, CY, CX, CY, "obstacle_decor"); +for (let dy = -1; dy <= 1; dy++) { + for (let dx = -1; dx <= 1; dx++) { + if (dx === 0 && dy === 0) continue; + const x = CX + dx; + const y = CY + dy; + if (x >= 0 && x < 64 && y >= 0 && y < 64) { + paintRect(mapId, "ground", x, y, x, y, "difficult_terrain"); + } + } +} + +// Electric shock zones around the nodes (difficult_terrain) +for (const ang of nodeAngles) { + const rad = ang * Math.PI / 180; + for (let r = 13; r <= 14; r++) { + const x = Math.round(CX + r * Math.cos(rad)); + const y = Math.round(CY + r * Math.sin(rad)); + if (x >= 0 && x < 64 && y >= 0 && y < 64) { + paintRect(mapId, "ground", x, y, x, y, "difficult_terrain"); + } + } +} + +// ---------- Hacker lair building (bottom centre) ---------- +const BX1 = 22, BY1 = 44, BX2 = 41, BY2 = 60; + +// Building walls +paintWallBorder(mapId, BX1, BY1, BX2, BY2); + +// Interior floor +for (let y = BY1 + 1; y <= BY2 - 1; y++) { + for (let x = BX1 + 1; x <= BX2 - 1; x++) { + paintRect(mapId, "ground", x, y, x, y, "walkable_floor"); + } +} + +// Entrance door (middle of the building's north wall) +openWall(31, BY1); +paintRect(mapId, "ground", 31, BY1, 31, BY1, "door_closed"); + +// ---------- Hacker equipment inside ---------- +// Terminals / screens (obstacle_decor) +paintRect(mapId, "decorations", 26, 48, 26, 48, "obstacle_decor"); +paintRect(mapId, "decorations", 27, 48, 27, 48, "obstacle_decor"); +paintRect(mapId, "decorations", 36, 48, 36, 48, "obstacle_decor"); +paintRect(mapId, "decorations", 37, 48, 37, 48, "obstacle_decor"); +paintRect(mapId, "decorations", 26, 54, 26, 54, "obstacle_decor"); +paintRect(mapId, "decorations", 37, 54, 37, 54, "obstacle_decor"); + +// Servers / racks (obstacle_decor, 2x2) +paintRect(mapId, "decorations", 23, 50, 24, 51, "obstacle_decor"); +paintRect(mapId, "decorations", 39, 50, 40, 51, "obstacle_decor"); + +// Cables / floor details (decoration_minor) +for (let i = 0; i < 20; i++) { + const x = BX1 + 2 + (i * 3) % (BX2 - BX1 - 5); + const y = BY1 + 2 + Math.floor((i * 3) / (BX2 - BX1 - 5)) * 3; + if (x < BX2 - 1 && y < BY2 - 1) { + paintRect(mapId, "decorations", x, y, x, y, "decoration_minor"); + } +} + +// ---------- Spawns ---------- +// Player in front of the building door +placeSpawn(mapId, { x: 31, y: 42, role: "player", name: "player-start" }); + +// Hacker enemies inside the building +placeSpawn(mapId, { x: 26, y: 50, role: "enemy", npcName: "Hacker-reseau", name: "hacker-terminal-1" }); +placeSpawn(mapId, { x: 37, y: 50, role: "enemy", npcName: "Hacker-reseau", name: "hacker-terminal-2" }); +placeSpawn(mapId, { x: 31, y: 56, role: "enemy", npcName: "Hacker-reseau", name: "hacker-central" }); +placeSpawn(mapId, { x: 24, y: 55, role: "enemy", npcName: "Securite-numerique", name: "securite-1" }); + +// Guard enemy near the rune's core +placeSpawn(mapId, { x: 32, y: 20, role: "enemy", npcName: "IA-rogue", name: "ai-core-guardian" }); + +// ---------- Objects ---------- +// Data chest in the building +placeObject(mapId, { x: 30, y: 58, kind: "chest", name: "coffre-donnees-hacker" }); + +// Stairs (access to the lower level) +paintRect(mapId, "ground", 31, 59, 31, 59, "stairs"); + +// ---------- Minor decorations around the rune ---------- +const runeDecorSpots = [ + [16, 32], [48, 32], [32, 16], [32, 48], + [22, 22], [42, 22], [22, 42], [42, 42], +]; +for (const [ix, iy] of runeDecorSpots) { + paintRect(mapId, "decorations", ix, iy, ix, iy, "decoration_minor"); +} + +// ---------- Save the map ---------- +const mapData = serializeMap(mapId); +const outPath = fileURLToPath(new URL('../maps/reseau-electronique-repaire-hacker.tmj', import.meta.url)); +await saveMapFile(mapId, outPath); + +console.log("Saved:", outPath); +console.log("Size:", (fs.statSync(outPath).size / 1024).toFixed(2), "KB"); +console.log("Grid:", mapData.width, "x", mapData.height); +console.log("Orientation:", mapData.orientation); +console.log("Theme:", mapData.properties.find(p => p.name === "theme")?.value); +console.log("Spawns:", mapData.layers.find(l => l.name === "spawns").objects.length); +console.log("Objects:", mapData.layers.find(l => l.name === "objects").objects.length); +console.log("Decoration tiles:", mapData.layers.find(l => l.name === "decorations").data.filter(g => g !== 0).length); diff --git a/scripts/create-glacier-map.mjs b/scripts/create-glacier-map.mjs new file mode 100644 index 0000000000000000000000000000000000000000..1d63be0355c19207ff60da96324f0595e1413fc6 --- /dev/null +++ b/scripts/create-glacier-map.mjs @@ -0,0 +1,254 @@ +// Example map script: builds maps/forteresse-glace-etage.tmj (GLACIAIRE theme, 64x64: ice fortress with a circular central hall) +// by calling the builder API directly, without an MCP client. It is deterministic: +// re-running it reproduces the committed sample map. Run from the repository root +// after building the server (npm run build): +// node scripts/create-glacier-map.mjs +import { createMap, paintRect, paintWallBorder, eraseTile, placeObject, placeSpawn, serializeMap } from '../tiled-mcp/dist/builder.js'; +import { getTheme } from '../tiled-mcp/dist/themes/index.js'; +import { saveMapFile } from '../tiled-mcp/dist/tmj.js'; +import { fileURLToPath } from 'node:url'; +import fs from 'node:fs'; + +const theme = getTheme("GLACIAIRE"); + +const { mapId } = createMap({ + name: "Forteresse de Glace - Donjon Principal v4", + width: 64, + height: 64, + theme: theme, +}); + +console.log("Map created:", mapId); + +// ---------- Helpers ---------- +function openWall(x, y) { + eraseTile(mapId, "walls", x, y); +} + +function paintCircleRoom(cx, cy, radius, floorRole = "walkable_floor") { + for (let y = cy - radius; y <= cy + radius; y++) { + for (let x = cx - radius; x <= cx + radius; x++) { + const dx = x - cx; + const dy = y - cy; + if (dx * dx + dy * dy <= radius * radius) { + paintRect(mapId, "ground", x, y, x, y, floorRole); + } + } + } + paintWallBorder(mapId, cx - radius, cy - radius, cx + radius, cy + radius); +} + +function paintLRoom(x1a, y1a, x2a, y2a, x1b, y1b, x2b, y2b, floorRole = "walkable_floor") { + paintRect(mapId, "ground", x1a, y1a, x2a, y2a, floorRole); + paintRect(mapId, "ground", x1b, y1b, x2b, y2b, floorRole); + const xa = Math.min(x1a, x1b), xb = Math.max(x2a, x2b); + const ya = Math.min(y1a, y1b), yb = Math.max(y2a, y2b); + paintWallBorder(mapId, xa, ya, xb, yb); +} + +function paintTRoom(x1, y1, x2, y2, tx1, ty1, tx2, ty2, floorRole = "walkable_floor") { + paintRect(mapId, "ground", x1, y1, x2, y2, floorRole); + paintRect(mapId, "ground", tx1, ty1, tx2, ty2, floorRole); + const xa = Math.min(x1, tx1), xb = Math.max(x2, tx2); + const ya = Math.min(y1, ty1), yb = Math.max(y2, ty2); + paintWallBorder(mapId, xa, ya, xb, yb); +} + +// ---------- Central hall (circular, radius 10) ---------- +paintCircleRoom(32, 32, 10, "walkable_floor"); + +// Detailed ice ring around the centre (radius 6 to 8) +for (let y = 24; y <= 40; y++) { + for (let x = 24; x <= 40; x++) { + const dx = x - 32; + const dy = y - 32; + const d2 = dx * dx + dy * dy; + if (d2 > 36 && d2 <= 64) { + paintRect(mapId, "ground", x, y, x, y, "walkable_floor_alt"); + } + } +} + +// Frozen lake in the centre (hazard_primary, radius 5) +for (let y = 27; y <= 37; y++) { + for (let x = 27; x <= 37; x++) { + const dx = x - 32; + const dy = y - 32; + if (dx * dx + dy * dy <= 25) { + paintRect(mapId, "ground", x, y, x, y, "hazard_primary"); + } + } +} + +// Ice bridges across the central lake (4 cardinal bridges) +// Vertical north-south bridge +for (let y = 27; y <= 37; y++) { + paintRect(mapId, "ground", 32, y, 32, y, "walkable_floor_alt"); +} +// Horizontal east-west bridge +for (let x = 27; x <= 37; x++) { + paintRect(mapId, "ground", x, 32, x, 32, "walkable_floor_alt"); +} + +// Openings toward the 4 main corridors +openWall(32, 22); // north +openWall(32, 42); // south +openWall(22, 32); // west +openWall(42, 32); // east + +// Chest on the central lake +placeObject(mapId, { x: 32, y: 32, kind: "chest", name: "coffre-sur-le-lac" }); + +// Frozen fountain north of the centre +paintRect(mapId, "decorations", 32, 23, 32, 23, "obstacle_decor"); +paintRect(mapId, "decorations", 31, 23, 31, 23, "decoration_minor"); +paintRect(mapId, "decorations", 33, 23, 33, 23, "decoration_minor"); + +// Frozen fountain south of the centre +paintRect(mapId, "decorations", 32, 41, 32, 41, "obstacle_decor"); +paintRect(mapId, "decorations", 31, 41, 31, 41, "decoration_minor"); +paintRect(mapId, "decorations", 33, 41, 33, 41, "decoration_minor"); + +// ---------- Outer rooms (various shapes) ---------- + +// NORTH: rectangular room, final boss +paintRect(mapId, "ground", 15, 2, 48, 16, "walkable_floor"); +paintWallBorder(mapId, 15, 2, 48, 16); +openWall(31, 16); +placeSpawn(mapId, { x: 31, y: 6, role: "enemy", npcName: "Seigneur des Glaces", name: "boss-final" }); +// Boss throne +paintRect(mapId, "decorations", 31, 4, 31, 4, "obstacle_decor"); + +// SOUTH: rectangular room, player entrance +paintRect(mapId, "ground", 15, 47, 48, 61, "walkable_floor"); +paintWallBorder(mapId, 15, 47, 48, 61); +openWall(31, 47); +placeSpawn(mapId, { x: 31, y: 54, role: "player", name: "player-start" }); + +// EAST: L-shaped room +paintLRoom(47, 18, 62, 40, 47, 41, 58, 46, "walkable_floor"); +paintWallBorder(mapId, 47, 18, 62, 46); +openWall(47, 31); +placeSpawn(mapId, { x: 54, y: 31, role: "enemy", npcName: "Givre-Rôdeur", name: "ice-creature-east" }); +paintRect(mapId, "decorations", 58, 31, 58, 31, "obstacle_decor"); + +// WEST: L-shaped room +paintLRoom(2, 18, 17, 40, 6, 41, 17, 46, "walkable_floor"); +paintWallBorder(mapId, 2, 18, 17, 46); +openWall(17, 31); +placeSpawn(mapId, { x: 10, y: 31, role: "enemy", npcName: "Givre-Rôdeur", name: "ice-creature-west" }); +paintRect(mapId, "decorations", 6, 31, 6, 31, "obstacle_decor"); + +// NORTH-EAST: circular room (radius 8) +paintCircleRoom(54, 10, 8, "walkable_floor"); +paintWallBorder(mapId, 46, 2, 62, 18); +openWall(49, 18); +placeSpawn(mapId, { x: 54, y: 10, role: "enemy", npcName: "Esprit de Glace", name: "ice-creature-ne" }); +placeObject(mapId, { x: 54, y: 6, kind: "chest", name: "coffre-ne" }); + +// NORTH-WEST: circular room (radius 8) +paintCircleRoom(10, 10, 8, "walkable_floor"); +paintWallBorder(mapId, 2, 2, 18, 18); +openWall(14, 18); +placeSpawn(mapId, { x: 10, y: 10, role: "enemy", npcName: "Esprit de Glace", name: "ice-creature-nw" }); + +// SOUTH-EAST: T-shaped room +paintTRoom(47, 44, 62, 53, 52, 53, 56, 61, "walkable_floor"); +paintWallBorder(mapId, 47, 44, 62, 61); +openWall(49, 44); +placeSpawn(mapId, { x: 54, y: 56, role: "enemy", npcName: "Givre-Rôdeur", name: "ice-creature-se" }); + +// SOUTH-WEST: T-shaped room +paintTRoom(2, 44, 17, 53, 8, 53, 12, 61, "walkable_floor"); +paintWallBorder(mapId, 2, 44, 17, 61); +openWall(15, 44); +placeSpawn(mapId, { x: 10, y: 56, role: "enemy", npcName: "Givre-Rôdeur", name: "ice-creature-sw" }); + +// ---------- Outer ring (belt corridor linking the rooms) ---------- +paintRect(mapId, "ground", 2, 17, 62, 20, "walkable_floor"); // top +paintRect(mapId, "ground", 2, 43, 62, 46, "walkable_floor"); // bottom +paintRect(mapId, "ground", 2, 17, 5, 46, "walkable_floor"); // left +paintRect(mapId, "ground", 58, 17, 62, 46, "walkable_floor"); // right + +// Openings from the ring toward the outer rooms +openWall(31, 17); // toward north +openWall(31, 46); // toward south +openWall(5, 31); // toward west +openWall(58, 31); // toward east + +// ---------- Wide corridors toward the centre ---------- +paintRect(mapId, "ground", 29, 17, 35, 22, "walkable_floor"); // N-S toward centre +paintRect(mapId, "ground", 29, 42, 35, 46, "walkable_floor"); // S-N toward centre +paintRect(mapId, "ground", 17, 29, 22, 35, "walkable_floor"); // E-W toward centre +paintRect(mapId, "ground", 42, 29, 46, 35, "walkable_floor"); // W-E toward centre + +// ---------- Hazards ---------- +// Ring of thin ice around the central lake (radius 5 to 7) +for (let y = 25; y <= 39; y++) { + for (let x = 25; x <= 39; x++) { + const dx = x - 32; + const dy = y - 32; + const d2 = dx * dx + dy * dy; + if (d2 > 25 && d2 <= 49) { + paintRect(mapId, "ground", x, y, x, y, "hazard_primary"); + } + } +} + +// Black-ice patches in the corridors (difficult_terrain) +paintRect(mapId, "ground", 29, 17, 35, 21, "difficult_terrain"); +paintRect(mapId, "ground", 29, 43, 35, 46, "difficult_terrain"); +paintRect(mapId, "ground", 17, 29, 21, 35, "difficult_terrain"); +paintRect(mapId, "ground", 43, 29, 46, 35, "difficult_terrain"); + +// ---------- Doors ---------- +paintRect(mapId, "ground", 31, 17, 31, 17, "door_closed"); +paintRect(mapId, "ground", 31, 46, 31, 46, "door_closed"); +paintRect(mapId, "ground", 17, 31, 17, 31, "door_closed"); +paintRect(mapId, "ground", 46, 31, 46, 31, "door_closed"); + +// ---------- Minor decorations: icicles ---------- +const icicleSpots = [ + [20, 10], [21, 10], [22, 10], + [42, 10], [43, 10], [44, 10], + [20, 53], [21, 53], [22, 53], + [42, 53], [43, 53], [44, 53], + [10, 20], [10, 21], [10, 22], + [53, 20], [53, 21], [53, 22], + [30, 8], [31, 8], [32, 8], [33, 8], [34, 8], + [30, 55], [31, 55], [32, 55], [33, 55], [34, 55], + [8, 30], [8, 31], [8, 32], + [55, 30], [55, 31], [55, 32], + [14, 6], [15, 6], [16, 6], + [47, 6], [48, 6], [49, 6], + [14, 57], [15, 57], [16, 57], + [47, 57], [48, 57], [49, 57], +]; +for (const [ix, iy] of icicleSpots) { + paintRect(mapId, "decorations", ix, iy, ix, iy, "decoration_minor"); +} + +// Ice sculptures in the outer rooms +paintRect(mapId, "decorations", 31, 8, 31, 8, "obstacle_decor"); // north +paintRect(mapId, "decorations", 31, 55, 31, 55, "obstacle_decor"); // south +paintRect(mapId, "decorations", 8, 31, 8, 31, "obstacle_decor"); // west +paintRect(mapId, "decorations", 55, 31, 55, 31, "obstacle_decor"); // east + +// ---------- Stairs between floors ---------- +paintRect(mapId, "ground", 32, 6, 32, 6, "stairs"); +paintRect(mapId, "ground", 32, 57, 32, 57, "stairs"); + +// ---------- Lever (mechanism) ---------- +placeObject(mapId, { x: 40, y: 32, kind: "lever", name: "levier-pont-levis" }); + +// ---------- Save the map ---------- +const mapData = serializeMap(mapId); +const outPath = fileURLToPath(new URL('../maps/forteresse-glace-etage.tmj', import.meta.url)); +await saveMapFile(mapId, outPath); + +console.log("Saved:", outPath); +console.log("Size:", (fs.statSync(outPath).size / 1024).toFixed(2), "KB"); +console.log("Grid:", mapData.width, "x", mapData.height); +console.log("Spawns:", mapData.layers.find(l => l.name === "spawns").objects.length); +console.log("Objects:", mapData.layers.find(l => l.name === "objects").objects.length); +console.log("Decoration tiles:", mapData.layers.find(l => l.name === "decorations").data.filter(g => g !== 0).length); diff --git a/scripts/gen-docs.mjs b/scripts/gen-docs.mjs new file mode 100644 index 0000000000000000000000000000000000000000..3cfa5336f1c6ef5393a90e3abccc87b620ffa36b --- /dev/null +++ b/scripts/gen-docs.mjs @@ -0,0 +1,212 @@ +// Regenerate docs/tools.md and docs/themes.md from the running server (tools/list, +// prompts/list, list_themes), so the references always match the code. +// Run after `npm run build`: +// npm run docs (or: node scripts/gen-docs.mjs) + +import { spawn } from "node:child_process"; +import { writeFileSync } from "node:fs"; +import { fileURLToPath } from "node:url"; + +const serverPath = fileURLToPath(new URL("../tiled-mcp/dist/index.js", import.meta.url)); +const outPath = fileURLToPath(new URL("../docs/tools.md", import.meta.url)); +const themesPath = fileURLToPath(new URL("../docs/themes.md", import.meta.url)); + +// English one-line summaries; display names and descriptions come from the server. +const SUMMARY = { + CRYPT: "Burial vaults under chapels, cracked flagstones, poison vents from broken sarcophagi.", + CASTLE: "Black marble and basalt halls, broken stained glass, throne room, grand stairs.", + WEREWOLF_DEN: "Damp caves dug into the forest, bone-strewn earth floor, claw-marked rock, blood pools.", + TAVERN_BLOOD_PRINCE: "Dark floorboards, heavy beams, oak tables, crackling hearth. No active traps.", + VILLAGE: "Rain-soaked cobblestones, shuttered half-timbered houses, abandoned stalls, well and gallows.", + HAUNTED_FOREST: "Stifling undergrowth of black moss, fallen trunks, parasitic mist that slows walkers.", + MAUSOLEUM: "Grey-veined marble, fallen-angel statues, funeral urns in niches. No hazards.", + BLOOD_TOMB: "Deep ritual sanctuary, pulsing bleeding runes, central altar.", + AQUATIC: "Black stagnant water, water lilies, sunken ruins, haunted marsh.", + GLACIAIRE: "Black ice, figures frozen in the ice, frost, haunted tundra.", + INONDE: "Drowned city under the waves, hanging kelp, broken bridges, deep currents.", + VOLCAN: "Lava flows, cooled black rock, flying ash, active caldera.", + FORET: "Twisted woods, thick moss, exposed roots, misty clearings, quicksand.", + HIVER: "Powder snow, frozen lakes, frosted branches, trappers' huts.", + PRINTEMPS: "Flowering meadows, clear streams, budding trees, druid circles.", + ETE: "Golden grass, ripe wheat, cloudless heat, abandoned granaries.", + AUTOMNE: "Russet leaves, mushrooms, morning mist, bog mire.", + DESOLATION: "Cold ash, charred trees, barren ground, post-cataclysm ruins.", + FUTURISTE: "Chrome, cold neon, holographic panels, dystopian megacity.", + ELECTRONIQUE: "Circuit boards, optic fibre, silent servers, AI cores.", +}; + +const GROUPS = [ + ["Map lifecycle", ["list_themes", "create_map", "list_maps", "describe_map", "discard_map"]], + ["Painting tiles", ["paint_tile", "paint_rect", "paint_wall_border", "erase_tile", "get_tile_info"]], + ["Rooms and corridors", ["generate_room", "generate_corridor"]], + ["Layout presets", ["generate_crypt_layout", "generate_castle_floor", "generate_werewolf_den"]], + ["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 (optional, generation is paid)", ["preview_sprite_prompt", "generate_tile_sprite", "generate_theme_sprite_set", "override_tile_image"]], +]; + +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; + const msg = JSON.parse(line); + if (msg.id !== undefined && pending.has(msg.id)) { + pending.get(msg.id)(msg); + pending.delete(msg.id); + } + } +}); +let nextId = 1; +const request = (method, params) => + new Promise((resolve) => { + const id = nextId++; + pending.set(id, resolve); + server.stdin.write(JSON.stringify({ jsonrpc: "2.0", id, method, params }) + "\n"); + }); + +await request("initialize", { protocolVersion: "2025-06-18", capabilities: {}, clientInfo: { name: "gen-tool-docs", version: "1" } }); +server.stdin.write(JSON.stringify({ jsonrpc: "2.0", method: "notifications/initialized" }) + "\n"); +const { tools } = (await request("tools/list", {})).result; +const { prompts } = (await request("prompts/list", {})).result; +const themes = JSON.parse((await request("tools/call", { name: "list_themes", arguments: {} })).result.content[0].text); +server.kill(); + +const esc = (s) => String(s ?? "").replace(/\|/g, "\\|").replace(/\n/g, " "); + +function typeOf(schema) { + if (schema.enum) return schema.enum.map((v) => `\`${v}\``).join(", "); + if (schema.type === "array") { + const item = schema.items ?? {}; + if (item.type === "object") { + const fields = Object.entries(item.properties ?? {}).map(([k, v]) => `${k}: ${typeOf(v)}`); + return `array of { ${fields.join("; ")} }`; + } + return `array of ${typeOf(item)}`; + } + return schema.type === "integer" ? "integer" : schema.type ?? "any"; +} + +function constraints(schema) { + const out = []; + if (schema.minimum !== undefined && schema.maximum !== undefined) out.push(`${schema.minimum}..${schema.maximum}`); + else if (schema.minimum !== undefined) out.push(`>= ${schema.minimum}`); + else if (schema.maximum !== undefined) out.push(`<= ${schema.maximum}`); + if (schema.minLength !== undefined && schema.maxLength !== undefined) out.push(`${schema.minLength}..${schema.maxLength} chars`); + else if (schema.minLength !== undefined) out.push(`min ${schema.minLength} chars`); + if (schema.maxItems !== undefined) out.push(`max ${schema.maxItems} items`); + if (schema.pattern) out.push(`pattern \`${schema.pattern}\``); + return out.join(", "); +} + +function hints(a = {}) { + const tags = []; + if (a.readOnlyHint) tags.push("read-only"); + if (a.destructiveHint) tags.push("destructive"); + if (a.idempotentHint) tags.push("idempotent"); + if (a.openWorldHint) tags.push("network"); + return tags.length ? tags.map((t) => `\`${t}\``).join(" ") : "`writes map`"; +} + +const byName = new Map(tools.map((t) => [t.name, t])); +const listed = new Set(GROUPS.flatMap(([, names]) => names)); +const unlisted = tools.filter((t) => !listed.has(t.name)).map((t) => t.name); +if (unlisted.length) GROUPS.push(["Other", unlisted]); + +let md = `# Tool reference + + + +The server exposes **${tools.length} tools** and **${prompts.length} 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. + +Coordinates are grid cells: \`x\` is the column (0..width-1) and \`y\` the row (0..height-1). +On an isometric map, cell (0,0) is the top corner of the diamond; \`x\` grows toward the lower right +and \`y\` toward the lower left. See [map-format.md](map-format.md) for the layers and properties. + +Tags: \`read-only\` never changes anything, \`destructive\` can delete or overwrite, \`idempotent\` is safe +to repeat, \`network\` calls an external service. + +## Contents + +`; +for (const [group, names] of GROUPS) { + md += `- **${group}**: ${names.map((n) => `[\`${n}\`](#${n})`).join(", ")}\n`; +} +md += `- **Prompt**: ${prompts.map((p) => `[\`${p.name}\`](#prompt-${p.name})`).join(", ")}\n`; + +for (const [group, names] of GROUPS) { + md += `\n## ${group}\n`; + for (const name of names) { + const t = byName.get(name); + if (!t) continue; + md += `\n### ${name}\n\n${hints(t.annotations)}\n\n${t.description}\n`; + const props = Object.entries(t.inputSchema?.properties ?? {}); + const required = new Set(t.inputSchema?.required ?? []); + if (!props.length) { + md += `\nNo parameters.\n`; + continue; + } + md += `\n| Parameter | Type | Required | Notes |\n|---|---|---|---|\n`; + for (const [pname, schema] of props) { + const notes = [schema.description, constraints(schema)].filter(Boolean).join(". "); + md += `| \`${pname}\` | ${esc(typeOf(schema))} | ${required.has(pname) ? "yes" : "no"} | ${esc(notes)} |\n`; + } + } +} + +md += `\n## Prompts\n`; +for (const p of prompts) { + md += `\n### Prompt: ${p.name}\n\n${p.description}\n\n| Argument | Required | Notes |\n|---|---|---|\n`; + for (const a of p.arguments ?? []) md += `| \`${a.name}\` | ${a.required ? "yes" : "no"} | ${esc(a.description)} |\n`; +} + +writeFileSync(outPath, md.replace(/\n{3,}/g, "\n\n"), "utf8"); +console.log(`Wrote ${outPath} (${tools.length} tools, ${prompts.length} prompt(s))`); + +// ---------- docs/themes.md ---------- +const STATUS = { all: "bundled", partial: "partial", none: "not generated yet" }; +const bundled = themes.filter((t) => t.sprites.status === "all").length; +let tmd = `# Themes + + + +A theme is a tile palette: it maps each **role** used by the tools (\`walkable_floor\`, \`wall\`, +\`hazard_primary\`, ...) to one sprite and one tile type. Pass its key to \`create_map\`. +Display names and descriptions are in French, the language the themes were written in. + +**${themes.length} themes**, ${bundled} with bundled sprites. Themes without sprites still produce valid +maps; Tiled shows placeholders until the PNGs exist (see [sprite-generation.md](sprite-generation.md)). +Sprites live in \`assets//.png\`. + +| Key | Display name | Setting | Roles | Sprites | +|---|---|---|---|---| +`; +for (const t of themes) { + tmd += `| \`${t.key}\` | ${esc(t.name)} | ${esc(SUMMARY[t.key] ?? "")} | ${t.roles.length} | ${STATUS[t.sprites.status]} (${t.sprites.present}/${t.sprites.total}) |\n`; +} +tmd += `\n## Roles per theme\n\n| Key | Roles |\n|---|---|\n`; +for (const t of themes) tmd += `| \`${t.key}\` | ${t.roles.map((r) => `\`${r}\``).join(", ")} |\n`; +tmd += `\n## Original descriptions\n`; +for (const t of themes) tmd += `\n**${t.key}** (${t.name}): ${t.description}\n`; +tmd += ` +## Adding a theme + +1. Create \`tiled-mcp/src/themes/.ts\` exporting a \`Theme\` (copy an existing one). It must + define at least \`walkable_floor\` and \`wall\`. +2. Register it in \`tiled-mcp/src/themes/index.ts\`. +3. Add its prompt entries to \`ROLE_VISUALS\` and its key to \`ThemeKey\` in + \`tiled-mcp/src/themes/prompts.ts\` if you want sprite generation. +4. Put sprites in \`assets//.png\` (64x32 floors, 64x64 walls and props), + or generate them. +5. \`npm run build && npm run docs && npm run smoke\`. +`; +writeFileSync(themesPath, tmd, "utf8"); +console.log(`Wrote ${themesPath} (${themes.length} themes)`); diff --git a/scripts/gen-theme-set.mjs b/scripts/gen-theme-set.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c9f1c8892ca0f3d482649ada271e79b5663f1d27 --- /dev/null +++ b/scripts/gen-theme-set.mjs @@ -0,0 +1,118 @@ +// PAID: generate the missing sprites of one or more themes with FLUX.1-dev via Hugging Face. +// Runs the MCP server as a child process and calls its generate_theme_sprite_set tool, which +// skips sprites that already exist (unless --force). Each generated sprite is a paid call. +// +// Usage (from the repository root, after npm install && npm run build): +// node scripts/gen-theme-set.mjs VOLCAN --yes +// node scripts/gen-theme-set.mjs VOLCAN HIVER ETE --yes +// node scripts/gen-theme-set.mjs --missing --yes # every theme with missing sprites +// node scripts/gen-theme-set.mjs --dry-run VOLCAN # list what would be generated, free +// +// 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 { 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 missingOnly = args.includes("--missing"); +const requested = args.filter((a) => !a.startsWith("--")).map((a) => a.toUpperCase()); + +if (!requested.length && !missingOnly) { + console.error("Usage: node scripts/gen-theme-set.mjs | --missing [--yes] [--force] [--dry-run]"); + process.exit(1); +} + +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((resolve) => { + const id = nextId++; + pending.set(id, resolve); + server.stdin.write(JSON.stringify({ jsonrpc: "2.0", id, method, params }) + "\n"); + }); +} +async function callTool(name, args) { + const res = await request("tools/call", { name, arguments: args }); + 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-theme-set", version: "1.0.0" }, + }); + server.stdin.write(JSON.stringify({ jsonrpc: "2.0", method: "notifications/initialized" }) + "\n"); + + const themes = await callTool("list_themes", {}); + const known = new Map(themes.map((t) => [t.key, t])); + const unknown = requested.filter((k) => !known.has(k)); + if (unknown.length) throw new Error(`Unknown theme(s): ${unknown.join(", ")}. Known: ${[...known.keys()].join(", ")}`); + + const targets = (missingOnly ? themes.filter((t) => t.sprites.status !== "all") : requested.map((k) => known.get(k))); + const plan = targets.map((t) => ({ key: t.key, toGenerate: force ? t.sprites.total : t.sprites.total - t.sprites.present })); + const total = plan.reduce((n, p) => n + p.toGenerate, 0); + + console.log("Sprites to generate (one paid call each):"); + for (const p of plan) console.log(` ${p.key.padEnd(22)} ${p.toGenerate}`); + console.log(` ${"total".padEnd(22)} ${total}`); + + if (dryRun || total === 0) { + console.log(total === 0 ? "Nothing to generate." : "Dry run: nothing generated."); + } 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) { + if (p.toGenerate === 0) continue; + console.log(`\n=== ${p.key} ===`); + const res = await callTool("generate_theme_sprite_set", { theme: p.key, force }); + if (res.ok === false) throw new Error(res.error); + for (const r of res.results) { + const status = r.skipped ? "skipped (exists)" : r.ok ? `generated in ${Math.round(r.durationMs / 1000)}s` : `FAILED: ${r.error}`; + console.log(` ${r.role.padEnd(20)} ${status}`); + if (!r.skipped) r.ok ? ok++ : failed++; + } + } + console.log(`\nDone: ${ok} generated, ${failed} failed.`); + } +} catch (err) { + console.error(`Error: ${err instanceof Error ? err.message : String(err)}`); + process.exitCode = 1; +} finally { + server.kill(); +} diff --git a/scripts/render-map-preview.mjs b/scripts/render-map-preview.mjs new file mode 100644 index 0000000000000000000000000000000000000000..8e31584bed3cfa84a32ba03b2a1508dba5565f96 --- /dev/null +++ b/scripts/render-map-preview.mjs @@ -0,0 +1,46 @@ +// Render a .tmj 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. +// +// Usage (from the repository root, after npm install && npm run build): +// node scripts/render-map-preview.mjs maps/forteresse-glace-etage.tmj +// node scripts/render-map-preview.mjs [out.png] [--width 1600] [--no-markers] +// +// The renderer itself lives in tiled-mcp/src/render.ts and is shared with the hosted web page. + +import { readFileSync, writeFileSync } from "node:fs"; +import { dirname, resolve } from "node:path"; +import { renderMapPreview } from "../tiled-mcp/dist/render.js"; + +const args = process.argv.slice(2); +const flag = (name) => args.includes(name); +const option = (name, fallback) => { + const i = args.indexOf(name); + return i >= 0 ? args[i + 1] : fallback; +}; +const positional = args.filter((a, i) => !a.startsWith("--") && !(i > 0 && args[i - 1] === "--width")); +const [input, output = input?.replace(/\.(tmj|json)$/i, "") + ".png"] = positional; +if (!input) { + console.error("Usage: node scripts/render-map-preview.mjs [out.png] [--width 1600] [--no-markers]"); + process.exit(1); +} + +const mapPath = resolve(input); +const map = JSON.parse(readFileSync(mapPath, "utf8")); +let sprites = 0; +const png = await renderMapPreview( + map, + (image) => { + try { + const data = readFileSync(resolve(dirname(mapPath), image)); + sprites++; + return data; + } catch { + console.warn(`missing sprite: ${image}`); + return undefined; + } + }, + { maxWidth: Number(option("--width", "1600")), markers: !flag("--no-markers") }, +); +writeFileSync(output, png); +console.log(`Wrote ${output} (${sprites} tile sprites loaded)`); diff --git a/scripts/smoke-http.mjs b/scripts/smoke-http.mjs new file mode 100644 index 0000000000000000000000000000000000000000..6118e09ae462f1a4f2bcccb0cdb149c8be676a81 --- /dev/null +++ b/scripts/smoke-http.mjs @@ -0,0 +1,176 @@ +// End-to-end test of the hosted mode (tiled-mcp/dist/http.js): web routes, MCP over HTTP with +// isolated sessions and download links, and the web agent driven by a scripted stand-in for the +// AI model. Free and offline: the "model" is a local stub that replaces Hugging Face Inference +// Providers, so nothing is billed. +// +// Usage (after npm run build): +// npm run smoke:http +import { spawn } from "node:child_process"; +import { existsSync } from "node:fs"; +import { join, resolve } from "node:path"; +import { createServer } from "node:http"; +import { fileURLToPath } from "node:url"; +import { Client } from "@modelcontextprotocol/sdk/client/index.js"; +import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"; +import { unzipSync } from "fflate"; + +const httpPath = fileURLToPath(new URL("../tiled-mcp/dist/http.js", import.meta.url)); +const repoMaps = fileURLToPath(new URL("../maps/", import.meta.url)); +const VISITOR_TOKEN = "hf_visitor_token_for_tests"; +const SERVER_ENV_TOKEN = "hf_server_env_token_must_never_be_used"; + +let pass = 0, fail = 0; +const check = (label, cond, detail) => { + if (cond) { pass++; console.log("PASS", label); } + else { fail++; console.log("FAIL", label, detail !== undefined ? JSON.stringify(detail).slice(0, 400) : ""); } +}; + +// ---------- stand-in for the inference router ---------- +const seenAuth = new Set(); +let seenTools = []; +const fakeModel = createServer(async (req, res) => { + let raw = ""; + for await (const chunk of req) raw += chunk; + const body = JSON.parse(raw); + seenAuth.add(req.headers.authorization); + seenTools = body.tools.map((t) => t.function.name); + const step = body.messages.filter((m) => m.role === "assistant").length; + let mapId; + for (const m of body.messages) { + if (m.role !== "tool") continue; + try { mapId ??= JSON.parse(m.content).mapId; } catch { /* not JSON */ } + } + const call = (name, args) => ({ + role: "assistant", + content: null, + tool_calls: [{ id: `call_${step}`, type: "function", function: { name, arguments: JSON.stringify(args) } }], + }); + const script = [ + () => call("create_map", { name: "Smoke crypt", width: 28, height: 18, theme: "CRYPT" }), + () => 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" }); + res.end(JSON.stringify({ choices: [{ message }], usage: { prompt_tokens: 1000, completion_tokens: 50 } })); +}); +await new Promise((r) => fakeModel.listen(0, "127.0.0.1", r)); +const fakeUrl = `http://127.0.0.1:${fakeModel.address().port}/v1`; + +// ---------- start the hosted server ---------- +const port = 20000 + Math.floor(Math.random() * 20000); +const env = { ...process.env, PORT: String(port), HOST: "127.0.0.1", TILED_INFERENCE_URL: fakeUrl, HF_TOKEN: SERVER_ENV_TOKEN }; +for (const k of ["HUGGINGFACE_API_KEY", "OAUTH_CLIENT_ID", "OAUTH_CLIENT_SECRET", "SPACE_HOST", "PUBLIC_URL", "TILED_ASSETS_DIR", "TILED_AGENT_MODEL", "TILED_ENV_FILE"]) delete env[k]; +env.TILED_ENV_FILE = fileURLToPath(new URL("./does-not-exist.env", import.meta.url)); +const child = spawn(process.execPath, [httpPath], { env, stdio: ["ignore", "pipe", "pipe"] }); +let stderr = ""; +child.stderr.on("data", (d) => (stderr += d)); +await new Promise((resolve, reject) => { + const t = setTimeout(() => reject(new Error(`server did not start: ${stderr}`)), 15000); + child.stdout.on("data", (d) => { if (String(d).includes(`:${port}`)) { clearTimeout(t); resolve(); } }); +}); +const base = `http://127.0.0.1:${port}`; + +// ---------- web routes ---------- +const home = await fetch(`${base}/`); +check("home page served with a CSP", home.status === 200 && /Tiled Map Builder/.test(await home.text()) && /script-src 'self'/.test(home.headers.get("content-security-policy") ?? "")); +const config = await (await fetch(`${base}/api/config`)).json(); +check("config: 20 themes, no sign-in without a Space, MCP url", config.themes.length === 20 && config.oauth === false && config.mcpUrl === `${base}/mcp`, config); +check("config: default model is offered", config.models.some((m) => m.id === config.defaultModel), config.models); +const sprite = await fetch(`${base}/assets/crypt/wall.png`); +check("bundled sprite served", sprite.status === 200 && sprite.headers.get("content-type") === "image/png"); +check("asset route refuses paths outside the sprites", (await fetch(`${base}/assets/..%2Fpackage.json`)).status === 404); +check("login is off outside a Space", (await fetch(`${base}/login`, { redirect: "manual" })).status === 404); +check("unknown download is 404", (await fetch(`${base}/download/nope/x.zip`)).status === 404); + +// ---------- MCP over HTTP ---------- +async function connect(token) { + const transport = new StreamableHTTPClientTransport(new URL(`${base}/mcp`), token ? { requestInit: { headers: { Authorization: `Bearer ${token}` } } } : undefined); + const client = new Client({ name: "smoke-http", version: "1" }); + await client.connect(transport); + return { client, transport }; +} +const data = (r) => { try { return JSON.parse(r.content?.[0]?.text ?? ""); } catch { return r.content?.[0]?.text; } }; + +const 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); +check("session A lists its map", data(await a.client.callTool({ name: "list_maps", arguments: {} })).length === 1); +check("session B does not see session A's maps", data(await b.client.callTool({ name: "list_maps", arguments: {} })).length === 0); +const foreign = await b.client.callTool({ name: "describe_map", arguments: { mapId: mapA } }); +check("session B cannot open session A's map", foreign.isError === true, foreign); + +await a.client.callTool({ name: "generate_crypt_layout", arguments: { mapId: mapA } }); +const saved = data(await a.client.callTool({ name: "save_to_disk", arguments: { mapId: mapA, path: "../../escape.tmj" } })); +check("save_to_disk returns download links", saved.ok && /\/download\/.+\/escape\.zip$/.test(saved.zipUrl) && /escape\.tmj$/.test(saved.tmjUrl), saved); +check("save_to_disk wrote nothing to the server's disk", !existsSync(join(repoMaps, "escape.tmj")) && !existsSync(resolve(repoMaps, "../../escape.tmj"))); +const zipRes = await fetch(saved.zipUrl); +const files = unzipSync(new Uint8Array(await zipRes.arrayBuffer())); +const names = Object.keys(files); +check("zip holds the .tmj and its sprites", zipRes.headers.get("content-type") === "application/zip" && names.includes("escape/escape.tmj") && names.some((n) => /^escape\/assets\/crypt\/.+\.png$/.test(n)), names); +const tmj = JSON.parse(new TextDecoder().decode(files["escape/escape.tmj"])); +const images = tmj.tilesets[0].tiles.map((t) => t.image).filter(Boolean); +check("every sprite path in the .tmj resolves inside the zip", images.every((p) => names.includes(`escape/${p.replace(/^\.\//, "")}`)), images); +check("bare .tmj link works", (await fetch(saved.tmjUrl)).status === 200); + +const noToken = data(await a.client.callTool({ name: "generate_tile_sprite", arguments: { theme: "CRYPT", role: "wall", force: true } })); +check("paid tool without a caller token refuses (server env token ignored)", noToken.ok === false && /No Hugging Face token was sent/.test(noToken.error), noToken); + +const c = await connect(VISITOR_TOKEN); +const outDir = data(await c.client.callTool({ name: "generate_tile_sprite", arguments: { theme: "CRYPT", role: "wall", outputDir: "/tmp" } })); +check("hosted mode refuses outputDir before any paid call", outDir.ok === false && /outputDir is not available/.test(outDir.error), outDir); +const existing = data(await c.client.callTool({ name: "generate_tile_sprite", arguments: { theme: "CRYPT", role: "wall" } })); +check("existing bundled sprite is not regenerated", existing.skipped === true, existing); + +await a.transport.terminateSession(); +const gone = await fetch(`${base}/mcp`, { + method: "POST", + headers: { "Content-Type": "application/json", Accept: "application/json, text/event-stream", "Mcp-Session-Id": a.transport.sessionId ?? "x" }, + body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "tools/list" }), +}); +check("a closed session is gone", gone.status === 404 || gone.status === 400, gone.status); +await b.client.close(); +await c.client.close(); + +// ---------- web agent ---------- +const post = (body, token) => fetch(`${base}/api/generate`, { + method: "POST", + headers: { "Content-Type": "application/json", ...(token ? { Authorization: `Bearer ${token}` } : {}) }, + body: JSON.stringify(body), +}); +check("generate without a token is refused", (await post({ description: "a crypt" })).status === 401); +check("generate with an unknown theme is refused", (await post({ description: "a crypt", theme: "NOPE" }, VISITOR_TOKEN)).status === 400); +check("generate with a malformed model id is refused", (await post({ description: "a crypt", model: "not a model" }, VISITOR_TOKEN)).status === 400); + +const run = await post({ description: "A small crypt with a ghoul lord", theme: "CRYPT" }, VISITOR_TOKEN); +const events = (await run.text()).trim().split("\n").map((l) => JSON.parse(l)); +const 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(); +check("health check reports no running job", health.ok && health.jobs === 0, health); + +child.kill(); +fakeModel.close(); +console.log(`\n${pass} passed, ${fail} failed`); +if (stderr.trim()) console.log("server stderr:\n" + stderr); +process.exit(fail ? 1 : 0); diff --git a/scripts/smoke-test.mjs b/scripts/smoke-test.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b9d696a04b19640fae3f84611b9947fb39c3a438 --- /dev/null +++ b/scripts/smoke-test.mjs @@ -0,0 +1,163 @@ +// End-to-end smoke test: starts the built MCP server and drives it over stdio like a client +// would, checking tools, prompt, presets, placement rules, coordinates and file output. +// Free and offline: it never calls a paid or remote service. +// +// Usage (after npm run build): +// npm run smoke # Tiled-native object coordinates (default) +// node scripts/smoke-test.mjs screen # legacy screen-space coordinates +import { spawn } from "node:child_process"; +import { existsSync, readFileSync, mkdtempSync, rmSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { dirname, join, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; + +const mode = process.argv[2]; +const serverPath = fileURLToPath(new URL("../tiled-mcp/dist/index.js", import.meta.url)); +const outDir = mkdtempSync(join(tmpdir(), "tiled-mcp-smoke-")); +const env = { ...process.env, TILED_MAPS_DIR: outDir, TILED_ENV_FILE: resolve(outDir, "does-not-exist.env") }; +for (const k of ["HUGGINGFACE_API_KEY", "HF_TOKEN", "TILED_ASSETS_DIR", "TILED_OBJECT_COORDS"]) delete env[k]; +if (mode === "screen") env.TILED_OBJECT_COORDS = "screen"; + +const child = spawn(process.execPath, [serverPath], { env, stdio: ["pipe", "pipe", "pipe"] }); +let buf = ""; +const pending = new Map(); +let stderr = ""; +child.stderr.on("data", (d) => (stderr += d)); +child.stdout.on("data", (d) => { + buf += d; + let i; + while ((i = buf.indexOf("\n")) >= 0) { + const line = buf.slice(0, i).trim(); + buf = buf.slice(i + 1); + if (!line) continue; + let msg; + try { msg = JSON.parse(line); } catch { console.log("NON-JSON STDOUT:", line); continue; } + if (msg.id !== undefined && pending.has(msg.id)) { pending.get(msg.id)(msg); pending.delete(msg.id); } + } +}); +let nextId = 1; +const rpc = (method, params) => new Promise((res) => { const id = nextId++; pending.set(id, res); child.stdin.write(JSON.stringify({ jsonrpc: "2.0", id, method, params }) + "\n"); }); +const notify = (method, params) => child.stdin.write(JSON.stringify({ jsonrpc: "2.0", method, params }) + "\n"); +const call = async (name, args) => { + const r = await rpc("tools/call", { name, arguments: args }); + if (r.error) return { protocolError: r.error }; + const text = r.result.content?.[0]?.text ?? ""; + let data; try { data = JSON.parse(text); } catch { data = text; } + return { isError: !!r.result.isError, data }; +}; + +let pass = 0, fail = 0; +const check = (label, cond, detail) => { if (cond) { pass++; console.log("PASS", label); } else { fail++; console.log("FAIL", label, detail !== undefined ? JSON.stringify(detail).slice(0, 400) : ""); } }; + +const init = await rpc("initialize", { protocolVersion: "2025-06-18", capabilities: {}, clientInfo: { name: "smoke", version: "1" } }); +check("initialize", init.result?.serverInfo?.name === "tiled-map-builder", init.result?.serverInfo); +notify("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)); +const createMapTool = tools.find((t) => t.name === "create_map"); +check("create_map theme enum has 20 themes", createMapTool.inputSchema.properties.theme.enum.length === 20, createMapTool.inputSchema.properties.theme); +const genTool = tools.find((t) => t.name === "generate_tile_sprite"); +check("generate_tile_sprite accepts 20 themes", genTool.inputSchema.properties.theme.enum.length === 20); + +const prompts = (await rpc("prompts/list", {})).result.prompts; +check("map_builder prompt listed", prompts.some((p) => p.name === "map_builder")); +const pg = await rpc("prompts/get", { name: "map_builder", arguments: { description: "crypt 28x18" } }); +check("map_builder prompt loads the skill", !pg.error && pg.result.messages[0].content.text.includes("Map request: crypt 28x18") && pg.result.messages[0].content.text.length > 2000, pg.error ?? pg.result?.messages?.[0]?.content?.text?.slice(0, 200)); + +const themes = (await call("list_themes", {})).data; +check("list_themes returns 20", themes.length === 20, themes.length); +const crypt = themes.find((t) => t.key === "CRYPT"); +check("CRYPT sprites all present", crypt.sprites.status === "all", crypt.sprites); +check("every theme reports sprite status", themes.every((t) => ["all", "partial", "none"].includes(t.sprites.status))); + +// Presets: minimum sizes enforced +const small = (await call("create_map", { name: "small", width: 20, height: 14, theme: "CRYPT" })).data; +const tooSmall = await call("generate_crypt_layout", { mapId: small.mapId }); +check("crypt preset rejects 20x14 with a clear error", tooSmall.isError && /at least 27x18/.test(tooSmall.data), tooSmall); + +const results = {}; +for (const [preset, theme, w, h, extra] of [ + ["generate_crypt_layout", "CRYPT", 27, 18, {}], + ["generate_castle_floor", "CASTLE", 27, 20, { floorVariant: "throne" }], + ["generate_werewolf_den", "WEREWOLF_DEN", 22, 16, {}], +]) { + const m = (await call("create_map", { name: `${preset} test`, width: w, height: h, theme })).data; + const r = await call(preset, { mapId: m.mapId, ...extra }); + check(`${preset} at minimum size`, !r.isError && r.data.ok, r.data); + const v = (await call("validate_map", { mapId: m.mapId })).data; + check(`${preset} validates with no warnings`, v.ok && v.warnings.length === 0, v); + results[preset] = m.mapId; +} + +// Object placement rules on the crypt map +const cm = results.generate_crypt_layout; +const onWall = await call("place_chest", { mapId: cm, x: 8, y: 6 }); +check("chest on a wall is rejected", onWall.isError && /wall/.test(onWall.data), onWall); +const onObstacle = await call("place_chest", { mapId: cm, x: 9, y: 7 }); +check("chest on an obstacle prop is rejected", onObstacle.isError && /obstacle/.test(onObstacle.data), onObstacle); +const ok1 = await call("place_chest", { mapId: cm, x: 12, y: 8, locked: true, pickDC: 15 }); +check("chest on floor accepted", !ok1.isError && ok1.data.ok, ok1); +const dup = await call("place_spawn_enemy", { mapId: cm, x: 12, y: 8, npcName: "Ghoul" }); +check("spawn on occupied cell rejected", dup.isError && /occupied/.test(dup.data), dup); +const enemy = await call("place_spawn_enemy", { mapId: cm, x: 13, y: 8, npcName: "Ghoul" }); +check("enemy spawn accepted", !enemy.isError, enemy); +const info = (await call("get_tile_info", { mapId: cm, layer: "ground", x: 12, y: 8 })).data; +check("get_tile_info reports occupant", info.occupiedBy?.type === "chest", info); +const oob = await call("paint_rect", { mapId: cm, layer: "ground", x1: 0, y1: 0, x2: 40, y2: 2, role: "walkable_floor" }); +check("paint_rect out of grid rejected", oob.isError && /outside/.test(oob.data), oob); +const bogus = await call("describe_map", { mapId: "nope" }); +check("unknown mapId gives a tool error", bogus.isError && /Unknown mapId/.test(bogus.data), bogus); + +// Coordinates written to the file +const exp = (await call("export_json", { mapId: cm })).data; +const objs = exp.layers.find((l) => l.name === "objects").objects; +const spawns = exp.layers.find((l) => l.name === "spawns").objects; +const chest = objs.find((o) => o.type === "chest"); +const ghoul = spawns.find((o) => o.properties.some((p) => p.value === "Ghoul")); +if (mode === "screen") { + check("screen mode chest position", chest.x === 32 * (12 - 8) && chest.y === 16 * (12 + 8), chest); + check("screen mode spawn position", ghoul.x === 32 * (13 - 8) && ghoul.y === 16 * (13 + 8) && !ghoul.point, ghoul); +} else { + check("tiled mode chest at col*th,row*th size th", chest.x === 12 * 32 && chest.y === 8 * 32 && chest.width === 32 && chest.height === 32, chest); + check("tiled mode spawn is a centred point", ghoul.point === true && ghoul.x === 13.5 * 32 && ghoul.y === 8.5 * 32, ghoul); +} +check("export keeps ./assets paths", exp.tilesets[0].tiles[0].image.startsWith("./assets/crypt/"), exp.tilesets[0].tiles[0].image); + +// Save to disk +const badExt = await call("save_to_disk", { mapId: cm, path: "crypt.txt" }); +check("save_to_disk rejects non-.tmj", badExt.isError, badExt); +const saved = (await call("save_to_disk", { mapId: cm, path: "nested/smoke-crypt.tmj" })).data; +check("save_to_disk relative path lands in maps dir", saved.ok && resolve(saved.path) === resolve(outDir, "nested/smoke-crypt.tmj"), saved); +const file = JSON.parse(readFileSync(saved.path, "utf8")); +const missing = file.tilesets[0].tiles.filter((t) => !existsSync(resolve(dirname(saved.path), t.image))); +check("saved sprite paths resolve from the file location", missing.length === 0, missing.map((t) => t.image)); + +// Paid tools without credentials +const gen = await call("generate_tile_sprite", { theme: "AQUATIC", role: "wall" }); +check("sprite generation without token: clean message, no network", gen.data.ok === false && /HUGGINGFACE_API_KEY/.test(gen.data.error), gen); +const prev = await call("preview_sprite_prompt", { theme: "VOLCAN", role: "wall" }); +check("prompt preview works for a newer theme", prev.data.ok && /magenta/.test(prev.data.prompt), prev); +const ovr = (await call("override_tile_image", { mapId: cm, role: "obstacle_decor", variant: "alembic" })).data; +check("override to a missing variant warns", ovr.ok && /No file/.test(ovr.warning ?? ""), ovr); + +// Orthogonal map +const om = (await call("create_map", { name: "ortho", width: 10, height: 8, theme: "TAVERN_BLOOD_PRINCE", orientation: "orthogonal" })).data; +await call("generate_room", { mapId: om.mapId, originX: 0, originY: 0, width: 10, height: 8, exits: [{ direction: "south", offset: 3 }] }); +await call("place_spawn_player", { mapId: om.mapId, x: 2, y: 2 }); +const oexp = (await call("export_json", { mapId: om.mapId })).data; +const ps = oexp.layers.find((l) => l.name === "spawns").objects[0]; +const door = oexp.layers.find((l) => l.name === "objects").objects[0]; +check("orthogonal spawn point at tile centre", ps.point && ps.x === 2.5 * 64 && ps.y === 2.5 * 32, ps); +check("orthogonal door rect", door.x === 3 * 64 && door.y === 7 * 32 && door.width === 64, door); +const 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(); +rmSync(outDir, { recursive: true, force: true }); +process.exit(fail ? 1 : 0); diff --git a/skills/map-builder/SKILL.md b/skills/map-builder/SKILL.md new file mode 100644 index 0000000000000000000000000000000000000000..0ec6c3a45a01da30fc53228d6da883bd47e6109e --- /dev/null +++ b/skills/map-builder/SKILL.md @@ -0,0 +1,232 @@ +--- +name: map-builder +description: Design and build an isometric Tiled map (.tmj) for a tabletop or game dungeon zone with the tiled-map-builder MCP server. Use when the user types /map-builder, asks to compose, draw or generate a dungeon, crypt, castle, cave, tavern, village or other battle map, or wants an ASCII sketch turned into a Tiled map. Picks a theme, sketches the layout for confirmation, builds rooms, corridors, objects and spawns, validates, and saves the file. +--- + +# Map Builder + +Turn a free-form description of a dungeon zone into a tactically coherent, atmospheric +isometric Tiled map, using the **tiled-map-builder** MCP server for every edit. This skill +decides *which* layout, theme, traps and spawns to use and *where*; the server does the editing, +validation and file output. + +Reply in the user's language. Map, room and creature names follow the user's language too. + +## Requirements + +- The `tiled-map-builder` MCP server is connected (see the repository's `docs/client-setup.md`). + In Claude Code its tools appear as `mcp__tiled-map-builder__`; the prefix follows the + server name chosen in the client configuration. +- If the tools are missing: run `npm install && npm run build` at the repository root, then + restart the MCP client. +- Clients without Agent Skills support can load this same workflow through the server's + `map_builder` prompt. +- No local install: the hosted server at `https://4math-tiled-map-builder.hf.space/mcp` has the + same tools (send `Authorization: Bearer `). There, `save_to_disk` + returns a download link instead of writing a file: give that link to the user. + +## When to use + +- The user types `/map-builder ` or `/map-builder` alone. +- The user asks to build, compose or draw a map for a zone, encounter or scene. +- The user provides an ASCII mock-up and wants it as a `.tmj` file. + +Do not use it to edit a map that only exists as a file on disk: the server keeps maps in memory +and cannot load `.tmj` files. Suggest the Tiled editor for that. + +## Accepted input + +Free form: + +``` +/map-builder crypt 28x18 under an abandoned chapel, two skeletons patrol the nave, a ghoul lord sleeps in the deep crypt +``` + +Structured (recommended for complex maps): + +``` +/map-builder + theme: CRYPT + size: 28x18 + layout: crypt + encounters: + - npc: skeleton | position: nave | count: 2 + - npc: ghoul lord | position: deep + hazards: poison vents x2 + output: crypt-chapel.tmj +``` + +## Procedure + +### Step 1: understand the request + +- **Theme**: infer it from the vocabulary (table below). When unsure, call `list_themes` and + propose two options. +- **Size**: default 20x15 for a custom layout, minimum 12x10, maximum 64x64. Presets need at + least: crypt 27x18, castle 27x20, werewolf den 22x16. +- **Mood**: combat means an open map, infiltration means narrow corridors, a narrative scene + means a small map with NPCs. +- **Encounters**: every creature named becomes an enemy spawn (`npcName`, and `encounterId` + when the user gives one). +- **Boss**: "finale" or "boss" means a large room at the far end with a single way in. +- **Output**: a `.tmj` file name. + +| Vocabulary | Theme | +|---|---| +| crypt, chapel, ossuary | `CRYPT` | +| castle, throne room, keep | `CASTLE` | +| cave, den, lair, beasts | `WEREWOLF_DEN` | +| inn, tavern, interior | `TAVERN_BLOOD_PRINCE` | +| village, square, market, street | `VILLAGE` | +| haunted forest, undergrowth, clearing | `HAUNTED_FOREST` or `FORET` | +| mausoleum, tomb, statues | `MAUSOLEUM` | +| blood ritual, altar, sanctuary | `BLOOD_TOMB` | +| swamp, stagnant water, sunken ruins | `AQUATIC` | +| flooded city, drowned district | `INONDE` | +| ice, frozen fortress, tundra | `GLACIAIRE` or `HIVER` | +| volcano, lava, ash | `VOLCAN` | +| seasons: spring, summer, autumn | `PRINTEMPS`, `ETE`, `AUTOMNE` | +| wasteland, ruins after a cataclysm | `DESOLATION` | +| futuristic city, laboratory, neon | `FUTURISTE` | +| digital network, servers, hacker | `ELECTRONIQUE` | + +### Step 2: reference material (optional) + +If the user provides lore, an adventure module or a reference map, use it for atmosphere, +room purposes and creature choice. Paraphrase it. Never reproduce a published map layout or +text verbatim; the layout presets are original arrangements and can be reshaped freely. + +### Step 3: sketch the layout and confirm + +Always draw an ASCII sketch before calling any editing tool, and ask the user to confirm or +adjust it. + +``` + 0 1 2 3 4 5 6 7 8 9 ... +0 # # # # # # # # # # # # # # # # # # # # # # # # +1 # . . . . # # . . . . . # # . . . . . . . . # +2 # . P . . D . . . . . . . . . . . H . . . . # +3 # . . . . # # . . . . . D . . . . . . . . . # +4 # # # # # # # . . . . . # # . . . . . . . . # + ^ corridor ^ deep crypt +``` + +Legend: `#` wall, `.` floor, `P` player spawn, `D` door, `H` hazard, `E` enemy, `B` boss, +`C` chest, `T` trap, `N` friendly NPC. `x` is the column, `y` the row, (0,0) top left. + +### Step 4: check sprites (free) and variants (paid, optional) + +1. `list_themes` reports `sprites.status` per theme: `all`, `partial` or `none`. Missing + sprites never break a map; Tiled shows placeholders until the PNGs exist. +2. If sprites are missing and the user wants them, explain that generation is **paid** + (one Hugging Face call per sprite, 20-40 s each), preview the prompt with + `preview_sprite_prompt`, and only call `generate_tile_sprite` after the user agrees. + For a whole theme, recommend the script `node scripts/gen-theme-set.mjs --yes`. +3. Never regenerate an existing sprite unless the user asks (`force: true`). + +Contextual variants give one map a special prop, for example a laboratory in a castle where the +default `obstacle_decor` is a throne: + +1. Pick a short slug matching `[a-z0-9_]+`: `alembic`, `bookshelf`, `cauldron`, `iron_cage`, `altar`, `anvil`. +2. If `__.png` does not exist yet and the user accepts the cost: + `generate_tile_sprite(theme="CASTLE", role="obstacle_decor", variant="alembic", material="alchemical workbench with brass alembics and dusty tomes")`. +3. After `create_map`, bind it: `override_tile_image(mapId, role="obstacle_decor", variant="alembic")`. + +| The description mentions | Variant ideas | +|---|---| +| laboratory, alchemy | `obstacle_decor=alembic`, `decoration_minor=scattered_tomes` | +| library, archives | `obstacle_decor=bookshelf` | +| kitchen, banquet | `obstacle_decor=banquet_table` | +| cell, dungeon, oubliette | `obstacle_decor=iron_cage`, `door_closed=barred_grate` | +| chapel, altar | `obstacle_decor=altar`, `decoration_minor=prayer_book` | +| workshop, forge | `obstacle_decor=anvil`, `decoration_minor=hammer_tongs` | + +Use at most 2 variants per map, and none when the description has no strong context. + +### Step 5: build the map + +```text +1. list_themes sanity check, sprite availability +2. create_map(name, width, height, theme) -> mapId +3. Layout, either: + - a preset: generate_crypt_layout / generate_castle_floor / generate_werewolf_den + - or custom: generate_room x N (exits open doorways with doors) + generate_corridor x M, + then paint_rect / paint_tile for floors, hazards and props +4. Objects: place_door, place_chest, place_trap, place_lever, place_stairs_object +5. Spawns: place_spawn_player (at least one, at the entrance), place_spawn_enemy, place_spawn_npc +6. validate_map: fix every warning +7. save_to_disk(".tmj") +``` + +Placement rules the server enforces (a failing call explains why): + +- Chests, traps, levers, zone stairs and spawns need a painted ground cell with no wall, no + obstacle prop and no other object or spawn. Walls sit on their own layer above the ground, + so check with `get_tile_info(layer="walls")` when unsure. +- Doors go in wall openings. `generate_room` exits do this for you; for a custom doorway, call + `erase_tile(layer="walls")` first. +- Corridors are straight; chain two corridors for an L shape. + +### Step 6: report + +```markdown +# Map "" ready + +- **mapId**: +- **Theme**: **Size**: x **Layout**: +- **Spawns**: player, enemy, NPC +- **Objects**: doors, chests, traps, stairs +- **Validation**: ok (warnings: ) +- **Output**: maps/.tmj + +## Finishing suggestions +- +``` + +## Design heuristics + +### Atmosphere by theme + +- **CRYPT**: 1-2 poison vents (`hazard_primary`) in side chambers; sarcophagi as obstacles. +- **CASTLE**: great hall in the middle, throne room at the far end, locked + antechamber door (pick DC 18). No hazards in the hall: the threat comes from its inhabitants. +- **BLOOD_TOMB**: bleeding runes (`hazard_primary`) in a ring around a central altar: a visible + but costly obstacle. +- **WEREWOLF_DEN**: an alpha lair with boulders in the corners and bone piles + (`difficult_terrain`), several scattered enemy spawns, no locked doors (caves). +- **HAUNTED_FOREST / FORET**: no full perimeter walls (open forest); use `obstacle_decor` + (boulders, standing stones) to create chokepoints; parasitic mist (HAUNTED_FOREST) or + quicksand (FORET) as hazards in damp areas. +- **MAUSOLEUM**: fallen-angel statues as obstacles, several small alcoves, no hazards + (the theme has none: the mood is contemplative). +- **AQUATIC / INONDE**: deep water or currents as `hazard_primary`, stepping paths of floor tiles. +- **GLACIAIRE / HIVER**: cracked ice or slush (`difficult_terrain`) slows movement, thin ice is + the hazard; open frozen halls. +- **VOLCAN**: lava flows as hazards with narrow bridges of floor tiles. +- **TAVERN_BLOOD_PRINCE / VILLAGE**: social scenes; tables or the well as obstacles, + friendly NPC spawns, few or no traps. + +### Tactics + +- **Chokepoint**: a 1-cell corridor before the boss room isolates the fight. +- **Open arena**: at least 8x8 with pillars (`obstacle_decor` in a checkerboard), good against + flying enemies. +- **Gothic sightline**: a corridor of 5+ cells with a hazard at the end builds tension. +- **Fair spawns**: never place an enemy spawn within 4 cells of a player spawn. +- **Restraint**: 1-2 well placed hazards beat 10 scattered ones. + +### Rules values + +- `trapNotation` and hazard damage use dice notation: `2d6`, `1d8+2`. +- `trapSaveDC` and `pickDC` range 5-30: 12-15 for levels 3-5, 16-18 for levels 6-10. + +## Do not + +- Skip the ASCII sketch confirmation. +- 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. diff --git a/tiled-mcp/.env.example b/tiled-mcp/.env.example new file mode 100644 index 0000000000000000000000000000000000000000..a32598bd82b548926bc7370d73ae33022a21ae95 --- /dev/null +++ b/tiled-mcp/.env.example @@ -0,0 +1,20 @@ +# Optional settings for the Tiled Map Builder MCP server. +# Copy this file to tiled-mcp/.env and uncomment what you need. Nothing here is required to +# build maps. Variables already set by your MCP client's "env" block take precedence. +# Relative paths resolve against the repository root. See docs/configuration.md. + +# Where save_to_disk writes relative paths (default: /maps) +# TILED_MAPS_DIR=maps + +# Sprite folder holding /.png (default: /assets) +# TILED_ASSETS_DIR=assets + +# Object coordinates: "tiled" (default, Tiled's native encoding) or "screen" (legacy importers) +# TILED_OBJECT_COORDS=tiled + +# --- 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). diff --git a/tiled-mcp/.gitignore b/tiled-mcp/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..bd22d1f98e29b4209fb9b25cdd3b8d5cea7171b7 --- /dev/null +++ b/tiled-mcp/.gitignore @@ -0,0 +1,5 @@ +node_modules/ +dist/ +*.tsbuildinfo +.env +.env.local diff --git a/tiled-mcp/README.md b/tiled-mcp/README.md new file mode 100644 index 0000000000000000000000000000000000000000..32e848ee1b2fa93d9552900c9f49782a808ba844 --- /dev/null +++ b/tiled-mcp/README.md @@ -0,0 +1,55 @@ +# tiled-map-builder-mcp + +The MCP server package of [Tiled Map Builder MCP](../README.md): a stdio Model Context Protocol +server that composes isometric [Tiled](https://www.mapeditor.org) maps in memory and saves them +as `.tmj` files. The same package has a hosted mode (`dist/http.js`): a web page with an AI +agent and the MCP tools over HTTP, as run on Hugging Face ([docs/hugging-face.md](../docs/hugging-face.md)). + +It runs from inside the repository, because it reads sprites from `../assets`, the skill from +`../skills` and writes maps to `../maps` by default. It is not published to npm. + +## Build and run + +From the repository root: + +```bash +npm install +npm run build # tsc: src/ -> dist/ +npm run smoke # 38 offline end-to-end checks (stdio) +npm run smoke:http # offline checks of the hosted mode +npm run start:web # hosted mode on http://127.0.0.1:7860 +``` + +The client command is `node /tiled-mcp/dist/index.js`. See +[docs/client-setup.md](../docs/client-setup.md). + +## Source layout + +| File | Role | +|---|---| +| `src/index.ts` | Entry point (stdio): loads `.env`, connects one server to stdin/stdout | +| `src/server.ts` | Builds a server instance with every tool and the prompt | +| `src/http.ts` | Entry point (hosted): web page, `/api/generate`, MCP over HTTP at `/mcp`, Hugging Face sign-in, downloads | +| `src/agent.ts` | Web agent: an Inference Providers model drives the tools in-process with the visitor's token | +| `src/context.ts` | Per-session workspace (maps, sprites) and per-request token in hosted mode | +| `src/downloads.ts` | Tiled-ready `.zip` and `.tmj` download links (hosted mode) | +| `src/render.ts` | PNG preview renderer, shared with `scripts/render-map-preview.mjs` | +| `src/sprites.ts` | Reads and stores sprites: assets folder locally, session memory when hosted | +| `src/sharp.ts` | Lazy loader for the sharp image library | +| `src/builder.ts` | In-memory map model: layers, painting, objects, spawns, occupancy, serialization, object coordinates | +| `src/tmj.ts` | Writes `.tmj` files with sprite paths relative to the file | +| `src/paths.ts` | Repository paths, configurable folders, WSL path translation | +| `src/env.ts` | Minimal `.env` loader | +| `src/prompts.ts` | `map_builder` prompt that serves `skills/map-builder/SKILL.md` | +| `src/types.ts` | Tiled JSON types, tile roles, theme types | +| `src/tools/lifecycle.ts` | `list_themes`, `create_map`, `list_maps`, `describe_map`, `discard_map` | +| `src/tools/paint.ts` | `paint_tile`, `paint_rect`, `paint_wall_border`, `erase_tile`, `get_tile_info` | +| `src/tools/procedural.ts` | `generate_room`, `generate_corridor` | +| `src/tools/layout-presets.ts` | `generate_crypt_layout`, `generate_castle_floor`, `generate_werewolf_den` | +| `src/tools/objects.ts` | `place_door`, `place_chest`, `place_stairs_object`, `place_trap`, `place_lever`, `place_spawn_*` | +| `src/tools/export.ts` | `validate_map`, `export_json`, `save_to_disk` | +| `src/tools/generation.ts` | Sprite tools: `preview_sprite_prompt`, `generate_tile_sprite`, `generate_theme_sprite_set`, `override_tile_image` | +| `src/themes/*.ts` | One file per theme, registry in `index.ts`, FLUX prompt catalog in `prompts.ts` | +| `web/` | The hosted web page: `index.html`, `app.js`, `style.css` | + +Tool reference: [docs/tools.md](../docs/tools.md). Map format: [docs/map-format.md](../docs/map-format.md). diff --git a/tiled-mcp/package.json b/tiled-mcp/package.json new file mode 100644 index 0000000000000000000000000000000000000000..b99eaa82fe47cb414593eeecdb0f24925a18dd20 --- /dev/null +++ b/tiled-mcp/package.json @@ -0,0 +1,52 @@ +{ + "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": [ + "mcp", + "model-context-protocol", + "tiled", + "tilemap", + "isometric", + "map-generator", + "procedural-generation", + "ttrpg", + "ai-agents" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/4math2379/Tiled-MCP-Server.git", + "directory": "tiled-mcp" + }, + "type": "module", + "main": "dist/index.js", + "bin": { + "tiled-map-builder-mcp": "dist/index.js", + "tiled-map-builder-web": "dist/http.js" + }, + "files": [ + "dist", + "web" + ], + "scripts": { + "build": "tsc", + "start": "node dist/index.js", + "start:web": "node dist/http.js", + "dev": "tsc --watch" + }, + "dependencies": { + "@huggingface/inference": "^4.13.15", + "@modelcontextprotocol/sdk": "^1.23.0", + "fflate": "^0.8.2", + "sharp": "^0.35.5", + "zod": "^4.6.7" + }, + "devDependencies": { + "@types/node": "^20.11.0", + "typescript": "^5.4.0" + }, + "engines": { + "node": ">=20.9" + } +} diff --git a/tiled-mcp/src/agent.ts b/tiled-mcp/src/agent.ts new file mode 100644 index 0000000000000000000000000000000000000000..0b633f56a1b568cd43aa43197ba981c268704fde --- /dev/null +++ b/tiled-mcp/src/agent.ts @@ -0,0 +1,309 @@ +// "Describe a map" agent behind the hosted web page. An open model on Hugging Face Inference +// Providers drives this server's own MCP tools (through an in-process MCP client), guided by the +// map-builder skill, until the map is built and valid. Every model call is made with the +// visitor's own token, so it is billed to their Hugging Face account, never to the host. + +import { 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"; +import { readSprite } from "./sprites.js"; +import { ASSET_PREFIX } from "./tmj.js"; + +export const DEFAULT_MODEL = process.env.TILED_AGENT_MODEL || "openai/gpt-oss-120b"; + +/** Open models served with tool calling on Hugging Face Inference Providers (checked 2026-11). */ +export const SUGGESTED_MODELS = [ + { id: "openai/gpt-oss-120b", label: "gpt-oss-120b: fast and cheap" }, + { id: "deepseek-ai/DeepSeek-V4.1-Flash", label: "DeepSeek V4.1 Flash" }, + { id: "zai-org/GLM-5.3-Flash", label: "GLM 5.3 Flash" }, + { id: "Qwen/Qwen3.8-27B", label: "Qwen 3.8 27B" }, + { id: "moonshotai/Kimi-K2.6", label: "Kimi K2.6: stronger, pricier" }, +]; + +/** A model id as accepted by the router, with an optional ":provider" or ":policy" suffix. */ +export const MODEL_ID = /^[\w.-]+\/[\w.-]+(:[\w.-]+)?$/; + +const MAX_MODEL_CALLS = 40; +const MAX_TOOL_CALLS = 160; +const 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"]); + +/** A failure whose message is meant for the visitor. */ +export class AgentError extends Error {} + +export interface AgentRequest { + description: string; + theme?: string; + model?: string; + allowPaidSprites?: boolean; +} + +export type AgentEvent = + | { type: "status"; message: string } + | { type: "note"; text: string } + | { type: "tool"; name: string; args: unknown; ok: boolean; result: string } + | { + type: "done"; + map: MapSummary; + report: string; + warnings: string[]; + previewPng: string; + zipUrl: string; + tmjUrl: string; + expiresAt: string; + model: string; + usage: { modelCalls: number; toolCalls: number; promptTokens: number; completionTokens: number }; + }; + +export interface AgentContext { + token: string; + baseUrl: string; + signal: AbortSignal; + emit: (event: AgentEvent) => void; +} + +interface ToolCall { + id: string; + type: "function"; + function: { name: string; arguments: string }; +} + +interface ChatMessage { + role: "system" | "user" | "assistant" | "tool"; + content: string; + tool_calls?: ToolCall[]; + tool_call_id?: string; +} + +interface ChatReply { + choices?: Array<{ message?: { content?: string | null; tool_calls?: Array> } }>; + usage?: { prompt_tokens?: number; completion_tokens?: number }; +} + +function inferenceBase(): string { + return (process.env.TILED_INFERENCE_URL || "https://router.huggingface.co/v1").replace(/\/+$/, ""); +} + +/** Build one map from a description in a fresh workspace, streaming progress through ctx.emit. */ +export async function runMapAgent(req: AgentRequest, ctx: AgentContext): Promise { + await runInScope({ workspace: newWorkspace(), hfToken: ctx.token, baseUrl: ctx.baseUrl }, () => agentLoop(req, ctx)); +} + +async function agentLoop(req: AgentRequest, ctx: AgentContext): Promise { + const model = req.model || DEFAULT_MODEL; + const server = createServer(); + const client = new Client({ name: "tiled-web-agent", version: SERVER_VERSION }); + const [clientSide, serverSide] = InMemoryTransport.createLinkedPair(); + await server.connect(serverSide); + await client.connect(clientSide); + + try { + const { tools } = await client.listTools(); + const offered = tools.filter((t) => !HIDDEN_TOOLS.has(t.name) && (req.allowPaidSprites || !PAID_TOOLS.has(t.name))); + const offeredNames = new Set(offered.map((t) => t.name)); + const toolDefs = offered.map((t) => { + const { $schema: _ignored, ...parameters } = t.inputSchema as Record; + return { type: "function", function: { name: t.name, description: t.description ?? t.title ?? t.name, parameters } }; + }); + + let skill: string; + try { + skill = (await readFile(skillFile(), "utf8")).replace(/^---[\s\S]*?---\s*/, ""); + } catch { + skill = ""; + } + const messages: ChatMessage[] = [ + { role: "system", content: systemPrompt(skill, !!req.allowPaidSprites) }, + { role: "user", content: `Map request: ${req.description}${req.theme ? `\nUse the theme ${req.theme}.` : ""}` }, + ]; + + const usage = { modelCalls: 0, toolCalls: 0, promptTokens: 0, completionTokens: 0 }; + let report = ""; + ctx.emit({ type: "status", message: `${model} is planning the map...` }); + + while (usage.modelCalls < MAX_MODEL_CALLS) { + const reply = await chat( + ctx, + { model, messages, tools: toolDefs, tool_choice: "auto", temperature: 0.2, max_tokens: 4096 }, + ); + usage.modelCalls++; + usage.promptTokens += reply.usage?.prompt_tokens ?? 0; + usage.completionTokens += reply.usage?.completion_tokens ?? 0; + + const msg = reply.choices?.[0]?.message; + if (!msg) throw new AgentError(`${model} returned an empty answer. Try again or pick another model.`); + const calls: ToolCall[] = (msg.tool_calls ?? []).map((c, i) => ({ + id: c.id || `call_${usage.modelCalls}_${i}`, + type: "function", + function: { name: c.function?.name ?? "", arguments: c.function?.arguments ?? "{}" }, + })); + const content = (msg.content ?? "").trim(); + if (!calls.length) { + report = content; + break; + } + if (content) ctx.emit({ type: "note", text: content }); + messages.push({ role: "assistant", content, tool_calls: calls }); + + for (const call of calls) { + usage.toolCalls++; + const { name } = call.function; + let args: unknown = {}; + let ok = false; + let output: string; + if (usage.toolCalls > MAX_TOOL_CALLS) { + output = "Tool call limit reached: stop calling tools and write the final report now."; + } else if (!offeredNames.has(name)) { + output = `The tool '${name}' is not available here.`; + } else { + try { + args = call.function.arguments.trim() ? JSON.parse(call.function.arguments) : {}; + const result = await client.callTool({ name, arguments: args as Record }); + ok = !result.isError; + output = resultText(result.content); + } catch (err) { + output = err instanceof SyntaxError + ? `The arguments are not valid JSON (${err.message}). Send a JSON object.` + : err instanceof Error ? err.message : String(err); + } + } + ctx.emit({ type: "tool", name, args, ok, result: output.length > 400 ? `${output.slice(0, 400)}...` : output }); + messages.push({ + role: "tool", + tool_call_id: call.id, + content: output.length > TOOL_RESULT_CHARS ? `${output.slice(0, TOOL_RESULT_CHARS)}\n[truncated]` : output, + }); + } + } + + 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)}` : ""}`, + ); + } + ctx.emit({ type: "status", message: "Rendering the preview and packing the download..." }); + const 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, + expiresAt: links.expiresAt, + model, + usage, + }); + } finally { + await client.close().catch(() => {}); + await server.close().catch(() => {}); + } +} + +function systemPrompt(skill: string, allowPaid: boolean): string { + return [ + "You build isometric Tiled maps with the tiled-map-builder tools for a person using a web page.", + "", + "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.', + allowPaid + ? "- The person allowed paid sprite generation (billed to them). Use generate_tile_sprite only for at most 2 contextual variants that clearly fit the description, then bind them with override_tile_image." + : "- Sprite generation is not available: use the sprites every theme already ships.", + `- You have at most ${MAX_TOOL_CALLS} tool calls. Prefer layout presets, generate_room and generate_corridor over painting cells one by one.`, + "- When the map is valid, reply with a short report in the person's language: name, theme, size, layout, spawns, objects, validation result. Leave out the mapId and file paths.", + "", + "Skill:", + "", + skill, + ].join("\n"); +} + +function resultText(content: unknown): string { + if (!Array.isArray(content)) return ""; + return content + .map((c: { type?: string; text?: string }) => (c.type === "text" ? (c.text ?? "") : `[${c.type ?? "content"}]`)) + .join("\n"); +} + +async function chat(ctx: AgentContext, body: Record): Promise { + const delays = [2000, 6000]; + for (let attempt = 0; ; attempt++) { + let res: Response; + try { + res = await fetch(`${inferenceBase()}/chat/completions`, { + method: "POST", + headers: { Authorization: `Bearer ${ctx.token}`, "Content-Type": "application/json" }, + body: JSON.stringify(body), + signal: ctx.signal, + }); + } catch (err) { + if (ctx.signal.aborted) throw new AgentError("The job was stopped."); + throw new AgentError(`Could not reach Hugging Face Inference Providers: ${err instanceof Error ? err.message : String(err)}`); + } + const text = await res.text(); + if (res.ok) { + try { + return JSON.parse(text) as ChatReply; + } catch { + throw new AgentError("The inference service sent an unreadable answer. Try again."); + } + } + const retryable = res.status === 429 || res.status >= 500; + if (retryable && attempt < delays.length && !ctx.signal.aborted) { + await new Promise((r) => setTimeout(r, delays[attempt])); + continue; + } + throw new AgentError(explainHttpError(res.status, text, String(body.model))); + } +} + +function explainHttpError(status: number, text: string, model: string): string { + let detail = text; + try { + const j = JSON.parse(text) as { error?: string | { message?: string }; message?: string }; + detail = (typeof j.error === "string" ? j.error : j.error?.message) ?? j.message ?? text; + } catch { + // keep the raw text + } + detail = String(detail).slice(0, 400); + switch (status) { + case 401: + return "Hugging Face rejected your token. Sign in again, or use an access token that can make calls to Inference Providers."; + case 402: + return "Your Hugging Face account has no inference credits left. Add credits or a payment method in your Hugging Face billing settings, then try again."; + case 403: + return `Your token may not call Inference Providers (${detail}). Sign in again and accept the inference permission, or create a token with the "Make calls to Inference Providers" permission.`; + case 429: + return "Hugging Face is rate limiting your requests. Wait a minute and try again."; + case 400: + case 404: + case 422: + return `${model} could not run this request: ${detail}. Try another model.`; + default: + return `The inference service answered ${status}: ${detail}`; + } +} diff --git a/tiled-mcp/src/builder.ts b/tiled-mcp/src/builder.ts new file mode 100644 index 0000000000000000000000000000000000000000..d2c9b4eda345652eda6be86788383877b0508de3 --- /dev/null +++ b/tiled-mcp/src/builder.ts @@ -0,0 +1,590 @@ +// In-memory Tiled map builder. Each MapId is one map being composed during this server +// session. Maps are not persisted between restarts: call save_to_disk or export_json. +// The builder owns the tileset GIDs, the three tile layers and the two object groups. +// Maps live in the caller's workspace (src/context.ts): one per MCP session in hosted mode. + +import { randomUUID } from "node:crypto"; +import { currentScope, isHosted } from "./context.js"; +import type { + Theme, + ThemeRole, + TiledMap, + TiledObject, + TiledObjectGroup, + TiledProperty, + TiledTileLayer, + TiledTileset, + TiledTilesetTile, + ObjectKind, + ObjectState, + SpawnRole, +} from "./types.js"; + +export type MapId = string; + +export const MAX_MAP_SIZE = 64; + +export interface Occupant { + name: string; + type: string; +} + +export interface BuilderState { + id: MapId; + name: string; + width: number; + height: number; + tilewidth: number; + tileheight: number; + orientation: "isometric" | "orthogonal"; + theme: Theme; + tileset: TiledTileset; + // role -> gid, resolved once at creation + roleToGid: Map; + ground: TiledTileLayer; + walls: TiledTileLayer; + decorations: TiledTileLayer; + objects: TiledObjectGroup; + spawns: TiledObjectGroup; + // "x,y" -> object or spawn standing on that cell + occupied: Map; + nextObjectId: number; + createdAt: number; +} + +/** Maps of the current caller's workspace. */ +function maps(): Map { + return currentScope().workspace.maps; +} + +/** In hosted mode, how many maps one session may hold, so one caller cannot fill the shared memory. */ +export const MAX_HOSTED_MAPS = 20; + +const TILED_VERSION = "1.10.2"; +const FORMAT_VERSION = "1.10"; + +export interface CreateOptions { + name: string; + width: number; + height: number; + theme: Theme; + orientation?: "isometric" | "orthogonal"; +} + +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( + `This session already holds ${MAX_HOSTED_MAPS} maps, the limit on the hosted server: discard_map the ones you no longer need.`, + ); + } + + const id = randomUUID(); + const orientation = opts.orientation ?? "isometric"; + const theme = opts.theme; + const firstgid = 1; + + const usesImages = theme.tiles.some((t) => t.imageFile); + + const tiles: TiledTilesetTile[] = theme.tiles.map((t, idx) => { + const props: TiledProperty[] = [{ name: "tileType", value: t.tileType, type: "string" }]; + if (t.spriteId) props.push({ name: "spriteId", value: t.spriteId, type: "string" }); + if (t.tileType === "HAZARD") { + if (t.hazardType) props.push({ name: "hazardType", value: t.hazardType, type: "string" }); + if (t.hazardNotation) { + props.push({ name: "hazardNotation", value: t.hazardNotation, type: "string" }); + } + } + const tile: TiledTilesetTile = { id: idx, properties: props }; + if (t.imageFile) { + tile.image = t.imageFile; + tile.imagewidth = t.imageWidth ?? theme.tilewidth; + tile.imageheight = t.imageHeight ?? theme.tileheight; + } + return tile; + }); + + const tileset: TiledTileset = { + firstgid, + name: theme.tilesetName, + tilewidth: theme.tilewidth, + tileheight: theme.tileheight, + tilecount: tiles.length, + columns: usesImages ? 0 : Math.max(1, Math.min(tiles.length, 8)), + tiles, + }; + if (usesImages) { + tileset.grid = { orientation, width: theme.tilewidth, height: theme.tileheight }; + } + + const roleToGid = new Map(); + theme.tiles.forEach((t, idx) => { + if (!roleToGid.has(t.role)) roleToGid.set(t.role, firstgid + idx); + }); + + const emptyData = (): number[] => new Array(opts.width * opts.height).fill(0); + + const mkTileLayer = (layerId: number, name: string): TiledTileLayer => ({ + id: layerId, + name, + type: "tilelayer", + visible: true, + width: opts.width, + height: opts.height, + data: emptyData(), + opacity: 1, + x: 0, + y: 0, + }); + const mkObjectGroup = (layerId: number, name: string): TiledObjectGroup => ({ + id: layerId, + name, + type: "objectgroup", + visible: true, + objects: [], + opacity: 1, + x: 0, + y: 0, + draworder: "topdown", + }); + + const state: BuilderState = { + id, + name: opts.name, + width: opts.width, + height: opts.height, + tilewidth: theme.tilewidth, + tileheight: theme.tileheight, + orientation, + theme, + tileset, + roleToGid, + ground: mkTileLayer(1, "ground"), + walls: mkTileLayer(2, "walls"), + decorations: mkTileLayer(3, "decorations"), + objects: mkObjectGroup(4, "objects"), + spawns: mkObjectGroup(5, "spawns"), + occupied: new Map(), + nextObjectId: 1, + createdAt: Date.now(), + }; + + maps().set(id, state); + return { mapId: id, summary: summarize(state) }; +} + +export interface MapSummary { + mapId: MapId; + name: string; + width: number; + height: number; + orientation: "isometric" | "orthogonal"; + theme: string; + tileCount: { + walkable: number; + wall: number; + difficultTerrain: number; + hazard: number; + door: number; + obstacle: number; + stairs: number; + }; + objects: number; + spawns: number; + createdAt: number; +} + +function summarize(state: BuilderState): MapSummary { + const counts = { + walkable: 0, + wall: 0, + difficultTerrain: 0, + hazard: 0, + door: 0, + obstacle: 0, + stairs: 0, + }; + for (const data of [state.ground.data, state.walls.data, state.decorations.data]) { + for (const gid of data) { + if (gid === 0) continue; + const tile = state.theme.tiles[gid - state.tileset.firstgid]; + if (!tile) continue; + switch (tile.tileType) { + case "WALKABLE": + counts.walkable++; + break; + case "WALL": + counts.wall++; + break; + case "DIFFICULT_TERRAIN": + counts.difficultTerrain++; + break; + case "HAZARD": + counts.hazard++; + break; + case "DOOR": + counts.door++; + break; + case "OBSTACLE": + counts.obstacle++; + break; + case "STAIRS": + counts.stairs++; + break; + } + } + } + return { + mapId: state.id, + name: state.name, + width: state.width, + height: state.height, + orientation: state.orientation, + theme: state.theme.key, + tileCount: 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) { + throw new Error( + `Unknown mapId '${id}'. Call create_map first, or list_maps to see the maps of this session (maps are lost when the server restarts).`, + ); + } + return m; +} + +export function listMaps(): MapSummary[] { + return Array.from(maps().values()).map((m) => summarize(m)); +} + +export function describeMap(id: MapId): MapSummary { + return summarize(getMap(id)); +} + +export function discardMap(id: MapId): boolean { + return maps().delete(id); +} + +// ---------- Tile editing ---------- + +export function gidForRole(state: BuilderState, role: ThemeRole): number { + const gid = state.roleToGid.get(role); + if (!gid) { + throw new Error( + `Theme '${state.theme.key}' does not define the role '${role}'. Call list_themes to see the roles of each theme.`, + ); + } + return gid; +} + +export 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}).`, + ); + } +} + +export function paintTile(id: MapId, layer: LayerName, x: number, y: number, role: ThemeRole): void { + const state = getMap(id); + assertInGrid(state, x, y); + const gid = gidForRole(state, role); + state[layer].data[y * state.width + x] = gid; +} + +export function eraseTile(id: MapId, layer: LayerName, x: number, y: number): void { + const state = getMap(id); + assertInGrid(state, x, y); + state[layer].data[y * state.width + x] = 0; +} + +export function paintRect( + id: MapId, + layer: LayerName, + x1: number, + y1: number, + x2: number, + y2: number, + role: ThemeRole, +): number { + const state = getMap(id); + const xa = Math.min(x1, x2); + const xb = Math.max(x1, x2); + const ya = Math.min(y1, y2); + const yb = Math.max(y1, y2); + assertInGrid(state, xa, ya, "Rectangle corner"); + assertInGrid(state, xb, yb, "Rectangle corner"); + const gid = gidForRole(state, role); + let painted = 0; + for (let y = ya; y <= yb; y++) { + for (let x = xa; x <= xb; x++) { + state[layer].data[y * state.width + x] = gid; + painted++; + } + } + return painted; +} + +export function paintWallBorder(id: MapId, x1: number, y1: number, x2: number, y2: number): number { + const state = getMap(id); + const xa = Math.min(x1, x2); + const xb = Math.max(x1, x2); + const ya = Math.min(y1, y2); + const yb = Math.max(y1, y2); + assertInGrid(state, xa, ya, "Rectangle corner"); + assertInGrid(state, xb, yb, "Rectangle corner"); + let painted = 0; + const wallGid = gidForRole(state, "wall"); + for (let x = xa; x <= xb; x++) { + state.walls.data[ya * state.width + x] = wallGid; + state.walls.data[yb * state.width + x] = wallGid; + painted += 2; + } + for (let y = ya + 1; y < yb; y++) { + state.walls.data[y * state.width + xa] = wallGid; + state.walls.data[y * state.width + xb] = wallGid; + painted += 2; + } + return painted; +} + +// ---------- Objects & spawns ---------- + +/** + * How object and spawn positions are written to the .tmj (see docs/map-format.md). + * + * - "tiled" (default): Tiled's native encoding. On isometric maps Tiled stores object + * positions in an unprojected space where BOTH axes use the tile height: + * x = col * tileheight, y = row * tileheight (Tiled's IsometricRenderer::tileToPixelCoords). + * Interactive objects are one-tile rectangles anchored on the tile's top corner and spawns + * are point objects at the tile centre, so everything lands on the right tile in Tiled. + * Inverse: col = floor(x / tileheight), row = floor(y / tileheight). + * - "screen": the encoding of earlier versions of this server, kept for importers that decode + * screen-space positions: x = tilewidth/2 * (col - row), y = tileheight/2 * (col + row), + * with no origin offset. Tiled itself does not place these on the right tiles. + * + * Orthogonal maps always use x = col * tilewidth, y = row * tileheight. + */ +export type ObjectCoordMode = "tiled" | "screen"; + +export function objectCoordMode(): ObjectCoordMode { + return process.env.TILED_OBJECT_COORDS?.trim().toLowerCase() === "screen" ? "screen" : "tiled"; +} + +type Placement = Pick; + +function placementFor(state: BuilderState, col: number, row: number, as: "object" | "spawn"): Placement { + const tw = state.tilewidth; + const th = state.tileheight; + if (state.orientation === "orthogonal") { + return as === "spawn" + ? { x: (col + 0.5) * tw, y: (row + 0.5) * th, point: true } + : { x: col * tw, y: row * th, width: tw, height: th }; + } + if (objectCoordMode() === "screen") { + const pos = { x: (tw / 2) * (col - row), y: (th / 2) * (col + row) }; + return as === "spawn" ? pos : { ...pos, width: tw, height: th }; + } + return as === "spawn" + ? { x: (col + 0.5) * th, y: (row + 0.5) * th, point: true } + : { x: col * th, y: row * th, width: th, height: th }; +} + +/** + * Throws when a spawn, chest, trap or lever would land on a wall, an unpainted cell or a cell + * already holding an object or spawn. Walls sit on their own layer above a walkable ground tile, + * so the ground layer alone cannot tell; models placing objects blindly get an actionable error + * instead of a broken map. + */ +export function assertPlaceable(id: MapId, x: number, y: number): void { + const state = getMap(id); + assertInGrid(state, x, y); + const i = y * state.width + x; + if (state.walls.data[i]) { + throw new Error( + `Cell (${x}, ${y}) holds a wall: pick a floor cell inside a room (check with get_tile_info layer=walls).`, + ); + } + if (!state.ground.data[i]) { + throw new Error(`Cell (${x}, ${y}) has no ground tile (it is outside every room): pick a painted floor cell.`); + } + const deco = state.decorations.data[i]; + if (deco && state.theme.tiles[deco - state.tileset.firstgid]?.tileType === "OBSTACLE") { + throw new Error(`Cell (${x}, ${y}) holds an obstacle prop on the decorations layer: pick a free floor cell.`); + } + const taken = state.occupied.get(`${x},${y}`); + if (taken) { + throw new Error( + `Cell (${x}, ${y}) is already occupied by "${taken.name}" (${taken.type}): pick a neighbouring cell.`, + ); + } +} + +export interface PlaceObjectOptions { + x: number; + y: number; + kind: ObjectKind; + state?: ObjectState; + name?: string; + pickDC?: number; + targetZoneId?: string; + trapType?: string; + trapNotation?: string; + trapSaveDC?: number; +} + +export function placeObject(id: MapId, opts: PlaceObjectOptions): number { + const state = getMap(id); + assertInGrid(state, opts.x, opts.y, "Object"); + const objectId = state.nextObjectId++; + const properties: TiledProperty[] = [ + { name: "kind", value: opts.kind, type: "string" }, + { name: "state", value: opts.state ?? "closed", type: "string" }, + ]; + if (opts.pickDC !== undefined) { + properties.push({ name: "pickDC", value: opts.pickDC, type: "int" }); + } + if (opts.targetZoneId) { + properties.push({ name: "targetZoneId", value: opts.targetZoneId, type: "string" }); + } + if (opts.trapType && opts.trapNotation) { + properties.push({ name: "trapType", value: opts.trapType, type: "string" }); + properties.push({ name: "trapNotation", value: opts.trapNotation, type: "string" }); + } + if (opts.trapSaveDC !== undefined) { + properties.push({ name: "trapSaveDC", value: opts.trapSaveDC, type: "int" }); + } + const name = opts.name ?? `${opts.kind}-${objectId}`; + const obj: TiledObject = { + id: objectId, + ...placementFor(state, opts.x, opts.y, "object"), + name, + type: opts.kind, + visible: true, + rotation: 0, + properties, + }; + state.objects.objects.push(obj); + state.occupied.set(`${opts.x},${opts.y}`, { name, type: opts.kind }); + return objectId; +} + +export interface PlaceSpawnOptions { + x: number; + y: number; + role: SpawnRole; + name?: string; + encounterId?: string; + npcName?: string; +} + +export function placeSpawn(id: MapId, opts: PlaceSpawnOptions): number { + const state = getMap(id); + assertInGrid(state, opts.x, opts.y, "Spawn"); + const objectId = state.nextObjectId++; + const properties: TiledProperty[] = [{ name: "role", value: opts.role, type: "string" }]; + if (opts.encounterId) { + properties.push({ name: "encounterId", value: opts.encounterId, type: "string" }); + } + if (opts.npcName) { + properties.push({ name: "npcName", value: opts.npcName, type: "string" }); + } + const name = opts.name ?? `${opts.role}-${objectId}`; + const obj: TiledObject = { + id: objectId, + ...placementFor(state, opts.x, opts.y, "spawn"), + name, + type: opts.role, + visible: true, + rotation: 0, + properties, + }; + state.spawns.objects.push(obj); + state.occupied.set(`${opts.x},${opts.y}`, { name, type: `${opts.role} spawn` }); + return 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, + tiledversion: TILED_VERSION, + orientation: state.orientation, + renderorder: "right-down", + width: state.width, + height: state.height, + tilewidth: 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 ---------- + +/** + * Point one role of this map's tileset at another image, for example the contextual variant + * `obstacle_decor__alembic.png` for a laboratory. Only the in-memory tileset of this map + * changes; other maps and the theme definition are untouched. + */ +export function overrideTileImage( + id: MapId, + role: ThemeRole, + imagePath: string, + imageWidth?: number, + imageHeight?: number, +): void { + const state = getMap(id); + const gid = state.roleToGid.get(role); + if (!gid) { + throw new Error(`Role '${role}' is not defined by theme '${state.theme.key}'.`); + } + const localId = gid - state.tileset.firstgid; + const tile = state.tileset.tiles?.[localId]; + if (!tile) { + throw new Error(`Tile #${localId} not found in the tileset.`); + } + tile.image = imagePath; + if (imageWidth !== undefined) tile.imagewidth = imageWidth; + if (imageHeight !== undefined) tile.imageheight = imageHeight; +} + +export function getTileInfo( + id: MapId, + layer: LayerName, + x: number, + y: number, +): { gid: number; role?: ThemeRole; tileType?: string; spriteId?: string; occupiedBy?: Occupant } { + const state = getMap(id); + assertInGrid(state, x, y); + const gid = state[layer].data[y * state.width + x]; + const occupied = state.occupied.get(`${x},${y}`); + const occupiedBy = occupied ? { occupiedBy: occupied } : {}; + if (gid === 0) return { gid: 0, ...occupiedBy }; + const def = state.theme.tiles[gid - state.tileset.firstgid]; + if (!def) return { gid, ...occupiedBy }; + return { gid, role: def.role, tileType: def.tileType, spriteId: def.spriteId, ...occupiedBy }; +} diff --git a/tiled-mcp/src/context.ts b/tiled-mcp/src/context.ts new file mode 100644 index 0000000000000000000000000000000000000000..24c60e7e1338adf708ce9436de1bcd714e3e9aff --- /dev/null +++ b/tiled-mcp/src/context.ts @@ -0,0 +1,53 @@ +// Per-caller state. +// +// Over stdio one person drives the server, so everything lives in one implicit workspace. +// In hosted mode (src/http.ts) many people share one process: every MCP session and every web +// job gets its own workspace (maps and generated sprites), and every request carries its own +// Hugging Face token. AsyncLocalStorage carries that scope from the HTTP handler down to the +// tool handlers, through the MCP SDK. + +import { AsyncLocalStorage } from "node:async_hooks"; +import type { BuilderState } from "./builder.js"; + +export interface Workspace { + maps: Map; + /** Sprites generated in this workspace, keyed "/.png" (hosted mode only). */ + sprites: Map; +} + +export interface Scope { + workspace: Workspace; + /** Hugging Face token sent with the current request; paid calls are billed to its owner. */ + hfToken?: string; + /** Public base URL of the server, used to build download links, e.g. https://x.hf.space */ + baseUrl?: string; +} + +const storage = new AsyncLocalStorage(); +const LOCAL: Scope = { workspace: newWorkspace() }; +let hosted = false; + +export function newWorkspace(): Workspace { + return { maps: new Map(), sprites: new Map() }; +} + +/** Run `fn` (and everything it awaits) with `scope` as the current scope. */ +export function runInScope(scope: Scope, fn: () => T): T { + return storage.run(scope, fn); +} + +export function currentScope(): Scope { + return storage.getStore() ?? LOCAL; +} + +/** + * Hosted mode: the server is shared over HTTP. Paid tools then only use the caller's token + * (never HF_TOKEN from the environment), and nothing is written to the server's disk. + */ +export function setHostedMode(on: boolean): void { + hosted = on; +} + +export function isHosted(): boolean { + return hosted; +} diff --git a/tiled-mcp/src/downloads.ts b/tiled-mcp/src/downloads.ts new file mode 100644 index 0000000000000000000000000000000000000000..2dcb3256b279f3851dbbbae98bd257265cb20193 --- /dev/null +++ b/tiled-mcp/src/downloads.ts @@ -0,0 +1,103 @@ +// Map downloads for the hosted mode. A map is packed as a .zip holding the .tmj file and the +// sprites it uses, laid out so it opens directly in Tiled, and kept in memory for one hour +// behind an unguessable link. + +import { 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; + +interface Download { + name: string; + contentType: string; + data: Buffer; + expires: number; +} + +const DOWNLOADS = new Map(); +let totalBytes = 0; + +function drop(id: string): void { + const d = DOWNLOADS.get(id); + if (!d) return; + totalBytes -= d.data.length; + DOWNLOADS.delete(id); +} + +function sweep(): void { + const now = Date.now(); + for (const [id, d] of DOWNLOADS) if (d.expires <= now) drop(id); + // Oldest first (Map keeps insertion order) until the store fits its budget. + for (const id of DOWNLOADS.keys()) { + if (totalBytes <= MAX_TOTAL_BYTES) break; + drop(id); + } +} + +export function getDownload(id: string): Download | undefined { + const d = DOWNLOADS.get(id); + if (!d || d.expires <= Date.now()) { + drop(id); + return undefined; + } + return d; +} + +function publish(name: string, contentType: string, data: Buffer): string { + const id = randomBytes(18).toString("base64url"); + DOWNLOADS.set(id, { name, contentType, data, expires: Date.now() + TTL_MS }); + totalBytes += data.length; + sweep(); + return `${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 `/.tmj` plus `/assets//.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 = { [`${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, "")); + const { zip, tmj, missingSprites } = mapArchive(mapId, base); + return { + zipUrl: publish(`${base}.zip`, "application/zip", zip), + tmjUrl: publish(`${base}.tmj`, "application/json", tmj), + expiresAt: new Date(Date.now() + TTL_MS).toISOString(), + ...(missingSprites.length ? { missingSprites } : {}), + }; +} diff --git a/tiled-mcp/src/env.ts b/tiled-mcp/src/env.ts new file mode 100644 index 0000000000000000000000000000000000000000..6e542a8466a8c74e5e7056ff037f114b3959da4b --- /dev/null +++ b/tiled-mcp/src/env.ts @@ -0,0 +1,23 @@ +import { existsSync, readFileSync } from "node:fs"; +import { join } from "node:path"; +import { PACKAGE_ROOT, REPO_ROOT, resolveUserPath } from "./paths.js"; + +/** + * Minimal `.env` loader (no dependency). Reads `KEY=value` lines and only fills variables + * that are not already set, so values passed by the MCP client always win. + * + * Lookup order: TILED_ENV_FILE if set, otherwise `tiled-mcp/.env`. + * Returns the file that was loaded, or null. + */ +export function loadEnvFile(): string | null { + const configured = process.env.TILED_ENV_FILE; + const file = configured ? resolveUserPath(configured, REPO_ROOT) : join(PACKAGE_ROOT, ".env"); + if (!existsSync(file)) return null; + const raw = readFileSync(file, "utf8"); + for (const line of raw.split(/\r?\n/)) { + const m = line.match(/^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*?)\s*$/); + if (!m || process.env[m[1]] !== undefined) continue; + process.env[m[1]] = m[2].replace(/^(["'])(.*)\1$/, "$2"); + } + return file; +} diff --git a/tiled-mcp/src/http.ts b/tiled-mcp/src/http.ts new file mode 100644 index 0000000000000000000000000000000000000000..94a63d371e6b7251f92ebd2edb39fc79c7fc2a65 --- /dev/null +++ b/tiled-mcp/src/http.ts @@ -0,0 +1,422 @@ +#!/usr/bin/env node +// Tiled Map Builder, hosted mode: one HTTP server for a public deployment such as a +// Hugging Face Space (see docs/hugging-face.md). +// +// GET / web page: describe a map, an AI model builds it, preview, download +// POST /api/generate runs that agent and streams its progress as NDJSON +// * /mcp every MCP tool over Streamable HTTP, for agents (Claude, Cursor, ...) +// GET /login "Sign in with Hugging Face" (Space OAuth), then /login/callback +// GET /download//.. map downloads (one hour) +// +// Paid calls (the AI model, FLUX sprites) only ever use the caller's own Hugging Face token, +// sent as "Authorization: Bearer hf_...", so they are billed to the caller. The server holds no +// token of its own, writes nothing to disk, and forgets a caller's maps when the session ends. + +import { randomBytes, randomUUID } from "node:crypto"; +import { readFile } from "node:fs/promises"; +import { createServer as createHttpServer, type IncomingMessage, type ServerResponse } from "node:http"; +import { extname, join } from "node:path"; +import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; +import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js"; +import { AgentError, DEFAULT_MODEL, MODEL_ID, SUGGESTED_MODELS, runMapAgent, type AgentEvent } from "./agent.js"; +import { newWorkspace, runInScope, setHostedMode, type Workspace } from "./context.js"; +import { getDownload } from "./downloads.js"; +import { loadEnvFile } from "./env.js"; +import { PACKAGE_ROOT } from "./paths.js"; +import { createServer, SERVER_VERSION } from "./server.js"; +import { assetFile } from "./sprites.js"; +import { THEME_KEYS, describeThemes } from "./themes/index.js"; + +setHostedMode(true); +loadEnvFile(); + +const PORT = Number(process.env.PORT || 7860); +const HOST = process.env.HOST || "127.0.0.1"; +const WEB_ROOT = join(PACKAGE_ROOT, "web"); +const MAX_JOBS = Math.max(1, Number(process.env.TILED_MAX_JOBS) || 4); +const JOB_TIMEOUT_MS = 8 * 60 * 1000; +const MAX_DESCRIPTION = 2000; +const MAX_SESSIONS = 200; +const SESSION_IDLE_MS = 30 * 60 * 1000; + +const OAUTH = + process.env.OAUTH_CLIENT_ID && process.env.OAUTH_CLIENT_SECRET + ? { + clientId: process.env.OAUTH_CLIENT_ID, + clientSecret: process.env.OAUTH_CLIENT_SECRET, + scopes: process.env.OAUTH_SCOPES || "openid profile inference-api", + provider: (process.env.OPENID_PROVIDER_URL || "https://huggingface.co").replace(/\/+$/, ""), + } + : null; + +const PAGE_CSP = + "default-src 'self'; img-src 'self' data: https:; style-src 'self'; script-src 'self'; connect-src 'self'; " + + "base-uri 'none'; form-action 'self'; frame-ancestors 'self' https://huggingface.co"; + +const STATIC: Record = { + "/": { file: "index.html", type: "text/html; charset=utf-8" }, + "/index.html": { file: "index.html", type: "text/html; charset=utf-8" }, + "/app.js": { file: "app.js", type: "text/javascript; charset=utf-8" }, + "/style.css": { file: "style.css", type: "text/css; charset=utf-8" }, + "/favicon.svg": { file: "favicon.svg", type: "image/svg+xml" }, +}; + +// ---------- small helpers ---------- + +function send(res: ServerResponse, status: number, body: string | Buffer, headers: Record = {}): void { + res.writeHead(status, { "X-Content-Type-Options": "nosniff", ...headers }); + res.end(body); +} + +function json(res: ServerResponse, status: number, payload: unknown): void { + send(res, status, JSON.stringify(payload), { "Content-Type": "application/json; charset=utf-8", "Cache-Control": "no-store" }); +} + +function bearer(req: IncomingMessage): string | undefined { + const m = /^Bearer\s+(\S+)\s*$/i.exec(req.headers.authorization ?? ""); + return m?.[1]; +} + +/** Public base URL, used in download links. */ +function baseUrl(req: IncomingMessage): string { + if (process.env.PUBLIC_URL) return process.env.PUBLIC_URL.replace(/\/+$/, ""); + if (process.env.SPACE_HOST) return `https://${process.env.SPACE_HOST.split(",")[0].trim()}`; + const proto = String(req.headers["x-forwarded-proto"] ?? "http").split(",")[0].trim(); + return `${proto}://${req.headers.host ?? `localhost:${PORT}`}`; +} + +async function readBody(req: IncomingMessage, limit: number): Promise { + const chunks: Buffer[] = []; + let size = 0; + for await (const chunk of req) { + size += (chunk as Buffer).length; + if (size > limit) throw new Error("too large"); + chunks.push(chunk as Buffer); + } + return Buffer.concat(chunks).toString("utf8"); +} + +function escapeHtml(s: string): string { + return s.replace(/[&<>"']/g, (c) => `&#${c.charCodeAt(0)};`); +} + +// ---------- MCP over Streamable HTTP ---------- + +interface Session { + transport: StreamableHTTPServerTransport; + server: McpServer; + workspace: Workspace; + lastSeen: number; +} + +const sessions = new Map(); + +function dropSession(id: string): void { + const s = sessions.get(id); + if (!s) return; + sessions.delete(id); + void s.server.close().catch(() => {}); +} + +function sweepSessions(): void { + const now = Date.now(); + for (const [id, s] of sessions) if (now - s.lastSeen > SESSION_IDLE_MS) dropSession(id); + while (sessions.size >= MAX_SESSIONS) { + const oldest = [...sessions.entries()].sort((a, b) => a[1].lastSeen - b[1].lastSeen)[0]; + dropSession(oldest[0]); + } +} + +function mcpCors(res: ServerResponse): void { + res.setHeader("Access-Control-Allow-Origin", "*"); + res.setHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, OPTIONS"); + res.setHeader("Access-Control-Allow-Headers", "Authorization, Content-Type, Accept, Mcp-Session-Id, Mcp-Protocol-Version, Last-Event-Id"); + res.setHeader("Access-Control-Expose-Headers", "Mcp-Session-Id"); +} + +async function handleMcp(req: IncomingMessage, res: ServerResponse): Promise { + mcpCors(res); + if (req.method === "OPTIONS") return send(res, 204, ""); + const scope = (workspace: Workspace) => ({ workspace, hfToken: bearer(req), baseUrl: baseUrl(req) }); + const sessionId = req.headers["mcp-session-id"]; + + if (typeof sessionId === "string") { + const s = sessions.get(sessionId); + if (!s) { + return json(res, 404, { jsonrpc: "2.0", error: { code: -32001, message: "Session not found or expired: start a new MCP session." }, id: null }); + } + s.lastSeen = Date.now(); + await runInScope(scope(s.workspace), () => s.transport.handleRequest(req, res)); + return; + } + if (req.method !== "POST") { + return json(res, 400, { jsonrpc: "2.0", error: { code: -32000, message: "Missing Mcp-Session-Id header: initialize a session first." }, id: null }); + } + + sweepSessions(); + const workspace = newWorkspace(); + const server = createServer(); + const transport: StreamableHTTPServerTransport = new StreamableHTTPServerTransport({ + sessionIdGenerator: () => randomUUID(), + onsessioninitialized: (id) => { + sessions.set(id, { transport, server, workspace, lastSeen: Date.now() }); + }, + onsessionclosed: (id) => dropSession(id), + }); + transport.onclose = () => { + if (transport.sessionId) sessions.delete(transport.sessionId); + }; + await server.connect(transport); + await runInScope(scope(workspace), () => transport.handleRequest(req, res)); + if (!transport.sessionId) await server.close().catch(() => {}); +} + +// ---------- the web agent ---------- + +let activeJobs = 0; + +async function handleGenerate(req: IncomingMessage, res: ServerResponse): Promise { + const token = bearer(req); + if (!token) { + return json(res, 401, { error: "Sign in with Hugging Face, or send your own access token: the AI model runs on your account." }); + } + let body: Record; + try { + body = JSON.parse(await readBody(req, 16_384)) as Record; + } catch { + return json(res, 400, { error: "The request body must be a small JSON object." }); + } + const description = typeof body.description === "string" ? body.description.trim() : ""; + if (!description) return json(res, 400, { error: "Describe the map first." }); + if (description.length > MAX_DESCRIPTION) { + return json(res, 400, { error: `The description is too long (${description.length} characters, at most ${MAX_DESCRIPTION}).` }); + } + const theme = typeof body.theme === "string" && body.theme ? body.theme : undefined; + if (theme && !THEME_KEYS.includes(theme)) return json(res, 400, { error: `Unknown theme '${theme}'.` }); + const model = typeof body.model === "string" && body.model.trim() ? body.model.trim() : DEFAULT_MODEL; + if (!MODEL_ID.test(model)) return json(res, 400, { error: `'${model}' is not a model id such as openai/gpt-oss-120b.` }); + if (activeJobs >= MAX_JOBS) { + return json(res, 503, { error: "The server is busy with other maps. Try again in a minute, or duplicate the Space to get your own copy." }); + } + + activeJobs++; + res.writeHead(200, { + "Content-Type": "application/x-ndjson; charset=utf-8", + "Cache-Control": "no-store", + "X-Accel-Buffering": "no", + "X-Content-Type-Options": "nosniff", + }); + const controller = new AbortController(); + const timeout = setTimeout(() => controller.abort(), JOB_TIMEOUT_MS); + res.on("close", () => { + if (!res.writableFinished) controller.abort(); + }); + const emit = (event: AgentEvent | { type: "ping" } | { type: "error"; message: string }) => { + if (!res.writableEnded) res.write(`${JSON.stringify(event)}\n`); + }; + // Keeps proxies from closing the stream while the model thinks. + const ping = setInterval(() => emit({ type: "ping" }), 15_000); + try { + await runMapAgent( + { description, theme, model, allowPaidSprites: body.allowPaidSprites === true }, + { token, baseUrl: baseUrl(req), signal: controller.signal, emit }, + ); + } catch (err) { + if (err instanceof AgentError) emit({ type: "error", message: err.message }); + else if (controller.signal.aborted) emit({ type: "error", message: "The job took too long and was stopped." }); + else { + console.error("generate failed:", err); + emit({ type: "error", message: `Unexpected server error: ${err instanceof Error ? err.message : String(err)}` }); + } + } finally { + clearInterval(ping); + clearTimeout(timeout); + activeJobs--; + res.end(); + } +} + +// ---------- Sign in with Hugging Face ---------- + +const pendingLogins = new Map(); + +function handleLogin(req: IncomingMessage, res: ServerResponse): void { + if (!OAUTH) { + return send(res, 404, "Sign-in with Hugging Face is only available on a Hugging Face Space with hf_oauth enabled. Paste an access token instead.", { + "Content-Type": "text/plain; charset=utf-8", + }); + } + const now = Date.now(); + for (const [state, expires] of pendingLogins) if (expires < now) pendingLogins.delete(state); + if (pendingLogins.size > 10_000) pendingLogins.clear(); + const state = randomBytes(16).toString("hex"); + pendingLogins.set(state, now + 10 * 60 * 1000); + const params = new URLSearchParams({ + client_id: OAUTH.clientId, + redirect_uri: `${baseUrl(req)}/login/callback`, + scope: OAUTH.scopes, + state, + response_type: "code", + }); + send(res, 302, "", { Location: `${OAUTH.provider}/oauth/authorize?${params}`, "Cache-Control": "no-store" }); +} + +function loginPage(res: ServerResponse, payload: object | null, message: string): void { + const nonce = randomBytes(16).toString("base64"); + const script = payload + ? `try{sessionStorage.setItem("tiled.hf",${JSON.stringify(JSON.stringify(payload)).replace(/Tiled Map Builder` + + `` + + `

${escapeHtml(message)}

Back to Tiled Map Builder

` + + (script ? `` : "") + + ``, + { + "Content-Type": "text/html; charset=utf-8", + "Cache-Control": "no-store", + "Referrer-Policy": "no-referrer", + "Content-Security-Policy": `default-src 'none'; script-src 'nonce-${nonce}'; style-src 'unsafe-inline'`, + }, + ); +} + +async function handleLoginCallback(req: IncomingMessage, res: ServerResponse, url: URL): Promise { + if (!OAUTH) return loginPage(res, null, "Sign-in is not enabled on this server."); + const error = url.searchParams.get("error"); + if (error) return loginPage(res, null, `Sign-in was cancelled or refused (${error}).`); + const code = url.searchParams.get("code"); + const state = url.searchParams.get("state") ?? ""; + const expires = pendingLogins.get(state); + pendingLogins.delete(state); + if (!code || !expires || expires < Date.now()) return loginPage(res, null, "This sign-in link expired. Please sign in again."); + + const redirectUri = `${baseUrl(req)}/login/callback`; + const tokenRes = await fetch(`${OAUTH.provider}/oauth/token`, { + method: "POST", + headers: { + Authorization: `Basic ${Buffer.from(`${OAUTH.clientId}:${OAUTH.clientSecret}`).toString("base64")}`, + "Content-Type": "application/x-www-form-urlencoded", + }, + body: new URLSearchParams({ grant_type: "authorization_code", code, redirect_uri: redirectUri, client_id: OAUTH.clientId }), + }).catch(() => null); + if (!tokenRes?.ok) return loginPage(res, null, "Hugging Face did not accept the sign-in. Please try again."); + const tokens = (await tokenRes.json()) as { access_token?: string; expires_in?: number }; + if (!tokens.access_token) return loginPage(res, null, "Hugging Face did not return an access token. Please try again."); + + type UserInfo = { name?: string; preferred_username?: string; picture?: string }; + const info: UserInfo = await fetch(`${OAUTH.provider}/oauth/userinfo`, { headers: { Authorization: `Bearer ${tokens.access_token}` } }) + .then((r) => (r.ok ? (r.json() as Promise) : {})) + .catch(() => ({})); + loginPage( + res, + { + token: tokens.access_token, + expiresAt: Date.now() + (tokens.expires_in ?? 8 * 3600) * 1000, + user: { name: info.name ?? info.preferred_username ?? "", username: info.preferred_username ?? "", avatar: info.picture ?? "" }, + via: "oauth", + }, + "Signed in. Opening Tiled Map Builder...", + ); +} + +async function handleWhoami(req: IncomingMessage, res: ServerResponse): Promise { + const token = bearer(req); + if (!token) return json(res, 401, { error: "No token." }); + const r = await fetch("https://huggingface.co/api/whoami-v2", { headers: { Authorization: `Bearer ${token}` } }).catch(() => null); + if (!r) return json(res, 502, { error: "Could not reach Hugging Face." }); + if (!r.ok) return json(res, r.status === 401 ? 401 : 502, { error: r.status === 401 ? "Hugging Face rejected this token." : "Could not check the token." }); + const w = (await r.json()) as { name?: string; fullname?: string; avatarUrl?: string }; + json(res, 200, { username: w.name ?? "", name: w.fullname ?? w.name ?? "", avatar: w.avatarUrl ?? "" }); +} + +// ---------- routing ---------- + +function config(req: IncomingMessage) { + const models = SUGGESTED_MODELS.some((m) => m.id === DEFAULT_MODEL) + ? SUGGESTED_MODELS + : [{ id: DEFAULT_MODEL, label: DEFAULT_MODEL }, ...SUGGESTED_MODELS]; + return { + version: SERVER_VERSION, + oauth: !!OAUTH, + defaultModel: DEFAULT_MODEL, + models, + maxDescription: MAX_DESCRIPTION, + mcpUrl: `${baseUrl(req)}/mcp`, + themes: describeThemes().map((t) => ({ key: t.key, name: t.name, description: t.description, sprites: t.sprites.status })), + }; +} + +async function handle(req: IncomingMessage, res: ServerResponse): Promise { + const url = new URL(req.url ?? "/", "http://localhost"); + const path = url.pathname; + const method = req.method ?? "GET"; + + if (path === "/mcp") return handleMcp(req, res); + if (path === "/api/generate" && method === "POST") return handleGenerate(req, res); + if (method !== "GET" && method !== "HEAD") return json(res, 405, { error: "Method not allowed." }); + + if (path === "/healthz") return json(res, 200, { ok: true, version: SERVER_VERSION, sessions: sessions.size, jobs: activeJobs }); + if (path === "/api/config") return json(res, 200, config(req)); + if (path === "/api/whoami") return handleWhoami(req, res); + if (path === "/login") return handleLogin(req, res); + if (path === "/login/callback") return handleLoginCallback(req, res, url); + + const download = /^\/download\/([\w-]+)\/[^/]+$/.exec(path); + if (download) { + const d = getDownload(download[1]); + if (!d) return send(res, 404, "This download link expired (links last one hour). Build or save the map again.", { "Content-Type": "text/plain; charset=utf-8" }); + return send(res, 200, d.data, { + "Content-Type": d.contentType, + "Content-Disposition": `attachment; filename="${d.name.replace(/[^\w.-]/g, "_")}"`, + "Cache-Control": "private, no-store", + }); + } + + const asset = /^\/assets\/([a-z0-9_]+\/[a-z0-9_]+\.png)$/.exec(path); + if (asset) { + const file = assetFile(asset[1]); + const data = file ? await readFile(file).catch(() => null) : null; + if (!data) return send(res, 404, "Not found", { "Content-Type": "text/plain; charset=utf-8" }); + return send(res, 200, data, { "Content-Type": "image/png", "Cache-Control": "public, max-age=86400" }); + } + + const page = STATIC[path]; + if (page) { + const data = await readFile(join(WEB_ROOT, page.file)).catch(() => null); + if (!data) return send(res, 500, "The web page files are missing (tiled-mcp/web).", { "Content-Type": "text/plain; charset=utf-8" }); + const headers: Record = { "Content-Type": page.type, "Cache-Control": "no-cache" }; + if (extname(page.file) === ".html") { + headers["Content-Security-Policy"] = PAGE_CSP; + headers["Referrer-Policy"] = "no-referrer"; + } + return send(res, 200, data, headers); + } + send(res, 404, "Not found", { "Content-Type": "text/plain; charset=utf-8" }); +} + +const httpServer = createHttpServer((req, res) => { + handle(req, res).catch((err) => { + console.error("request failed:", err); + if (!res.headersSent) json(res, 500, { error: "Internal server error." }); + else res.end(); + }); +}); + +setInterval(sweepSessions, 5 * 60 * 1000).unref(); + +httpServer.listen(PORT, HOST, () => { + console.log( + `Tiled Map Builder ${SERVER_VERSION} on http://${HOST}:${PORT} (web page /, MCP /mcp, Hugging Face sign-in ${OAUTH ? "on" : "off"}, default model ${DEFAULT_MODEL})`, + ); +}); + +for (const signal of ["SIGINT", "SIGTERM"] as const) { + process.on(signal, () => { + httpServer.close(); + for (const id of [...sessions.keys()]) dropSession(id); + process.exit(0); + }); +} diff --git a/tiled-mcp/src/index.ts b/tiled-mcp/src/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..7baecce0707d81efe6144b92c11d85a35d0af93a --- /dev/null +++ b/tiled-mcp/src/index.ts @@ -0,0 +1,16 @@ +#!/usr/bin/env node +// Tiled Map Builder MCP server, stdio transport. +// Exposes tools to compose isometric Tiled maps in memory, validate them, save .tmj files +// and optionally generate tile sprites (paid). For the hosted web and HTTP mode see http.ts. +// stdout carries the MCP protocol: log to stderr only. + +import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; + +import { loadEnvFile } from "./env.js"; +import { createServer } from "./server.js"; + +export { SERVER_NAME, SERVER_VERSION } from "./server.js"; + +loadEnvFile(); + +await createServer().connect(new StdioServerTransport()); diff --git a/tiled-mcp/src/paths.ts b/tiled-mcp/src/paths.ts new file mode 100644 index 0000000000000000000000000000000000000000..6afc2f54998dc19d695b4268d1c502ae5f39a27b --- /dev/null +++ b/tiled-mcp/src/paths.ts @@ -0,0 +1,53 @@ +import { isAbsolute, join, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; + +/** + * Directory layout, resolved from this file's location so the server works no matter + * which working directory the MCP client launches it from: + * + * / REPO_ROOT + * /tiled-mcp/ PACKAGE_ROOT (package.json, .env) + * /tiled-mcp/dist/ compiled server (this file runs from here as paths.js) + * /assets/ bundled sprites (override with TILED_ASSETS_DIR) + * /maps/ default .tmj output (override with TILED_MAPS_DIR) + * /skills/ agent skills (override with TILED_SKILL_FILE) + */ +export const PACKAGE_ROOT = fileURLToPath(new URL("..", import.meta.url)); +export const REPO_ROOT = fileURLToPath(new URL("../..", import.meta.url)); + +/** + * Some MCP clients (for example Zed opened on a WSL project) run the server on the Linux + * side while users keep typing Windows paths such as `D:/maps/crypt.tmj`. On a non-Windows + * platform, translate `X:/...` or `X:\...` into `/mnt/x/...`. Other paths pass through. + */ +export function toLocalPath(p: string): string { + const m = p.match(/^([A-Za-z]):[\\/](.*)$/); + if (process.platform === "win32" || !m) return p; + return `/mnt/${m[1].toLowerCase()}/${m[2].replace(/\\/g, "/")}`; +} + +/** Resolve a user-supplied path: WSL translation first, then relative paths against `base`. */ +export function resolveUserPath(p: string, base: string): string { + const local = toLocalPath(p); + return isAbsolute(local) ? resolve(local) : resolve(base, local); +} + +/** Root folder holding the `/.png` sprites. */ +export function assetsRoot(): string { + const configured = process.env.TILED_ASSETS_DIR; + return configured ? resolveUserPath(configured, REPO_ROOT) : join(REPO_ROOT, "assets"); +} + +/** Folder used by `save_to_disk` when it receives a relative path. */ +export function mapsRoot(): string { + const configured = process.env.TILED_MAPS_DIR; + return configured ? resolveUserPath(configured, REPO_ROOT) : join(REPO_ROOT, "maps"); +} + +/** Path of the map-builder skill served as the `map_builder` MCP prompt. */ +export function skillFile(): string { + const configured = process.env.TILED_SKILL_FILE; + return configured + ? resolveUserPath(configured, REPO_ROOT) + : join(REPO_ROOT, "skills", "map-builder", "SKILL.md"); +} diff --git a/tiled-mcp/src/prompts.ts b/tiled-mcp/src/prompts.ts new file mode 100644 index 0000000000000000000000000000000000000000..7375eea2c10c171cdcde1465700c8b1ae9930fb7 --- /dev/null +++ b/tiled-mcp/src/prompts.ts @@ -0,0 +1,43 @@ +import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; +import { z } from "zod"; +import { readFile } from "node:fs/promises"; +import { skillFile } from "./paths.js"; + +// Serves the map-builder skill (skills/map-builder/SKILL.md) as an MCP prompt, so clients +// without Agent Skills support can still load the full workflow with one prompt call. +export function registerPrompts(server: McpServer): void { + server.registerPrompt( + "map_builder", + { + title: "Build an isometric Tiled map (map-builder skill)", + description: + "Loads the map-builder skill and applies it to your description of the map: theme, size, encounters, traps, output.", + argsSchema: { + description: z + .string() + .describe("Free-form description, e.g. 'crypt 28x18 under a chapel, two skeletons, a locked chest DC 15'"), + }, + }, + async ({ description }) => { + const file = skillFile(); + let skill: string; + try { + skill = await readFile(file, "utf8"); + } catch { + throw new Error(`Skill file not found at ${file}. Set TILED_SKILL_FILE or restore skills/map-builder/SKILL.md.`); + } + const body = skill.replace(/^---[\s\S]*?---\s*/, ""); + return { + messages: [ + { + role: "user" as const, + content: { + type: "text" as const, + text: `Follow this skill step by step using the tiled-map-builder MCP tools.\n\n${body}\n\n---\n\nMap request: ${description}`, + }, + }, + ], + }; + }, + ); +} diff --git a/tiled-mcp/src/render.ts b/tiled-mcp/src/render.ts new file mode 100644 index 0000000000000000000000000000000000000000..14e2fe3ea044b213fd6b84b0a4a138eae7e0524e --- /dev/null +++ b/tiled-mcp/src/render.ts @@ -0,0 +1,163 @@ +// 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"; + +export interface PreviewOptions { + /** Downscale the image to at most this width in pixels. Default 1600. */ + maxWidth?: number; + /** Draw object and spawn markers. Default true. */ + markers?: boolean; +} + +const COLORS: Record = { + player: "#3ddc84", + enemy: "#ff4d4f", + npc: "#4da3ff", + door: "#c08a4a", + chest: "#ffd84d", + trap: "#c77dff", + lever: "#bbbbbb", + stairs: "#4dd8e6", +}; +const LETTER: Record = { player: "P", enemy: "E", npc: "N", door: "D", chest: "C", trap: "T", lever: "L", stairs: "S" }; + +const PLACEHOLDER: Record = { + WALKABLE: { color: "#4a5363", block: false }, + DIFFICULT_TERRAIN: { color: "#8a7440", block: false }, + HAZARD: { color: "#b03a3a", block: false }, + WALL: { color: "#7d8796", block: true }, + OBSTACLE: { color: "#5b6472", block: true }, + DOOR: { color: "#9a6532", block: true }, + STAIRS: { color: "#4f8796", block: true }, +}; + +/** A flat diamond (floors) or a small cube (walls, props) standing in for a missing sprite. */ +function placeholderSvg(tileType: string, tw: number, th: number, iso: boolean): { markup: string; height: number } { + const { color, block } = PLACEHOLDER[tileType] ?? PLACEHOLDER.WALKABLE; + const stroke = `stroke="#0d1117" stroke-opacity="0.45" stroke-width="1"`; + if (!iso) { + return { + markup: ``, + height: th, + }; + } + const h = block ? th * 2 : th; + const top = 0; + const diamond = `${tw / 2},${top} ${tw},${top + th / 2} ${tw / 2},${top + th} 0,${top + th / 2}`; + const faces = block + ? `` + + `` + : ""; + return { + markup: `${faces}`, + height: h, + }; +} + +/** + * @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, + readImage: (imagePath: string) => Buffer | undefined, + options: PreviewOptions = {}, +): Promise { + const sharp = await loadSharp(); + const maxWidth = options.maxWidth ?? 1600; + const markers = options.markers ?? true; + const { 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(); + const placeholders = new Map(); + 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 ?? ""; + const color = COLORS[kind] ?? "#ffffff"; + const shape = iso + ? `` + : ``; + svg += `${shape}${LETTER[kind] ?? "?"}`; + } + } + composites.push({ + input: Buffer.from(`${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(); +} diff --git a/tiled-mcp/src/server.ts b/tiled-mcp/src/server.ts new file mode 100644 index 0000000000000000000000000000000000000000..f6f2c32e93981ea890f17054b79f004f3bf0b366 --- /dev/null +++ b/tiled-mcp/src/server.ts @@ -0,0 +1,28 @@ +// Builds one MCP server instance with every tool and prompt. The stdio entry point (index.ts) +// creates one; the hosted entry point (http.ts) creates one per MCP session and one per web job. + +import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; +import { registerLifecycleTools } from "./tools/lifecycle.js"; +import { registerPaintTools } from "./tools/paint.js"; +import { registerObjectTools } from "./tools/objects.js"; +import { registerProceduralTools } from "./tools/procedural.js"; +import { 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 }); + registerLifecycleTools(server); + registerPaintTools(server); + registerObjectTools(server); + registerProceduralTools(server); + registerLayoutPresetTools(server); + registerExportTools(server); + registerGenerationTools(server); + registerPrompts(server); + return server; +} diff --git a/tiled-mcp/src/sharp.ts b/tiled-mcp/src/sharp.ts new file mode 100644 index 0000000000000000000000000000000000000000..7c7193db16fbf4a8cf251abbcd608417554ce22b --- /dev/null +++ b/tiled-mcp/src/sharp.ts @@ -0,0 +1,14 @@ +// sharp is loaded lazily so the map tools keep working even if the native image library +// fails to install: only sprite generation and preview rendering need it. + +export type Sharp = (typeof import("sharp"))["default"]; + +export async function loadSharp(): Promise { + try { + return (await import("sharp")).default; + } catch (err) { + throw new Error( + `The 'sharp' image library could not be loaded (${err instanceof Error ? err.message : String(err)}). Run 'npm install' in the repository; sprite generation and previews need it, map editing does not.`, + ); + } +} diff --git a/tiled-mcp/src/sprites.ts b/tiled-mcp/src/sprites.ts new file mode 100644 index 0000000000000000000000000000000000000000..26e89f815a4295786826fecc8f4c590d5a36d0bc --- /dev/null +++ b/tiled-mcp/src/sprites.ts @@ -0,0 +1,59 @@ +// Where sprite PNGs are read and written. +// +// Local mode (stdio): files below the assets folder, as always. +// Hosted mode: the bundled sprites are read-only and shared by every caller, so sprites a caller +// generates stay in their workspace (memory) and ship inside their map download. +// A sprite is named by its path below the assets root: "/.png". + +import { existsSync, readFileSync } from "node:fs"; +import { mkdir, writeFile } from "node:fs/promises"; +import { dirname, join, resolve, sep } from "node:path"; +import { currentScope, isHosted } from "./context.js"; +import { assetsRoot } from "./paths.js"; + +/** In hosted mode, how many sprites one session may generate and keep. */ +export const MAX_HOSTED_SPRITES = 40; + +/** Absolute path of a sprite below the assets root, or undefined if `relPath` would escape it. */ +export function assetFile(relPath: string): string | undefined { + const root = resolve(assetsRoot()); + const file = resolve(root, relPath); + return file.startsWith(root + sep) ? file : undefined; +} + +export function spriteExists(relPath: string): boolean { + if (isHosted() && currentScope().workspace.sprites.has(relPath)) return true; + const file = assetFile(relPath); + return file !== undefined && existsSync(file); +} + +/** Bytes of a sprite: the caller's own generated one first (hosted mode), then the bundled file. */ +export function readSprite(relPath: string): Buffer | undefined { + const own = isHosted() ? currentScope().workspace.sprites.get(relPath) : undefined; + if (own) return own; + const file = assetFile(relPath); + if (!file) return undefined; + try { + return readFileSync(file); + } catch { + return undefined; + } +} + +/** + * Store a generated sprite. Local mode writes `file` (default: below the assets root); + * hosted mode keeps it in the caller's workspace. Returns where it went. + */ +export async function saveSprite(relPath: string, data: Buffer, file = join(assetsRoot(), relPath)): Promise { + if (isHosted()) { + const sprites = currentScope().workspace.sprites; + if (!sprites.has(relPath) && sprites.size >= MAX_HOSTED_SPRITES) { + throw new Error(`This session already holds ${MAX_HOSTED_SPRITES} generated sprites, the limit on the hosted server.`); + } + sprites.set(relPath, data); + return `session:${relPath}`; + } + await mkdir(dirname(file), { recursive: true }); + await writeFile(file, data); + return file; +} diff --git a/tiled-mcp/src/themes/aquatic.ts b/tiled-mcp/src/themes/aquatic.ts new file mode 100644 index 0000000000000000000000000000000000000000..04f44fbf89866399cdb1f9a6e7eb59246d3e544d --- /dev/null +++ b/tiled-mcp/src/themes/aquatic.ts @@ -0,0 +1,28 @@ +import type { Theme } from "../types.js"; + +// Sprite paths are "./assets//.png", relative to the repository root +// (or TILED_ASSETS_DIR). save_to_disk rewrites them relative to the saved .tmj file. +const A = "./assets/aquatic"; + +export const AQUATIC: Theme = { + key: "AQUATIC", + name: "Eaux Croupies", + description: + "Eaux noires stagnantes, nénuphars, ruines submergées, brume sur l'eau. Marais hanté, pontons pourris, cryptes inondées.", + tilesetName: "aquatic-tileset", + tilewidth: 64, + tileheight: 32, + tiles: [ + { role: "walkable_floor", tileType: "WALKABLE", spriteId: "aquatic.black_water", imageFile: `${A}/walkable_floor.png` }, + { role: "walkable_floor_alt", tileType: "WALKABLE", spriteId: "aquatic.murky_water", imageFile: `${A}/walkable_floor_alt.png` }, + { role: "wall", tileType: "WALL", spriteId: "aquatic.weeping_stone", imageFile: `${A}/wall.png`, imageWidth: 64, imageHeight: 64 }, + { role: "wall_corner", tileType: "WALL", spriteId: "aquatic.damp_corner", imageFile: `${A}/wall_corner.png`, imageWidth: 64, imageHeight: 64 }, + { role: "difficult_terrain", tileType: "DIFFICULT_TERRAIN", spriteId: "aquatic.algae_flagstone", imageFile: `${A}/difficult_terrain.png` }, + { role: "hazard_primary", tileType: "HAZARD", spriteId: "aquatic.deep_water", imageFile: `${A}/hazard_primary.png`, imageWidth: 64, imageHeight: 64 }, + { role: "obstacle_decor", tileType: "OBSTACLE", spriteId: "aquatic.submerged_sarcophagus", imageFile: `${A}/obstacle_decor.png`, imageWidth: 64, imageHeight: 64 }, + { role: "decoration_minor", tileType: "WALKABLE", spriteId: "aquatic.water_lily", imageFile: `${A}/decoration_minor.png` }, + { role: "door_closed", tileType: "DOOR", spriteId: "aquatic.barnacled_door", imageFile: `${A}/door_closed.png`, imageWidth: 64, imageHeight: 64 }, + { role: "stairs", tileType: "STAIRS", spriteId: "aquatic.slimy_stairs", imageFile: `${A}/stairs.png`, imageWidth: 64, imageHeight: 64 }, + ], + ambient: { lightColor: "#0a1a1a", fogIntensity: 0.3 }, +}; diff --git a/tiled-mcp/src/themes/automne.ts b/tiled-mcp/src/themes/automne.ts new file mode 100644 index 0000000000000000000000000000000000000000..507537aba058fdc2bd37fff289135a3adc04b00a --- /dev/null +++ b/tiled-mcp/src/themes/automne.ts @@ -0,0 +1,28 @@ +import type { Theme } from "../types.js"; + +// Sprite paths are "./assets//.png", relative to the repository root +// (or TILED_ASSETS_DIR). save_to_disk rewrites them relative to the saved .tmj file. +const AU = "./assets/automne"; + +export const AUTOMNE: Theme = { + key: "AUTOMNE", + name: "Foret d'Automne", + description: + "Feuilles rousses, champignons, brume matinale, gibier traqué. Bois automnal, sentiers couverts, tombes sous les érables.", + tilesetName: "automne-tileset", + tilewidth: 64, + tileheight: 32, + tiles: [ + { role: "walkable_floor", tileType: "WALKABLE", spriteId: "automne.fallen_leaves", imageFile: `${AU}/walkable_floor.png` }, + { role: "walkable_floor_alt", tileType: "WALKABLE", spriteId: "automne.damp_earth", imageFile: `${AU}/walkable_floor_alt.png` }, + { role: "wall", tileType: "WALL", spriteId: "automne.rustic_oak", imageFile: `${AU}/wall.png`, imageWidth: 64, imageHeight: 64 }, + { role: "wall_corner", tileType: "WALL", spriteId: "automne.twisted_branch", imageFile: `${AU}/wall_corner.png`, imageWidth: 64, imageHeight: 64 }, + { role: "difficult_terrain", tileType: "DIFFICULT_TERRAIN", spriteId: "automne.slippery_leaf_carpet", imageFile: `${AU}/difficult_terrain.png` }, + { role: "hazard_primary", tileType: "HAZARD", spriteId: "automne.bog_mire", imageFile: `${AU}/hazard_primary.png`, imageWidth: 64, imageHeight: 64 }, + { role: "obstacle_decor", tileType: "OBSTACLE", spriteId: "automne.scarecrow_withered", imageFile: `${AU}/obstacle_decor.png`, imageWidth: 64, imageHeight: 64 }, + { role: "decoration_minor", tileType: "WALKABLE", spriteId: "automne.acorn", imageFile: `${AU}/decoration_minor.png` }, + { role: "door_closed", tileType: "DOOR", spriteId: "automne.ivy_door", imageFile: `${AU}/door_closed.png`, imageWidth: 64, imageHeight: 64 }, + { role: "stairs", tileType: "STAIRS", spriteId: "automne.leaf_stairs", imageFile: `${AU}/stairs.png`, imageWidth: 64, imageHeight: 64 }, + ], + ambient: { lightColor: "#2a1a0a", fogIntensity: 0.25 }, +}; diff --git a/tiled-mcp/src/themes/blood-tomb.ts b/tiled-mcp/src/themes/blood-tomb.ts new file mode 100644 index 0000000000000000000000000000000000000000..7d88c2d770c4b1f7f4c1cf30ab225224f207c588 --- /dev/null +++ b/tiled-mcp/src/themes/blood-tomb.ts @@ -0,0 +1,33 @@ +import type { Theme } from "../types.js"; + +// Sprite paths are "./assets//.png", relative to the repository root +// (or TILED_ASSETS_DIR). save_to_disk rewrites them relative to the saved .tmj file. +const A = "./assets/blood_tomb"; + +export const BLOOD_TOMB: Theme = { + key: "BLOOD_TOMB", + name: "Tombeau de sang", + description: + "Sanctuaire profond consacré aux pactes anciens. Dalles rituelles, runes saignantes qui pulsent au passage, autel central, candélabres en fer noir. Le sang ne sèche jamais sur ce sol.", + tilesetName: "blood-tomb-tileset", + tilewidth: 64, + tileheight: 32, + tiles: [ + { role: "walkable_floor", tileType: "WALKABLE", spriteId: "tomb.ritual_slab", imageFile: `${A}/walkable_floor.png` }, + { role: "walkable_floor_alt", tileType: "WALKABLE", spriteId: "tomb.ritual_slab_stained", imageFile: `${A}/walkable_floor_alt.png` }, + { role: "wall", tileType: "WALL", spriteId: "tomb.bleeding_wall", imageFile: `${A}/wall.png`, imageWidth: 64, imageHeight: 64 }, + { role: "difficult_terrain", tileType: "DIFFICULT_TERRAIN", spriteId: "tomb.blood_layer", imageFile: `${A}/difficult_terrain.png` }, + { + role: "hazard_primary", + tileType: "HAZARD", + spriteId: "tomb.bleeding_rune", + hazardType: "necrotique", + hazardNotation: "3d6", + imageFile: `${A}/hazard_primary.png`, + }, + { role: "obstacle_decor", tileType: "OBSTACLE", spriteId: "tomb.altar", imageFile: `${A}/obstacle_decor.png`, imageWidth: 64, imageHeight: 64 }, + { role: "decoration_minor", tileType: "WALKABLE", spriteId: "tomb.candelabra", imageFile: `${A}/decoration_minor.png` }, + { role: "door_closed", tileType: "DOOR", spriteId: "tomb.sealed_door", imageFile: `${A}/door_closed.png`, imageWidth: 64, imageHeight: 64 }, + ], + ambient: { lightColor: "#220808", fogIntensity: 0.3 }, +}; diff --git a/tiled-mcp/src/themes/castle.ts b/tiled-mcp/src/themes/castle.ts new file mode 100644 index 0000000000000000000000000000000000000000..3b77036d1d5655a0ddfab113e5bb94bdf3a97d63 --- /dev/null +++ b/tiled-mcp/src/themes/castle.ts @@ -0,0 +1,27 @@ +import type { Theme } from "../types.js"; + +// Sprite paths are "./assets//.png", relative to the repository root +// (or TILED_ASSETS_DIR). save_to_disk rewrites them relative to the saved .tmj file. +const A = "./assets/castle"; + +export const CASTLE: Theme = { + key: "CASTLE", + name: "Castel Von Drak", + description: + "Marbres noirs, basalte poli, vitraux brisés, bannières frappées du blason des Von Drak. Salle du trône, escaliers grandioses, candélabres en fer noir.", + tilesetName: "castle-tileset", + tilewidth: 64, + tileheight: 32, + tiles: [ + { role: "walkable_floor", tileType: "WALKABLE", spriteId: "castle.black_marble", imageFile: `${A}/walkable_floor.png` }, + { role: "walkable_floor_alt", tileType: "WALKABLE", spriteId: "castle.red_carpet", imageFile: `${A}/walkable_floor_alt.png` }, + { role: "wall", tileType: "WALL", spriteId: "castle.basalt_wall", imageFile: `${A}/wall.png`, imageWidth: 64, imageHeight: 64 }, + { role: "wall_corner", tileType: "WALL", spriteId: "castle.basalt_corner", imageFile: `${A}/wall_corner.png`, imageWidth: 64, imageHeight: 64 }, + { role: "difficult_terrain", tileType: "DIFFICULT_TERRAIN", spriteId: "castle.debris", imageFile: `${A}/difficult_terrain.png` }, + { role: "obstacle_decor", tileType: "OBSTACLE", spriteId: "castle.throne", imageFile: `${A}/obstacle_decor.png`, imageWidth: 64, imageHeight: 64 }, + { role: "decoration_minor", tileType: "WALKABLE", spriteId: "castle.banner", imageFile: `${A}/decoration_minor.png` }, + { role: "door_closed", tileType: "DOOR", spriteId: "castle.oak_door", imageFile: `${A}/door_closed.png`, imageWidth: 64, imageHeight: 64 }, + { role: "stairs", tileType: "STAIRS", spriteId: "castle.grand_stairs", imageFile: `${A}/stairs.png`, imageWidth: 64, imageHeight: 64 }, + ], + ambient: { lightColor: "#1a0a0a", fogIntensity: 0.1 }, +}; diff --git a/tiled-mcp/src/themes/crypt.ts b/tiled-mcp/src/themes/crypt.ts new file mode 100644 index 0000000000000000000000000000000000000000..0344ed27ff6a2ea646afa99933bf6a9d6d6bb01c --- /dev/null +++ b/tiled-mcp/src/themes/crypt.ts @@ -0,0 +1,35 @@ +import type { Theme } from "../types.js"; + +// Sprite paths are "./assets//.png", relative to the repository root +// (or TILED_ASSETS_DIR). save_to_disk rewrites them relative to the saved .tmj file. +const A = "./assets/crypt"; + +export const CRYPT: Theme = { + key: "CRYPT", + name: "Crypte mournevaldienne", + description: + "Caveaux funéraires sous les chapelles, dalles fissurées, runes mortuaires, gaz toxiques émanant des sarcophages disjoints.", + tilesetName: "crypt-tileset", + tilewidth: 64, + tileheight: 32, + tiles: [ + { role: "walkable_floor", tileType: "WALKABLE", spriteId: "crypt.flagstone", imageFile: `${A}/walkable_floor.png` }, + { role: "walkable_floor_alt", tileType: "WALKABLE", spriteId: "crypt.flagstone_cracked", imageFile: `${A}/walkable_floor_alt.png` }, + { role: "wall", tileType: "WALL", spriteId: "crypt.wall_mossy", imageFile: `${A}/wall.png`, imageWidth: 64, imageHeight: 64 }, + { role: "wall_corner", tileType: "WALL", spriteId: "crypt.wall_corner", imageFile: `${A}/wall_corner.png`, imageWidth: 64, imageHeight: 64 }, + { role: "difficult_terrain", tileType: "DIFFICULT_TERRAIN", spriteId: "crypt.rubble", imageFile: `${A}/difficult_terrain.png` }, + { + role: "hazard_primary", + tileType: "HAZARD", + spriteId: "crypt.poison_vent", + hazardType: "poison", + hazardNotation: "2d6", + imageFile: `${A}/hazard_primary.png`, + }, + { role: "obstacle_decor", tileType: "OBSTACLE", spriteId: "crypt.sarcophagus", imageFile: `${A}/obstacle_decor.png`, imageWidth: 64, imageHeight: 64 }, + { role: "decoration_minor", tileType: "WALKABLE", spriteId: "crypt.bones", imageFile: `${A}/decoration_minor.png` }, + { role: "door_closed", tileType: "DOOR", spriteId: "crypt.iron_door", imageFile: `${A}/door_closed.png`, imageWidth: 64, imageHeight: 64 }, + { role: "stairs", tileType: "STAIRS", spriteId: "crypt.stone_stairs", imageFile: `${A}/stairs.png`, imageWidth: 64, imageHeight: 64 }, + ], + ambient: { lightColor: "#2a1f1f", fogIntensity: 0.4 }, +}; diff --git a/tiled-mcp/src/themes/desolation.ts b/tiled-mcp/src/themes/desolation.ts new file mode 100644 index 0000000000000000000000000000000000000000..d31a2daf206915a07a880e9ddd9b063c46409bef --- /dev/null +++ b/tiled-mcp/src/themes/desolation.ts @@ -0,0 +1,28 @@ +import type { Theme } from "../types.js"; + +// Sprite paths are "./assets//.png", relative to the repository root +// (or TILED_ASSETS_DIR). save_to_disk rewrites them relative to the saved .tmj file. +const D = "./assets/desolation"; + +export const DESOLATION: Theme = { + key: "DESOLATION", + name: "Terre Desolee", + description: + "Cendres froides, arbres carbonisés, sols stériles, ciel gris. Paysage post-cataclysmique, ruines calcinées, ossuaires à ciel ouvert.", + tilesetName: "desolation-tileset", + tilewidth: 64, + tileheight: 32, + tiles: [ + { role: "walkable_floor", tileType: "WALKABLE", spriteId: "desolation.cold_ash", imageFile: `${D}/walkable_floor.png` }, + { role: "walkable_floor_alt", tileType: "WALKABLE", spriteId: "desolation.scorched_rock", imageFile: `${D}/walkable_floor_alt.png` }, + { role: "wall", tileType: "WALL", spriteId: "desolation.charred_wall", imageFile: `${D}/wall.png`, imageWidth: 64, imageHeight: 64 }, + { role: "wall_corner", tileType: "WALL", spriteId: "desolation.burnt_corner", imageFile: `${D}/wall_corner.png`, imageWidth: 64, imageHeight: 64 }, + { role: "difficult_terrain", tileType: "DIFFICULT_TERRAIN", spriteId: "desolation.sharp_debris", imageFile: `${D}/difficult_terrain.png` }, + { role: "hazard_primary", tileType: "HAZARD", spriteId: "desolation.ash_pit", imageFile: `${D}/hazard_primary.png`, imageWidth: 64, imageHeight: 64 }, + { role: "obstacle_decor", tileType: "OBSTACLE", spriteId: "desolation.skeletal_tree", imageFile: `${D}/obstacle_decor.png`, imageWidth: 64, imageHeight: 64 }, + { role: "decoration_minor", tileType: "WALKABLE", spriteId: "desolation.dust_mote", imageFile: `${D}/decoration_minor.png` }, + { role: "door_closed", tileType: "DOOR", spriteId: "desolation.warped_metal_door", imageFile: `${D}/door_closed.png`, imageWidth: 64, imageHeight: 64 }, + { role: "stairs", tileType: "STAIRS", spriteId: "desolation.rubble_steps", imageFile: `${D}/stairs.png`, imageWidth: 64, imageHeight: 64 }, + ], + ambient: { lightColor: "#1a1a1a", fogIntensity: 0.45 }, +}; diff --git a/tiled-mcp/src/themes/electronique.ts b/tiled-mcp/src/themes/electronique.ts new file mode 100644 index 0000000000000000000000000000000000000000..d04147b82cb2f72ec7c1478309c5e056ae1946c0 --- /dev/null +++ b/tiled-mcp/src/themes/electronique.ts @@ -0,0 +1,28 @@ +import type { Theme } from "../types.js"; + +// Sprite paths are "./assets//.png", relative to the repository root +// (or TILED_ASSETS_DIR). save_to_disk rewrites them relative to the saved .tmj file. +const EL = "./assets/electronique"; + +export const ELECTRONIQUE: Theme = { + key: "ELECTRONIQUE", + name: "Reseau Electronique", + description: + "Circuits imprimés, fibres optiques, données en flux, serveurs silencieux. Matrice numérique, nœuds de calcul, foyers d'IA.", + tilesetName: "electronique-tileset", + tilewidth: 64, + tileheight: 32, + tiles: [ + { role: "walkable_floor", tileType: "WALKABLE", spriteId: "electronique.pcb_trace", imageFile: `${EL}/walkable_floor.png` }, + { role: "walkable_floor_alt", tileType: "WALKABLE", spriteId: "electronique.chip_substrate", imageFile: `${EL}/walkable_floor_alt.png` }, + { role: "wall", tileType: "WALL", spriteId: "electronique.server_casing", imageFile: `${EL}/wall.png`, imageWidth: 64, imageHeight: 64 }, + { role: "wall_corner", tileType: "WALL", spriteId: "electronique.circuit_corner", imageFile: `${EL}/wall_corner.png`, imageWidth: 64, imageHeight: 64 }, + { role: "difficult_terrain", tileType: "DIFFICULT_TERRAIN", spriteId: "electronique.tangled_cable", imageFile: `${EL}/difficult_terrain.png` }, + { role: "hazard_primary", tileType: "HAZARD", spriteId: "electronique.power_surge", imageFile: `${EL}/hazard_primary.png`, imageWidth: 64, imageHeight: 64 }, + { role: "obstacle_decor", tileType: "OBSTACLE", spriteId: "electronique.mainframe_core", imageFile: `${EL}/obstacle_decor.png`, imageWidth: 64, imageHeight: 64 }, + { role: "decoration_minor", tileType: "WALKABLE", spriteId: "electronique.blinking_led", imageFile: `${EL}/decoration_minor.png` }, + { role: "door_closed", tileType: "DOOR", spriteId: "electronique.biometric_door", imageFile: `${EL}/door_closed.png`, imageWidth: 64, imageHeight: 64 }, + { role: "stairs", tileType: "STAIRS", spriteId: "electronique.access_ladder", imageFile: `${EL}/stairs.png`, imageWidth: 64, imageHeight: 64 }, + ], + ambient: { lightColor: "#0a0a1a", fogIntensity: 0.2 }, +}; diff --git a/tiled-mcp/src/themes/ete.ts b/tiled-mcp/src/themes/ete.ts new file mode 100644 index 0000000000000000000000000000000000000000..71f6bec2ffaa26b53bf0ffb281e5dd752093bff3 --- /dev/null +++ b/tiled-mcp/src/themes/ete.ts @@ -0,0 +1,28 @@ +import type { Theme } from "../types.js"; + +// Sprite paths are "./assets//.png", relative to the repository root +// (or TILED_ASSETS_DIR). save_to_disk rewrites them relative to the saved .tmj file. +const E = "./assets/ete"; + +export const ETE: Theme = { + key: "ETE", + name: "Plaine Estivale", + description: + "Herbe dorée, blés mûrs, ciel sans nuage, chaleur accablante. Moissons, greniers abandonnés, ossuaires sous le soleil.", + tilesetName: "ete-tileset", + tilewidth: 64, + tileheight: 32, + tiles: [ + { role: "walkable_floor", tileType: "WALKABLE", spriteId: "ete.golden_wheat", imageFile: `${E}/walkable_floor.png` }, + { role: "walkable_floor_alt", tileType: "WALKABLE", spriteId: "ete.dry_grass", imageFile: `${E}/walkable_floor_alt.png` }, + { role: "wall", tileType: "WALL", spriteId: "ete.sunbaked_clay", imageFile: `${E}/wall.png`, imageWidth: 64, imageHeight: 64 }, + { role: "wall_corner", tileType: "WALL", spriteId: "ete.terracotta_corner", imageFile: `${E}/wall_corner.png`, imageWidth: 64, imageHeight: 64 }, + { role: "difficult_terrain", tileType: "DIFFICULT_TERRAIN", spriteId: "ete.cracked_earth", imageFile: `${E}/difficult_terrain.png` }, + { role: "hazard_primary", tileType: "HAZARD", spriteId: "ete.heat_haze_pool", imageFile: `${E}/hazard_primary.png`, imageWidth: 64, imageHeight: 64 }, + { role: "obstacle_decor", tileType: "OBSTACLE", spriteId: "ete.scarecrow", imageFile: `${E}/obstacle_decor.png`, imageWidth: 64, imageHeight: 64 }, + { role: "decoration_minor", tileType: "WALKABLE", spriteId: "ete.dried_herb", imageFile: `${E}/decoration_minor.png` }, + { role: "door_closed", tileType: "DOOR", spriteId: "ete.weathered_plank_door", imageFile: `${E}/door_closed.png`, imageWidth: 64, imageHeight: 64 }, + { role: "stairs", tileType: "STAIRS", spriteId: "ete.dusty_steps", imageFile: `${E}/stairs.png`, imageWidth: 64, imageHeight: 64 }, + ], + ambient: { lightColor: "#2a1a0a", fogIntensity: 0.1 }, +}; diff --git a/tiled-mcp/src/themes/forest.ts b/tiled-mcp/src/themes/forest.ts new file mode 100644 index 0000000000000000000000000000000000000000..df523354fd933f4fbb12d9c9c64507db2ee7bf6f --- /dev/null +++ b/tiled-mcp/src/themes/forest.ts @@ -0,0 +1,32 @@ +import type { Theme } from "../types.js"; + +// Sprite paths are "./assets//.png", relative to the repository root +// (or TILED_ASSETS_DIR). save_to_disk rewrites them relative to the saved .tmj file. +const A = "./assets/haunted_forest"; + +export const HAUNTED_FOREST: Theme = { + key: "HAUNTED_FOREST", + name: "Forêt de Drakenmark", + description: + "Sous-bois étouffant de mousses noires, troncs morts couchés, brumes parasitaires qui s'enroulent autour des chevilles et ralentissent la marche.", + tilesetName: "forest-tileset", + tilewidth: 64, + tileheight: 32, + tiles: [ + { role: "walkable_floor", tileType: "WALKABLE", spriteId: "forest.moss", imageFile: `${A}/walkable_floor.png` }, + { role: "walkable_floor_alt", tileType: "WALKABLE", spriteId: "forest.dead_leaves", imageFile: `${A}/walkable_floor_alt.png` }, + { role: "wall", tileType: "WALL", spriteId: "forest.dead_tree", imageFile: `${A}/wall.png`, imageWidth: 64, imageHeight: 64 }, + { role: "difficult_terrain", tileType: "DIFFICULT_TERRAIN", spriteId: "forest.bramble", imageFile: `${A}/difficult_terrain.png` }, + { + role: "hazard_primary", + tileType: "HAZARD", + spriteId: "forest.parasitic_mist", + hazardType: "necrotique", + hazardNotation: "1d4", + imageFile: `${A}/hazard_primary.png`, + }, + { role: "obstacle_decor", tileType: "OBSTACLE", spriteId: "forest.boulder", imageFile: `${A}/obstacle_decor.png`, imageWidth: 64, imageHeight: 64 }, + { role: "decoration_minor", tileType: "WALKABLE", spriteId: "forest.mushroom", imageFile: `${A}/decoration_minor.png` }, + ], + ambient: { lightColor: "#1a1f18", fogIntensity: 0.5 }, +}; diff --git a/tiled-mcp/src/themes/foret.ts b/tiled-mcp/src/themes/foret.ts new file mode 100644 index 0000000000000000000000000000000000000000..2225937ffc8c29be9d3b1e356efe8b2cf768c1d7 --- /dev/null +++ b/tiled-mcp/src/themes/foret.ts @@ -0,0 +1,28 @@ +import type { Theme } from "../types.js"; + +// Sprite paths are "./assets//.png", relative to the repository root +// (or TILED_ASSETS_DIR). save_to_disk rewrites them relative to the saved .tmj file. +const F = "./assets/foret"; + +export const FORET: Theme = { + key: "FORET", + name: "Foret Sombre", + description: + "Bois sylvains tordus, mousse épaisse, racines apparentes, clairières brumeuses. Foret hantée, huttes de bûcherons, tombes sous les chênes.", + tilesetName: "foret-tileset", + tilewidth: 64, + tileheight: 32, + tiles: [ + { role: "walkable_floor", tileType: "WALKABLE", spriteId: "foret.moss_ground", imageFile: `${F}/walkable_floor.png` }, + { role: "walkable_floor_alt", tileType: "WALKABLE", spriteId: "foret.pine_needles", imageFile: `${F}/walkable_floor_alt.png` }, + { role: "wall", tileType: "WALL", spriteId: "foret.ancient_trunk", imageFile: `${F}/wall.png`, imageWidth: 64, imageHeight: 64 }, + { role: "wall_corner", tileType: "WALL", spriteId: "foret.gnarled_root", imageFile: `${F}/wall_corner.png`, imageWidth: 64, imageHeight: 64 }, + { role: "difficult_terrain", tileType: "DIFFICULT_TERRAIN", spriteId: "foret.thicket", imageFile: `${F}/difficult_terrain.png` }, + { role: "hazard_primary", tileType: "HAZARD", spriteId: "foret.quicksand_pool", imageFile: `${F}/hazard_primary.png`, imageWidth: 64, imageHeight: 64 }, + { role: "obstacle_decor", tileType: "OBSTACLE", spriteId: "foret.standing_stone", imageFile: `${F}/obstacle_decor.png`, imageWidth: 64, imageHeight: 64 }, + { role: "decoration_minor", tileType: "WALKABLE", spriteId: "foret.fallen_leaf", imageFile: `${F}/decoration_minor.png` }, + { role: "door_closed", tileType: "DOOR", spriteId: "foret.wooden_gate", imageFile: `${F}/door_closed.png`, imageWidth: 64, imageHeight: 64 }, + { role: "stairs", tileType: "STAIRS", spriteId: "foret.root_stairs", imageFile: `${F}/stairs.png`, imageWidth: 64, imageHeight: 64 }, + ], + ambient: { lightColor: "#1a2a1a", fogIntensity: 0.3 }, +}; diff --git a/tiled-mcp/src/themes/futuriste.ts b/tiled-mcp/src/themes/futuriste.ts new file mode 100644 index 0000000000000000000000000000000000000000..de3f27820e3edb66bf03f3c66c8fb25a974fc52d --- /dev/null +++ b/tiled-mcp/src/themes/futuriste.ts @@ -0,0 +1,28 @@ +import type { Theme } from "../types.js"; + +// Sprite paths are "./assets//.png", relative to the repository root +// (or TILED_ASSETS_DIR). save_to_disk rewrites them relative to the saved .tmj file. +const FT = "./assets/futuriste"; + +export const FUTURISTE: Theme = { + key: "FUTURISTE", + name: "Cite Futuriste", + description: + "Métal chromé, néons froids, panneaux holographiques, gratte-ciel en ruine. Megalopole dystopique, laboratoires secrets, cités volantes.", + tilesetName: "futuriste-tileset", + tilewidth: 64, + tileheight: 32, + tiles: [ + { role: "walkable_floor", tileType: "WALKABLE", spriteId: "futuriste.plasteel_plate", imageFile: `${FT}/walkable_floor.png` }, + { role: "walkable_floor_alt", tileType: "WALKABLE", spriteId: "futuriste.circuit_floor", imageFile: `${FT}/walkable_floor_alt.png` }, + { role: "wall", tileType: "WALL", spriteId: "futuriste.chrome_panel", imageFile: `${FT}/wall.png`, imageWidth: 64, imageHeight: 64 }, + { role: "wall_corner", tileType: "WALL", spriteId: "futuriste.alloy_corner", imageFile: `${FT}/wall_corner.png`, imageWidth: 64, imageHeight: 64 }, + { role: "difficult_terrain", tileType: "DIFFICULT_TERRAIN", spriteId: "futuriste.broken_conduit", imageFile: `${FT}/difficult_terrain.png` }, + { role: "hazard_primary", tileType: "HAZARD", spriteId: "futuriste.plasma_leak", imageFile: `${FT}/hazard_primary.png`, imageWidth: 64, imageHeight: 64 }, + { role: "obstacle_decor", tileType: "OBSTACLE", spriteId: "futuriste.server_rack", imageFile: `${FT}/obstacle_decor.png`, imageWidth: 64, imageHeight: 64 }, + { role: "decoration_minor", tileType: "WALKABLE", spriteId: "futuriste.holographic_tag", imageFile: `${FT}/decoration_minor.png` }, + { role: "door_closed", tileType: "DOOR", spriteId: "futuriste.sliding_airlock", imageFile: `${FT}/door_closed.png`, imageWidth: 64, imageHeight: 64 }, + { role: "stairs", tileType: "STAIRS", spriteId: "futuriste.metal_grating_stairs", imageFile: `${FT}/stairs.png`, imageWidth: 64, imageHeight: 64 }, + ], + ambient: { lightColor: "#0a0a1a", fogIntensity: 0.3 }, +}; diff --git a/tiled-mcp/src/themes/glaciaire.ts b/tiled-mcp/src/themes/glaciaire.ts new file mode 100644 index 0000000000000000000000000000000000000000..1758e886d51011f3ee4c84d2dd1673092117fb57 --- /dev/null +++ b/tiled-mcp/src/themes/glaciaire.ts @@ -0,0 +1,28 @@ +import type { Theme } from "../types.js"; + +// Sprite paths are "./assets//.png", relative to the repository root +// (or TILED_ASSETS_DIR). save_to_disk rewrites them relative to the saved .tmj file. +const G = "./assets/glaciaire"; + +export const GLACIAIRE: Theme = { + key: "GLACIAIRE", + name: "Toundra Glacée", + description: + "Glace noire, figures gelées prises dans la glace, givre, stalactites de pierre. Toundra hantée, pontons de gel, cryptes sous pergélisol.", + tilesetName: "glaciaire-tileset", + tilewidth: 64, + tileheight: 32, + tiles: [ + { role: "walkable_floor", tileType: "WALKABLE", spriteId: "glaciaire.black_ice", imageFile: `${G}/walkable_floor.png` }, + { role: "walkable_floor_alt", tileType: "WALKABLE", spriteId: "glaciaire.frost_flagstone", imageFile: `${G}/walkable_floor_alt.png` }, + { role: "wall", tileType: "WALL", spriteId: "glaciaire.glacial_ice", imageFile: `${G}/wall.png`, imageWidth: 64, imageHeight: 64 }, + { role: "wall_corner", tileType: "WALL", spriteId: "glaciaire.frost_corner", imageFile: `${G}/wall_corner.png`, imageWidth: 64, imageHeight: 64 }, + { role: "difficult_terrain", tileType: "DIFFICULT_TERRAIN", spriteId: "glaciaire.cracked_ice", imageFile: `${G}/difficult_terrain.png` }, + { role: "hazard_primary", tileType: "HAZARD", spriteId: "glaciaire.thin_ice", imageFile: `${G}/hazard_primary.png`, imageWidth: 64, imageHeight: 64 }, + { role: "obstacle_decor", tileType: "OBSTACLE", spriteId: "glaciaire.frozen_statue", imageFile: `${G}/obstacle_decor.png`, imageWidth: 64, imageHeight: 64 }, + { role: "decoration_minor", tileType: "WALKABLE", spriteId: "glaciaire.icicles", imageFile: `${G}/decoration_minor.png` }, + { role: "door_closed", tileType: "DOOR", spriteId: "glaciaire.frosted_door", imageFile: `${G}/door_closed.png`, imageWidth: 64, imageHeight: 64 }, + { role: "stairs", tileType: "STAIRS", spriteId: "glaciaire.ice_stairs", imageFile: `${G}/stairs.png`, imageWidth: 64, imageHeight: 64 }, + ], + ambient: { lightColor: "#0a1a2a", fogIntensity: 0.25 }, +}; diff --git a/tiled-mcp/src/themes/hiver.ts b/tiled-mcp/src/themes/hiver.ts new file mode 100644 index 0000000000000000000000000000000000000000..7bd681377acfe7bd6f47c3976ba605b016311f8b --- /dev/null +++ b/tiled-mcp/src/themes/hiver.ts @@ -0,0 +1,28 @@ +import type { Theme } from "../types.js"; + +// Sprite paths are "./assets//.png", relative to the repository root +// (or TILED_ASSETS_DIR). save_to_disk rewrites them relative to the saved .tmj file. +const H = "./assets/hiver"; + +export const HIVER: Theme = { + key: "HIVER", + name: "Plaine Enneigee", + description: + "Neige poudreuse, lacs gelés, branches givrées, brouillard glacial. Toundra hivernale, refuges de trappeurs, tombeaux sous la neige.", + tilesetName: "hiver-tileset", + tilewidth: 64, + tileheight: 32, + tiles: [ + { role: "walkable_floor", tileType: "WALKABLE", spriteId: "hiver.fresh_snow", imageFile: `${H}/walkable_floor.png` }, + { role: "walkable_floor_alt", tileType: "WALKABLE", spriteId: "hiver.packed_ice", imageFile: `${H}/walkable_floor_alt.png` }, + { role: "wall", tileType: "WALL", spriteId: "hiver.snow_drift", imageFile: `${H}/wall.png`, imageWidth: 64, imageHeight: 64 }, + { role: "wall_corner", tileType: "WALL", spriteId: "hiver.frozen_corner", imageFile: `${H}/wall_corner.png`, imageWidth: 64, imageHeight: 64 }, + { role: "difficult_terrain", tileType: "DIFFICULT_TERRAIN", spriteId: "hiver.slush", imageFile: `${H}/difficult_terrain.png` }, + { role: "hazard_primary", tileType: "HAZARD", spriteId: "hiver.thin_ice_lake", imageFile: `${H}/hazard_primary.png`, imageWidth: 64, imageHeight: 64 }, + { role: "obstacle_decor", tileType: "OBSTACLE", spriteId: "hiver.frozen_cairn", imageFile: `${H}/obstacle_decor.png`, imageWidth: 64, imageHeight: 64 }, + { role: "decoration_minor", tileType: "WALKABLE", spriteId: "hiver.snowflake", imageFile: `${H}/decoration_minor.png` }, + { role: "door_closed", tileType: "DOOR", spriteId: "hiver.frosted_log_door", imageFile: `${H}/door_closed.png`, imageWidth: 64, imageHeight: 64 }, + { role: "stairs", tileType: "STAIRS", spriteId: "hiver.ice_steps", imageFile: `${H}/stairs.png`, imageWidth: 64, imageHeight: 64 }, + ], + ambient: { lightColor: "#0f1a2a", fogIntensity: 0.2 }, +}; diff --git a/tiled-mcp/src/themes/index.ts b/tiled-mcp/src/themes/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..470e14a21999507c9f6c1b6a0d841c78d77f2177 --- /dev/null +++ b/tiled-mcp/src/themes/index.ts @@ -0,0 +1,92 @@ +import { existsSync } from "node:fs"; +import { join } from "node:path"; +import { assetsRoot } from "../paths.js"; +import { ASSET_PREFIX } from "../tmj.js"; +import type { Theme } from "../types.js"; +import { CRYPT } from "./crypt.js"; +import { CASTLE } from "./castle.js"; +import { WEREWOLF_DEN } from "./werewolf-den.js"; +import { TAVERN_BLOOD_PRINCE } from "./tavern.js"; +import { VILLAGE } from "./village.js"; +import { HAUNTED_FOREST } from "./forest.js"; +import { MAUSOLEUM } from "./mausoleum.js"; +import { BLOOD_TOMB } from "./blood-tomb.js"; +import { AQUATIC } from "./aquatic.js"; +import { GLACIAIRE } from "./glaciaire.js"; +import { INONDE } from "./inonde.js"; +import { VOLCAN } from "./volcan.js"; +import { FORET } from "./foret.js"; +import { HIVER } from "./hiver.js"; +import { PRINTEMPS } from "./printemps.js"; +import { ETE } from "./ete.js"; +import { AUTOMNE } from "./automne.js"; +import { DESOLATION } from "./desolation.js"; +import { FUTURISTE } from "./futuriste.js"; +import { ELECTRONIQUE } from "./electronique.js"; + +export const THEMES: Record = { + 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, +}; + +export const THEME_KEYS = Object.keys(THEMES) as [string, ...string[]]; + +export function getTheme(key: string): Theme { + const theme = THEMES[key]; + if (!theme) { + throw new Error(`Unknown theme '${key}'. Available themes: ${THEME_KEYS.join(", ")}`); + } + return theme; +} + +/** Folder of a theme's sprites below the assets root, e.g. WEREWOLF_DEN -> werewolf_den. */ +export function themeAssetDir(key: string): string { + return key.toLowerCase(); +} + +/** How many of the theme's sprite files exist under the assets root. */ +export function spriteAvailability(theme: Theme, root = assetsRoot()) { + const files = theme.tiles.filter((t) => t.imageFile?.startsWith(ASSET_PREFIX)); + const missing = files + .filter((t) => !existsSync(join(root, t.imageFile!.slice(ASSET_PREFIX.length)))) + .map((t) => t.role); + const status = missing.length === 0 ? "all" : missing.length === files.length ? "none" : "partial"; + return { status, present: files.length - missing.length, total: files.length, missingRoles: missing }; +} + +export function describeThemes() { + const root = assetsRoot(); + return Object.values(THEMES).map((t) => { + const sprites = spriteAvailability(t, root); + return { + key: t.key, + name: t.name, + description: t.description, + roles: t.tiles.map((tile) => tile.role), + sprites: { + status: sprites.status, + present: sprites.present, + total: sprites.total, + ...(sprites.missingRoles.length ? { missingRoles: sprites.missingRoles } : {}), + }, + }; + }); +} diff --git a/tiled-mcp/src/themes/inonde.ts b/tiled-mcp/src/themes/inonde.ts new file mode 100644 index 0000000000000000000000000000000000000000..24e33cf6f49ffa295a632bc3db4af2fa7021ed7b --- /dev/null +++ b/tiled-mcp/src/themes/inonde.ts @@ -0,0 +1,28 @@ +import type { Theme } from "../types.js"; + +// Sprite paths are "./assets//.png", relative to the repository root +// (or TILED_ASSETS_DIR). save_to_disk rewrites them relative to the saved .tmj file. +const I = "./assets/inonde"; + +export const INONDE: Theme = { + key: "INONDE", + name: "Cote Inondee", + description: + "Villes englouties sous les flots, ruines submergees, algues pendantes, eaux saumustres. Quartiers noyés, ponts rompus, cryptes immergees.", + tilesetName: "inonde-tileset", + tilewidth: 64, + tileheight: 32, + tiles: [ + { role: "walkable_floor", tileType: "WALKABLE", spriteId: "inonde.stagnant_water", imageFile: `${I}/walkable_floor.png` }, + { role: "walkable_floor_alt", tileType: "WALKABLE", spriteId: "inonde.muddy_flats", imageFile: `${I}/walkable_floor_alt.png` }, + { role: "wall", tileType: "WALL", spriteId: "inonde.submerged_wall", imageFile: `${I}/wall.png`, imageWidth: 64, imageHeight: 64 }, + { role: "wall_corner", tileType: "WALL", spriteId: "inonde.drowned_corner", imageFile: `${I}/wall_corner.png`, imageWidth: 64, imageHeight: 64 }, + { role: "difficult_terrain", tileType: "DIFFICULT_TERRAIN", spriteId: "inonde.kelp_tangle", imageFile: `${I}/difficult_terrain.png` }, + { role: "hazard_primary", tileType: "HAZARD", spriteId: "inonde.deep_current", imageFile: `${I}/hazard_primary.png`, imageWidth: 64, imageHeight: 64 }, + { role: "obstacle_decor", tileType: "OBSTACLE", spriteId: "inonde.sunken_statue", imageFile: `${I}/obstacle_decor.png`, imageWidth: 64, imageHeight: 64 }, + { role: "decoration_minor", tileType: "WALKABLE", spriteId: "inonde.floating_debris", imageFile: `${I}/decoration_minor.png` }, + { role: "door_closed", tileType: "DOOR", spriteId: "inonde.bloated_door", imageFile: `${I}/door_closed.png`, imageWidth: 64, imageHeight: 64 }, + { role: "stairs", tileType: "STAIRS", spriteId: "inonde.slippery_steps", imageFile: `${I}/stairs.png`, imageWidth: 64, imageHeight: 64 }, + ], + ambient: { lightColor: "#0a1a2a", fogIntensity: 0.35 }, +}; diff --git a/tiled-mcp/src/themes/mausoleum.ts b/tiled-mcp/src/themes/mausoleum.ts new file mode 100644 index 0000000000000000000000000000000000000000..cc5c8c9b824aa8f989e48e7743d02de8ea5fa66a --- /dev/null +++ b/tiled-mcp/src/themes/mausoleum.ts @@ -0,0 +1,26 @@ +import type { Theme } from "../types.js"; + +// Sprite paths are "./assets//.png", relative to the repository root +// (or TILED_ASSETS_DIR). save_to_disk rewrites them relative to the saved .tmj file. +const A = "./assets/mausoleum"; + +export const MAUSOLEUM: Theme = { + key: "MAUSOLEUM", + name: "Mausolée", + description: + "Marbre veiné de gris, statues d'anges déchus aux ailes brisées, urnes funéraires alignées dans les niches, chuchotements à la limite de l'audible.", + tilesetName: "mausoleum-tileset", + tilewidth: 64, + tileheight: 32, + tiles: [ + { role: "walkable_floor", tileType: "WALKABLE", spriteId: "mausoleum.marble_floor", imageFile: `${A}/walkable_floor.png` }, + { role: "walkable_floor_alt", tileType: "WALKABLE", spriteId: "mausoleum.marble_cracked", imageFile: `${A}/walkable_floor_alt.png` }, + { role: "wall", tileType: "WALL", spriteId: "mausoleum.granite_wall", imageFile: `${A}/wall.png`, imageWidth: 64, imageHeight: 64 }, + { role: "difficult_terrain", tileType: "DIFFICULT_TERRAIN", spriteId: "mausoleum.broken_urns", imageFile: `${A}/difficult_terrain.png` }, + { role: "obstacle_decor", tileType: "OBSTACLE", spriteId: "mausoleum.fallen_angel", imageFile: `${A}/obstacle_decor.png`, imageWidth: 64, imageHeight: 64 }, + { role: "decoration_minor", tileType: "WALKABLE", spriteId: "mausoleum.urn_niche", imageFile: `${A}/decoration_minor.png` }, + { role: "door_closed", tileType: "DOOR", spriteId: "mausoleum.bronze_door", imageFile: `${A}/door_closed.png`, imageWidth: 64, imageHeight: 64 }, + { role: "stairs", tileType: "STAIRS", spriteId: "mausoleum.marble_stairs", imageFile: `${A}/stairs.png`, imageWidth: 64, imageHeight: 64 }, + ], + ambient: { lightColor: "#1f1f24", fogIntensity: 0.15 }, +}; diff --git a/tiled-mcp/src/themes/printemps.ts b/tiled-mcp/src/themes/printemps.ts new file mode 100644 index 0000000000000000000000000000000000000000..ca2b006af219a51e38ed28fbbf9de7d4b5cca702 --- /dev/null +++ b/tiled-mcp/src/themes/printemps.ts @@ -0,0 +1,28 @@ +import type { Theme } from "../types.js"; + +// Sprite paths are "./assets//.png", relative to the repository root +// (or TILED_ASSETS_DIR). save_to_disk rewrites them relative to the saved .tmj file. +const P = "./assets/printemps"; + +export const PRINTEMPS: Theme = { + key: "PRINTEMPS", + name: "Prairie Printaniere", + description: + "Champs en fleurs, herbe tendre, ruisseaux clairs, arbres en bourgeon. Prairies ouvertes, cercles de druides, fontaines sacrées.", + tilesetName: "printemps-tileset", + tilewidth: 64, + tileheight: 32, + tiles: [ + { role: "walkable_floor", tileType: "WALKABLE", spriteId: "printemps.green_meadow", imageFile: `${P}/walkable_floor.png` }, + { role: "walkable_floor_alt", tileType: "WALKABLE", spriteId: "printemps.clover_field", imageFile: `${P}/walkable_floor_alt.png` }, + { role: "wall", tileType: "WALL", spriteId: "printemps.living_hedge", imageFile: `${P}/wall.png`, imageWidth: 64, imageHeight: 64 }, + { role: "wall_corner", tileType: "WALL", spriteId: "printemps.flowered_arch", imageFile: `${P}/wall_corner.png`, imageWidth: 64, imageHeight: 64 }, + { role: "difficult_terrain", tileType: "DIFFICULT_TERRAIN", spriteId: "printemps.muddy_puddle", imageFile: `${P}/difficult_terrain.png` }, + { role: "hazard_primary", tileType: "HAZARD", spriteId: "printemps.swollen_stream", imageFile: `${P}/hazard_primary.png`, imageWidth: 64, imageHeight: 64 }, + { role: "obstacle_decor", tileType: "OBSTACLE", spriteId: "printemps.maypole", imageFile: `${P}/obstacle_decor.png`, imageWidth: 64, imageHeight: 64 }, + { role: "decoration_minor", tileType: "WALKABLE", spriteId: "printemps.wildflower", imageFile: `${P}/decoration_minor.png` }, + { role: "door_closed", tileType: "DOOR", spriteId: "printemps.woven_wicker_door", imageFile: `${P}/door_closed.png`, imageWidth: 64, imageHeight: 64 }, + { role: "stairs", tileType: "STAIRS", spriteId: "printemps.moss_steps", imageFile: `${P}/stairs.png`, imageWidth: 64, imageHeight: 64 }, + ], + ambient: { lightColor: "#1a2a1a", fogIntensity: 0.15 }, +}; diff --git a/tiled-mcp/src/themes/prompts.ts b/tiled-mcp/src/themes/prompts.ts new file mode 100644 index 0000000000000000000000000000000000000000..706bab396847608753c5d1e97ae64fd0415f168d --- /dev/null +++ b/tiled-mcp/src/themes/prompts.ts @@ -0,0 +1,1155 @@ +// FLUX.1-dev prompt templates for isometric tile sprites. +// +// Target tone: gothic horror, not demonic. Decay, melancholy, faded grandeur. +// No pentagrams, blood pools, infernal or hellish imagery. +// Validated style "v2-flat-no-depth": flat 2D painterly, no 3D depth shading. + +import type { ThemeRole } from "../types.js"; + +export type ThemeKey = + | "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"; + +interface RoleVisual { + /** Material / subject description for the tile. */ + material: string; + /** Lighting cue specific to this tile and theme. */ + lighting: string; + /** Either "surface" (64x32 flat floor) or "cube" (64x64 vertical block). */ + geometry: "surface" | "cube"; +} + +// Critical: NEVER put these words in the positive prompt, not even negated, because they +// prime the model: candle, candles, torch, torches, flame, fire, bonfire, lantern, amber, +// warm orange, glow source. Lighting stays colour-neutral (intensity and direction only). +// They are excluded explicitly through NEGATIVE_PROMPT instead. +const POSITIVE_FRAMING = + `clean empty composition, only the main subject in frame, ` + + `completely empty apart from the main subject, plain solid background, ` + + `no decorative props, no ornaments around the subject`; + +// Pure magenta #FF00FF background: a colour never present in a gothic sprite, so a magenta +// chroma key removes the background cleanly without touching the subject (which may have +// deep blacks, shadows, iron, etc.). +const SURFACE_TEMPLATE = (material: string, lighting: string) => + `flat 2D illustration of a single isometric floor tile at 30 degree angle, ` + + `painterly oil paint style, ${material}, ` + + `${lighting}, hand-drawn smooth lines, gothic horror dark fantasy palette, ` + + `no 3D depth shading, no perspective distortion beyond isometric projection, ` + + `decayed elegance, faded grandeur, brooding melancholy, ` + + `single isolated tile centered on pure bright magenta solid background, ` + + `chroma key background #FF00FF, ` + + `${POSITIVE_FRAMING}, game asset for 2D tactical RPG`; + +const CUBE_TEMPLATE = (material: string, lighting: string) => + `isometric view of a single cube block at 30 degree angle, ` + + `hand-painted digital illustration, painterly oil paint style, ` + + `${material}, ${lighting}, gothic horror dark fantasy palette, ` + + `decayed elegance, faded grandeur, brooding melancholy, ` + + `smooth lines no 3D ray-traced effects, no depth-of-field, ` + + `single isolated object centered on pure bright magenta solid background, ` + + `chroma key background #FF00FF, ` + + `${POSITIVE_FRAMING}, game asset for 2D tactical RPG`; + +/** + * Negative prompt sent alongside the positive prompt: an aggressive list of everything + * that must NOT appear. FLUX.1-dev accepts negative_prompt through Inference Providers. + */ +export const NEGATIVE_PROMPT = + `candle, candles, candlelight, candelabra, candleholder, ` + + `torch, torches, torchlight, sconce, brazier, ` + + `flame, flames, fire, ember, smoke, ` + + `lantern, lamp, oil lamp, light bulb, lightsource, ` + + `multiple tiles, multiple objects, several items, tile grid, tile sheet, ` + + `scenery, landscape, room scene, dungeon scene, interior view, ` + + `characters, people, person, figure, hand, face, eye, ` + + `text, letters, numbers, watermark, signature, logo, UI element, ` + + `border, frame, vignette, gradient background, ` + + `bright glow, halo, lens flare, light beam, light rays, ` + + `props, decorations around, foreground object, extra item, ` + + `furniture in background, ornaments, knick-knacks, ` + + `realistic photo, photograph, 3D render, voxel, blender render, ` + + `cartoon, anime, manga, chibi, pixelated low-res`; + +// Lighting policy : color-neutral descriptors only. Surface material carries +// the warmth/coolness via its color. Never use "warm/amber/orange/umber/sepia" +// in lightings — these are flame triggers for FLUX. +export const ROLE_VISUALS: Partial>>> = { + CASTLE: { + walkable_floor: { + material: "polished black marble floor with subtle crimson veining, centuries of footwear", + lighting: "soft top-down ambient illumination, low key", + geometry: "surface", + }, + walkable_floor_alt: { + material: + "threadbare crimson velvet carpet with faded golden embroidery on flagstone, tattered edges", + lighting: "soft top-down ambient illumination, low key", + geometry: "surface", + }, + wall: { + material: + "weathered obsidian basalt brick wall with mortar lines, gothic cathedral stonework, time-worn", + lighting: "soft directional ambient lighting from the upper left, low key", + geometry: "cube", + }, + wall_corner: { + material: + "weathered obsidian basalt corner block, gothic cathedral cornerstone, carved relief", + lighting: "soft directional ambient lighting from the upper left, low key", + geometry: "cube", + }, + difficult_terrain: { + material: + "scattered stone debris and broken gothic statue fragments on flagstone, dust and rubble", + lighting: "muted desaturated ambient lighting", + geometry: "surface", + }, + obstacle_decor: { + material: + "ornate gothic carved stone block with weathered relief carvings of wolves and bats, single solitary object", + lighting: "soft top-down ambient illumination, soft shadow underneath", + geometry: "cube", + }, + decoration_minor: { + material: + "tattered crimson heraldic banner with faded wolf sigil, draped on flagstone, dust", + lighting: "very low key ambient illumination", + geometry: "surface", + }, + door_closed: { + material: + "iron-bound oak gothic door, closed, studded with black iron rivets and a heavy ring handle", + lighting: "soft directional ambient illumination on the wood grain", + geometry: "cube", + }, + stairs: { + material: + "weathered stone gothic stairs descending, marble steps worn smooth at the center", + lighting: "soft ambient illumination, slight gradient from below", + geometry: "cube", + }, + }, + CRYPT: { + walkable_floor: { + material: + "cracked flagstone floor with green moss in the seams, weathered gravestone surface", + lighting: "muted cool ambient lighting, slight greenish tint", + geometry: "surface", + }, + walkable_floor_alt: { + material: + "moss-covered ancient flagstone with subtle bone fragments, gray dust", + lighting: "very low key neutral ambient illumination", + geometry: "surface", + }, + wall: { + material: + "mossy stone wall with niche carvings for funerary urns, weeping water stains", + lighting: "directional cool ambient lighting from above, no source visible", + geometry: "cube", + }, + wall_corner: { + material: "mossy stone corner block with carved family crest, time-worn", + lighting: "directional cool ambient lighting from above, no source visible", + geometry: "cube", + }, + difficult_terrain: { + material: "pile of bones and skull fragments on flagstone, scattered, dusty", + lighting: "muted gray ambient lighting", + geometry: "surface", + }, + hazard_primary: { + material: + "cracked flagstone with sickly green poison vapor seeping upward from the cracks, faint wisps", + lighting: "eerie green underglow from the cracks themselves", + geometry: "surface", + }, + obstacle_decor: { + material: + "stone sarcophagus lid carved with effigy of a sleeping noble, weathered, single object", + lighting: "soft directional ambient lighting from above, soft shadow under the lid", + geometry: "cube", + }, + decoration_minor: { + material: "dust and scattered bone shards on flagstone, very subtle", + lighting: "low key cool ambient tint", + geometry: "surface", + }, + door_closed: { + material: + "rusted iron crypt door, closed, oxidized, gothic ironwork patterns", + lighting: "soft directional ambient illumination on the metal", + geometry: "cube", + }, + stairs: { + material: + "worn stone stairs descending into deeper crypt, narrow, slippery moss", + lighting: "dark cool ambient gloom rising from below", + geometry: "cube", + }, + }, + WEREWOLF_DEN: { + walkable_floor: { + material: "packed earth and dirt floor with claw marks, scratched by beast tracks", + lighting: "low key ambient lighting", + geometry: "surface", + }, + walkable_floor_alt: { + material: "packed earth darkened by old dried bloodstains, matted fur scraps", + lighting: "dim ambient lighting", + geometry: "surface", + }, + wall: { + material: + "rough natural cave wall of dark rock, deeply gouged by claws, damp", + lighting: "soft directional ambient from above", + geometry: "cube", + }, + difficult_terrain: { + material: "scattered pile of gnawed bones and animal skulls on dirt floor", + lighting: "muted ambient lighting", + geometry: "surface", + }, + hazard_primary: { + material: + "dark congealed blood pool on dirt floor, viscous and stagnant, faint red glow", + lighting: "subtle dark red ambient glow from the pool itself", + geometry: "surface", + }, + obstacle_decor: { + material: "rough boulder of dark rock with claw-deep gouges, single object", + lighting: "soft directional ambient, soft shadow below", + geometry: "cube", + }, + decoration_minor: { + material: "matted clump of dark fur and shed claws on dirt floor", + lighting: "low key ambient illumination", + geometry: "surface", + }, + door_closed: { + material: + "heavy hide and bone curtain draped across an opening, primitive doorway", + lighting: "dim ambient illumination", + geometry: "cube", + }, + }, + MAUSOLEUM: { + walkable_floor: { + material: + "polished gray-veined white marble floor, cool and somber, faintly chipped", + lighting: "pale cool blue ambient lighting from above", + geometry: "surface", + }, + walkable_floor_alt: { + material: + "cracked white marble slab with hairline fractures and slight dust drift", + lighting: "pale cool ambient, very low key", + geometry: "surface", + }, + wall: { + material: + "smooth gray granite wall with carved niche showing an empty urn alcove", + lighting: "pale cool directional ambient from above, no source visible", + geometry: "cube", + }, + difficult_terrain: { + material: "scattered shards of broken funerary urns and white marble dust", + lighting: "muted pale ambient", + geometry: "surface", + }, + obstacle_decor: { + material: + "weathered marble statue of a fallen angel with broken wings, kneeling, single isolated object", + lighting: "pale cool ambient from above, soft shadow under the statue", + geometry: "cube", + }, + decoration_minor: { + material: "small bronze plaque set in marble floor with weathered inscriptions", + lighting: "low key cool ambient", + geometry: "surface", + }, + door_closed: { + material: + "tarnished bronze double door with gothic relief of mourning figures, sealed", + lighting: "pale ambient lighting on the metal, no source visible", + geometry: "cube", + }, + stairs: { + material: "wide marble stairs descending, worn smooth at the center, somber", + lighting: "pale cool ambient gloom from below", + geometry: "cube", + }, + }, + BLOOD_TOMB: { + walkable_floor: { + material: + "dark ritual stone slab with faint crimson runes etched along the seams, weathered", + lighting: "very low key dark red ambient", + geometry: "surface", + }, + walkable_floor_alt: { + material: + "ritual stone slab darkened by old dried bloodstains in concentric ring patterns", + lighting: "subtle dark red ambient", + geometry: "surface", + }, + wall: { + material: + "black volcanic stone wall carved with bleeding crimson runes that drip downward", + lighting: "ominous dark red ambient glow from the runes themselves", + geometry: "cube", + }, + difficult_terrain: { + material: + "thick layer of dried dark blood and ritual ash spread across the stone floor", + lighting: "muted dark red ambient", + geometry: "surface", + }, + hazard_primary: { + material: + "single bleeding ritual rune carved into stone slab, glowing crimson, viscous", + lighting: "intense crimson glow emanating from the rune itself", + geometry: "surface", + }, + obstacle_decor: { + material: + "weathered black stone ritual altar carved with bleeding sigils, single isolated object", + lighting: "subtle crimson ambient glow, ominous shadow below", + geometry: "cube", + }, + decoration_minor: { + material: + "shallow groove etched into stone slab in spiral pattern, dark blood residue", + lighting: "very low key dark red ambient", + geometry: "surface", + }, + door_closed: { + material: + "massive black stone door sealed with crimson wax seal and gothic carvings", + lighting: "subtle dark red ambient on the stone, no source visible", + geometry: "cube", + }, + }, + VILLAGE: { + walkable_floor: { + material: + "wet cobblestone street glistening with rain, dark stones with mossy gaps", + lighting: "cool overcast daylight, muted blue-gray", + geometry: "surface", + }, + walkable_floor_alt: { + material: + "muddy ground with shallow puddles and trampled grass at the edges", + lighting: "overcast muted daylight", + geometry: "surface", + }, + wall: { + material: + "timber-framed plaster wall of a gothic eastern european village house, weathered wood beams and cracked plaster", + lighting: "cool overcast daylight, ambient from above", + geometry: "cube", + }, + difficult_terrain: { + material: + "deep mud puddle in cobblestone street, reflective with rain ripples", + lighting: "overcast cool reflection", + geometry: "surface", + }, + obstacle_decor: { + material: + "old stone village well with iron crank, weathered and moss-covered, single isolated object", + lighting: "overcast daylight from above, soft shadow", + geometry: "cube", + }, + decoration_minor: { + material: + "abandoned wooden market stall planks on cobblestone, draped with damp canvas", + lighting: "cool overcast ambient", + geometry: "surface", + }, + door_closed: { + material: + "weathered wooden cottage door with iron hinges, closed, planks dark from rain", + lighting: "overcast cool daylight on the wood", + geometry: "cube", + }, + }, + HAUNTED_FOREST: { + walkable_floor: { + material: + "dark forest floor covered in black moss and tangled roots, damp and uneven", + lighting: "deep green-tinted ambient, very low key", + geometry: "surface", + }, + walkable_floor_alt: { + material: + "carpet of dead russet leaves and twigs on dark forest soil", + lighting: "muted ambient lighting", + geometry: "surface", + }, + wall: { + material: + "tall dead tree trunk with peeling bark and dead branches, blocking passage, gnarled", + lighting: "dark green-tinted ambient from above", + geometry: "cube", + }, + difficult_terrain: { + material: + "dense bramble thicket of dark thorny vines on forest floor", + lighting: "muted green ambient", + geometry: "surface", + }, + hazard_primary: { + material: + "patch of swirling parasitic mist on the forest floor, pale gray-green wisps", + lighting: "sickly pale green underglow from the mist", + geometry: "surface", + }, + obstacle_decor: { + material: + "large moss-covered boulder in dark forest, single isolated object", + lighting: "dark green ambient from above, soft shadow below", + geometry: "cube", + }, + decoration_minor: { + material: + "cluster of small pale mushrooms growing on moss-covered forest floor", + lighting: "dim green ambient", + geometry: "surface", + }, + }, + TAVERN_BLOOD_PRINCE: { + walkable_floor: { + material: + "dark oak plank floor with knots and grain lines, slightly worn at the center", + lighting: "soft top-down ambient illumination", + geometry: "surface", + }, + walkable_floor_alt: { + material: + "darker oak plank floor with ale stains and scuffs near the tables", + lighting: "low key ambient illumination", + geometry: "surface", + }, + wall: { + material: + "cream plaster wall with cracked patches and exposed dark wooden beams, gothic country inn", + lighting: "soft directional ambient illumination", + geometry: "cube", + }, + difficult_terrain: { + material: + "spilled puddle of dark ale on plank floor, with broken wooden mug shards", + lighting: "soft ambient reflection on the puddle", + geometry: "surface", + }, + obstacle_decor: { + material: + "sturdy round wooden table with dark stained surface and turned legs, single isolated object", + lighting: "soft top-down ambient illumination, soft shadow below", + geometry: "cube", + }, + decoration_minor: { + material: + "single wooden chair tipped over on plank floor, dark stained finish", + lighting: "low key ambient illumination", + geometry: "surface", + }, + door_closed: { + material: + "thick oak tavern door with iron strapping and a small barred window slot", + lighting: "soft directional ambient on the wood", + geometry: "cube", + }, + stairs: { + material: + "narrow wooden tavern stairs ascending, dark oak with worn treads", + lighting: "soft ambient illumination, slight gradient from below", + geometry: "cube", + }, + }, + AQUATIC: { + walkable_floor: { + material: "still black water with lily pads and submerged ruins, oily surface", + lighting: "dim diffuse moonlight filtering through mist, low key", + geometry: "surface", + }, + walkable_floor_alt: { + material: "murky stagnant water with floating algae and submerged debris", + lighting: "very low key neutral ambient illumination", + geometry: "surface", + }, + wall: { + material: "weeping stone wall with water seepage and dark mildew stains", + lighting: "directional cool ambient lighting from above, no source visible", + geometry: "cube", + }, + wall_corner: { + material: "damp stone corner block with algae growth, time-worn", + lighting: "directional cool ambient lighting from above, no source visible", + geometry: "cube", + }, + difficult_terrain: { + material: "slick algae-covered flagstone with puddles and slippery moss", + lighting: "muted gray ambient lighting", + geometry: "surface", + }, + hazard_primary: { + material: "deep black water with unseen undertow and faint ripples on surface", + lighting: "eerie blue-green underglow from below the water", + geometry: "surface", + }, + obstacle_decor: { + material: "half-submerged stone sarcophagus lid with carved effigy, weathered", + lighting: "soft directional ambient lighting from above, soft shadow under water", + geometry: "cube", + }, + decoration_minor: { + material: "single floating white water lily on black water surface", + lighting: "low key cool ambient tint", + geometry: "surface", + }, + door_closed: { + material: "iron-bound oak door with barnacles and dark water stains, closed", + lighting: "soft directional ambient illumination on the wet wood", + geometry: "cube", + }, + stairs: { + material: "stone steps descending into dark water, narrow, slippery with slime", + lighting: "dark cool ambient gloom rising from below", + geometry: "cube", + }, + }, + GLACIAIRE: { + walkable_floor: { + material: "black ice with trapped air bubbles and frozen debris inside", + lighting: "dim diffuse pale blue light, low key", + geometry: "surface", + }, + walkable_floor_alt: { + material: "frost-rimed flagstone with ice patches and hoarfrost", + lighting: "very low key neutral ambient illumination", + geometry: "surface", + }, + wall: { + material: "glacial ice wall with frozen figures trapped inside, pale blue", + lighting: "directional cool ambient lighting from above, no source visible", + geometry: "cube", + }, + wall_corner: { + material: "sharp ice corner block with frost rime and crack lines", + lighting: "directional cool ambient lighting from above, no source visible", + geometry: "cube", + }, + difficult_terrain: { + material: "cracked ice sheets and frost heaves on stone, jagged", + lighting: "muted pale blue ambient lighting", + geometry: "surface", + }, + hazard_primary: { + material: "thin ice over freezing water with visible cracks and bubbles beneath", + lighting: "eerie pale blue underglow from cracks in the ice", + geometry: "surface", + }, + obstacle_decor: { + material: "frozen stone statue encased in clear ice, single solitary object", + lighting: "soft directional ambient lighting from above, soft shadow under ice", + geometry: "cube", + }, + decoration_minor: { + material: "icicles hanging from stone ledge, glistening, very subtle", + lighting: "low key cool ambient tint", + geometry: "surface", + }, + door_closed: { + material: "iron-bound oak door rimed with thick frost and ice crystals", + lighting: "soft directional ambient illumination on the frosted wood", + geometry: "cube", + }, + stairs: { + material: "ice-slick stone stairs descending into blue gloom, narrow", + lighting: "dark cool ambient gloom rising from below", + geometry: "cube", + }, + }, + INONDE: { + walkable_floor: { + material: "stagnant black water with floating debris and oil sheen", + lighting: "dim diffuse gray-green light, low key", + geometry: "surface", + }, + walkable_floor_alt: { + material: "muddy tidal flats with cracked silt and shallow puddles", + lighting: "muted neutral ambient illumination", + geometry: "surface", + }, + wall: { + material: "waterlogged stone wall with barnacles and seaweed stains", + lighting: "directional cool ambient lighting from above, no source visible", + geometry: "cube", + }, + wall_corner: { + material: "submerged stone corner block with algae and mineral deposits", + lighting: "directional cool ambient lighting from above, no source visible", + geometry: "cube", + }, + difficult_terrain: { + material: "tangled kelp and seaweed on silt-covered floor", + lighting: "muted blue-green ambient lighting", + geometry: "surface", + }, + hazard_primary: { + material: "deep underwater current with visible undertow and swirling silt", + lighting: "eerie blue-green underglow from below the water", + geometry: "surface", + }, + obstacle_decor: { + material: "sunken stone statue half-buried in silt, weathered", + lighting: "soft directional ambient lighting from above, soft shadow under water", + geometry: "cube", + }, + decoration_minor: { + material: "floating driftwood fragment on black water surface", + lighting: "low key cool ambient tint", + geometry: "surface", + }, + door_closed: { + material: "bloated wood door swollen by water, rusted iron bands", + lighting: "soft directional ambient illumination on the wet wood", + geometry: "cube", + }, + stairs: { + material: "slippery stone steps descending into dark water, algae-covered", + lighting: "dark cool ambient gloom rising from below", + geometry: "cube", + }, + }, + VOLCAN: { + walkable_floor: { + material: "cooled black lava with rough, jagged surface", + lighting: "dim red ambient glow from below", + geometry: "surface", + }, + walkable_floor_alt: { + material: "gray ash ground with scattered cinders", + lighting: "muted warm neutral ambient illumination", + geometry: "surface", + }, + wall: { + material: "dark basalt wall with volcanic pores and heat cracks", + lighting: "directional warm ambient lighting from above, no source visible", + geometry: "cube", + }, + wall_corner: { + material: "magma-heated stone corner with glowing fissures", + lighting: "directional warm ambient lighting from above, no source visible", + geometry: "cube", + }, + difficult_terrain: { + material: "cracked obsidian shards and volcanic glass", + lighting: "muted orange-red ambient lighting", + geometry: "surface", + }, + hazard_primary: { + material: "flowing lava with bright molten core and black crust", + lighting: "intense red-orange underglow from molten rock", + geometry: "surface", + }, + obstacle_decor: { + material: "obsidian menhir with volcanic etchings, single solitary block", + lighting: "soft directional ambient lighting from above, soft shadow", + geometry: "cube", + }, + decoration_minor: { + material: "glowing ember ash floating in hot air", + lighting: "low key warm ambient tint", + geometry: "surface", + }, + door_closed: { + material: "iron-bound door with volcanic rivets and heat stains", + lighting: "soft directional ambient illumination on hot metal", + geometry: "cube", + }, + stairs: { + material: "ash-covered stone stairs descending into volcanic darkness", + lighting: "dark warm ambient gloom rising from below", + geometry: "cube", + }, + }, + FORET: { + walkable_floor: { + material: "thick moss-covered forest floor with exposed roots", + lighting: "dappled green ambient light filtering through canopy", + geometry: "surface", + }, + walkable_floor_alt: { + material: "pine needles and decaying leaves on soft earth", + lighting: "muted forest green ambient illumination", + geometry: "surface", + }, + wall: { + material: "ancient gnarled tree trunk with bark and sap", + lighting: "directional cool ambient lighting from above, no source visible", + geometry: "cube", + }, + wall_corner: { + material: "twisted forest root corner with moss and soil", + lighting: "directional cool ambient lighting from above, no source visible", + geometry: "cube", + }, + difficult_terrain: { + material: "dense thicket of brambles and thorny vines", + lighting: "muted green-gray ambient lighting", + geometry: "surface", + }, + hazard_primary: { + material: "quicksand pool with sucking mud and floating debris", + lighting: "eerie green-gray underglow from below the mire", + geometry: "surface", + }, + obstacle_decor: { + material: "standing stone circle monolith covered in lichen", + lighting: "soft directional ambient lighting from above, soft shadow under stone", + geometry: "cube", + }, + decoration_minor: { + material: "single fallen autumn leaf on moss", + lighting: "low key cool ambient tint", + geometry: "surface", + }, + door_closed: { + material: "heavy wooden gate with iron bands and moss growth", + lighting: "soft directional ambient illumination on weathered wood", + geometry: "cube", + }, + stairs: { + material: "root-entwined stone steps descending into woodland gloom", + lighting: "dark cool ambient gloom rising from below", + geometry: "cube", + }, + }, + HIVER: { + walkable_floor: { + material: "fresh powder snow with subtle wind ripples", + lighting: "bright cool white ambient light, low key", + geometry: "surface", + }, + walkable_floor_alt: { + material: "packed ice with frost patterns and trapped air", + lighting: "very low key neutral ambient illumination", + geometry: "surface", + }, + wall: { + material: "snow drift wall with compacted ice layers", + lighting: "directional cool ambient lighting from above, no source visible", + geometry: "cube", + }, + wall_corner: { + material: "frozen ice corner with rime and crack lines", + lighting: "directional cool ambient lighting from above, no source visible", + geometry: "cube", + }, + difficult_terrain: { + material: "slush and half-melted snow with hidden ice", + lighting: "muted pale blue ambient lighting", + geometry: "surface", + }, + hazard_primary: { + material: "thin ice over frozen lake with visible cracks beneath", + lighting: "eerie pale blue underglow from cracks in ice", + geometry: "surface", + }, + obstacle_decor: { + material: "frozen stone cairn encased in clear ice, solitary", + lighting: "soft directional ambient lighting from above, soft shadow under ice", + geometry: "cube", + }, + decoration_minor: { + material: "single snowflake crystal on ice surface", + lighting: "low key cool ambient tint", + geometry: "surface", + }, + door_closed: { + material: "frosted log door with thick ice crystals and snow", + lighting: "soft directional ambient illumination on frosted wood", + geometry: "cube", + }, + stairs: { + material: "ice-slick stone stairs descending into winter darkness", + lighting: "dark cool ambient gloom rising from below", + geometry: "cube", + }, + }, + PRINTEMPS: { + walkable_floor: { + material: "green meadow grass with small wildflowers", + lighting: "soft pale green ambient light, bright", + geometry: "surface", + }, + walkable_floor_alt: { + material: "clover field with dew-covered leaves", + lighting: "muted fresh green ambient illumination", + geometry: "surface", + }, + wall: { + material: "living hedge wall with intertwined branches and blossoms", + lighting: "directional soft ambient lighting from above, no source visible", + geometry: "cube", + }, + wall_corner: { + material: "flowered arch corner with vines and spring blooms", + lighting: "directional soft ambient lighting from above, no source visible", + geometry: "cube", + }, + difficult_terrain: { + material: "muddy spring puddle with reeds and wet earth", + lighting: "muted green-gray ambient lighting", + geometry: "surface", + }, + hazard_primary: { + material: "swollen spring stream with fast current and foam", + lighting: "eerie pale green underglow from moving water", + geometry: "surface", + }, + obstacle_decor: { + material: "maypole with ribbons and flower garlands, solitary", + lighting: "soft directional ambient lighting from above, soft shadow", + geometry: "cube", + }, + decoration_minor: { + material: "single wildflower on green grass", + lighting: "low key fresh ambient tint", + geometry: "surface", + }, + door_closed: { + material: "woven wicker door with spring flowers and vines", + lighting: "soft directional ambient illumination on woven wood", + geometry: "cube", + }, + stairs: { + material: "moss-covered stone steps descending into spring glade", + lighting: "dark soft ambient gloom rising from below", + geometry: "cube", + }, + }, + ETE: { + walkable_floor: { + material: "golden wheat field with ripe stalks", + lighting: "warm pale yellow ambient light, bright", + geometry: "surface", + }, + walkable_floor_alt: { + material: "dry summer grass with scattered straw", + lighting: "muted warm neutral ambient illumination", + geometry: "surface", + }, + wall: { + material: "sunbaked clay wall with cracks and dust", + lighting: "directional warm ambient lighting from above, no source visible", + geometry: "cube", + }, + wall_corner: { + material: "terracotta corner block with heat-cured surface", + lighting: "directional warm ambient lighting from above, no source visible", + geometry: "cube", + }, + difficult_terrain: { + material: "cracked dry earth with dust and pebbles", + lighting: "muted orange-brown ambient lighting", + geometry: "surface", + }, + hazard_primary: { + material: "heat haze pool with shimmering air distortion", + lighting: "eerie warm underglow from heated ground", + geometry: "surface", + }, + obstacle_decor: { + material: "weathered scarecrow with straw and tattered cloth", + lighting: "soft directional ambient lighting from above, soft shadow", + geometry: "cube", + }, + decoration_minor: { + material: "single dried herb on golden wheat", + lighting: "low key warm ambient tint", + geometry: "surface", + }, + door_closed: { + material: "weathered plank door with sun-bleached wood", + lighting: "soft directional ambient illumination on dry wood", + geometry: "cube", + }, + stairs: { + material: "dusty stone steps descending into summer heat", + lighting: "dark warm ambient gloom rising from below", + geometry: "cube", + }, + }, + AUTOMNE: { + walkable_floor: { + material: "thick carpet of fallen autumn leaves in rust and gold", + lighting: "soft warm amber ambient light, low key", + geometry: "surface", + }, + walkable_floor_alt: { + material: "damp earth with fallen leaves and pine cones", + lighting: "muted brown-green ambient illumination", + geometry: "surface", + }, + wall: { + material: "rustic oak wall with bark and autumn vines", + lighting: "directional warm ambient lighting from above, no source visible", + geometry: "cube", + }, + wall_corner: { + material: "twisted branch corner with autumn leaves and moss", + lighting: "directional warm ambient lighting from above, no source visible", + geometry: "cube", + }, + difficult_terrain: { + material: "slippery leaf carpet with hidden roots and mud", + lighting: "muted orange-brown ambient lighting", + geometry: "surface", + }, + hazard_primary: { + material: "bog mire with sucking mud and floating autumn leaves", + lighting: "eerie brown-green underglow from below the mire", + geometry: "surface", + }, + obstacle_decor: { + material: "withered scarecrow with tattered autumn cloth", + lighting: "soft directional ambient lighting from above, soft shadow", + geometry: "cube", + }, + decoration_minor: { + material: "single acorn on leaf carpet", + lighting: "low key warm ambient tint", + geometry: "surface", + }, + door_closed: { + material: "ivy-covered wooden door with autumn leaves", + lighting: "soft directional ambient illumination on wood and vines", + geometry: "cube", + }, + stairs: { + material: "leaf-covered stone steps descending into autumn woods", + lighting: "dark warm ambient gloom rising from below", + geometry: "cube", + }, + }, + DESOLATION: { + walkable_floor: { + material: "cold gray ash with fine soot and scattered cinders", + lighting: "dim gray ambient light, desaturated", + geometry: "surface", + }, + walkable_floor_alt: { + material: "scorched black rock with heat fractures", + lighting: "muted dark gray ambient illumination", + geometry: "surface", + }, + wall: { + material: "charred stone wall with soot stains and burn marks", + lighting: "directional cool gray ambient lighting from above, no source visible", + geometry: "cube", + }, + wall_corner: { + material: "burnt corner block with ash and carbon deposits", + lighting: "directional cool gray ambient lighting from above, no source visible", + geometry: "cube", + }, + difficult_terrain: { + material: "sharp ash debris and broken glass shards", + lighting: "muted gray ambient lighting", + geometry: "surface", + }, + hazard_primary: { + material: "ash pit with sucking gray dust and hidden embers", + lighting: "eerie gray underglow from below the ash", + geometry: "surface", + }, + obstacle_decor: { + material: "skeletal dead tree with blackened branches, solitary", + lighting: "soft directional ambient lighting from above, soft shadow", + geometry: "cube", + }, + decoration_minor: { + material: "single dust mote floating in gray air", + lighting: "low key neutral ambient tint", + geometry: "surface", + }, + door_closed: { + material: "warped metal door with rust and burn scars", + lighting: "soft directional ambient illumination on corroded metal", + geometry: "cube", + }, + stairs: { + material: "rubble steps descending into desolation darkness", + lighting: "dark gray ambient gloom rising from below", + geometry: "cube", + }, + }, + FUTURISTE: { + walkable_floor: { + material: "plasteel floor plate with brushed metal finish", + lighting: "dim cool blue ambient light, low key", + geometry: "surface", + }, + walkable_floor_alt: { + material: "circuit board floor with etched traces and pads", + lighting: "muted neon-blue ambient illumination", + geometry: "surface", + }, + wall: { + material: "chrome panel wall with reflective surface", + lighting: "directional cool ambient lighting from above, no source visible", + geometry: "cube", + }, + wall_corner: { + material: "alloy corner block with seamless joints", + lighting: "directional cool ambient lighting from above, no source visible", + geometry: "cube", + }, + difficult_terrain: { + material: "broken conduit with exposed wiring and sparks", + lighting: "muted electric blue ambient lighting", + geometry: "surface", + }, + hazard_primary: { + material: "plasma leak with ionized gas and electrical arcs", + lighting: "intense neon-purple underglow from plasma", + geometry: "surface", + }, + obstacle_decor: { + material: "server rack with blinking lights and cables", + lighting: "soft directional ambient lighting from above, soft shadow", + geometry: "cube", + }, + decoration_minor: { + material: "holographic data tag floating in air", + lighting: "low key cool ambient tint", + geometry: "surface", + }, + door_closed: { + material: "sliding airlock door with sealed seam and indicator lights", + lighting: "soft directional ambient illumination on metal", + geometry: "cube", + }, + stairs: { + material: "metal grating stairs descending into futuristic depths", + lighting: "dark cool ambient gloom rising from below", + geometry: "cube", + }, + }, + ELECTRONIQUE: { + walkable_floor: { + material: "PCB trace floor with copper lines and solder pads", + lighting: "dim cool green ambient light, low key", + geometry: "surface", + }, + walkable_floor_alt: { + material: "chip substrate floor with printed circuits", + lighting: "muted neon-green ambient illumination", + geometry: "surface", + }, + wall: { + material: "server casing wall with metal panels and vents", + lighting: "directional cool ambient lighting from above, no source visible", + geometry: "cube", + }, + wall_corner: { + material: "circuit corner block with etched pathways", + lighting: "directional cool ambient lighting from above, no source visible", + geometry: "cube", + }, + difficult_terrain: { + material: "tangled fiber optic cables and data wires", + lighting: "muted electric cyan ambient lighting", + geometry: "surface", + }, + hazard_primary: { + material: "power surge with crackling electricity and arcs", + lighting: "intense electric blue underglow from surge", + geometry: "surface", + }, + obstacle_decor: { + material: "mainframe core with data drives and cooling", + lighting: "soft directional ambient lighting from above, soft shadow", + geometry: "cube", + }, + decoration_minor: { + material: "blinking LED indicator on dark panel", + lighting: "low key cool ambient tint", + geometry: "surface", + }, + door_closed: { + material: "biometric door with scanner panel and sealed frame", + lighting: "soft directional ambient illumination on metal", + geometry: "cube", + }, + stairs: { + material: "access ladder with metal rungs and cable trays", + lighting: "dark cool ambient gloom rising from below", + geometry: "cube", + }, + }, +}; + +export interface RenderedPrompt { + prompt: string; + geometry: "surface" | "cube"; + dimensions: { 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 the + * generation width/height and the post-process crop target). + */ +export function buildPrompt( + theme: ThemeKey, + role: ThemeRole, + overrides?: { material?: string; lighting?: string; extraDetail?: string }, +): RenderedPrompt { + const visual = ROLE_VISUALS[theme]?.[role]; + if (!visual) { + throw new Error( + `Pas de prompt visual défini pour theme=${theme} role=${role}. ` + + `Ajoute une entrée dans ROLE_VISUALS dans src/themes/prompts.ts, ` + + `ou passe material+lighting via overrides.`, + ); + } + const material = overrides?.material ?? visual.material; + const lighting = overrides?.lighting ?? visual.lighting; + const base = + visual.geometry === "surface" + ? SURFACE_TEMPLATE(material, lighting) + : CUBE_TEMPLATE(material, lighting); + const prompt = overrides?.extraDetail ? `${base}, ${overrides.extraDetail}` : base; + return { + prompt, + geometry: visual.geometry, + dimensions: + visual.geometry === "surface" + ? { width: 1024, height: 1024 } // FLUX préfère carré, on croppe en post-process + : { width: 1024, height: 1024 }, + }; +} diff --git a/tiled-mcp/src/themes/tavern.ts b/tiled-mcp/src/themes/tavern.ts new file mode 100644 index 0000000000000000000000000000000000000000..2b64f932c6f9710852fbf0cd7f1ccd7c373038c5 --- /dev/null +++ b/tiled-mcp/src/themes/tavern.ts @@ -0,0 +1,26 @@ +import type { Theme } from "../types.js"; + +// Sprite paths are "./assets//.png", relative to the repository root +// (or TILED_ASSETS_DIR). save_to_disk rewrites them relative to the saved .tmj file. +const A = "./assets/tavern_blood_prince"; + +export const TAVERN_BLOOD_PRINCE: Theme = { + key: "TAVERN_BLOOD_PRINCE", + name: "Auberge du Prince Sanglant", + description: + "Parquet sombre, enduit fissuré, lourde charpente apparente. Tables rondes en chêne, âtre crépitant, bar marbré de taches anciennes. Pas de pièges actifs — la peur suffit.", + tilesetName: "tavern-tileset", + tilewidth: 64, + tileheight: 32, + tiles: [ + { role: "walkable_floor", tileType: "WALKABLE", spriteId: "tavern.plank_floor", imageFile: `${A}/walkable_floor.png` }, + { role: "walkable_floor_alt", tileType: "WALKABLE", spriteId: "tavern.plank_floor_worn", imageFile: `${A}/walkable_floor_alt.png` }, + { role: "wall", tileType: "WALL", spriteId: "tavern.plaster_wall", imageFile: `${A}/wall.png`, imageWidth: 64, imageHeight: 64 }, + { role: "difficult_terrain", tileType: "DIFFICULT_TERRAIN", spriteId: "tavern.spilled_ale", imageFile: `${A}/difficult_terrain.png` }, + { role: "obstacle_decor", tileType: "OBSTACLE", spriteId: "tavern.table", imageFile: `${A}/obstacle_decor.png`, imageWidth: 64, imageHeight: 64 }, + { role: "decoration_minor", tileType: "WALKABLE", spriteId: "tavern.chair", imageFile: `${A}/decoration_minor.png` }, + { role: "door_closed", tileType: "DOOR", spriteId: "tavern.wood_door", imageFile: `${A}/door_closed.png`, imageWidth: 64, imageHeight: 64 }, + { role: "stairs", tileType: "STAIRS", spriteId: "tavern.wood_stairs", imageFile: `${A}/stairs.png`, imageWidth: 64, imageHeight: 64 }, + ], + ambient: { lightColor: "#3a2a18", fogIntensity: 0.05 }, +}; diff --git a/tiled-mcp/src/themes/village.ts b/tiled-mcp/src/themes/village.ts new file mode 100644 index 0000000000000000000000000000000000000000..3281da23832d5b218d703cef30b76471cf6d1b3d --- /dev/null +++ b/tiled-mcp/src/themes/village.ts @@ -0,0 +1,25 @@ +import type { Theme } from "../types.js"; + +// Sprite paths are "./assets//.png", relative to the repository root +// (or TILED_ASSETS_DIR). save_to_disk rewrites them relative to the saved .tmj file. +const A = "./assets/village"; + +export const VILLAGE: Theme = { + key: "VILLAGE", + name: "Village mournevaldien", + description: + "Pavés humides luisant sous la pluie perpétuelle, maisons à colombages aux fenêtres closes, étals de marché abandonnés, puits central et potence rouillée sur la place.", + tilesetName: "village-tileset", + tilewidth: 64, + tileheight: 32, + tiles: [ + { role: "walkable_floor", tileType: "WALKABLE", spriteId: "village.cobblestone", imageFile: `${A}/walkable_floor.png` }, + { role: "walkable_floor_alt", tileType: "WALKABLE", spriteId: "village.mud", imageFile: `${A}/walkable_floor_alt.png` }, + { role: "wall", tileType: "WALL", spriteId: "village.timber_wall", imageFile: `${A}/wall.png`, imageWidth: 64, imageHeight: 64 }, + { role: "difficult_terrain", tileType: "DIFFICULT_TERRAIN", spriteId: "village.mud_puddle", imageFile: `${A}/difficult_terrain.png` }, + { role: "obstacle_decor", tileType: "OBSTACLE", spriteId: "village.well", imageFile: `${A}/obstacle_decor.png`, imageWidth: 64, imageHeight: 64 }, + { role: "decoration_minor", tileType: "WALKABLE", spriteId: "village.market_stall", imageFile: `${A}/decoration_minor.png` }, + { role: "door_closed", tileType: "DOOR", spriteId: "village.house_door", imageFile: `${A}/door_closed.png`, imageWidth: 64, imageHeight: 64 }, + ], + ambient: { lightColor: "#283040", fogIntensity: 0.3 }, +}; diff --git a/tiled-mcp/src/themes/volcan.ts b/tiled-mcp/src/themes/volcan.ts new file mode 100644 index 0000000000000000000000000000000000000000..52bf0ec65ab36c57b6136ebd0318c19de3efb606 --- /dev/null +++ b/tiled-mcp/src/themes/volcan.ts @@ -0,0 +1,28 @@ +import type { Theme } from "../types.js"; + +// Sprite paths are "./assets//.png", relative to the repository root +// (or TILED_ASSETS_DIR). save_to_disk rewrites them relative to the saved .tmj file. +const V = "./assets/volcan"; + +export const VOLCAN: Theme = { + key: "VOLCAN", + name: "Pente Volcanique", + description: + "Coulées de lave, roches noires refroidies, cendres volantes, chaleur étouffante. Caldera active, ponts de basalte, cryptes de cendre.", + tilesetName: "volcan-tileset", + tilewidth: 64, + tileheight: 32, + tiles: [ + { role: "walkable_floor", tileType: "WALKABLE", spriteId: "volcan.cooled_lava", imageFile: `${V}/walkable_floor.png` }, + { role: "walkable_floor_alt", tileType: "WALKABLE", spriteId: "volcan.ash_ground", imageFile: `${V}/walkable_floor_alt.png` }, + { role: "wall", tileType: "WALL", spriteId: "volcan.dark_basalt", imageFile: `${V}/wall.png`, imageWidth: 64, imageHeight: 64 }, + { role: "wall_corner", tileType: "WALL", spriteId: "volcan.magma_corner", imageFile: `${V}/wall_corner.png`, imageWidth: 64, imageHeight: 64 }, + { role: "difficult_terrain", tileType: "DIFFICULT_TERRAIN", spriteId: "volcan.cracked_obsidian", imageFile: `${V}/difficult_terrain.png` }, + { role: "hazard_primary", tileType: "HAZARD", spriteId: "volcan.lava_flow", imageFile: `${V}/hazard_primary.png`, imageWidth: 64, imageHeight: 64 }, + { role: "obstacle_decor", tileType: "OBSTACLE", spriteId: "volcan.obsidian_menhir", imageFile: `${V}/obstacle_decor.png`, imageWidth: 64, imageHeight: 64 }, + { role: "decoration_minor", tileType: "WALKABLE", spriteId: "volcan.ember_ash", imageFile: `${V}/decoration_minor.png` }, + { role: "door_closed", tileType: "DOOR", spriteId: "volcan.iron_door", imageFile: `${V}/door_closed.png`, imageWidth: 64, imageHeight: 64 }, + { role: "stairs", tileType: "STAIRS", spriteId: "volcan.ash_stairs", imageFile: `${V}/stairs.png`, imageWidth: 64, imageHeight: 64 }, + ], + ambient: { lightColor: "#1a0a00", fogIntensity: 0.4 }, +}; diff --git a/tiled-mcp/src/themes/werewolf-den.ts b/tiled-mcp/src/themes/werewolf-den.ts new file mode 100644 index 0000000000000000000000000000000000000000..9d00c9dd56c254b10da4041a73f4804fb165592e --- /dev/null +++ b/tiled-mcp/src/themes/werewolf-den.ts @@ -0,0 +1,33 @@ +import type { Theme } from "../types.js"; + +// Sprite paths are "./assets//.png", relative to the repository root +// (or TILED_ASSETS_DIR). save_to_disk rewrites them relative to the saved .tmj file. +const A = "./assets/werewolf_den"; + +export const WEREWOLF_DEN: Theme = { + key: "WEREWOLF_DEN", + name: "Tanière de loups-garous", + description: + "Cavernes humides creusées dans la forêt de Drakenmark, sol en terre battue jonché d'ossements, parois rocheuses entaillées par les griffes, mares de sang frénétique près des proies récentes.", + tilesetName: "werewolf-den-tileset", + tilewidth: 64, + tileheight: 32, + tiles: [ + { role: "walkable_floor", tileType: "WALKABLE", spriteId: "den.dirt", imageFile: `${A}/walkable_floor.png` }, + { role: "walkable_floor_alt", tileType: "WALKABLE", spriteId: "den.dirt_bloody", imageFile: `${A}/walkable_floor_alt.png` }, + { role: "wall", tileType: "WALL", spriteId: "den.cave_wall", imageFile: `${A}/wall.png`, imageWidth: 64, imageHeight: 64 }, + { role: "difficult_terrain", tileType: "DIFFICULT_TERRAIN", spriteId: "den.bone_pile", imageFile: `${A}/difficult_terrain.png` }, + { + role: "hazard_primary", + tileType: "HAZARD", + spriteId: "den.blood_pool", + hazardType: "necrotique", + hazardNotation: "1d6", + imageFile: `${A}/hazard_primary.png`, + }, + { role: "obstacle_decor", tileType: "OBSTACLE", spriteId: "den.boulder", imageFile: `${A}/obstacle_decor.png`, imageWidth: 64, imageHeight: 64 }, + { role: "decoration_minor", tileType: "WALKABLE", spriteId: "den.fur", imageFile: `${A}/decoration_minor.png` }, + { role: "door_closed", tileType: "DOOR", spriteId: "den.hide_curtain", imageFile: `${A}/door_closed.png`, imageWidth: 64, imageHeight: 64 }, + ], + ambient: { lightColor: "#1f1410", fogIntensity: 0.25 }, +}; diff --git a/tiled-mcp/src/tmj.ts b/tiled-mcp/src/tmj.ts new file mode 100644 index 0000000000000000000000000000000000000000..f3a7a47b9a8ca35012714a07f6ddc194a4ce96bb --- /dev/null +++ b/tiled-mcp/src/tmj.ts @@ -0,0 +1,39 @@ +// Writing maps to disk. Theme tiles reference their sprites as "./assets//.png", +// a path relative to the repository root. Tiled resolves tile images relative to the .tmj +// file itself, so before writing a file we rewrite those paths relative to its folder. + +import { mkdir, writeFile } from "node:fs/promises"; +import { dirname, isAbsolute, join, relative, sep } from "node:path"; +import { serializeMap, type MapId } from "./builder.js"; +import { assetsRoot } from "./paths.js"; +import type { TiledMap } from "./types.js"; + +export const ASSET_PREFIX = "./assets/"; + +/** Rewrite "./assets/..." tile images so they resolve from the folder of `outFile`. */ +export function relativizeImagePaths(map: TiledMap, outFile: string, root = assetsRoot()): TiledMap { + const fromDir = dirname(outFile); + for (const tileset of map.tilesets) { + for (const tile of tileset.tiles ?? []) { + if (!tile.image?.startsWith(ASSET_PREFIX)) continue; + const target = join(root, tile.image.slice(ASSET_PREFIX.length)); + const rel = relative(fromDir, target); + // Different Windows drives have no relative path: keep the absolute one. + tile.image = isAbsolute(rel) + ? target.split(sep).join("/") + : rel.startsWith("..") + ? rel.split(sep).join("/") + : `./${rel.split(sep).join("/")}`; + } + } + return 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) }; +} diff --git a/tiled-mcp/src/tools/export.ts b/tiled-mcp/src/tools/export.ts new file mode 100644 index 0000000000000000000000000000000000000000..c9d38f770b88cf2a5e3d8a958cc69fae478facfc --- /dev/null +++ b/tiled-mcp/src/tools/export.ts @@ -0,0 +1,130 @@ +import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; +import { z } from "zod"; +import { basename, extname } from "node:path"; +import { getMap, objectCoordMode, serializeMap } from "../builder.js"; +import { 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. */ +function validateTiledShape(json: unknown): string[] { + const errors: string[] = []; + if (!json || typeof json !== "object") return ["The root of the map JSON must be an object."]; + const o = json as Record; + for (const k of ["width", "height", "tilewidth", "tileheight", "orientation", "layers"]) { + if (!(k in o)) errors.push(`Missing required field: ${k}`); + } + if (typeof o.width !== "number" || (o.width as number) <= 0) errors.push("Invalid width"); + if (typeof o.height !== "number" || (o.height as number) <= 0) errors.push("Invalid height"); + if (o.orientation !== "isometric" && o.orientation !== "orthogonal") { + errors.push(`Unsupported orientation: ${String(o.orientation)}`); + } + if (!Array.isArray(o.layers)) errors.push("layers must be an array"); + return errors; +} + +export function registerExportTools(server: McpServer): void { + server.registerTool( + "validate_map", + { + title: "Validate a map", + description: + "Checks the map before export: Tiled structure (errors) and gameplay sanity (warnings): at least one player spawn, no object or spawn on a wall or outside the painted ground, no door left inside a wall. Returns { ok, errors, warnings }.", + inputSchema: { mapId: z.string() }, + annotations: { readOnlyHint: true, openWorldHint: false }, + }, + async ({ mapId }) => { + const state = getMap(mapId); + const 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; + } + if (onWall) warnings.push(`"${who.name}" (${who.type}) at (${x}, ${y}) stands on a wall.`); + else if (!onGround) warnings.push(`"${who.name}" (${who.type}) at (${x}, ${y}) stands outside the painted ground.`); + } + + return asText({ ok: errors.length === 0, errors, warnings, objectCoordinates: objectCoordMode() }); + }, + ); + + server.registerTool( + "export_json", + { + title: "Export as Tiled JSON", + description: + "Returns the full Tiled JSON (.tmj content) of a map as text. Sprite paths are written as './assets//.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()) { + // The hosted server never writes to its own disk: the caller gets a download link instead. + server.registerTool( + "save_to_disk", + { + title: "Save (download link)", + description: + "Hosted server: packs the map into a .zip holding the .tmj file and the sprites it uses (including sprites generated in this session), laid out to open directly in Tiled, and returns a download link plus a link to the bare .tmj. Links expire after one hour. Only the file name of path is used; folders are ignored.", + inputSchema: { + mapId: z.string(), + path: z.string().min(1).describe("File name ending in .tmj or .json, e.g. 'crypt-chapel.tmj'"), + }, + annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false }, + }, + async ({ mapId, path }) => { + const name = basename(path.replace(/\\/g, "/")); + const ext = extname(name).toLowerCase(); + if (ext !== ".tmj" && ext !== ".json") { + throw new Error(`The file name must end in .tmj or .json (got '${path}').`); + } + getMap(mapId); + return asText({ ok: true, ...publishMap(mapId, name) }); + }, + ); + return; + } + + server.registerTool( + "save_to_disk", + { + 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: z + .string() + .min(1) + .describe("File path ending in .tmj or .json, e.g. 'crypt-chapel.tmj' (goes to the maps folder) or an absolute path"), + }, + annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false }, + }, + async ({ mapId, path }) => { + const ext = extname(path).toLowerCase(); + if (ext !== ".tmj" && ext !== ".json") { + throw new Error(`The file name must end in .tmj or .json (got '${path}').`); + } + getMap(mapId); + const target = resolveUserPath(path, mapsRoot()); + const saved = await saveMapFile(mapId, target); + return asText({ ok: true, ...saved }); + }, + ); +} diff --git a/tiled-mcp/src/tools/generation.ts b/tiled-mcp/src/tools/generation.ts new file mode 100644 index 0000000000000000000000000000000000000000..30119dddcc113976727b2b67a5d2a1c99c4dfd89 --- /dev/null +++ b/tiled-mcp/src/tools/generation.ts @@ -0,0 +1,329 @@ +// Optional, paid sprite generation with FLUX.1-dev through Hugging Face Inference Providers. +// Everything else in this server is free and offline. sharp and @huggingface/inference are +// loaded lazily so the map tools keep working even if those packages fail to install. +// In hosted mode the call is billed to the caller's own token and the sprite stays in their +// session (src/sprites.ts) instead of the server's disk. + +import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; +import { z } from "zod"; +import { existsSync } from "node:fs"; +import { join } from "node:path"; +import { buildPrompt, NEGATIVE_PROMPT, type ThemeKey } from "../themes/prompts.js"; +import { THEME_KEYS, themeAssetDir } from "../themes/index.js"; +import { THEME_ROLES } from "../types.js"; +import { getMap, overrideTileImage } from "../builder.js"; +import { assetsRoot, resolveUserPath } from "../paths.js"; +import { ASSET_PREFIX } from "../tmj.js"; +import { currentScope, isHosted } from "../context.js"; +import { loadSharp, type Sharp } from "../sharp.js"; +import { saveSprite, spriteExists } from "../sprites.js"; +import { asText } from "./util.js"; + +/** + * Magenta chroma key. FLUX is asked for a pure #FF00FF background, a colour no gothic sprite + * contains, so removing it keeps the subject intact (deep blacks, shadows, iron included). + * Uses R/G and B/G ratios to also catch the desaturated magenta FLUX often produces + * (e.g. R142 G41 B100). Fully magenta pixels become transparent neutral grey (no halo after + * resize); partially magenta edge pixels fade out and are desaturated. + */ +async function chromaKeyMagenta(sharp: Sharp, buf: Buffer): Promise { + const { data, info } = await sharp(buf).ensureAlpha().raw().toBuffer({ resolveWithObject: true }); + const out = Buffer.from(data); + for (let i = 0; i < data.length; i += 4) { + const r = data[i]; + const g = data[i + 1]; + const b = data[i + 2]; + const gSafe = Math.max(g, 1); + const rRatio = r / gSafe; + const bRatio = b / gSafe; + const isFullMagenta = g < 80 && rRatio > 1.4 && bRatio > 1.4; + const isPartialMagenta = g < 130 && rRatio > 1.2 && bRatio > 1.2; + if (isFullMagenta) { + out[i] = 128; + out[i + 1] = 128; + out[i + 2] = 128; + out[i + 3] = 0; + } else if (isPartialMagenta) { + const fade = (g - 80) / 50; // 0..1: the greener, the more we keep + out[i + 3] = Math.round(fade * 255); + const avg = Math.round((r + g + b) / 3); + const ds = 1 - fade; + out[i] = Math.round(r * fade + avg * ds); + out[i + 1] = Math.round(g * fade + avg * ds); + out[i + 2] = Math.round(b * fade + avg * ds); + } + } + return sharp(out, { raw: { width: info.width, height: info.height, channels: 4 } }).png().toBuffer(); +} + +/** + * Downsample to the final iso tile size, keeping alpha: + * - surface (floors, minor decorations): centre 2:1 strip, resized to 64x32 + * - cube (walls, obstacles, doors, stairs): centre square, resized to 64x64 + */ +async function resizeForTile(sharp: Sharp, buf: Buffer, geometry: "surface" | "cube"): Promise { + const meta = await sharp(buf).metadata(); + const w = meta.width ?? 1024; + const h = meta.height ?? 1024; + if (geometry === "surface") { + const cropH = Math.floor(w / 2); + const top = Math.max(0, Math.floor((h - cropH) / 2)); + return sharp(buf) + .extract({ left: 0, top, width: w, height: cropH }) + .resize(64, 32, { kernel: "lanczos3" }) + .png() + .toBuffer(); + } + const side = Math.min(w, h); + return sharp(buf) + .extract({ left: Math.floor((w - side) / 2), top: Math.floor((h - side) / 2), width: side, height: side }) + .resize(64, 64, { kernel: "lanczos3" }) + .png() + .toBuffer(); +} + +/** The token paid calls use. Hosted mode only ever uses the caller's own token. */ +function hfToken(): string | null { + if (isHosted()) return currentScope().hfToken ?? null; + return process.env.HUGGINGFACE_API_KEY || process.env.HF_TOKEN || null; +} + +function hfProvider(): string { + return process.env.TILED_HF_PROVIDER || "replicate"; +} + +function missingToken() { + return isHosted() + ? { + ok: false, + error: "No Hugging Face token was sent with this request. Sprite generation is a paid Hugging Face service billed to your own account; map editing does not need it.", + hint: "Configure your MCP client to send the header 'Authorization: Bearer hf_...' with a token that can make calls to Inference Providers. See docs/hugging-face.md.", + } + : { + ok: false, + error: "HUGGINGFACE_API_KEY (or HF_TOKEN) is not set. Sprite generation is a paid Hugging Face service; map editing does not need it.", + hint: "Add the token to tiled-mcp/.env or to the env block of your MCP client configuration. See docs/sprite-generation.md.", + }; +} + +/** Generate one sprite PNG and return the processed bytes. */ +async function renderSprite(prompt: ReturnType, seed?: number) { + const sharp = await loadSharp(); + const { InferenceClient } = await import("@huggingface/inference"); + const client = new InferenceClient(hfToken()!); + const blob = (await client.textToImage({ + model: "black-forest-labs/FLUX.1-dev", + provider: hfProvider() as never, + inputs: prompt.prompt, + parameters: { + width: prompt.dimensions.width, + height: prompt.dimensions.height, + negative_prompt: NEGATIVE_PROMPT, + guidance_scale: 4.5, + ...(seed !== undefined ? { seed } : {}), + }, + })) as unknown as Blob; + const raw = Buffer.from(await blob.arrayBuffer()); + return resizeForTile(sharp, await chromaKeyMagenta(sharp, raw), prompt.geometry); +} + +const THEME = z.enum(THEME_KEYS).describe("Theme key from list_themes"); +const ROLE = z.enum(THEME_ROLES).describe("Tile role, e.g. walkable_floor, wall, obstacle_decor"); +const PAID = { readOnlyHint: false, destructiveHint: false, openWorldHint: true } as const; + +export function registerGenerationTools(server: McpServer): void { + server.registerTool( + "generate_tile_sprite", + { + title: "Generate one tile sprite (paid)", + description: + isHosted() + ? "PAID, billed to the Hugging Face token you send: generates one isometric sprite for (theme, role) with FLUX.1-dev via Hugging Face Inference Providers, removes the magenta background and resizes it to 64x32 (floors) or 64x64 (walls, props). The sprite is returned as an image and kept with your session as /.png, or __.png when variant is set; maps of this session use it in previews and save_to_disk downloads. Takes 20-40 s and costs money per call; preview the prompt with preview_sprite_prompt first. Every theme already ships its sprites, so an existing one is kept unless force is true." + : "PAID: generates one isometric sprite for (theme, role) with FLUX.1-dev via Hugging Face Inference Providers, removes the magenta background and resizes it to 64x32 (floors) or 64x64 (walls, props). Saves //.png, or __.png when variant is set. Takes 20-40 s and costs money per call; check that the file is missing first (list_themes shows missing sprites) and preview the prompt with preview_sprite_prompt. An existing file is kept unless force is true.", + inputSchema: { + theme: THEME, + role: ROLE, + variant: z + .string() + .regex(/^[a-z0-9_]+$/) + .optional() + .describe("Contextual variant slug, e.g. 'alembic' for a laboratory: saved as __.png and bound to a map with override_tile_image"), + material: z.string().optional().describe("Override of the material description, e.g. 'alchemical workbench with brass alembics'"), + lighting: z.string().optional().describe("Override of the lighting description"), + extraDetail: z.string().optional().describe("Free text appended to the prompt"), + seed: z.number().int().optional().describe("Seed for reproducibility"), + force: z.boolean().optional().describe("Regenerate even if the file already exists (paid again)"), + outputDir: z + .string() + .optional() + .describe("Output folder; relative paths resolve against the assets folder. Defaults to //"), + }, + annotations: PAID, + }, + async ({ theme, role, variant, material, lighting, extraDetail, seed, force, outputDir }) => { + if (!hfToken()) return asText(missingToken()); + const hosted = isHosted(); + if (hosted && outputDir) { + return asText({ + ok: false, + error: "outputDir is not available on the hosted server: generated sprites stay with your session and are included in the map download (save_to_disk).", + }); + } + const key = theme as ThemeKey; + let rendered; + try { + rendered = buildPrompt(key, role, { material, lighting, extraDetail }); + } catch (err) { + return asText({ ok: false, error: err instanceof Error ? err.message : String(err) }); + } + + const fileName = variant ? `${role}__${variant}.png` : `${role}.png`; + const relPath = `${themeAssetDir(key)}/${fileName}`; + const dir = outputDir ? resolveUserPath(outputDir, assetsRoot()) : join(assetsRoot(), themeAssetDir(key)); + const outPath = hosted ? relPath : join(dir, fileName); + if ((hosted ? spriteExists(relPath) : existsSync(outPath)) && !force) { + return asText({ + ok: false, + skipped: true, + outputPath: outPath, + error: "The sprite already exists; nothing was generated or billed. Pass force: true to regenerate it.", + }); + } + + const start = Date.now(); + try { + const buf = await renderSprite(rendered, seed); + const saved = await saveSprite(relPath, buf, outPath); + const result = asText({ + ok: true, + theme, + role, + variant: variant ?? null, + geometry: rendered.geometry, + outputPath: saved, + finalSize: rendered.geometry === "surface" ? "64x32" : "64x64", + relativePath: `${ASSET_PREFIX}${relPath}`, + bytes: buf.length, + durationMs: Date.now() - start, + promptUsed: rendered.prompt, + }); + // Hosted callers cannot read the server's disk: send them the image itself as well. + return hosted + ? { content: [...result.content, { type: "image" as const, data: buf.toString("base64"), mimeType: "image/png" }] } + : result; + } catch (err) { + return asText({ ok: false, error: err instanceof Error ? err.message : String(err), promptAttempted: rendered.prompt }); + } + }, + ); + + server.registerTool( + "override_tile_image", + { + title: "Use a sprite variant on one map", + description: + "Points one role of a single map's tileset at a variant image, e.g. obstacle_decor__alembic.png instead of obstacle_decor.png. Only that map changes; other maps and the theme keep their defaults. Call after create_map and before saving or exporting.", + inputSchema: { + mapId: z.string(), + role: ROLE, + variant: z + .string() + .regex(/^[a-z0-9_]+$/) + .describe("Variant slug: the file //__.png should exist"), + imageWidth: z.number().int().optional().describe("Image width in pixels if it differs from the default"), + imageHeight: z.number().int().optional().describe("Image height in pixels if it differs from the default"), + customPath: z + .string() + .optional() + .describe("Use this image path verbatim instead of the './assets//__.png' convention"), + }, + annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false }, + }, + async ({ mapId, role, variant, imageWidth, imageHeight, customPath }) => { + const state = getMap(mapId); + const file = `${themeAssetDir(state.theme.key)}/${role}__${variant}.png`; + const path = customPath ?? `${ASSET_PREFIX}${file}`; + overrideTileImage(mapId, role, path, imageWidth, imageHeight); + const fileExists = customPath ? undefined : spriteExists(file); + const where = isHosted() ? file : join(assetsRoot(), file); + return asText({ + ok: true, + mapId, + role, + variant, + imagePath: path, + ...(fileExists === false + ? { warning: `No file at ${where} yet: generate it with generate_tile_sprite (variant '${variant}') or Tiled will show a placeholder.` } + : {}), + }); + }, + ); + + server.registerTool( + "preview_sprite_prompt", + { + title: "Preview a sprite prompt (free)", + description: + "Free: returns the exact FLUX prompt, geometry and size generate_tile_sprite would use for (theme, role) with optional overrides, without calling any service. Use it to iterate on wording before paying for a generation.", + inputSchema: { + theme: THEME, + role: ROLE, + material: z.string().optional(), + lighting: z.string().optional(), + extraDetail: z.string().optional(), + }, + annotations: { readOnlyHint: true, openWorldHint: false }, + }, + async ({ theme, role, material, lighting, extraDetail }) => { + try { + return asText({ ok: true, ...buildPrompt(theme as ThemeKey, role, { material, lighting, extraDetail }) }); + } catch (err) { + return asText({ ok: false, error: err instanceof Error ? err.message : String(err) }); + } + }, + ); + + server.registerTool( + "generate_theme_sprite_set", + { + title: "Generate a theme's missing sprites (paid)", + description: + "PAID and slow: generates every sprite of a theme that is missing on disk (about 30 s and one paid call per sprite, typically 8-10 sprites, so 4-5 minutes). Existing sprites are skipped unless force is true. Many MCP clients time out on calls this long; for a whole theme prefer the command line script: node scripts/gen-theme-set.mjs --yes.", + inputSchema: { + theme: THEME, + force: z.boolean().optional().describe("Regenerate sprites that already exist (paid again)"), + seed: z.number().int().optional(), + }, + annotations: PAID, + }, + async ({ theme, force, seed }) => { + if (!hfToken()) return asText(missingToken()); + const key = theme as ThemeKey; + const hosted = isHosted(); + const dir = hosted ? themeAssetDir(key) : join(assetsRoot(), themeAssetDir(key)); + + const results: Array<{ role: string; ok: boolean; path?: string; error?: string; durationMs?: number; skipped?: boolean }> = []; + for (const role of THEME_ROLES) { + const relPath = `${themeAssetDir(key)}/${role}.png`; + let rendered; + try { + rendered = buildPrompt(key, role); + } catch { + continue; // no prompt for this role in this theme + } + if (spriteExists(relPath) && !force) { + results.push({ role, ok: true, path: hosted ? relPath : join(assetsRoot(), relPath), skipped: true }); + continue; + } + const start = Date.now(); + try { + const path = await saveSprite(relPath, await renderSprite(rendered, seed)); + results.push({ role, ok: true, path, durationMs: Date.now() - start }); + } catch (err) { + results.push({ role, ok: false, error: err instanceof Error ? err.message : String(err), durationMs: Date.now() - start }); + } + } + return asText({ theme, dir, results }); + }, + ); +} diff --git a/tiled-mcp/src/tools/layout-presets.ts b/tiled-mcp/src/tools/layout-presets.ts new file mode 100644 index 0000000000000000000000000000000000000000..17a7ff6036153fb8084e8d5316bce8331632fcb2 --- /dev/null +++ b/tiled-mcp/src/tools/layout-presets.ts @@ -0,0 +1,294 @@ +// Ready-made layouts with a gothic-horror flavour: a crypt, a castle floor and a werewolf den. +// They are original arrangements (rooms, sizes and connections are not copied from any published +// adventure) meant as a starting point that an agent or a human then refines. + +import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; +import { z } from "zod"; +import { describeMap, getMap, paintTile, placeObject, placeSpawn } from "../builder.js"; +import { applyRoom } from "./procedural.js"; +import { asText } from "./util.js"; + +interface RoomPlan { + label: string; + originX: number; + originY: number; + width: number; + height: number; + exits: { direction: "north" | "south" | "east" | "west"; offset?: number }[]; + hazardCenter?: boolean; + obstacleCorners?: boolean; +} + +interface CorridorPlan { + fromX: number; + fromY: number; + toX: number; + toY: number; +} + +/** Smallest map each preset fits in without rooms overlapping. */ +const MIN_SIZE = { + crypt: { width: 27, height: 18 }, + castle: { width: 27, height: 20 }, + den: { width: 22, height: 16 }, +} as const; + +function assertMinSize(mapId: string, preset: keyof typeof MIN_SIZE, tool: string): void { + const state = getMap(mapId); + const min = MIN_SIZE[preset]; + if (state.width < min.width || state.height < min.height) { + throw new Error( + `Map too small for ${tool}: ${state.width}x${state.height}. This layout needs at least ${min.width}x${min.height}; create a larger map or build rooms with generate_room.`, + ); + } +} + +function applyLayout(mapId: string, rooms: RoomPlan[], corridors: CorridorPlan[]) { + const state = getMap(mapId); + const floorGid = state.roleToGid.get("walkable_floor")!; + + for (const r of rooms) { + applyRoom(mapId, r.originX, r.originY, r.width, r.height, r.exits ?? [], { + hazardCenter: r.hazardCenter, + obstacleCorners: r.obstacleCorners, + }); + } + + // One-cell corridors: floor on the ground layer, walls cleared along the path. + for (const c of corridors) { + const xa = Math.min(c.fromX, c.toX); + const xb = Math.max(c.fromX, c.toX); + const ya = Math.min(c.fromY, c.toY); + const yb = Math.max(c.fromY, c.toY); + if (ya === yb) { + for (let x = xa; x <= xb; x++) { + state.ground.data[ya * state.width + x] = floorGid; + state.walls.data[ya * state.width + x] = 0; + } + } else if (xa === xb) { + for (let y = ya; y <= yb; y++) { + state.ground.data[y * state.width + xa] = floorGid; + state.walls.data[y * state.width + xa] = 0; + } + } else { + // L-shaped: vertical leg first, then horizontal. + for (let y = ya; y <= yb; y++) { + state.ground.data[y * state.width + c.fromX] = floorGid; + state.walls.data[y * state.width + c.fromX] = 0; + } + for (let x = xa; x <= xb; x++) { + state.ground.data[c.toY * state.width + x] = floorGid; + state.walls.data[c.toY * state.width + x] = 0; + } + } + } +} + +export function registerLayoutPresetTools(server: McpServer): void { + server.registerTool( + "generate_crypt_layout", + { + title: "Generate a crypt layout", + description: `Fills a map with a crypt: entrance hall (west), central nave, north and south burial chambers, and a deep crypt (east) with a hazard tile and corner obstacles, all connected by doors and corridors. Needs a map of at least ${MIN_SIZE.crypt.width}x${MIN_SIZE.crypt.height}. Suited to the CRYPT, BLOOD_TOMB and MAUSOLEUM themes. Adds a player spawn in the entrance unless addPlayerSpawn is false.`, + inputSchema: { + mapId: z.string(), + addPlayerSpawn: z.boolean().optional().describe("Place a player spawn in the entrance (default true)"), + }, + annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: false }, + }, + async ({ mapId, addPlayerSpawn }) => { + assertMinSize(mapId, "crypt", "generate_crypt_layout"); + const state = getMap(mapId); + const w = state.width; + const h = state.height; + const cy = Math.floor(h / 2); + + const entrance: RoomPlan = { label: "entrance", originX: 0, originY: cy - 2, width: 6, height: 5, exits: [{ direction: "east" }] }; + const nave: RoomPlan = { + label: "nave", + originX: 8, + originY: cy - 3, + width: 10, + height: 7, + exits: [{ direction: "west" }, { direction: "north" }, { direction: "south" }, { direction: "east" }], + obstacleCorners: true, + }; + const northChamber: RoomPlan = { label: "north-chamber", originX: 10, originY: 0, width: 6, height: 5, exits: [{ direction: "south" }] }; + const southChamber: RoomPlan = { label: "south-chamber", originX: 10, originY: h - 5, width: 6, height: 5, exits: [{ direction: "north" }] }; + const deepCrypt: RoomPlan = { + label: "deep-crypt", + originX: Math.min(w - 8, 20), + originY: cy - 3, + width: 7, + height: 7, + exits: [{ direction: "west" }], + hazardCenter: true, + obstacleCorners: true, + }; + + const corridors: CorridorPlan[] = [ + { fromX: entrance.originX + entrance.width, fromY: cy, toX: nave.originX - 1, toY: cy }, + { fromX: nave.originX + nave.width, fromY: cy, toX: deepCrypt.originX - 1, toY: cy }, + { fromX: northChamber.originX + 3, fromY: northChamber.originY + northChamber.height, toX: northChamber.originX + 3, toY: nave.originY - 1 }, + { fromX: southChamber.originX + 3, fromY: nave.originY + nave.height, toX: southChamber.originX + 3, toY: southChamber.originY - 1 }, + ]; + + const rooms = [entrance, nave, northChamber, southChamber, deepCrypt]; + applyLayout(mapId, rooms, corridors); + + if (addPlayerSpawn !== false) { + placeSpawn(mapId, { x: entrance.originX + 1, y: entrance.originY + 2, role: "player" }); + } + + return asText({ ok: true, layout: "crypt", rooms: rooms.map((r) => r.label), summary: describeMap(mapId) }); + }, + ); + + server.registerTool( + "generate_castle_floor", + { + title: "Generate a castle floor", + description: `Fills a map with a castle floor: antechamber (west) behind a locked main door (pick DC 18), a great hall, north and south wings, and a far room (east) whose content depends on floorVariant. The 'throne' variant adds a throne prop and an enemy 'Castle lord' spawn. Needs a map of at least ${MIN_SIZE.castle.width}x${MIN_SIZE.castle.height}. Suited to the CASTLE theme.`, + inputSchema: { + mapId: z.string(), + floorVariant: z + .enum(["entrance", "throne", "private_chambers"]) + .optional() + .describe("entrance = inner courtyard, throne = throne room (default), private_chambers = private apartments"), + addPlayerSpawn: z.boolean().optional().describe("Place a player spawn in the antechamber (default true)"), + }, + annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: false }, + }, + async ({ mapId, floorVariant, addPlayerSpawn }) => { + assertMinSize(mapId, "castle", "generate_castle_floor"); + const state = getMap(mapId); + const variant = floorVariant ?? "throne"; + const w = state.width; + const h = state.height; + const cy = Math.floor(h / 2); + + const antechamber: RoomPlan = { label: "antechamber", originX: 0, originY: cy - 3, width: 6, height: 6, exits: [{ direction: "east" }] }; + const greatHall: RoomPlan = { + label: "great-hall", + originX: 8, + originY: cy - 4, + width: 10, + height: 9, + exits: [{ direction: "west" }, { direction: "north" }, { direction: "south" }, { direction: "east" }], + obstacleCorners: variant === "throne", + }; + const northWing: RoomPlan = { label: "north-wing", originX: 10, originY: 0, width: 7, height: 5, exits: [{ direction: "south" }] }; + const southWing: RoomPlan = { label: "south-wing", originX: 10, originY: h - 5, width: 7, height: 5, exits: [{ direction: "north" }] }; + const farRoom: RoomPlan = { + label: variant === "throne" ? "throne-room" : variant === "private_chambers" ? "private-chambers" : "inner-courtyard", + originX: Math.min(w - 8, 20), + originY: cy - 3, + width: 7, + height: 7, + exits: [{ direction: "west" }], + obstacleCorners: variant !== "entrance", + }; + + const corridors: CorridorPlan[] = [ + { fromX: antechamber.originX + antechamber.width, fromY: cy, toX: greatHall.originX - 1, toY: cy }, + { fromX: greatHall.originX + greatHall.width, fromY: cy, toX: farRoom.originX - 1, toY: cy }, + { fromX: northWing.originX + 3, fromY: northWing.originY + northWing.height, toX: northWing.originX + 3, toY: greatHall.originY - 1 }, + { fromX: southWing.originX + 3, fromY: greatHall.originY + greatHall.height, toX: southWing.originX + 3, toY: southWing.originY - 1 }, + ]; + + const rooms = [antechamber, greatHall, northWing, southWing, farRoom]; + applyLayout(mapId, rooms, corridors); + + if (variant === "throne") { + const tx = farRoom.originX + Math.floor(farRoom.width / 2); + const ty = farRoom.originY + 1; + paintTile(mapId, "decorations", tx, ty, "obstacle_decor"); + placeSpawn(mapId, { x: tx, y: ty, role: "enemy", npcName: "Castle lord" }); + } + + if (addPlayerSpawn !== false) { + placeSpawn(mapId, { x: antechamber.originX + 1, y: antechamber.originY + 3, role: "player" }); + } + + // The main entrance on the antechamber's west wall is a locked door in a wall opening. + state.walls.data[(antechamber.originY + 3) * state.width + antechamber.originX] = 0; + placeObject(mapId, { + x: antechamber.originX, + y: antechamber.originY + 3, + kind: "door", + state: "locked", + pickDC: 18, + name: "main-door", + }); + + return asText({ ok: true, layout: "castle", variant, rooms: rooms.map((r) => r.label), summary: describeMap(mapId) }); + }, + ); + + server.registerTool( + "generate_werewolf_den", + { + title: "Generate a werewolf den", + description: `Fills a map with a cave den: cave mouth (west), hunting hall with bone obstacles, a nest of young wolves (north), a bone store (south) and the alpha's lair (east) with a hazard tile. Adds enemy spawns 'Alpha werewolf' and 'Werewolf cub'. Needs a map of at least ${MIN_SIZE.den.width}x${MIN_SIZE.den.height}. Suited to the WEREWOLF_DEN theme.`, + inputSchema: { + mapId: z.string(), + addPlayerSpawn: z.boolean().optional().describe("Place a player spawn at the cave mouth (default true)"), + }, + annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: false }, + }, + async ({ mapId, addPlayerSpawn }) => { + assertMinSize(mapId, "den", "generate_werewolf_den"); + const state = getMap(mapId); + const w = state.width; + const h = state.height; + const cy = Math.floor(h / 2); + + const caveMouth: RoomPlan = { label: "cave-mouth", originX: 0, originY: cy - 2, width: 5, height: 5, exits: [{ direction: "east" }] }; + const huntingHall: RoomPlan = { + label: "hunting-hall", + originX: 6, + originY: cy - 4, + width: 8, + height: 8, + exits: [{ direction: "west" }, { direction: "north" }, { direction: "south" }, { direction: "east" }], + obstacleCorners: true, + }; + const nest: RoomPlan = { label: "nest", originX: 8, originY: 0, width: 5, height: 4, exits: [{ direction: "south" }] }; + const alphaLair: RoomPlan = { + label: "alpha-lair", + originX: Math.min(w - 7, 15), + originY: cy - 3, + width: 7, + height: 7, + exits: [{ direction: "west" }], + hazardCenter: true, + }; + const boneStore: RoomPlan = { label: "bone-store", originX: 8, originY: h - 4, width: 5, height: 4, exits: [{ direction: "north" }] }; + + const corridors: CorridorPlan[] = [ + { fromX: caveMouth.originX + caveMouth.width, fromY: cy, toX: huntingHall.originX - 1, toY: cy }, + { fromX: huntingHall.originX + huntingHall.width, fromY: cy, toX: alphaLair.originX - 1, toY: cy }, + { fromX: nest.originX + 2, fromY: nest.originY + nest.height, toX: nest.originX + 2, toY: huntingHall.originY - 1 }, + { fromX: boneStore.originX + 2, fromY: huntingHall.originY + huntingHall.height, toX: boneStore.originX + 2, toY: boneStore.originY - 1 }, + ]; + + const rooms = [caveMouth, huntingHall, nest, alphaLair, boneStore]; + applyLayout(mapId, rooms, corridors); + + // The alpha stands just north of the lair's central hazard tile rather than on it. + placeSpawn(mapId, { + x: alphaLair.originX + 3, + y: alphaLair.originY + 2, + role: "enemy", + npcName: "Alpha werewolf", + }); + placeSpawn(mapId, { x: nest.originX + 2, y: nest.originY + 2, role: "enemy", npcName: "Werewolf cub" }); + + if (addPlayerSpawn !== false) { + placeSpawn(mapId, { x: caveMouth.originX + 1, y: caveMouth.originY + 2, role: "player" }); + } + + return asText({ ok: true, layout: "werewolf_den", rooms: rooms.map((r) => r.label), summary: describeMap(mapId) }); + }, + ); +} diff --git a/tiled-mcp/src/tools/lifecycle.ts b/tiled-mcp/src/tools/lifecycle.ts new file mode 100644 index 0000000000000000000000000000000000000000..307a753cd513d7dc2265fce91e28521902f10a73 --- /dev/null +++ b/tiled-mcp/src/tools/lifecycle.ts @@ -0,0 +1,77 @@ +import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; +import { z } from "zod"; +import { createMap, describeMap, discardMap, listMaps, MAX_MAP_SIZE } from "../builder.js"; +import { THEME_KEYS, describeThemes, getTheme } from "../themes/index.js"; +import { asText } from "./util.js"; + +export function registerLifecycleTools(server: McpServer): void { + server.registerTool( + "list_themes", + { + title: "List themes", + description: + "Lists the available map themes (tile palettes): key, display name, description, the tile roles each theme provides, and whether its sprite PNGs are present locally (sprites.status: all, partial or none). Themes without sprites still produce valid maps; Tiled shows placeholders until the sprites exist.", + inputSchema: {}, + annotations: { readOnlyHint: true, openWorldHint: false }, + }, + async () => asText(describeThemes()), + ); + + server.registerTool( + "create_map", + { + title: "Create a map", + description: + "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.", + inputSchema: { + name: z.string().min(1).max(120).describe("Display name of the map, e.g. 'Crypt under the abandoned chapel'"), + width: z.number().int().min(4).max(MAX_MAP_SIZE).describe("Width in cells (1 cell = 5 ft in tabletop terms)"), + height: z.number().int().min(4).max(MAX_MAP_SIZE).describe("Height in cells"), + theme: z.enum(THEME_KEYS).describe("Theme key from list_themes, e.g. CRYPT"), + orientation: z.enum(["isometric", "orthogonal"]).optional().describe("Defaults to isometric"), + }, + annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: false }, + }, + async ({ name, width, height, theme, orientation }) => + asText(createMap({ name, width, height, theme: getTheme(theme), orientation })), + ); + + server.registerTool( + "list_maps", + { + title: "List maps", + description: "Lists the maps held in memory by this server session, with their summaries.", + inputSchema: {}, + annotations: { readOnlyHint: true, openWorldHint: false }, + }, + async () => asText(listMaps()), + ); + + server.registerTool( + "describe_map", + { + title: "Describe a map", + description: + "Returns a summary of one map: size, orientation, theme, tile counts per tile type, and number of objects and spawns.", + inputSchema: { + mapId: z.string().describe("mapId returned by create_map"), + }, + annotations: { readOnlyHint: true, openWorldHint: false }, + }, + async ({ mapId }) => asText(describeMap(mapId)), + ); + + server.registerTool( + "discard_map", + { + title: "Discard a map", + description: + "Deletes a map from server memory. Irreversible unless it was saved or exported first.", + inputSchema: { + mapId: z.string().describe("mapId returned by create_map"), + }, + annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false }, + }, + async ({ mapId }) => asText({ ok: discardMap(mapId), mapId }), + ); +} diff --git a/tiled-mcp/src/tools/objects.ts b/tiled-mcp/src/tools/objects.ts new file mode 100644 index 0000000000000000000000000000000000000000..03788a9531b0812469ef947d6edac3b1f2c8e751 --- /dev/null +++ b/tiled-mcp/src/tools/objects.ts @@ -0,0 +1,184 @@ +import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; +import { z } from "zod"; +import { assertPlaceable, placeObject, placeSpawn } from "../builder.js"; +import { GRID_HELP, asText } from "./util.js"; + +const CELL = z.number().int().min(0); +const DC = z.number().int().min(5).max(30); +const PLACEMENT_RULE = + "The cell must be painted ground without a wall and without another object or spawn; otherwise the call fails with an explanation."; +const WRITE = { readOnlyHint: false, destructiveHint: false, openWorldHint: false } as const; + +export function registerObjectTools(server: McpServer): void { + server.registerTool( + "place_door", + { + title: "Place a door", + description: `Adds a door to the 'objects' layer. Put doors in a wall opening: erase the wall at that cell first (erase_tile layer=walls) and keep a ground tile under it; generate_room does this for its exits. A locked door needs pickDC to be picked open. ${GRID_HELP}`, + inputSchema: { + mapId: z.string(), + x: CELL, + y: CELL, + locked: z.boolean().optional().describe("Defaults to false (closed but unlocked)"), + pickDC: DC.optional().describe("Difficulty class to pick the lock (5..30)"), + targetZoneId: z.string().optional().describe("Optional id of the zone this door leads to (for multi-zone dungeons)"), + name: z.string().optional(), + }, + annotations: WRITE, + }, + async ({ mapId, x, y, locked, pickDC, targetZoneId, name }) => { + const objectId = placeObject(mapId, { + x, + y, + kind: "door", + state: locked ? "locked" : "closed", + pickDC, + targetZoneId, + name, + }); + return asText({ ok: true, objectId, kind: "door" }); + }, + ); + + server.registerTool( + "place_chest", + { + title: "Place a chest", + description: `Adds a chest to the 'objects' layer. A locked chest needs pickDC to be opened. ${PLACEMENT_RULE} ${GRID_HELP}`, + inputSchema: { + mapId: z.string(), + x: CELL, + y: CELL, + locked: z.boolean().optional(), + pickDC: DC.optional().describe("Difficulty class to pick the lock (5..30)"), + name: z.string().optional(), + }, + annotations: WRITE, + }, + async ({ mapId, x, y, locked, pickDC, name }) => { + assertPlaceable(mapId, x, y); + const objectId = placeObject(mapId, { x, y, kind: "chest", state: locked ? "locked" : "closed", pickDC, name }); + return asText({ ok: true, objectId, kind: "chest" }); + }, + ); + + server.registerTool( + "place_stairs_object", + { + title: "Place zone stairs", + description: `Adds a stairs object that moves the party to another zone (targetZoneId). Unlike the decorative 'stairs' tile role, this object carries the zone link. ${PLACEMENT_RULE} ${GRID_HELP}`, + inputSchema: { + mapId: z.string(), + x: CELL, + y: CELL, + targetZoneId: z.string().describe("Id of the destination zone"), + name: z.string().optional(), + }, + annotations: WRITE, + }, + async ({ mapId, x, y, targetZoneId, name }) => { + assertPlaceable(mapId, x, y); + const objectId = placeObject(mapId, { x, y, kind: "stairs", state: "open", targetZoneId, name }); + return asText({ ok: true, objectId, kind: "stairs", targetZoneId }); + }, + ); + + server.registerTool( + "place_trap", + { + title: "Place a trap", + description: `Adds a trap to the 'objects' layer. Entering the cell triggers a saving throw when trapSaveDC is set, otherwise the damage applies automatically. ${PLACEMENT_RULE} ${GRID_HELP}`, + inputSchema: { + mapId: z.string(), + x: CELL, + y: CELL, + trapType: z.string().describe("Damage type, e.g. piercing, fire, poison, lightning"), + trapNotation: z + .string() + .regex(/^\d+[dD]\d+([+-]\d+)?$/) + .describe("Damage dice, e.g. 2d6 or 3d4+1"), + trapSaveDC: DC.optional().describe("Saving throw difficulty class (5..30)"), + name: z.string().optional(), + }, + annotations: WRITE, + }, + async ({ mapId, x, y, trapType, trapNotation, trapSaveDC, name }) => { + assertPlaceable(mapId, x, y); + const objectId = placeObject(mapId, { x, y, kind: "trap", state: "closed", trapType, trapNotation, trapSaveDC, name }); + return asText({ ok: true, objectId, kind: "trap", trapType, trapNotation, trapSaveDC }); + }, + ); + + server.registerTool( + "place_lever", + { + title: "Place a lever", + description: `Adds a lever players can pull. Its effect is up to the game engine that loads the map. ${PLACEMENT_RULE} ${GRID_HELP}`, + inputSchema: { mapId: z.string(), x: CELL, y: CELL, name: z.string().optional() }, + annotations: WRITE, + }, + async ({ mapId, x, y, name }) => { + assertPlaceable(mapId, x, y); + const objectId = placeObject(mapId, { x, y, kind: "lever", state: "closed", name }); + return asText({ ok: true, objectId, kind: "lever" }); + }, + ); + + server.registerTool( + "place_spawn_player", + { + title: "Place a player spawn", + description: `Adds a player start point to the 'spawns' layer. Every playable map needs at least one (validate_map warns otherwise). ${PLACEMENT_RULE} ${GRID_HELP}`, + inputSchema: { mapId: z.string(), x: CELL, y: CELL, name: z.string().optional() }, + annotations: WRITE, + }, + async ({ mapId, x, y, name }) => { + assertPlaceable(mapId, x, y); + const objectId = placeSpawn(mapId, { x, y, role: "player", name }); + return asText({ ok: true, objectId, role: "player" }); + }, + ); + + server.registerTool( + "place_spawn_enemy", + { + title: "Place an enemy spawn", + description: `Adds an enemy spawn point to the 'spawns' layer. encounterId links it to an encounter defined by the game engine; npcName is the creature's display name. ${PLACEMENT_RULE} ${GRID_HELP}`, + inputSchema: { + mapId: z.string(), + x: CELL, + y: CELL, + encounterId: z.string().optional().describe("Id of an existing encounter in the game engine"), + npcName: z.string().optional().describe("Display name, e.g. 'Alpha werewolf'"), + name: z.string().optional(), + }, + annotations: WRITE, + }, + async ({ mapId, x, y, encounterId, npcName, name }) => { + assertPlaceable(mapId, x, y); + const objectId = placeSpawn(mapId, { x, y, role: "enemy", encounterId, npcName, name }); + return asText({ ok: true, objectId, role: "enemy" }); + }, + ); + + server.registerTool( + "place_spawn_npc", + { + title: "Place a friendly NPC spawn", + description: `Adds a non-hostile NPC spawn point (merchant, quest giver, ally) to the 'spawns' layer. ${PLACEMENT_RULE} ${GRID_HELP}`, + inputSchema: { + mapId: z.string(), + x: CELL, + y: CELL, + npcName: z.string().optional().describe("Display name, e.g. 'Old innkeeper'"), + name: z.string().optional(), + }, + annotations: WRITE, + }, + async ({ mapId, x, y, npcName, name }) => { + assertPlaceable(mapId, x, y); + const objectId = placeSpawn(mapId, { x, y, role: "npc", npcName, name }); + return asText({ ok: true, objectId, role: "npc" }); + }, + ); +} diff --git a/tiled-mcp/src/tools/paint.ts b/tiled-mcp/src/tools/paint.ts new file mode 100644 index 0000000000000000000000000000000000000000..4b519e8a685292a0015087247562d9e182f8254f --- /dev/null +++ b/tiled-mcp/src/tools/paint.ts @@ -0,0 +1,79 @@ +import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; +import { z } from "zod"; +import { eraseTile, getTileInfo, paintRect, paintTile, paintWallBorder } from "../builder.js"; +import { THEME_ROLES } from "../types.js"; +import { GRID_HELP, asText } from "./util.js"; + +const LAYER = z + .enum(["ground", "walls", "decorations"]) + .describe( + "ground = floors, hazards and difficult terrain; walls = wall tiles drawn above the ground (a cell with a wall is impassable); decorations = props above the ground (obstacle_decor blocks movement, decoration_minor is walkable)", + ); +const ROLE = z.enum(THEME_ROLES).describe("Tile role, resolved to a sprite by the map's theme"); +const CELL = z.number().int().min(0); + +export function registerPaintTools(server: McpServer): void { + server.registerTool( + "paint_tile", + { + title: "Paint one tile", + description: `Paints a single cell of a tile layer with a tile role. ${GRID_HELP}`, + inputSchema: { mapId: z.string(), layer: LAYER, x: CELL, y: CELL, role: ROLE }, + annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false }, + }, + async ({ mapId, layer, x, y, role }) => { + paintTile(mapId, layer, x, y, role); + return asText({ ok: true, mapId, layer, x, y, role }); + }, + ); + + server.registerTool( + "paint_rect", + { + title: "Paint a filled rectangle", + description: `Paints every cell of the rectangle between two opposite corners (inclusive) on one layer. Typical use: paint_rect on 'ground' with walkable_floor for a room's floor. ${GRID_HELP}`, + inputSchema: { mapId: z.string(), layer: LAYER, x1: CELL, y1: CELL, x2: CELL, y2: CELL, role: ROLE }, + annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false }, + }, + async ({ mapId, layer, x1, y1, x2, y2, role }) => { + const painted = paintRect(mapId, layer, x1, y1, x2, y2, role); + return asText({ ok: true, painted, layer, role }); + }, + ); + + server.registerTool( + "paint_wall_border", + { + title: "Paint a wall border", + description: `Paints walls on the outline of a rectangle (inclusive corners) on the 'walls' layer, to enclose a room quickly. Erase single wall cells afterwards (erase_tile layer=walls) to open doorways. ${GRID_HELP}`, + inputSchema: { mapId: z.string(), x1: CELL, y1: CELL, x2: CELL, y2: CELL }, + annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false }, + }, + async ({ mapId, x1, y1, x2, y2 }) => asText({ ok: true, painted: paintWallBorder(mapId, x1, y1, x2, y2) }), + ); + + server.registerTool( + "erase_tile", + { + title: "Erase one tile", + description: `Clears one cell of a tile layer (for example to open a doorway in a wall). ${GRID_HELP}`, + inputSchema: { mapId: z.string(), layer: LAYER, x: CELL, y: CELL }, + annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false }, + }, + async ({ mapId, layer, x, y }) => { + eraseTile(mapId, layer, x, y); + return asText({ ok: true, mapId, layer, x, y }); + }, + ); + + server.registerTool( + "get_tile_info", + { + title: "Inspect one tile", + description: `Returns the tile on one layer at (x, y): gid (0 = empty), role, tile type and sprite id, plus the object or spawn standing on that cell if any. Check layer=walls before placing objects: a wall sits on top of a walkable ground tile. ${GRID_HELP}`, + inputSchema: { mapId: z.string(), layer: LAYER, x: CELL, y: CELL }, + annotations: { readOnlyHint: true, openWorldHint: false }, + }, + async ({ mapId, layer, x, y }) => asText(getTileInfo(mapId, layer, x, y)), + ); +} diff --git a/tiled-mcp/src/tools/procedural.ts b/tiled-mcp/src/tools/procedural.ts new file mode 100644 index 0000000000000000000000000000000000000000..5b71c1f16a9cb4775db907e1a6b9a3b16fec2e36 --- /dev/null +++ b/tiled-mcp/src/tools/procedural.ts @@ -0,0 +1,200 @@ +import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; +import { z } from "zod"; +import { getMap, paintRect, paintTile, paintWallBorder, placeObject } from "../builder.js"; +import { GRID_HELP, asText } from "./util.js"; + +const EXIT_DIR = z.enum(["north", "south", "east", "west"]); + +interface ExitSpec { + direction: "north" | "south" | "east" | "west"; + offset?: number; +} + +/** + * Paints a room: walkable floor, a wall border, a doorway (wall removed + door object) per + * exit, and optionally a central hazard and corner obstacles. North is the room's top edge + * (row originY), west its left edge (column originX). + */ +function applyRoom( + mapId: string, + originX: number, + originY: number, + width: number, + height: number, + exits: ExitSpec[], + options: { hazardCenter?: boolean; obstacleCorners?: boolean }, +): { painted: number; doors: number[] } { + const state = getMap(mapId); + if (originX < 0 || originY < 0 || originX + width > state.width || originY + height > state.height) { + throw new Error( + `Room out of bounds: origin (${originX},${originY}) size ${width}x${height} does not fit in the ${state.width}x${state.height} grid.`, + ); + } + + const painted = paintRect( + mapId, + "ground", + originX, + originY, + originX + width - 1, + originY + height - 1, + "walkable_floor", + ); + paintWallBorder(mapId, originX, originY, originX + width - 1, originY + height - 1); + + // Doorways: open the wall, keep a floor tile under it, add a closed door object. + const doors: number[] = []; + for (const exit of exits) { + const along = exit.direction === "north" || exit.direction === "south" ? width : height; + const offset = exit.offset ?? Math.floor(along / 2); + if (offset >= along) { + throw new Error(`Exit offset ${offset} is outside the ${exit.direction} wall (length ${along}).`); + } + let dx = originX; + let dy = originY; + switch (exit.direction) { + case "north": + dx = originX + offset; + dy = originY; + break; + case "south": + dx = originX + offset; + dy = originY + height - 1; + break; + case "west": + dx = originX; + dy = originY + offset; + break; + case "east": + dx = originX + width - 1; + dy = originY + offset; + break; + } + state.walls.data[dy * state.width + dx] = 0; + paintTile(mapId, "ground", dx, dy, "walkable_floor"); + doors.push(placeObject(mapId, { x: dx, y: dy, kind: "door", state: "closed" })); + } + + if (options.hazardCenter && state.roleToGid.has("hazard_primary")) { + const cx = originX + Math.floor(width / 2); + const cy = originY + Math.floor(height / 2); + paintTile(mapId, "ground", cx, cy, "hazard_primary"); + } + + if (options.obstacleCorners && state.roleToGid.has("obstacle_decor")) { + const corners = [ + { x: originX + 1, y: originY + 1 }, + { x: originX + width - 2, y: originY + 1 }, + { x: originX + 1, y: originY + height - 2 }, + { x: originX + width - 2, y: originY + height - 2 }, + ]; + for (const c of corners) { + if (c.x > originX && c.x < originX + width - 1 && c.y > originY && c.y < originY + height - 1) { + paintTile(mapId, "decorations", c.x, c.y, "obstacle_decor"); + } + } + } + + return { painted, doors }; +} + +export function registerProceduralTools(server: McpServer): void { + server.registerTool( + "generate_room", + { + title: "Generate a room", + description: `Builds a rectangular room in one call: walkable floor, a wall border, and a doorway with a closed door for each exit. Options add a hazard tile in the centre and obstacle props in the four inner corners (only if the theme defines those roles). originX/originY is the room's top-left cell; the walls are part of the room's width and height. ${GRID_HELP}`, + inputSchema: { + mapId: z.string(), + originX: z.number().int().min(0), + originY: z.number().int().min(0), + width: z.number().int().min(3).max(40).describe("Outer width including walls"), + height: z.number().int().min(3).max(40).describe("Outer height including walls"), + exits: z + .array( + z.object({ + direction: EXIT_DIR.describe("north = top edge (row originY), west = left edge (column originX)"), + offset: z + .number() + .int() + .min(1) + .optional() + .describe("Cells from the start of that wall (default: middle). 1 is the first cell after the corner."), + }), + ) + .max(4) + .optional(), + hazardCenter: z.boolean().optional().describe("Paint the theme's hazard_primary tile at the room centre"), + obstacleCorners: z.boolean().optional().describe("Paint obstacle_decor props in the four inner corners"), + }, + annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: false }, + }, + async ({ mapId, originX, originY, width, height, exits, hazardCenter, obstacleCorners }) => { + const result = applyRoom(mapId, originX, originY, width, height, exits ?? [], { hazardCenter, obstacleCorners }); + return asText({ ok: true, ...result }); + }, + ); + + server.registerTool( + "generate_corridor", + { + title: "Generate a corridor", + description: `Draws a straight, axis-aligned corridor between (fromX,fromY) and (toX,toY): walkable floor plus side walls. Interior width defaults to 1 (3 cells including both walls). Side walls that cross an existing room are painted too, so connect corridors to doorways. ${GRID_HELP}`, + inputSchema: { + mapId: z.string(), + fromX: z.number().int().min(0), + fromY: z.number().int().min(0), + toX: z.number().int().min(0), + toY: z.number().int().min(0), + width: z.number().int().min(1).max(4).optional().describe("Interior width in cells (default 1)"), + }, + annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: false }, + }, + async ({ mapId, fromX, fromY, toX, toY, width }) => { + const w = width ?? 1; + const state = getMap(mapId); + const isHoriz = fromY === toY; + const isVert = fromX === toX; + if (!isHoriz && !isVert) { + throw new Error("A corridor must be strictly horizontal or vertical: use the same y (horizontal) or the same x (vertical), or chain two corridors."); + } + + const xa = Math.min(fromX, toX); + const xb = Math.max(fromX, toX); + const ya = Math.min(fromY, toY); + const yb = Math.max(fromY, toY); + + let painted = 0; + if (isHoriz) { + const halfW = Math.floor(w / 2); + const top = ya - halfW; + const bottom = ya + (w - halfW - 1); + for (let x = xa; x <= xb; x++) { + for (let y = top; y <= bottom; y++) { + if (y < 0 || y >= state.height) continue; + paintTile(mapId, "ground", x, y, "walkable_floor"); + painted++; + } + if (top - 1 >= 0) paintTile(mapId, "walls", x, top - 1, "wall"); + if (bottom + 1 < state.height) paintTile(mapId, "walls", x, bottom + 1, "wall"); + } + } else { + const halfW = Math.floor(w / 2); + const left = xa - halfW; + const right = xa + (w - halfW - 1); + for (let y = ya; y <= yb; y++) { + for (let x = left; x <= right; x++) { + if (x < 0 || x >= state.width) continue; + paintTile(mapId, "ground", x, y, "walkable_floor"); + painted++; + } + if (left - 1 >= 0) paintTile(mapId, "walls", left - 1, y, "wall"); + if (right + 1 < state.width) paintTile(mapId, "walls", right + 1, y, "wall"); + } + } + return asText({ ok: true, painted, length: isHoriz ? xb - xa + 1 : yb - ya + 1, width: w }); + }, + ); +} + +export { applyRoom }; diff --git a/tiled-mcp/src/tools/util.ts b/tiled-mcp/src/tools/util.ts new file mode 100644 index 0000000000000000000000000000000000000000..26a9d607a1a484a6358ad2399243776755ac8438 --- /dev/null +++ b/tiled-mcp/src/tools/util.ts @@ -0,0 +1,10 @@ +/** Wrap a JSON-serialisable payload as an MCP text result. */ +export function asText(payload: unknown) { + return { + content: [{ type: "text" as const, text: JSON.stringify(payload, null, 2) }], + }; +} + +/** Shared wording so every tool explains the grid the same way. */ +export const GRID_HELP = + "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)."; diff --git a/tiled-mcp/src/types.ts b/tiled-mcp/src/types.ts new file mode 100644 index 0000000000000000000000000000000000000000..ee780725ade63e206aa295790d4fa13df2fb78a1 --- /dev/null +++ b/tiled-mcp/src/types.ts @@ -0,0 +1,146 @@ +// Tiled JSON map format (.tmj) types, limited to what this server emits. +// Reference: https://doc.mapeditor.org/en/stable/reference/json-map-format/ + +export type TileType = + | "WALKABLE" + | "WALL" + | "DIFFICULT_TERRAIN" + | "HAZARD" + | "DOOR" + | "OBSTACLE" + | "STAIRS"; + +export type ObjectKind = "door" | "chest" | "stairs" | "lever" | "trap"; +export type ObjectState = "closed" | "open" | "locked" | "triggered"; +export type SpawnRole = "player" | "enemy" | "npc"; + +export interface TiledProperty { + name: string; + value: string | number | boolean; + type?: "string" | "int" | "float" | "bool"; +} + +export interface TiledTilesetTile { + id: number; + properties?: TiledProperty[]; + image?: string; + imagewidth?: number; + imageheight?: number; +} + +export interface TiledTileset { + firstgid: number; + name: string; + tilewidth: number; + tileheight: number; + tilecount: number; + columns: number; + tiles?: TiledTilesetTile[]; + grid?: { orientation: "isometric" | "orthogonal"; width: number; height: number }; +} + +export interface TiledTileLayer { + id: number; + name: string; + type: "tilelayer"; + visible: boolean; + width: number; + height: number; + data: number[]; + opacity: number; + x: number; + y: number; +} + +export interface TiledObject { + id: number; + x: number; + y: number; + width?: number; + height?: number; + name?: string; + type?: string; + gid?: number; + visible?: boolean; + rotation?: number; + /** Point object (used for spawns). */ + point?: boolean; + properties?: TiledProperty[]; +} + +export interface TiledObjectGroup { + id: number; + name: string; + type: "objectgroup"; + visible: boolean; + objects: TiledObject[]; + opacity: number; + x: number; + y: number; + draworder?: "topdown" | "index"; +} + +export type TiledLayer = TiledTileLayer | TiledObjectGroup; + +export interface TiledMap { + type: "map"; + version: string; + tiledversion: string; + orientation: "isometric" | "orthogonal"; + renderorder: "right-down" | "right-up" | "left-down" | "left-up"; + width: number; + height: number; + tilewidth: number; + tileheight: number; + infinite: boolean; + nextlayerid: number; + nextobjectid: number; + tilesets: TiledTileset[]; + layers: TiledLayer[]; + properties?: TiledProperty[]; +} + +// Roles a theme tile can fulfil in the procedural pipeline. Every theme +// must provide at least walkable_floor and wall; the others are optional. +export const THEME_ROLES = [ + "walkable_floor", + "walkable_floor_alt", + "wall", + "wall_corner", + "difficult_terrain", + "hazard_primary", + "obstacle_decor", + "decoration_minor", + "door_closed", + "stairs", +] as const; + +export type ThemeRole = (typeof THEME_ROLES)[number]; + +export interface ThemeTileDef { + role: ThemeRole; + tileType: TileType; + spriteId?: string; + hazardType?: string; + hazardNotation?: string; + /** Absolute or relative path to a PNG used as Tiled image for this tile. + * When present, the builder emits the tileset in "collection of images" mode. */ + imageFile?: string; + /** Pixel dimensions of imageFile. Defaults to tileset tilewidth/tileheight. */ + imageWidth?: number; + imageHeight?: number; +} + +export interface Theme { + key: string; + name: string; + description: string; + tilesetName: string; + tilewidth: number; + tileheight: number; + tiles: ThemeTileDef[]; + ambient?: { + lightColor?: string; + fogIntensity?: number; + }; +} diff --git a/tiled-mcp/tsconfig.json b/tiled-mcp/tsconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..d074af0a08b71bec00671c21f3a321eeea630169 --- /dev/null +++ b/tiled-mcp/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "esModuleInterop": true, + "strict": true, + "outDir": "dist", + "rootDir": "src", + "declaration": false, + "skipLibCheck": true, + "resolveJsonModule": true, + "forceConsistentCasingInFileNames": true, + "noUncheckedIndexedAccess": false + }, + "include": ["src/**/*"] +} diff --git a/tiled-mcp/web/app.js b/tiled-mcp/web/app.js new file mode 100644 index 0000000000000000000000000000000000000000..d305fccd707748bd09db41960032944fd56b5d51 --- /dev/null +++ b/tiled-mcp/web/app.js @@ -0,0 +1,269 @@ +// Tiled Map Builder web page. Talks to the same server: /api/config, /api/whoami, +// /api/generate (NDJSON stream). The Hugging Face token lives in sessionStorage only. +"use strict"; + +const $ = (id) => document.getElementById(id); +const STORE_KEY = "tiled.hf"; + +const EXAMPLES = [ + ["Crypt", "A crypt 28x18 under an abandoned chapel: two skeletons patrol the nave, a ghoul lord sleeps in the deep crypt behind a locked door (DC 15), and a poison trap guards the reliquary."], + ["Ice fortress", "A frozen fortress 30x22: a great hall with ice pillars, a throne room at the far end where a frost giant waits, two guard rooms, and slippery ice in the corridors."], + ["Tavern", "A cozy tavern 20x14 with a bar, tables, a hearth and stairs to the cellar. The innkeeper and three patrons are friendly NPCs; a thief hides in the storeroom."], + ["Repaire (FR)", "Un repaire de loups-garous 24x18 dans une grotte humide : l'alpha dort au fond de sa tanière, des tas d'os ralentissent le passage, et trois loups attendent en embuscade près de l'entrée."], +]; + +let session = loadSession(); +let config = null; +let controller = null; +const inIframe = (() => { + try { + return window.self !== window.top; + } catch { + return true; + } +})(); + +function loadSession() { + try { + const s = JSON.parse(sessionStorage.getItem(STORE_KEY) || "null"); + if (s && s.token && (!s.expiresAt || s.expiresAt > Date.now() + 60_000)) return s; + } catch { + // storage unavailable + } + return null; +} + +function saveSession(s) { + session = s; + try { + if (s) sessionStorage.setItem(STORE_KEY, JSON.stringify(s)); + else sessionStorage.removeItem(STORE_KEY); + } catch { + // storage unavailable: the session lasts until the page is reloaded + } + renderAccount(); +} + +function el(tag, attrs = {}, text) { + const node = document.createElement(tag); + for (const [k, v] of Object.entries(attrs)) node.setAttribute(k, v); + if (text !== undefined) node.textContent = text; + return node; +} + +function renderAccount() { + const box = $("account"); + box.replaceChildren(); + $("signin").hidden = !!session; + if (!session) return; + const user = session.user || {}; + if (user.avatar && /^https:\/\//.test(user.avatar)) box.append(el("img", { src: user.avatar, alt: "", width: "28", height: "28", class: "avatar" })); + box.append(el("span", { class: "who" }, user.username || user.name || "Signed in")); + const out = el("button", { class: "button small", type: "button" }, "Sign out"); + out.addEventListener("click", () => saveSession(null)); + box.append(out); +} + +function showError(id, message) { + const p = $(id); + p.textContent = message || ""; + p.hidden = !message; +} + +function mcpSnippet(url) { + return [ + "# Claude Code", + `claude mcp add --transport http tiled-map-builder ${url} \\`, + ' --header "Authorization: Bearer hf_YOUR_TOKEN"', + "", + "# Clients configured with JSON (Cursor, VS Code, ...)", + JSON.stringify({ mcpServers: { "tiled-map-builder": { url, headers: { Authorization: "Bearer hf_YOUR_TOKEN" } } } }, null, 2), + ].join("\n"); +} + +async function init() { + for (const [label, text] of EXAMPLES) { + const chip = el("button", { type: "button", class: "chip" }, label); + chip.addEventListener("click", () => { + $("description").value = text; + $("description").focus(); + }); + $("examples").append(chip); + } + renderAccount(); + + try { + config = await fetch("/api/config").then((r) => r.json()); + } catch { + showError("form-error", "Could not load the server configuration. Reload the page."); + return; + } + for (const t of config.themes) { + const option = new Option(`${t.name} (${t.key})${t.sprites === "all" ? "" : ", no sprites yet: grey placeholders"}`, t.key); + option.title = t.description; + $("theme").add(option); + } + for (const m of config.models) $("model").add(new Option(m.label, m.id)); + $("model").add(new Option("Other model...", "__custom")); + $("model").value = config.defaultModel; + $("model").addEventListener("change", () => { + $("model-custom").hidden = $("model").value !== "__custom"; + }); + $("description").maxLength = config.maxDescription; + $("mcp-snippet").textContent = mcpSnippet(config.mcpUrl); + $("version").textContent = config.version; + + $("login").hidden = !config.oauth; + if (config.oauth && inIframe) { + $("login").target = "_blank"; + $("login").rel = "noopener"; + $("iframe-note").hidden = false; + } + if (!config.oauth) $("token-box").open = true; +} + +$("token-form").addEventListener("submit", async (event) => { + event.preventDefault(); + const token = $("token-input").value.trim(); + showError("token-error", ""); + if (!token) return; + const res = await fetch("/api/whoami", { headers: { Authorization: `Bearer ${token}` } }).catch(() => null); + if (!res || !res.ok) { + const j = res ? await res.json().catch(() => ({})) : {}; + showError("token-error", j.error || "Could not check the token."); + return; + } + const user = await res.json(); + $("token-input").value = ""; + saveSession({ token, user, via: "token" }); +}); + +function argsPreview(args) { + const text = JSON.stringify(args ?? {}); + return text.length > 140 ? `${text.slice(0, 140)}...` : text; +} + +function addStep(className, title, detail) { + const li = el("li", { class: className }); + li.append(el("span", { class: "step-title" }, title)); + if (detail) li.append(el("span", { class: "step-detail" }, detail)); + $("steps").append(li); + li.scrollIntoView({ block: "nearest" }); +} + +function showResult(e) { + $("result").hidden = false; + $("result-title").textContent = `${e.map.name} (${e.map.theme}, ${e.map.width}x${e.map.height})`; + $("dl-zip").href = e.zipUrl; + $("dl-tmj").href = e.tmjUrl; + $("dl-note").textContent = `Download links last one hour (until ${new Date(e.expiresAt).toLocaleTimeString()}). The .zip holds the .tmj and its sprites; open the .tmj in Tiled.`; + $("preview").src = e.previewPng; + $("warnings").replaceChildren(...e.warnings.map((w) => el("li", {}, w))); + $("report").textContent = e.report; + const u = e.usage; + $("usage").textContent = `${e.model}: ${u.modelCalls} model calls, ${u.toolCalls} tool calls, ${u.promptTokens.toLocaleString()} input and ${u.completionTokens.toLocaleString()} output tokens billed to your account.`; + $("result").scrollIntoView({ behavior: "smooth", block: "start" }); +} + +function handleEvent(e) { + switch (e.type) { + case "status": + $("status").textContent = e.message; + break; + case "note": + addStep("note", e.text); + break; + case "tool": + addStep(e.ok ? "ok" : "fail", `${e.name} ${argsPreview(e.args)}`, e.ok ? "" : e.result); + $("status").textContent = `Working... ${$("steps").children.length} steps`; + break; + case "done": + $("status").textContent = "Done."; + showResult(e); + break; + case "error": + $("status").textContent = "Stopped."; + showError("form-error", e.message); + if (/rejected your token/.test(e.message)) saveSession(null); + break; + default: + break; + } +} + +function setRunning(running) { + $("run").disabled = running; + $("run").textContent = running ? "Building..." : "Build the map"; + $("stop").hidden = !running; +} + +$("stop").addEventListener("click", () => controller?.abort()); + +$("gen-form").addEventListener("submit", async (event) => { + event.preventDefault(); + showError("form-error", ""); + session = loadSession() || session; + if (!session) { + showError("form-error", "Sign in with Hugging Face (or use an access token) first: the AI model runs on your account."); + $("signin").scrollIntoView({ behavior: "smooth" }); + return; + } + const model = $("model").value === "__custom" ? $("model-custom").value.trim() : $("model").value; + const body = { + description: $("description").value.trim(), + theme: $("theme").value || undefined, + model, + allowPaidSprites: $("paid").checked, + }; + if (!body.description) { + showError("form-error", "Describe the map first."); + return; + } + + $("progress").hidden = false; + $("result").hidden = true; + $("steps").replaceChildren(); + $("status").textContent = "Starting..."; + setRunning(true); + controller = new AbortController(); + try { + const res = await fetch("/api/generate", { + method: "POST", + headers: { "Content-Type": "application/json", Authorization: `Bearer ${session.token}` }, + body: JSON.stringify(body), + signal: controller.signal, + }); + if (!res.ok) { + const j = await res.json().catch(() => ({})); + if (res.status === 401) saveSession(null); + $("status").textContent = "Not started."; + showError("form-error", j.error || `The server answered ${res.status}.`); + return; + } + const reader = res.body.getReader(); + const decoder = new TextDecoder(); + let buffer = ""; + for (;;) { + const { value, done } = await reader.read(); + if (done) break; + buffer += decoder.decode(value, { stream: true }); + let i; + while ((i = buffer.indexOf("\n")) >= 0) { + const line = buffer.slice(0, i).trim(); + buffer = buffer.slice(i + 1); + if (line) handleEvent(JSON.parse(line)); + } + } + } catch (err) { + if (err.name === "AbortError") { + $("status").textContent = "Stopped."; + } else { + showError("form-error", `The connection was lost: ${err.message}`); + } + } finally { + setRunning(false); + controller = null; + } +}); + +init(); diff --git a/tiled-mcp/web/favicon.svg b/tiled-mcp/web/favicon.svg new file mode 100644 index 0000000000000000000000000000000000000000..5963c0d36bbc30e9987425f36ba6a208a744ad64 --- /dev/null +++ b/tiled-mcp/web/favicon.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/tiled-mcp/web/index.html b/tiled-mcp/web/index.html new file mode 100644 index 0000000000000000000000000000000000000000..e383cada181f86da14b3453d76ff1a14c7cb38e1 --- /dev/null +++ b/tiled-mcp/web/index.html @@ -0,0 +1,121 @@ + + + + + + Tiled Map Builder + + + + + + +
+ Tiled Map Builder + +
+ +
+
+

Describe a map. Get a Tiled file.

+

+ An open AI model reads your description and builds an isometric map with this project's + MCP tools: rooms, corridors, doors, traps, chests and spawns. Preview it here, then download + a .zip that opens in the Tiled editor. +

+

+ Everything runs on your Hugging Face account: the AI model calls are billed + to you (usually a few cents per map, often covered by your monthly inference credits). Your + token stays in this browser tab and is only used for your own requests. +

+
+ + + +
+

Describe your map

+
+ + +
+ Examples: +
+
+
+ + +
+
+ + + +
+
+ +
+ + +
+ +
+
+ + + + + +
+

Use it from your own AI agent

+

+ This app is also a remote MCP server with all 30 map tools. Connect Claude, Cursor or any MCP + client and send your own Hugging Face token. The map tools are free; sprite generation is + billed to that token. On this server, save_to_disk returns a download link. +

+

+    
+
+ + + + diff --git a/tiled-mcp/web/style.css b/tiled-mcp/web/style.css new file mode 100644 index 0000000000000000000000000000000000000000..a78aa8cfdda2c9b26d6f0db2987d893752c65342 --- /dev/null +++ b/tiled-mcp/web/style.css @@ -0,0 +1,310 @@ +:root { + --bg: #0d1117; + --panel: #161b22; + --line: #30363d; + --text: #e6edf3; + --muted: #8b949e; + --accent: #7c5cff; + --accent-text: #ffffff; + --link: #7ab7ff; + --ok: #3ddc84; + --fail: #ff6b6b; + --code: #0b0f14; + color-scheme: dark; +} + +@media (prefers-color-scheme: light) { + :root { + --bg: #f6f8fa; + --panel: #ffffff; + --line: #d0d7de; + --text: #1f2328; + --muted: #59636e; + --link: #0969da; + --ok: #1a7f37; + --fail: #cf222e; + --code: #f6f8fa; + color-scheme: light; + } +} + +* { + box-sizing: border-box; +} + +body { + margin: 0; + background: var(--bg); + color: var(--text); + font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; +} + +a { + color: var(--link); +} + +[hidden] { + display: none !important; +} + +.top { + display: flex; + align-items: center; + justify-content: space-between; + gap: 1rem; + padding: 0.75rem 1rem; + border-bottom: 1px solid var(--line); + background: var(--panel); +} + +.brand { + display: flex; + align-items: center; + gap: 0.6rem; + color: var(--text); + font-weight: 700; + text-decoration: none; +} + +.account { + display: flex; + align-items: center; + gap: 0.6rem; +} + +.avatar { + border-radius: 50%; +} + +main { + max-width: 920px; + margin: 0 auto; + padding: 1rem; +} + +.intro h1 { + margin: 1rem 0 0.5rem; + font-size: clamp(1.6rem, 4vw, 2.2rem); + line-height: 1.2; +} + +.card { + margin: 1rem 0; + padding: 1.25rem; + border: 1px solid var(--line); + border-radius: 12px; + background: var(--panel); +} + +.card h2 { + margin: 0 0 0.75rem; + font-size: 1.2rem; +} + +.muted { + color: var(--muted); +} + +label { + display: block; + margin: 0.75rem 0 0.35rem; + font-weight: 600; +} + +textarea, +select, +input[type="text"], +input[type="password"] { + width: 100%; + padding: 0.6rem 0.7rem; + border: 1px solid var(--line); + border-radius: 8px; + background: var(--bg); + color: var(--text); + font: inherit; +} + +textarea { + resize: vertical; +} + +#model-custom { + margin-top: 0.5rem; +} + +.grid { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); + gap: 0 1rem; +} + +.check { + display: flex; + align-items: flex-start; + gap: 0.5rem; + font-weight: 400; +} + +.check input { + margin-top: 0.35rem; +} + +.examples { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 0.4rem; + margin-top: 0.5rem; +} + +.chip { + padding: 0.2rem 0.7rem; + border: 1px solid var(--line); + border-radius: 999px; + background: transparent; + color: var(--text); + font: inherit; + font-size: 0.9rem; + cursor: pointer; +} + +.chip:hover { + border-color: var(--accent); +} + +.row { + display: flex; + gap: 0.5rem; +} + +.actions { + display: flex; + flex-wrap: wrap; + gap: 0.6rem; + margin-top: 1rem; +} + +.button { + display: inline-block; + padding: 0.55rem 1rem; + border: 1px solid var(--line); + border-radius: 8px; + background: transparent; + color: var(--text); + font: inherit; + font-weight: 600; + text-decoration: none; + white-space: nowrap; + cursor: pointer; +} + +.button.primary { + border-color: var(--accent); + background: var(--accent); + color: var(--accent-text); +} + +.button.small { + padding: 0.25rem 0.6rem; + font-size: 0.85rem; +} + +.button:disabled { + opacity: 0.6; + cursor: wait; +} + +.error { + color: var(--fail); +} + +.status { + font-weight: 600; +} + +.steps { + max-height: 320px; + overflow: auto; + margin: 0; + padding-left: 1.6rem; + font: 0.85rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; +} + +.steps li { + margin: 0.15rem 0; + overflow-wrap: anywhere; +} + +.steps li.ok::marker { + color: var(--ok); +} + +.steps li.fail::marker, +.steps li.fail .step-detail { + color: var(--fail); +} + +.steps li.note { + font-family: system-ui, sans-serif; + color: var(--muted); +} + +.step-detail { + display: block; +} + +.preview { + display: block; + width: 100%; + height: auto; + margin: 1rem 0 0.25rem; + border: 1px solid var(--line); + border-radius: 8px; + background: #0d1117; +} + +.legend { + margin-top: 0; + font-size: 0.85rem; +} + +.warnings { + color: var(--fail); +} + +.report { + white-space: pre-wrap; +} + +.code { + overflow-x: auto; + padding: 0.9rem; + border: 1px solid var(--line); + border-radius: 8px; + background: var(--code); + font: 0.85rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; +} + +code { + font-family: ui-monospace, SFMono-Regular, Consolas, monospace; +} + +footer { + display: flex; + flex-wrap: wrap; + justify-content: center; + gap: 1.25rem; + padding: 2rem 1rem; + color: var(--muted); + font-size: 0.9rem; +} + +@media (max-width: 560px) { + .row { + flex-direction: column; + } + + .button { + white-space: normal; + } +}