Hello everybody, first post, woohoo [attention] Hello World.
Too much text? Scroll down for animation. If you don't like reading all this text you can scroll down for an animation. Though I don't know if it makes any sense without the text. [grin]
Goal: Pathfinding in a HUGE world I've been thinking about pathfinding in huge worlds. I'd like to get some feedback on my approach which I believe can be enhanced (or is actually useless and should be replaced by a different one?).
Approach: Waypoints I'm used to pathfinding with a net of waypoints thus my first approach is to place waypoints throughout the world. The waypoints will be placed in a way that there's a clear route between connected waypoints.
Problem: too many calculations This, however, means that there are going to be a lot of waypoints and there will be awfully many (*) calculations when looking for the shortest way. Finding the shortest way, by the way, will be done by trying all paths shortest first, longest last and stopping once the current way reaches the goal.
(*) I'm not going to spend my time on calculating any numbers (I tried to but I came up with too many variables) but I believe it's pretty many and rises faster than in proportion to the number of the waypoints. But: The shorter the route, the less calculations. That's what brought me to the following enhancement.Solution: LOD? To reduce the amount of calculations I thought about adding an LOD system. When a character searches for the way from easttown to westtown (see example map below) he will first look at it on a great scale (highlevel waypoints) and finds out that he should go through the forest, then over the bridge and finally through the desert. He doesn't plan to visit the lake and the volcano.
Example Map referenced in the paragraph above - if you're scrolling down for the animation: scroll further. He then looks at how to reach the forest. This might involve the same principle on a smaller scale until he reaches the waypoints with a clear path to each other described above. Once there, he'll continue with the bridge and so on. In this case, easttown, westtown, forest, bridge, desert, lake and volcano would be the highlevel waypoints. I think this model is quite close to how we would do it in real life, isn't it?
Problem: Not the shortest path? One problem that arises is that the found path is not the shortest one as all high level waypoints in the path must be visited. An example of this is in the animation: visiting the second highlevel waypoint is taking a curcuit. Solution, anybody? I think clever highlevel waypoint placement can reduce this problem, though you might end up with lots of highlevel waypoints then. Probably still less than the lowlevel waypoints anyway. Oh and for calculating the length of a path: During some kind of navigation compile the connections will be bundled with the length of the way connecting them if it differs from their distance.
Animation visualizing my algorithm The character searches for a path from A to B. Green circles are high level waypoint, blue squares low level. The colored lines are connections (colored based on the waypoints they connect) and black lines are obstacles.

Please comment on and critisize my pathfinding system as I'd like to improve it before programming it. Changes during design are easier after all. Thanks Mr. Wonko