Skip to content

Blueprint node rules

You can attach Blueprint (or C++) based logic on the theme nodes for more control. There are two types of rules you can attach to Visual nodes and we’ll explore them in the next sections

Visual Node Rules

A selection rule is a blueprint class (or C++ class) that is used to decide if the current node is to be attached to the scene. This rule replaces the default Probability property that is used for randomly deciding if visual node needs spawning based on a probability.

Selection rules gives you more power, when you need it. In the rule’s blueprint logic, you can query the dungeon model and determin if this node should be inserted into the scene

To assing an existing rule into the node, Check the Use Selection Logic property and select the rule you would like to attach to the node from the dropdown list

Assign an existing Selection Rule

Create a new selection rule by creating a new blueprint class derived from the appropriate DungeonSelectorLogic. It should match the builder you are targeting

Create a new Selection Rule

Open up the blueprint and override the Select Node function. This function will be called by the engine and the logic you put here will let you decide if the node should to be selected

Override function to define logic

The selection can be combined with the Probability varaible by unchecking Logic Overrides Probability

Combine selection logic with Probability variable

Here is an example of a selection logic that selects a node only if the sum of their X and Y positions are even numbers (logic for a checkerboard pattern)

Override function to define logic

And the result after applying this rule to the ground node:

Custom selection rule attached to a mesh node

You can add more visual nodes and experiment with the Consume on Attach parameter to get interesting results

Multiple visual nodes working together

In the above example, the first node has Consume on Attach checked. So if your blueprint logic selects the node, the sandstone mesh will be inserted and the execution stops. However if the selection node doesn’t select the node, the execution will always proceed to the next node and execute the mesh which inserts a clay brick mesh

In the above example, the selection rule is applied to the golden pillar. But whenever it is selected, it stops execution because the Consume on Attach variable is set and doesn’t build a ground mesh there. Unchecking Consume on Attach on the first node lets the execution proceed even if it is inserted into the scene

This example places a stone mesh on the ground, but only if the cell is inside a room (and not a corridor)

Stone ground mesh selection only when inside rooms

Room selector logic

The above Selection logic was attached to the stone mesh ground node so it gets selected only when the ground marker is inside a room

Ignore nodes that are near other markers. This is very useful if you don’t want to place blocking items near stairs, doors etc

Query System

Query System

Dungeon Architect lets you specify offsets to your visual nodes to move/scale/rotate them from their relative marker locations.

Static node Offset

However, if you want a more dynamic way of applying offsets (based on blueprint or C++ logic), you can do so with a Transform Rule. This can be very useful to add variations to your levels for certain props

To assing an existing rule into the node, Check the Use Transform Logic property and select the rule you would like to attach to the node from the dropdown list

Assign an existing Transform Rule

Create a new Transform rule by creating a new blueprint class derived from the appropriate DungeonTransformLogic. It should match the builder you are targeting

Create a new Selection Rule

Open up the blueprint and override the Get Node Offset function. This function will be called by the engine and the logic you put here will let you decide on the offset that needs to be applied on this node

Override function to define logic

In this example, a single rock mesh is randomly rotated, and slightly scaled and translated to give a nice cave like look

Rocks randomly rotated, translated and scaled

A different transformation rule is applied to ceiling stone meshes for more variations

Transform rule applied to rock nodes

Cliff Random rotation rule

Here is an example where alternate pipes are rotated by 180 degrees to give a visually appealing look

Alternate meshes are rotated by 180 degrees

This was done by rotating the mesh node by 180 degrees for every alternate cell (similar to the checker rule logic seen previously)

Rule assignment

In this example a small random rotation is applied to orange ground tiles. Useful while creating ruins when laying down broken tile meshes

Transform rule applied to orange ground meshes

Transformation Rule Blueprint

Spawn Logics are blueprints that are attached to visual nodes and are executed whenever that visual item (mesh, actor, particle system, light etc) is spawned into the scene

These are great for initializing blueprints (or randomizing them). Some use cases include randomizing the colors of the lights that spawn from a light node, or you can use it to initialize your blueprints spawned from the actor nodes

You can attach a spawn logic to any visual node (e.g. mesh node, light node, particle system node, actor node etc)

Set the Use Spawn Logic flag and choose your spawn logic blueprint

Spawn Logic

Spawn Logic

Create a new blueprint class and pick DungeonSpawnLogic class as the parent

Open your blueprint and override the OnItemSpawn function.

Spawn Logic

Get the reference of the spawn actor and cast it to the type you are expecting. Since this logic was attached to a mesh node, it is cast to a static mesh and customizations can be applied to it

Spawn Logic

Another blueprint that was attached to a point light. Since we expect a point light, we cast to the correct type and change the color

Spawn Logic