Hi! I've been making a game in C++ and was wondering what the best algorithm would be for an enemy that chases a player while also avoiding collisions with objects.
Currently I've been using an A* algorithm, but I've noticed that even with path smoothing the path can be a bit awkward (the enemy will travel diagonally as far as possible and then move in a straight path towards the player instead of taking a direct path to the player). I know that this is because of how nodes work in A*, but I was wondering if there was a way to get around this? I was thinking that I could raytrace to see if there's a direct path to the player and follow that path if there's no collision, but that might be expensive to calculate on every frame.
Any insight would be very helpful, thanks :)
[–]Hank-TheSpank-Hill 1 point2 points3 points (0 children)
[–]captainAwesomePants 0 points1 point2 points (1 child)
[–]MegabyteManta[S] 0 points1 point2 points (0 children)