Tile map itself defines which automapping rules are applied to it?

I’m looking for a feature where a tile map could define on itself which automapping rules “theme” would apply to it.

Looking through the docs I do see that it’s possible to use the rules.txt to specify which tile maps get which rules through the [wildcard*]s. From a design perspective this does feel a bit inverted, it seems to mix the tile map’s internal configuration with the automapping logic, and makes my developer senses tingle a bit. (I’m guessing it was a quick convenience shortcut to mitigate all the downstream work for a theme-like system?). Ideally, I’d like to have automapping rules and logic travel independently from the maps that use them.

Either way, I’m mentioning to see if there is a similar feature that I missed? Like, maybe a some specific rules.txt can be set on a tile map property and is refreshed downstream or something?

A tile map will use the rules.txt located in its directory, so if your differently themed maps are located in different subdirectories, you can have different rules.txts for each theme. This requires the same amount of preplanning as using the map name in the rules.txt though, since you have to make sure your maps are in the appropriate directory for their theme. With the appropriate structure, it should be easy to move maps between these subdirectories without breaking the tileset and template file paths, though.

Another approach is to use a guide layer in the map which is filled with some tile indicating which theme to use, and your rules would check for the presense of these tiles. A benefit of this is it allows you to include several themes in different parts of the same map. The downside is you end up with a layer in your map that’s useless for everything but Automapping, but such layers are a common feature of the way many people use Automapping to begin with, and is ultimately not much different from a property that exists solely to inform automapping.

A third option is to automap via scripting, which allows you to have any control flow you like, such as applying a particular set of rules based on a custom property on the map or some other heuristic. This can be done directly via TileMap.autoMap(), or indirectly by modifying the relevant rules.txt via script.

There has been discussion about adding a built-in way to specify a specific rules.txt (or better yet, specific rules maps) from a map rather than the way it’s currently done, it was even brought up in the issue that resulted in the map name filters, but that hasn’t been added yet. I suggested the current way and naturally find it far more convenient than the reverse (you can read my reasoning in that thread), but I do think there’s value in having a way to specify specific rules maps directly from the map, especially for scenarios where individual maps have different rule sets, rather than large groups of maps sharing rule sets. Plus, for many users, having to create a rules.txt is an unnecessary hassle as they might just need 1-2 rule maps that only affect 1-2 working maps.