Remove Occluded Tiles

A thing I keep on thinking of asking - I’m forever adding layer after layer of tiles and not removing the tiles you can’t even see because they’re behind another tile. Something that could analyze the selected tiles to see if there are any non-transparent tiles in front of them, and if so, remove them, would be handy for cleaning up the map (also reduce overdraw at runtime).

I think this is better avoided through better layer management. Even if there’s zero overdraw, in many engines, every layer is its own draw call (and in some engines, empty tiles may be drawn as invisible quads anyway, for data access optimization), so there wouldn’t be much performance benefit unless the layers are also consolidated instead of tiles merely being removed.

Rather than a built-in feature, I think it would be better as a script. Fortunately, Tiled 1.5 (releasing soon-ish) will have features to work with Images (to detect transparent pixels) in the scripting API, which would make it possible to do this in a script :>

1 Like

That would be cool. I had thought of doing this as a part of the build process when I generate the binaries, but then the original tmx would still have an unsightly mess hidden behind the front layers.