A* Pathfinding in Blueprints

Click to see it in action on Vine
And another Vine
I wanted the drones my game (Crystal Flux) to be stupid yet productive. They come out of a tunnel, race to their target, and bring it back before you get the object they are looking for. I decided to attempt my own 3d A* pathfinding in Blueprints and it finally works pretty well!

Some of the issues I had to deal with:
3d Arrays in Blueprints are somewhat messy (awful nesting that you can’t edit individual items easily) so I had to some math to convert them to 1d Array.

Calculating distance was driving me nuts until I came up with this beautiful function

And after I got it working a heap sort was needed to realistic performance

But it still wasn’t fast enough so I had to break the calculation up and only run a portion of it every frame… which is still messy right now but I’m not dropping any frames, so I’m happy with it. Speed of the calculation aren’t really needed here as my drones are supposed to be stupid. Sometimes it takes them a few seconds to find out where they need to go, but that is okay. They just bob up and down while “they” calculate, which makes them vulnerable to attack.

Any tips, suggestions, or questions are appreciated. :slight_smile: