Indeed. People (some of them, anyway) aren't
very upset about any necessary time take to make any particular path-finding search, except for the fact that it needs to be done
every time. Some very common paths could easily be cached, except:
- While it might be easy to throw-out and re-do a stock-pile to workshop path when the path ends up blocked, when does one realise the need for a re-cache of a quicker path when a short-cut is opened?
- Also, very few paths (except maybe between a 1x1 quantum stockpile and a workshop about to use now unforbidden items, and possibly the migrant edge-arrival point directly to the designated meeting area) have exactly the same end-points time after time after time. Do you store one path for each point in a 10x10 stockpile? Between every possibly food stockpile point and every single table? Or sacrifice some of that final accuracy to "common point-to-common point" routing.[1] This is one reason why a semi-cached "ultimately you always go through this zone at travel cost <foo>" look-up table is popular, the precise dtails of the travel through it to be worked out (at vastly less expense than while the trip would be still speculative) once there's general algorithmical agreement that it's necessary to sort out. (Or, indeed, pull a zone-entrance to zone-exit cached path out from the known lists.
- Finally, multi-tile wide corridors get built for a reason, i.e. smoother traffic without having to crawl through oncoming traffic. While I wouldn't generally say that any particular individual player layout styles should actually dictate the mechanics behind the pathfinding algorithm, to the extent of "it is currently considered good practice to use stairwell blocks, so optimise for stairwell blocks", it has to be appreciated that the player will have a small 'library' of common fortress 'tropes', and to restrict oneself to a pure-cached route that cannot deal with something as common as wide corridors without some kind of fudge[2] to handle this.
I suppose in some parts it depends on whether you want to accept a possibly sub-optimal path (especially as that would add an extra possibility or two to the "Dwarfs are Stupid" list) for fast game-playing, or whether you'd rather have a perfect path, every time.
You can add to either (or both?) of these two other requirements:
Firstly the possibility of needing to learn paths, which can either be done by Artificial Stupidity. The computer knows the perfect path, but the agent knows that it shouldn't know the path so will work with what it does and then work to improve its knowledge, possibly by haranguing another nearby agent for the "information", a.k.a permission to realise that heading along one particular tunnel will take them to where the stone to be dumped is.
Secondly, dynamic response, architecture interaction and patience. Not just "new path has opened, recalculate!", but "well, the bridge is up now, and it takes a long time to walk around the alternate route, but there's a pressure plate I can stamp on to lower the bridge for a moment, and if I'm quick (...although you can imagine the self-inflicted bridge-launchings and atom-smashings this might also cause[3]) I can get across and save myself a lot of walking". Or the knowledge that magma-falls start and stop. Or plain and simple sequential lever-operation to make an airlock-like route open.
Whatever, if there's limited/learned knowledge of routing for friendly agents, hostile ones are going to have the same possibilities to bustle their way through, a bit like certain friendly trader-nations can negate traps they know about after they've been pushed into becoming hostile. Which is not to say that a "kill me!" dummy lever couldn't be added to kill off the more experimental of enemies, alongside the regular one for actually gaining entry.
[1] There are arguments for getting a selection of suitably known "to get there, starting from not-quite-here paths, run the "from here" path search until you encounter a point upon one or other of the paths then using the remainder of the cached route.
[2] "Hug the left" or "Hug the right" rules (possibly cultural as to which one gets adopted!) would help, here, and I think the current "which complex diagonal route to take" agent-pathing routine does give a taste of that. Apart from dwarfs with different travel speed capabilities, it would mean you'd get an orderly progression of westward-bound dwarfs on one side of a corridor and eastward bound ones on the other side, for example.
[3] Sort-of-Mechanics suggestion: Klaxon. In the above circumstances, link a lever (or other input) to both a bridge and a klaxon. Klaxon has a quicker response than the bridge and blares out, and the dwarfs find out/learn/already know what this means and immediately vacate any danger area. Other uses: general alarms (could even be tied directly into with military alerts, e.g. "enemies at south entrance! Military get read, straight from pressure-plate activation", civvies get to safety!"), disturbing noise-makers (when you really want to annoy nobles), alarm-clocks for sleeping dwarfs ("come on, trader, get out of bed and get to the depot, before they leave!"), creature scarers ([CAN LEARN] or [INTELLIGENT] creatures get to ignore them, eventually, but at least at first they can be used to either repulse wildlife/etc or if set off behind them drawn them further into a zone you want them to be in.)