I had an idea last night. The only time that a dwarf really needs to path to anything is to find how to get somewhere. Items and places don't "move" so they only need to be path'd to once per job. I think that civilian dwarves should be mostly just a representation for an action.
For instance
- Urist takes a hauling job
- Urist builds a path to the item and back and writes it to memory regardless of non-block obstacles in the way.
- Urist determines that job should take X game turns
- Urist icon follows the path in memory within the determined game turns
- Urist completes job after X game turns as long as no non-block obstacles interfere
If 200 dwarves are doing a 200 tile job and 3 bytes for every coordinate of the path thats only like 200k of memory which is not much (may not be thinking straight, didn't sleep last night, let me know...). CPU should go down because dwarves are no longer constantly pathing or checking whats directly around them.
If a non-block obstacle does interfere it would have to trigger the dwarf to perform some kind of action (i.e. a certain radius or area of control for a goblin would trigger a flight response for a dwarf whose next path coordinate falls in the AoC and the path is cencelled). Also, a civilian dwarf would have to re-path if a block obstacle were created on their path. I'm no programmer, but I do script and I don't think it would be too hard to check for these things...
feel free to tell me I'm wrong if thats the case.
Thanks