Hi,
I'm trying to implement the A.I. of the NPC of my game, and I want them to go after the closest enemy.
However, the closest enemy (in euclidian distance) might not always be the enemy with the shortest path to it (imagine an enemy behind a very large wall).
So, the only way I can think of solving this problem is using dijkstra from where the NPC is, to get the distance to all enemies, and then choose to attack the one with the shortest waypoint-distance, but dijkstra would have to go through all the waypoints in the scene, which might not be the best thing every time any NPC looks for an enemy to attack to.
It would be better to use something more efficent like A*, but that requires knowing your target beforehand in order to compute the heuristic to determine the best next waypoint to build the path.
Any advice?