So, here TMap's in Blueprint - Blueprint - Unreal Engine Forums we were asked to make a new thread if this is needed (2014). That thread is the first google hit, I don’t know if there is something more current.
Basically, asking for an implementation of dictionary/tmap for blueprints. there are many algorithms that rely on it and while it can be emulated with two arrays, the performance is terrible.
For a specific use case, here something from my Project, as it may well be among the worst there are. I have a Tilemap, where I want to remove/add tiles, and neighbour tiles have blended states (They change depending on their surrounding). So, when a change happens, the 4 surrounding tiles need to be checked and may need to be changed too.
Now I’ve done this in the past with a different project, in this case Python/Pygame. I had a Data Structure like this:
{(Bool, Bool, Bool, Bool) : SubSurfaceRef}
Where the Bools are the 4 neighbours existing and then the texture that should be set based on these.
I have found no way to do this well in UE4 Blueprints. C++ would be an option, if one doesn’t target HTML5/Mobile.
So, my current way, a Data Table:
Then iterate over the thing:
Check if it’s the right entry:
And then set the tile.
For 64 Tiles this took my computer ~5.5 seconds to run through in editor.
The old Python system took less than 1ms.
Implementation Idea:
A variation of Data Table, where one column can be set as key and we can retrieve a row by key in Blueprints.
Edit: I optimized into acceptable margin by using Find, which I appear to have overlooked. Still a dictionary would speed up the algorithm from O(n²) to O(n)