[SUPPORT] Advanced Turn Based Tile Toolkit

Hey Kon, sorry about skipping your question earlier. For someone’s first post Epic usually take a while to approve it, to prevent spam, so it did not show up for me until now.

Interesting question, though. In your case you basically have two different grids, where one is overlaying the other. One way to do this would be to make a separate GridEdges TMap for large units, which connects 1/4 of tiles to each other. That is probably the most efficient and clean way of doing things, but it would require running an additional, modified version of the GenerateGridEdges function at startup. In this function you would loop through the GridLocations keys, but skip any tile that is not in the “upper left” of your 2*2 tile sets. You could create this rule by checking the GridIndex and only adding edges for tiles where both GetX and GetY for that GridIndex is an even number.

Now for each of these filtered out tiles you would connect them to all surrounding 22 tiles. This would mean using AddEdgeBothWays to [CurrentTile - 1998], [CurrentTile - 2000] … -2002, +2, +2002, +2000, +1998, -2]. The trickiest part would be making a modified function for removing edges that are blocked by terrain. This might involve something like using the regular TraceForWalls implementation, but changing from a line trace for walls to a box or sphere trace (maybe the size of a tile), where the start and end locations of each trace is shifted by +100,+100,0] to trace between the centers of your 22 tile clusters.

Lastly you would have to make a modified custom pathfinding function. You could modify the SearchAndAddAdjacentTilesBig function so that it uses your new custom GridEdges TMap instead of the regular one.

Off the top of my head this is what I think I would do in your situation. There might be a solution that is simpler to implement where you can hack the SearchAndAddAdjacentTiles function to search for all tiles as usual, but only return the relevant ones, but I’m not able to think of a way right now. It would in any case be less performant.