c# - How to Find Path to a Certain Object Without Knowing Its Position in a Grid Based Video Game? -
i´m in middle of development of personal project . in video game there grid based movement , creation , pathfinding system . , have used a* pathfinding in order make characters move towards known position .
but have encountereda big question . there character in game has go kind of object , character doesn´t know exact coordinate of such object . easiest way of doing know coordinates of objects , calculate 1 nearest 1 , use a* pathfinding in order point , aproach seems rigged , not dynamic enough type of game i´m making.
so know if there pathfinding algorithm searches around point (the location of character using algorithm) , in radial way , , keeps searching until finds object type looking , returns path object.
look dijkstra's algorithm. covers whole graph before calculating shortest path destination, unlike a* goes towards destination upfront. in other words, dijkstra finds all paths nodes source, choose destination , shortest path or least cost. there nice gif on wiki illustrates mean here: click , a* on wiki see gif , understand comparison.
how dijkstra's algorithm approach shortest path destination:
how a* algorithm approach shortest path destination: