To make something spawn inside the painted cells, you need to create a BuidlingLogic object and give it to the tool.
This object will store the rules that the tool will follow to spawn actors inside the cells.
This makes the tool really modular and powerfull : It's a tool integrated to the editor but you can write your own logic in it to modify its usage. And you can do it entierly in Blueprints !
That way, you can choose to setup the spawning logic to create a platformer map or a house, a dungeon, a cave,...
When cells are painted inside the grid, the topology of the cell is computed.
topology refers to configuration of the cell inside the grid. It takes into account how many neightbors the cell has and how they are positionned.
Note : A cell is considered to be a valid neighbor cell for another cell only if the two cells have the same GroupID.
The cell can have the 5 following topology.
If none of them is found, the topology of the cell is "None" (which is the case for most, if not all, the cells which are not located in the borders).
In addition of that topology. You can obtain the list of external corner direction and internal corner directions, as shown below :
Those infos are stored inside each cell. You can get those infos to determine what kind of item you'll spawn inside the cell.
Each cell stores the following informations :
Category, GroupName, Tag and Group ID are the informations which identify the cell. Those infos are the infos that you paint inside the cells. You can interpret those infos the way you want in the Building Logic blueprint.
Topology, External Corner Dirs, Internal Corner Dirs, Neighbor Count and Neighbor Dirs are topological informations which are automatically computed when the cell is painted in the grid.
Open Dirs and Main Dirs are two additional infos that you can set in the cell when you paint them. You can use them to give some directions to the cell (if you want to place something in a given direction in the cell or if you want to place specific things in a specific direction like doors, ...)
Note : Because UE4 hides the underlying type of the variable when it is a bitmask field, I've added some notes to the displayed variable names : DD is for "Cell Diagonal Direction", D8 is for "Cell Direction 8" and D4 is for "Cell Direction 4".
In the code, you'll find multiple Enum for sirections
The important thing to note here is that ECellDirections8, ECellDirections4 and ECellDiagonalDirections are bitmask flags. Which mean that you can store multiple direction inside one variable of this type.
Another thing to note is that you can convert ECellDirection8 to/from ECellDirection4 to/from EDiagonalDirection without any restriction. It's just syntactic sugar.
Because you'll probably implement your own Building Logic in BP, I've providen a buch of utility functions to manipulate those direction more easily. You'll find those functions inside the DungeonUtilities function library :
Note : I've implemented the bitflags in a way that lets you convert them from one type of direction to the other without having to worry. BUT you need to be carefull if you perform any bitmask operation on them (especially the "~" operator. comparison and fine).
If you do
CellDirection4 MyDir = CellDirection4::RightCellDirection4 MyOtherDir = ~MyDir CellDirection8 ReinterpretedDir = (CellDirection8)((uint8)MyOtherDir)Then ReinterpretedDir is now equal to [Up, Up-Right, Right-Down, Down, Down-Left, Left, Left-Up] and not [Up, Down, Left]
Because Blueprint hide so much things under the hood when it comes to bitmask, you need to be carefull with that.