i have a game use A*, this algorithm find path is good in many case.
But if I could not find the way to the destination, it would have to go through many nodes (my map is in gird format). I am looking for an algorithm to know that if I cannot find the way to the destination, A * algorithm will not work to avoid wasting CPU or then my object will only go straight to the target, when it collision with an object, it will stop. I saw a game like Age of Empires, when the farmer was locked in between the 4 walls, which meant he couldn't go out. If I want him to go to a point outside those four walls, he just goes straight to that point and stops when he hits a wall. If the 4 walls have a hole, he will go there and get there]1
[
]2
Thanks everyone !