Hi Studder, happy to hear that you’re enjoying the kit
What you are talking about essentially boils down to modifying the GridEdges array in BP_GridManager, as well as GridLocations.
The toolkit is represented by a bunch of arrays. Grid locations holds the in-game location of each grid index. If you have a 3*3 grid, then the top left index will be 0, the next to the right be 1, the one below 0 would be 3 etc. Like so:
0 ] 1 ] 2 ]
3 ] 4 ] 5 ]
6 ] 7 ] 8 ]
so that is a 2D grid. When adding multiple levels, the tiles on the second level would equal the tile below it plus (GridSizeX * GridSizeY), so the tile directly above tile 2, for instance, would be 11 in this example. However, from your description it sounds like you do not need multi-level grids. Rather it is really just a single “level” in the sense that a unit can never stand on a tile directly below another unit (am I right?).
If so it makes things a lot simpler. So to start with you would have a grid like the one outlined above, where each tile would be connected to each of the others as defined in the edge array. The edges represented like lines would look like this:
0 ] - 1 ] - 2 ]
…|…X…|…X…|
3 ] - 4 ] - 5 ]
…|…X…|…X…|
6 ] - 7 ] - 8 ]
So if we looked at index 3 of the GridEdgesArray we would find that it would have 5 elements, one for each edge. If we looked at their values they would be 0,1,4,6 and 7, with edge costs of 1 by default. This is our starting position.
Now lets say a player wants to raise the tile at index 4 to the next level. This would first entail placing the block mesh, of course. After that you would need to modify the GridLocations TMap in BP_GridManager so that the index had the appropriate height, or units would just more right through it. So you would remove index 4 of the map and then add a new vector at index 4 with the same X and Y as before, but with Z at the same height as the top of the box.
Since we’ve just gone up one level the edge array won’t be affected in this particular case, if it is, as you say, where tiles at the ground level can always move to level 1. However, it might be that index 5 has already been raised to level 2, in which case we would want to modify the edge array, so whenever we add a new block we want to check if the edge array should be modified.
Now how do we do this? Pretty simple, actually, thanks to a couple of functions included in BP_GridManager. First use GetIndexesInRange with a range of 1 to get an array of all surrounding tile indexes. Then loop through this array and for each index get the associated value from the GridLocations TMap. Subtract the Z location of each tile to the Z location of the center tile and get the absolute value. If it is below an arbitrary threshold you want to add edges between the tiles (if there is not an edge there already). If it is above you want to remove the edges (if they exist).
To add and remove edges is simple. Use the RemoveTileEdgeBothWays and AddTileEdgeBothWays functions in BP_GridManager. There are already checks in place to make sure a tile is not added twice. For these functions input the grid index of the center tile and its neighbor. The order does not matter. You want to use the “both ways” function, as if you only add or remove one way you will still be able to move one of the directions.
Hope that helps!