409
« on: May 16, 2010, 11:02:39 am »
Only one problem... when should the paths be calculated?
Just imagine you have one very long U-shaped path and dwarves have to get from one end to the other. Now you dig a shorter way (directly between both "ends" of the "U") - your dwarves would still take the much longer way, because that's the one they know.
Ok, so the game should calculate a new, shorter path at this time, but how does it know, if something relevant changed? There's no way to know, if there's a more effective path, unless new paths are calculated all the time (or at least everytime something is dug out or build) - it would bring a minor speed gain in forts, where you don't build anything anymore, but how often does that happen? I say, that system wouldn't help at all unless there'd be a very complex method of determining, what is relevant for the current paths and what isn't.
Also, dwarves don't use the same path several times... one of the most common would be the path from the boozepile/dining room to a specific workshop and there are still hundreds of paths for every tile of the starting room. You'd start saving paths from every tile to every other tile. More than 5 Million paths for 48x48 tiles and one z-level, more than a few trillion for a reasonably sized map. I don't want my computer to save a few gigabytes of paths and search through all of them for the right one everytime someone needs to path somewhere.
Always remember, what looks so easy for the human brain like "just go from this room to that room and remember it for the next time" can be hard for a computer. Computers are very, very dumb, if you don't tell them exactly what to do and how to do it.
The only practical possibility, I can think of, is only saving major traffic routes that are frequently used. The dwarves would still need to use regular pathing from their current location to the beginning of the main route (that goes wherever they need to go) and once they'd reach that route, they would just follow the predefined path until the end point from where the regular pathing would kick in again. It's still not easy to let them know, which main route is the best for their current purpose, but maybe it's a tiny bit more practical than saving everything.
Please correct me, if there's something fundamentally wrong with my negative thinking.