Rules for modifying collision layer

Due to a quirk in how trees are placed, my collision grid is a checkerboard. This doesn’t affect the game at all, but drives my OCD crazy.


I was trying to create a rule that I can run once and have it fill in encloses collision tiles. The input is…


and the output is…


But no matter what I do, I can’t get it to work. Is it even possible?

I tried creating a rule myself and it worked fine. Here’s the files I used: (39.2 KB)

I think you may have forgotten to define “regions_input” and “regions_output” layers? They are necessary because in this case the input and output regions of the rule are different.

Since it feels a little silly to effectively duplicate the input and output layers of the rule, I’m considering to derive the input and output regions from the input and output layers in case no explicit “region” layers have been defined.

I did forget those, but adding them still doesn’t fix the issue. I must be doing something else wrong.

Here is my rules file… as far as I can tell, it’s exactly the same as yours.

Rules_collision.tmx (1.5 KB)

Yes, your rules look the same to me as well. Another thing that may go wrong, is when your map isn’t using the same tileset as your rules.

Did you test the files I uploaded, and do they work for you?

Yes, the map you sent does work. My tiles are from the same tiles set. My map is 250x150, I don’t know if that matters. I did have a bug the other day where autotiles would only work on part of the map until I restarted. In this situation, restarting doesn’t help. Is it possible I am missing (or have defined) a map property that is preventing it from autotiling. Just to clarify, I am not using autotile while draw, that is OFF and I’m just using the AutoMap (A) command.

Could you upload a complete set of files with which I could try to reproduce your problem?

So, the problem was a typo in the layer name of the “input” rule.

I think it would be very reasonable if Tiled would report any “input” or “output” rules that are somehow standing alone as errors, since that never makes sense.

Yes, thanks for spotting that!

1 Like

Hrm, while looking at implementing this, I came to the conclusion that it would not help in this case. If you define a rule with input_collison and output_collision, the rule makes perfect sense and Tiled has no way to determine there is a typo.

If there is no input layer or output layer at all then Tiled already shows an error message. I’ll also add an error message for when there is no output layer at all.