Rule placement
One of the core axioms of the Theme engine is that whenever a rule is applied, no other rule can be applied on the same tile in the same layout. While that is usually enough for 2D levels, we might need something more flexible in 3D. That is where the concept called Rule placement comes into play. Not only can a rule be applied inside a grid tile (or cell), but we can also create rules that occupy grid edges or corners.
We can use this feature by clicking the Toggle rule placement button inside the rule editor window. The green color means that the specific part of the grid is occupied by the rule and no other rule must be applied there. For example, in the image below, the rule uses the floor tile cell and also both the edges between the floor tile and the wall tiles.
Example 1
Let's use the 3x3 level below to illustrate how to use the rule placement feature.
First, let's add a treasure chest on top of each floor tile. For this rule, we do not need to use the rule placement feature.
The level will look like this:
Now what if we wanted to place a wooden structure between each two neighboring floor tiles like this?
We can use the rule placement feature and configure the rule to occupy the edge between the floor tiles like this:
We also need to allow rotations of the rule and configure the offset of the rule so that the game object is visually placed on the edge of the two tiles.
Example 2
In the *Mini Dungeon example scene, we have these red banners as decorations on walls, and we also use the wooden structure if there are two walls close to each other (picture below). What if we never want to have a banner placed inside the wooded structure?
We can define the banner rule like this, occupying only the edge between the floor tile and the wall tile.
We can define the wooden structure rule like this, occupying the grid cell and also both of the edges to prevent the banner from being placed.
There are many ways to handle this specific setup. For example, both tiles could be defined as occupying the cell of the floor tile and that would also prevent them from being placed on the same tile.