I\'m creating a game with a 10,000 by 10,000 map.
I would like for a user to be able to set a location and have the computer instantly find the best path.
However, since
My initial understanding of the problem statement was like follows. There are predefined terminal locations on the map. The user selects a location on the map, and the best/shortest path to the closest one of those locations must be found.
If my understanding is correct, then you can precompute the shortest paths for all locations on your map through a single application of the BFS algorithm. You can efficiently store that information using just 2 bits per node (the value associated with each node will tell in which direction you must move from that node in order to stay on the shortest path).
However, as tobias_k has commented, the problem may be defined differently - the player selects an arbitrary location on the map and the best path from the current location to that location must be found. The previously described approach can again be utilized, provided that
Then the already described algorithm is executed to find the shortest paths from any location on the map to a small circumference centered at the player's current location. Then for a short period of time that data can be used to quickly route the quasi-shortest path toward any location on the map. When the player, while moving, gets too close to the boundary of that circle, the algorithm is preemptively executed for the player's new location.
The disadvantage of this approach is that it consumes a lot of CPU resources. The advantage is its simplicity.