Confused on terrain mixing and red-crossed tiles

Hello !
I recently started working with Tiled (version 1.8.4) to build a terrain with a custom tileset, everything worked fine with one main pattern and three other being neighbor to it. When I added a fifth one and additional transitions, everything started to go haywire. (I’m using a corner set.)

This is my tileset:
tileset

This is the terrain pattern setup:

And when I try to paint is goes badly:
tileset_painting

What I find confusing is:

  • why are there black/crossed tile ? Like something is missing ?
  • it may not be clear on the screenshot, but the painted tiles are “grass” with a transition to “soft grass”
    and then “dark grass”. I don’t understand why (is there a “main” tile ?), why is Tiled doing transitions already with so many different patterns ?
  • from the documentation, I didn’t see clear explanation on that overall behavior I’m seeing

The red-cross tiles are usually seen when a tile is missing. I’ve never seen them show up in terrains, though, so I have no idea what’s happening there.

Your tileset is not correctly labelled, you need to add the red “Dark Grass” terrain to the 9 (or at least 8) tiles in the lower left. Right now, because they’re unlabelled, Tiled sees them valid transitions to empty, just like your “soft grass” tiles in the upper right.

If the “soft grass” tiles in the upper right are meant to be transitions to empty, you need to finish labelling them with the concave corners. If they’re not, then you need to remove the labels from all of them except the centre tile that has 4 “soft grass” corners. If you choose this latter option, you’ll not be able to use these terrains on an empty layer since you don’t have transitions to empty, but that’s fine for a tileset like this - just remember to fill the layer with some solid tile like a grass tile, and then you’ll be able to paint normally.

The red-cross tiles are usually seen when a tile is missing. I’ve never seen them show up in terrains, though, so I have no idea what’s happening there.

That’s what happened initially when I reformatted my tileset source image and updated the pattern rules. But I have since cleaned up the terrain with the eraser and started painting from scratch again.

Now for some reason they continue to show up, depending on which type of terrain I want to paint.

Your tileset is not correctly labelled, you need to add the red “Dark Grass” terrain to the 9 (or at least 8) tiles in the lower left. Right now, because they’re unlabelled, Tiled sees them valid transitions to empty, just like your “soft grass” tiles in the upper right.

Indeed, I did several tweaks to see how Tiled would behave and I forgot to setup back that pattern.


So following your remarks I have reworked the rules a bit to remove the empty transitions:

However I’m still seeing very weird behaviors depending on which type of terrain I want to paint:
demo_tiled_behavior

I filled the map with the “soft grass” and as you can see only the dark grass behave as I would expect.

Could it be a bug ? :thinking:

Ah, the reformatting might explain it. Have you tried restarting Tiled to make sure those deleted tiles are actually gone from memory? If they remain after a restart, then it’s possible your tileset still contains terrain data for tiles that don’t exist, you might need to edit the tileset file manually to remove them if Tiled won’t let you.

Another option is to delete this terrain set and make a new one. It’s not a lot to relabel :]

I restarted Tiled several times already and the problem persisted.
I went ahead with your suggestion of deleting and recreating the terrain set and that solved my issue. Now everything behave as expected.

I will try to be careful during my future tileset iterations. :smile:

Looks like there is an actual bug here though: Resizing the tileset such that some tiles are lost and not taking care to delete the Terrain data from them results in bugged tiles that can’t be easily deleted.

Pinging @bjorn to take a look.

2 Likes

Makes sense, I have indeed resized the tileset image from a square (2048x2048px) to a smaller non-square (2048x1024) before adjusting the rules. So the old ones weren’t visible for me to cleanup.

When you do that, Tiled normally shows you a bunch of white placeholder tiles, so you can inspect them, move data from them, delete data from them, etc. Sounds like you missed that step. But also, I think it’s a reasonable assumption that if you close and reopen the tileset after this, you want all that extra data gone next time the tileset is loaded.

Hmm, I don’t recall seeing anything like that. I think I did the resizing while Tiled was closed. :thinking:
But yeah, I would expect the missing tiles to be gone.

Partly addressed by Fixed removal of terrain info when removing tiles from a collection · mapeditor/tiled@ff83712 · GitHub, but still needs to be fixed for the case where the tileset image is cropped.

I also noticed an additional bug, which is that undoing tile removal will see the tiles return to the collection at the end instead of from where you removed them. A regression from the addition of reordering…