I'm going to break off answering this into discrete chunks at this point...
I was talking about only the tree-based pathfinding here, without also imposing the hierarchical scheme you suggested subsequently. If all you have are cities, not states or any larger groups, you'll still have the problem I describe. Just clarifying.
Well, the thing is that the tree-based pathfinding is optimized for finding a path with the least amount of processor time consumed possible.
It is NOT trying to find the optimal path for a dwarf to get from point A to point B in the shortest number of steps. It IS trying to make the processing-time-optimal calculation to find ANY valid path.
You are complaining that the form of the function that isn't concerned at all with distance optimization isn't distance optimized. Of course it isn't - it's not even supposed to be!
It's only the alternate versions, where we aren't optimizing one over the other that you have something closer to distance-optimization. But it's still a tradeoff.
It's like seeing a boat, and complaining about how it's really hard to handle on the Interstate. It wasn't ever built to accomplish that function in the first place.
No, you misunderstand. I really meant passing-through. If St. Louis has only, say, 10 major entry points you need to store 45 costs. All well and good. But what about the state of Missouri? It will likely have hundreds of entry points, meaning thousands of costs to pre-compute and store.
I'm not misunderstanding, this is exactly what I was talking about.
Missouri might have 100 entry points, but you don't need to actually record all of them. That's what I said about recording only the best of them.
Missouri is only connected to, what, 5, 6 different states? All you need to record is the
best path if you are traveling through Missouri from one state to another. Typically, this means you just stay on the Interstate the whole way through.
Yes, this means you'd have to pre-compute which paths are "best", but you'd either have to pre-compute them or else have to perform on-the-fly pathfinding no matter what pathfinding method you use, anyway. The only question in which one is best depends mostly on the probability of the map becoming dramatically changed vs. how often dwarves will pathfind through those areas.
I'll reiterate my main point: Hierarchical representations only help you if the world conforms to that hierarchy. Cities are natural clusters as far as pathfinding is concerned -states are not. Nor, as I said, are any Dwarf Fortress subdivisions except for "room" that I've heard proposed.
Star shaped topologies help you only if the world is star-shaped.
Quad trees help you only if the world has large square chunks of free space/occupied space. And if you impose a quad tree over a DF map, you're going to have an entry point count that is proportional to the length of the sides, meaning O(L^2) costs to be precomputed.
Basically: No free lunch. The only way to beat unbiased tile-by-tile BFS is to bias the search. A* biases in favor of worlds with straight-ish paths. Room-based nodes bias in favor of worlds which actually have rooms. Your tree search approach biases (heavily) in favor of worlds with a star-shaped topology. Your hierarchical search biases in favor of worlds with scale invariance.
Nothing wrong with any of this - one just have to go into it with open eyes. It happens to be my belief that both the star-shaped world assumption and the scale invariance assumption will be quite off in many, if not most Dwarf Fortress maps.
But this is, again, completely ignoring some of the solutions to these exact problems I've already outlined.
If you want to optimize for direct paths, you have to use a method which trades performance in terms of processor power and memory storage in exchange for better distance pathfinding optimization.
I've already discussed different gradients of ways to do this - duplicate-information storage in the tree WILL enable trees to become less "star-shaped" by having the "star" overlap on top of itself.
This is specifically HOW to avoid the "going to St. Louis to get to Pasadena" problem you were talking about - but you don't seem to be paying it any attention at all.