Skip to content

Godot Terrain Wrong Tiles — Find Missing Combinations

When Godot 4 terrain paints a tile with the wrong edge or leaves a cell empty, the terrain set is usually missing the tile for that neighbourhood, or a tile carries the wrong peering bits. Godot then substitutes the closest tile or leaves the cell blank, and the result can even change with the order you paint in.

Godot 4 terrains paint a wrong tile or leave a cell empty for four reasons: the terrain set has no tile for that neighbourhood (most often the isolated tile, one-tile-wide strips or an inner corner), the set's match mode does not fit the art, a tile's peering bits name the wrong position or terrain, or tiles and brush are in different terrain sets. Godot does not warn — it takes the closest pattern, which can be the empty one. Check the four in the table below; the Studio shows the first three before you open Godot.

Drop a tileset or autotile sheet (PNG)
Runs in your browser. Files are not uploaded.
Studio Tile workspace: a test map painted with the Godot rule where one cell stays empty because the set has no isolated tile, flagged in the Check panel
The real Studio with a CC0 asset (OpenGameArt).
Exports to
  • Godot 4 TileSetVerified· Godot 4.7.2
  • TiledVerified· Tiled 1.12.2
  • Unity 6 Rule TileVerified· Unity 6000.5.3f1 + 2D Tilemap Extras 8.0.3
  • LDtkPartly verified· LDtk 1.5.3 schema + loader

How Godot picks a tile, and why it goes wrong

When you paint (Terrains tab or set_cells_terrain_connect), Godot sets constraints on the painted cells' centres, sides and corners, then solves the cells one by one — painted cells in reverse order, then their neighbours. For each cell it scores every pattern the terrain set has, plus the always-present empty pattern, and keeps the lowest score. The TileMapLayer reference states the condition: the TileSet needs "all required terrain combinations. Otherwise, it may produce unexpected results."

Missing combinations are the main cause. One terrain against empty needs 47 tiles under Match Corners and Sides, 16 under Match Sides and 16 under Match Corners; a pair of terrains needs its transitions on top. Commonly missing: the isolated tile, the four dead ends and two straights of a side set (a 3 × 3 box has only 9 of the 16), and inner corners. The second cause is the mode: blob art under Match Sides collapses 47 tiles onto 16 patterns, so tiles with different inner corners become duplicates Godot picks among at random.

The other two are data errors. The Godot docs say Terrain Set and Terrain IDs start at 0 and −1 means none; a tile left at Terrain Set −1, or in terrain set 1 while you paint set 0, is never chosen. A peering bit on the wrong side, or naming terrain 1 instead of 0, makes a tile answer a neighbourhood no map produces. Nerulio cannot open your .tres to fix these in place; it rebuilds the TileSet from the image and correct bits.

Empty pattern
The "no tile" candidate Godot always considers; it wins when nothing else fits well enough.
Required combinations
Every neighbourhood a map can ask for in a given mode: 47, 16 or 16 per terrain against empty.
Duplicate pattern
Two tiles with identical terrain and bits; Godot picks between them by probability.
Corner bit behind an open side
A corner set while a side next to it is open: no map ever asks for it, so the tile is dead.

Example: what Godot does with incomplete sets (Godot rule, same as 4.7.2)

blob set without the isolated tile, one painted cell
  set_cells_terrain_connect([Vector2i(1, 1)], 0, 0)   →  the cell stays empty
3 × 3 box (9 of 16 side tiles) in Match Sides, a 4-cell horizontal strip
  →  all 4 cells stay empty: no tile is open above and below
blob set without mask 223, map    X X X
                                   X C X     C wants N NE E SE S W NW = 223
                                   . X X     Godot draws 215: inner corners bottom-left AND bottom-right
blob art in Match Sides  →  47 tiles on 16 side patterns, 31 tiles duplicate another

In the third case one extra inner corner appears at the bottom-right of C, where the map is solid — the typical "wrong corner" people report.

What it does

  • The Check panel counts, per terrain, the combinations the set has against the ones a map can ask for, and draws every missing one as a ghost tile, so you see exactly which tile to draw.
  • Duplicates (two tiles with the same bits) are listed and clickable, and tiles with a corner bit behind an open side, a combination no map ever requests, are counted separately.
  • The art-vs-bits check compares each tile's edge pixels with its bits. On the corpus it found two deliberately swapped tiles exactly, both of them and nothing else, with no false flag on any set.
  • The test map's Godot rule is a port of set_cells_terrain_connect that equalled Godot 4.7.2 cell for cell. Holes and substituted tiles are outlined; hovering a cell tells you which tile Godot picks and why.
  • When whole groups are missing, the Generator assembles a complete blob-47 or dual-grid 16 set from a small source block (RPG Maker A2, Blobsmith base, A4 wall, five-tile or a procedural rim).

How to do it

  1. Drop the tileset PNG into the Tile workspace and press Use this grid.
  2. Apply the recognised layout, or paint the bits with B if no layout fits.
  3. Open the Check panel, fix the flagged bits, then draw or generate each ghost tile it lists.
  4. Press M, keep the Godot rule and paint across the outlined cells until none are left.
  5. Export for Godot 4 and run nerulio_tileset_import.gd so the TileSet is rebuilt from the corrected bits.

Check the result

  • Paint a test shape with a lone cell, a one-tile-wide strip, a 3 × 3 square and an L-shaped inner corner: every cell shows a tile with continuous edges.
  • From code, get_cell_source_id(coords) returns −1 for a cell that stayed empty; loop over the painted cells to find any left.
  • In the Studio, the Check panel says every combination has one tile with no invalid bits, and the test map with the Godot rule outlines no cell.

Wrong Godot terrain tiles: symptom, cause, fix

SymptomUsual causeFix in the Studio
An inner corner or a junction shows a tile with the wrong edgeThe set has no tile for that neighbourhood, so Godot substitutes the closest oneCheck panel ghost tile shows the missing combination; draw it or rebuild the set with the Generator
A painted cell stays emptyNo tile fits the neighbourhood at allThe test map (Godot rule) outlines the hole and names what is missing
Two different tiles appear at random in the same spotTwo tiles carry identical bits and Godot picks by probabilityDuplicates list: keep one, or set probabilities if they are meant as variants
A tile exists but is never usedA corner bit sits behind an open side, a combination no map asks forClear the stray corner bit in the 3×3 bit editor
Bits look right, the painted map shows seamsBits contradict the art, for example two swapped tilesThe art-vs-bits check flags both tiles; fix them or apply the recognised layout again
The result changes with the painting orderGodot's matcher is path-dependentFill each terrain once, row by row, as the test map does

Corpus result: Godot 4.7.2 painted every test cell as the Studio predicted, 485/485 on each blob set and 251/251 on a 4-terrain dual-grid pack.

Troubleshooting

Check the causes in this order; each row names the check in Godot and, where it helps, in the Studio.

SymptomLikely causeHow to checkFix
A single painted cell stays emptyNo isolated tile (mask 0) in the setTileSet editor: is there a terrain tile with all 8 peering bits −1? Studio Check panel lists it as missingDraw it, or generate the set so it includes four outer corners
One-tile-wide paths or strips stay empty or get rimsA side set with only the 9 tiles of a 3 × 3 box: dead ends and straights are missingCount the terrain tiles: Match Sides needs 16Add the 7 missing side tiles, or generate the full 16
An inner corner shows on the wrong sideThe set lacks that inner-corner combination; Godot substitutes the closest tileStudio test map (Godot rule) outlines the substituted cell and names the missing patternDraw the missing corner tile
Identical spots get different tiles, inner corners ignoredMatch mode too coarse for the art (blob set in Match Sides)TileSet inspector › Terrain Sets › ModeSet Match Corners and Sides for 47-tile art, Match Corners for 16-corner art
A drawn tile is never usedA peering bit on the wrong position (a corner behind an open side) or the wrong terrain IDTileSet editor › Select mode › Terrains section of that tile; Studio counts "corner bit behind an open side"Clear or move the bit; bits name terrain IDs starting at 0
The brush paints nothing, or never picks certain tilesThe tiles have Terrain Set −1, or belong to another terrain set than the one selected in the Terrains tabTerrain Set field of the tile vs the set chosen in the Terrains tabPut all tiles of the terrain into the same terrain set
The result changes with painting orderGodot solves cells one after another, so gaps in the set are filled differently each strokePaint the same area in one call vs several strokesComplete the set; then the order no longer matters for a full set
Two terrains meet with gapsNo transition tiles between A and BStudio Check panel for the pair A–BGenerate A-over-B transitions, or draw them

Other ways to do it

OptionWhen it is the better choice
Fix the bits by hand in the TileSet editorOne or two wrong tiles in an otherwise complete set.
Rebuild the TileSet from the image: Godot 4 autotileMany wrong or missing bits, or you do not trust the existing .tres.
Test the set before Godot: autotile testerYou are still drawing the tiles and want to see gaps as you go.

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.

TargetFilesCheck
Godot 4 TileSetPNG · nerulio-tileset.json · nerulio_tileset_import.gdVerified 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.tmxVerified 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 Tilenerulio-ruletile.json · Editor/NerulioRuleTileImporter.csVerified 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 levelPartly 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

  • Nerulio cannot open an existing .tres: it rebuilds the TileSet from the image and bits, so keep your old resource until you have compared.
  • Art that does not exist cannot be fixed by bits: a missing tile has to be drawn or generated.
  • Godot's painting stays path-dependent for incomplete sets; the Studio shows one row-by-row fill per terrain.
  • 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

The Studio's Godot rule is a port of Godot 4's terrain matcher; on the corpus it equalled Godot 4.7.2 cell for cell, including the substitutions and empty cells of incomplete and multi-terrain sets, which are recorded as test fixtures. The examples above were computed with that port. Terrain settings and IDs follow the Godot 4.7 documentation.

Official documentation used

Questions

Why does my terrain not show up in the TileMap at all?

Where no tile matches the neighbourhood, Godot leaves the cell empty. If whole areas stay blank, the set is missing most of the combinations the map asks for; the Check panel's present/expected count shows how many, and the test map leaves the same cells empty and outlines them.

Can it open the TileSet .tres I already have?

No. It works from the tileset image. Export for Godot 4 and the bundled GDScript builds a fresh TileSet with the corrected terrain bits inside Godot; keep your old resource until you have compared the two.

Why is my dual-grid (corner) set half a tile off in Godot?

Godot draws corner-matched sets on the cells themselves, not on the points between them, so a dual grid needs a plugin such as TileMapDual. The Godot rule shows it the way Godot draws it; the Tiled rule shows the half-tile offset Tiled uses.

Was the Godot editor's own terrain brush tested?

No. The check ran set_cells_terrain_connect in Godot 4.7.2, which the editor brush calls, and compared every painted cell. The brush itself was not driven.

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).