Tiled Wang Set Export — Terrain Sets from an Autotile Sheet
Filling in a Tiled Wang set tile by tile is the same chore as Godot peering bits. The Studio writes the Wang set from the recognised layout — mixed, edge or corner, one colour per terrain — and adds a sample map drawn with the Tiled rule.
A Wang set — shown as a Terrain Set in Tiled since 1.5 — labels each tile's corners and/or edges with terrain colours so the Terrain Brush can pick matching tiles. Pick the type from the art: Corner Set and Edge Set (16 tiles for two terrains each) or Mixed Set (up to 256; the 47-tile blob works as a reduced mixed set). Nerulio writes the .tsx with every tile's Wang ID filled in from the recognised layout, plus a sample .tmx; Tiled 1.12.2 read every ID back as written.

- TiledVerified· Tiled 1.12.2
- Godot 4 TileSetVerified· Godot 4.7.2
- Unity 6 Rule TileVerified· Unity 6000.5.3f1 + 2D Tilemap Extras 8.0.3
- LDtkPartly verified· LDtk 1.5.3 schema + loader
Wang IDs, set types and the empty terrain
In the file, every marked tile has a Wang ID: eight colour indexes in the order top, top-right, right, bottom-right, bottom, bottom-left, left, top-left, where 0 means unset and 1 is the first colour (TMX format reference). A Corner Set only uses the four corner slots, an Edge Set the four sides, a Mixed Set all eight.
The Terrain Brush looks at the colours around the spot you paint and chooses a tile whose Wang ID matches; it also changes neighbouring tiles so they connect. Tiled's manual shows that when two terrains have no direct transition it goes through a third one that has (dirt → sand → cobblestone), and its Patterns view darkens every combination that already has a tile.
The manual also says you do not need an explicit terrain for "empty": transitions to nothing are simply left unmarked. For a one-colour blob set that means the isolated tile has the ID 0,0,0,0,0,0,0,0 — and Tiled drops an all-zero Wang tile when it loads the file, so the brush can never place it (a finding from our Tiled runs).
- Wang set / Terrain Set
- Tiled's set of terrain labels on a tileset; one tileset can hold several.
- Wang colour
- One terrain of the set (name, colour, optional icon tile, probability).
- Wang ID
- Eight colour indexes per tile, top first and clockwise; 0 = unset.
- Corner / Edge / Mixed
- Which slots a set uses: corners, sides, or both.
Example: the Wang IDs Nerulio writes
order: top, top-right, right, bottom-right, bottom, bottom-left, left, top-left
blob tile N NE E SE S (mask 31) wangid="1,1,1,1,1,0,0,0" mixed set
side tile N + S (vertical strip) wangid="1,0,0,0,1,0,0,0" edge set
corner tile NW + NE wangid="0,1,0,0,0,0,0,1" corner set
isolated blob tile wangid="0,0,0,0,0,0,0,0" not written
wangtile entries blob-47 → 46, 16-side → 15, 16-corner → 15
tile id = row × columns + column (cr31 8 × 6 sheet: mask 31 at row 1, column 4 → id 12)The sample map is painted with the same exact-match rule. For a corner set its layer carries offsetx/offsety of minus half a tile, because corner colours belong to grid points.
What it does
- .tsx with the Wang set type that fits the layout (mixed for blob, edge for 16-side, corner for 16-corner / dual grid).
- sample.tmx: a map drawn with the Tiled rule; corner sets as a layer offset by half a tile.
- Checked with Tiled 1.12.2's own --export-tileset / --export-map readers and tmxrasterizer (pixel-exact).
- The terrain brush itself was not driven (Tiled scripting does not run headless on Windows).
How to do it
- Drop the tileset and apply its layout.
- Paint a test map with the Tiled rule to preview.
- Export the Tiled bundle.
- Open the .tsx or sample.tmx in Tiled.
Files you get
The tiled folder of the export ZIP; files are named after your image (here cave.png):
| File | What it is for |
|---|---|
cave.tsx | The tileset: image, tile size, margin, spacing and one Wang set (type corner, edge or mixed) with a colour per terrain and a wangtile per marked tile; tile probabilities when set. |
sample.tmx | A small map drawn with the set, so you see it work before painting. |
cave.png | The tileset image, referenced by a relative path. |
README.txt | Set type, colour count and the Wang ID order. |
Use the Wang set in Tiled
- Unzip the
tiledfolder and keep the PNG next to the .tsx (the image is referenced by file name). - Open
sample.tmxin Tiled, or open the .tsx and use it from your own map. - To inspect the labels, open the tileset and click the Terrain Sets button on the toolbar: each tile shows its coloured corners or edges, and the Patterns tab highlights combinations that have no tile yet.
- Leave the terrain mode, go back to the map, open the Terrain Sets window, select the set and a terrain, and paint with the Terrain Brush (T). Hold Ctrl to paint a whole tile instead of one corner or edge; hold Shift for lines.
- On an empty map start by filling an area first (the manual's advice), or hold Ctrl, so the brush has neighbours to connect to.
- For Godot, either export the map with Tiled's Godot 4 exporter or build terrains directly: Godot 4 autotile.
Check the result
- Terrain Sets mode: every tile of the sheet except the isolated one shows colours; for a 16-corner set the Patterns view should have all 15 non-empty patterns darkened.
- Paint a 3 × 3 block with Ctrl held: 9 different tiles with continuous edges.
sample.tmxlooks like the Studio's test map drawn with the Tiled rule; cells the rule marked as gaps stay empty in Tiled too.
Troubleshooting
| Symptom | Likely cause | How to check | Fix |
|---|---|---|---|
| The brush paints nothing at first | The map is empty and the set has no transition to nothing to build on | The manual describes this case for fresh maps | Fill an area first, or hold Ctrl to paint whole tiles |
| Single-cell islands stay blank | The isolated tile has an all-zero Wang ID and is not part of the set | Terrain Sets mode: that tile shows no colour | Place it with the Stamp Brush where needed |
| The sample map sits half a tile off other layers | Corner-set samples are drawn on grid points with a −½ tile layer offset | Layer Properties: Offset X / Y | Keep the offset for a dual-grid look, or remove it and paint your own layer |
| Wrong tiles or seams everywhere | The set type does not match the art (a blob sheet as an edge set, for example) | The type attribute of the wangset in the .tsx | Apply the right layout in the Studio and export again |
| Two terrains never blend | No tile is marked with both colours | Patterns view: no pattern mixes the two | Draw transition tiles, or generate A-over-B tiles in the generator |
| An old Tiled shows no terrain at all | Terrain data written for Tiled 1.5 and later cannot be read by older versions (manual warning) | Help › About Tiled | Update Tiled |
Other ways to do it
| Option | When it is the better choice |
|---|---|
| Mark the tiles by hand in Tiled's Terrain Sets mode (select a terrain, click and drag over tile regions) | Small sets, unusual layouts, or several terrains per tile that no published layout describes. |
| Use LDtk auto-layer rules instead: LDtk autotile rules | You prefer IntGrid painting and rules you can extend with modulo, random chance or flips. |
| Build Godot terrains directly: Godot 4 autotile | Godot is the only target and you want to paint inside Godot. |
Engine exports and how each was checked
"Verified" means the exported files were loaded by the real engine or tool on real CC0 assets and the result was compared with the source. Anything that was not loaded is labelled as such.
| Target | Files | Check |
|---|---|---|
| Godot 4 TileSet | PNG · nerulio-tileset.json · nerulio_tileset_import.gd | Verified Godot 4.7.2The included import script builds the TileSet with terrain peering bits; a map painted with set_cells_terrain_connect equals the Studio preview in every cell on 9 corpus sheets. |
| Tiled | .tsx Wang set · sample.tmx | Verified Tiled 1.12.2Tiled's own readers load every Wang ID as written and the sample map renders pixel-exact. The terrain brush itself was not driven. |
| Unity 6 Rule Tile | nerulio-ruletile.json · Editor/NerulioRuleTileImporter.cs | Verified Unity 6000.5.3f1 + 2D Tilemap Extras 8.0.3Blob and side sets: a painted Tilemap shows the predicted sprite in every cell. Corner / dual-grid sets are not exported to Unity. |
| LDtk | .ldtk (1.5.3) · rules · sample level | Partly verified LDtk 1.5.3 schema + loaderAccepted by the LDtk JSON schema and its official loader, and the rules re-run to the exported tiles; not opened in the LDtk app. |
Evidence
Layouts identified from the pixels alone on the tile corpus: 4 blob-47 templates and 2 Wang templates with high confidence, a real 64 px cave tileset with medium confidence — every tile's bits right. Godot 4.7.2 painted every test cell exactly as the Studio predicted (485/485 per blob set, 251/251 on a 4-terrain dual-grid pack); Tiled 1.12.2 read every Wang ID back; Unity 6000.5 matched on every painted cell of the blob and side sets.
Limits
- The Terrain Brush itself was not driven by our checks (Tiled scripting does not run headless on Windows); the file readers were.
- Flip and rotation variants (Tile Transformations) are not written.
- One Wang set per export.
- Tiled's terrain brush, the LDtk app and Godot's editor painter were not driven; the checks use the engines' readers and set_cells_terrain_connect.
- Unity gets blob and side sets only; several terrains become several Rule Tiles with no transitions between them.
- Isometric and hex tiles, animated tiles, occlusion and navigation layers are out of scope.
- Suggesting bits without a known layout needs a reference "full" tile; on side-only path templates the guess can fail until you select it.
Versions and sources
Checked with Tiled 1.12.2's own command-line readers (--export-tileset, --export-map): every Wang ID came back as written and every sample map was a valid Wang tiling; tmxrasterizer rendered the samples pixel-exact against an independent render. Swapped Wang IDs, a changed gid or spacing +1 make those checks fail. Menu names above follow the Tiled documentation.
Official documentation used
Questions
Why is the lone "island" tile missing from my Wang set?
Tiled drops a Wang tile whose ID is all zeros, so a one-colour blob set's isolated tile is not written; the Studio's Tiled rule marks such lone cells.
Can Phaser load the sample map?
The .tmx is a Tiled map; Phaser reads Tiled JSON with embedded tilesets, which you can export from Tiled.
Is it free, and do I need an account?
Everything on these pages is free and works without an account. There is no watermark and no export that is held back.
Are my sprites uploaded?
No. The Studio decodes, packs and exports in this browser tab. Projects are autosaved in the browser (IndexedDB) and can be saved as a .nerulio file.
Does it need Aseprite or an engine plugin installed?
No. .aseprite files are read and written in the browser, and each engine bundle carries what that engine needs (for Godot, the import settings and scene; for Unity and the Godot TileSet, a small editor script).