Automapping empty output

Hello everyone
Is there a way to make the output layer in rules empty? This is mainly to prevent the player from putting tiles on the wrong layers. I tried setting the output empty and nothing happens.

Not entirely sure how to use : “DeleteTiles” option if this is the way to check if a tile should* be on a layer . Where do I specify which tiles to delete and which to keep ? I don’t understand the behavior of “DeleteTiles” , on how to make it keep certain tiles on a certain layer

Also how does automapping fit into groups? How would you select a tile layer inside a group?

1 Like

Just so I get this right, you have your players create maps with Tiled, and sometimes they’re putting tiles on the wrong layers, and you’re looking to solve this using AutoMapping rules that will automatically erase stuff? It’s a pretty interesting scenario!

DeleteTiles seems to erase all tiles from the output layers that are in the same place as any tile in any input layer. I don’t think this makes sense in all cases, but it does what it does and it probably doesn’t help you.

Currently AutoMapping does not at all work with layers in groups. It plainly ignores them. What I could probably do is to make it search the input and output layers by name in the whole hierarchy, but if an output layer is missing it would still always be created at the top-level. It’s slightly tricky because currently the code relies on layer indexes (after finding layers by name), which does not make sense in a hierarchy.

Alternatively, new output layers would be created using the same parent layers as in the rule file, and input layers in a rule file that are in a group may only match with layers that are in a group with the same name. In any case this is an area that still needs work.

So, coming back to this question, I think there currently isn’t. However, I don’t see a reason not to allow this. We already specify the output region and the actual output separately, so if you specify some output region but then leave the actual output empty, I think it really should work as an eraser. I think that would just mean getting rid of this line:

I’ll give it some testing and if it works as expected (and is not going to break too many existing rules), I’ll include that change in Tiled 1.2.1.

1 Like

Well, in my first test, with the “sewer_automap” example shipping with Tiled, I unfortunately ran into serious compatibility issues. The rules, and I think those of many, rely on the fact that empty tiles in an output layer do not get drawn. By relying on that the rules could generally share the rule regions between the input and the output layers, even if the output region was technically smaller due to the empty tiles.

I’d still like to support outputting empty tiles, but it’ll have to be added as an option.

1 Like

I second this feature! The ability to bind tiles to a certain layer so that players won’t place tiles on the wrong layer is what I’m missing.

Right, this is a common request and one I do want to implement as well, but I wouldn’t want to try doing that using the above requested AutoMapping feature. Automatically placing tiles in certain layers is covered by the following issue: