Implementation of A* algorithm in unreal engine

Hey everyone,

I would like to share with you my implementation of A* algorithm for path finding in unreal engine.

I used unreal engine 4.27 version.

AStarUnreal

I would really appreciate trying the project, and any comment on this project.

I still haven’t implemented any readme for the repo. i will later.

I am thinking about making a feature ( like a skill) for games using this technique (future work).

And thank you.

Found a minor flaw in your code. Loaded up the project and started the level, then ejected the player and started dragging the red ball around until I hit a wall. This triggered a nullptr exception.

Tracking any type of actor that could go passed player restrictive boundaries could be a problem

In pathfinder.cpp I added in a modification to counteract this problem, basically the EndNode would be null triggering a cascade of errors. In the case of it not being viable, I set the EndNode to the StartNode and the path finding resolves correctly once the obstructions are gone.

Added lines 40 => 42

Revised file
Pathfinder.cpp (4.9 KB)

1 Like

Nice, thank you very much for finding this flaw. I will try to fix it as i didn’t try what you mentioned.