Dwarf Fortress Bug Tracker - Dwarf Fortress
View Issue Details
0001074Dwarf FortressPathfindingpublic2010-04-13 03:292014-05-19 16:39
king doom 
0001074: Dwarves choose far-away stones instead of nearby ones
I've noticed that all the dwarves I have that use rock to craft - masons and stonecrafters and mechanics, will ignore available stone in the tile next to their workshops to run across the fort and grab stone that my miners have just dug out. The stone next to the workshops is not forbidden, hidden, locked away, unavailable or economic rock they have been told not to use, nor have the stockpiles next to the workshop emptied, it is filled with the same rock they are spending five minutes running across the fort to grab.
Build a workshop that uses stone to make goods. Make a stone stockpile next to it. Set the workshop on repeat, then on the other side of the fort start your miner digging. The dwarves using the workshop will ignore the nearby materials to gather newly mined stone.
The location of the dwarf when he begins the task has no bearing on the rock he selects, he will always go for the freshly dug rock. I've seen dwarves come off a break and fixate on freshly dug rock despite the workshops and rock stockpile being between them and the miners, so it isn't a case of finish task>grab nearest rock>take to workshop.
crafting, pathfinding, Save Included
has duplicate 0003742resolved Footkerchief Dwarves use random stones 
related to 0007208assigned Footkerchief Workers will grab the resources closest to them when they take the job rather than the resource closest to workshop 
Issue History
2010-04-13 03:29king doomNew Issue
2010-04-13 03:33king doomTag Attached: crafting
2010-04-13 03:33king doomTag Attached: pathfinding
2010-04-13 06:27Draco18sNote Added: 0003242
2010-04-13 06:52king doomNote Added: 0003246
2010-04-13 06:59ZeffrinNote Added: 0003247
2010-04-13 08:28FootkerchiefNote Added: 0003258
2010-04-13 08:55FootkerchiefNote Edited: 0003258bug_revision_view_page.php?bugnote_id=0003258#r1062
2010-04-26 16:11KumquatNote Added: 0005199
2010-06-14 23:53KumquatNote Edited: 0005199bug_revision_view_page.php?bugnote_id=0005199#r3233
2010-07-16 09:09FootkerchiefTag Attached: AWAITING UPDATE
2010-07-16 09:10FootkerchiefNote Added: 0010424
2010-07-16 11:52king doomNote Added: 0010441
2010-07-16 14:16kwielandNote Added: 0010448
2010-07-16 14:16kwielandIssue Monitored: kwieland
2010-07-16 15:26Rafal99Note Added: 0010453
2010-07-16 15:29Rafal99Issue Monitored: Rafal99
2010-07-16 15:31Rafal99Note Edited: 0010453bug_revision_view_page.php?bugnote_id=0010453#r4060
2010-07-16 15:53Rafal99Note Edited: 0010453bug_revision_view_page.php?bugnote_id=0010453#r4061
2010-07-23 05:59king doomNote Added: 0010865
2010-07-27 22:14Rafal99Issue End Monitor: Rafal99
2010-08-03 21:58RhenayaNote Added: 0011469
2010-08-03 21:58RhenayaIssue Monitored: Rhenaya
2010-08-03 22:08RhenayaNote Added: 0011470
2010-11-29 07:33FootkerchiefRelationship addedhas duplicate 0003742
2010-11-29 07:40FootkerchiefSummaryDwarves only use the freshest rock! => Dwarves choose far-away stones instead of nearby ones
2010-11-29 18:44FootkerchiefNote Added: 0014305
2011-01-04 19:40FlyingBishopNote Added: 0014787
2011-03-24 17:00kwielandNote Added: 0016534
2011-03-25 13:04Orkel2Note Added: 0016588
2011-03-28 06:36FootkerchiefRelationship addedhas duplicate 0004373
2011-03-28 06:36FootkerchiefRelationship deletedhas duplicate 0004373
2012-06-08 06:43grayfoxNote Added: 0022912
2013-09-23 09:11FootkerchiefTag Detached: AWAITING UPDATE
2013-09-23 09:12FootkerchiefTag Attached: Save Included
2014-05-19 07:50johndoughIssue Monitored: johndough
2014-05-19 07:50johndoughIssue End Monitor: johndough
2014-05-19 08:01johndoughNote Added: 0024762
2014-05-19 11:40QuietustNote Added: 0024763
2014-05-19 11:43QuietustNote Edited: 0024763bug_revision_view_page.php?bugnote_id=0024763#r9264
2014-05-19 16:39johndoughNote Added: 0024765
2014-07-13 09:14FootkerchiefRelationship addedrelated to 0007208

2010-04-13 06:27   
Are the miners directly below the shops?
king doom   
2010-04-13 06:52   
No, the miners are several Z levels further up and quite far away from a horizontal standpoint as well, the rock stockpiles are closer.
2010-04-13 06:59   
I've noticed this too, but in my case maybe they were closer to the other rock through the ground, but they walk past rocks on the same level and the next to get to the one which has just been dug out
2010-04-13 08:28   
(edited on: 2010-04-13 08:55)
This one's been suspected for forever but Toady's never gotten a reproducing test case. If the behavior in your save survives through a save/load AND reproduces in 31.03 (which came out last night: http://www.bay12games.com/forum/index.php?topic=54115.0 [^]), then please upload it.

2010-04-26 16:11   
(edited on: 2010-06-14 23:53)
Something like this happened to me too. I dug down 50 levels deep in search of lava and some dorfs came and picked up the freshly mined rock into a stockpile, while the upper levels and the mineshaft were still loaded with loose rock.

UPDATE: I suspect the actual problem is that stockpiles are filled newest-stockpile-first, newest-item-first. Crafters looking for material go for the nearest applicable, but stockpile filling goes for the newest.

2010-07-16 09:10   
Reminder sent to: king doom

Do you have a save demonstrating this problem?
king doom   
2010-07-16 11:52   
I've tried to obtain one, but it's inconsistent - occasionally the dwarves will take stuff near to them, occasionally they will take stuff from miles away. From the look of it, they don't seem to take travel across Z-levels into account, the 'find a rock' pathfinding seems to work as though the entire fort was a single totally open level and just finds a rock as the crow flies, then the dwarf wanders across the level he's on, donw three flights of stairs, across half of that level and grabs a rock right under the area the workshop is, but three floors down, rather than getting a rock on the same z level six tiles away.
2010-07-16 14:16   
I was under the impression that when the job is issued (for example make a mechanism) that the dwarf looks for the closest rock to where they are at that time, which could be miles away from the workshop. Does that explain your observations? Also, z-levels only count as one square, so if you have a stone 15 layers deep that is equivalent to 15 tiles in x or y away. Obviously the actual pathing time would be quite a bit different for those two cases.
2010-07-16 15:26   
(edited on: 2010-07-16 15:53)
My bet is that all the rock that is close to his workshop is already tasked for constructions. Only the newest rock is not.
Had same thing happen in my fortress where mason complained about no non-economic rock while there was about 100 boulders stockpiled in his burrow. The problem was they all were tasked for wall building already.

Are you building anything from the type of rock in question?

king doom   
2010-07-23 05:59   
I use rock blocks for construction, and I have all the spare rock my miners dig up hauled and dumped into one tile set so that all my workshops are equally spaced around it (and yes, I unforbid the stuff after it's been dumped) so that I avoid the problem Rafal99 mentioned - I hate seeing rocks cluttering my fort waiting to be used in something, so I don't use them. I tend to work one floor at a time, so there's always at least ten screens worth of rock sitting in the heap, waiting to be used, but they still run off across the map for freshly mined stuff randomly.
2010-08-03 21:58   
just wanted to report this same issue, as it gets annoying.

just an example:

build a mason workshop and but a neat obsidian stockpile, with 100 obsidian stones clearly not used in another job, right next to it...
mason workshop and stockpile is 15 tiles away from mason, who is in the dining hall idle
3 z level below the dining hall is a microline mining going on.

he will then run the 50 tiles around to get down to that 3 z level microline stone (or whatever), just because it was near him as he started construction, to haul it back, were you actually wanted obsidian stuff made from the workshop.

this is seriously annoying and a behaviour changed from

as you see footkerchief you wont need a save demonstrating, you can easily reproduce that behaviour, it works with all jobs. like the furnace operator will get a fresh stone out of the cavern if it was less tiles from him as the smelter stockpile.

the only workaround so far would be to put all dwarfs into a burrow, but thats just more annoying and genereates lots of error messages.
2010-08-03 22:08   
or in short: dwarfs that start a job at a workshop will look for the next material near their actuall place on which they picked the job, instead of near the workshop, of course if you produce 10 things at once, only the first one will be picked from afar, as the next ones will be likely near the workshop anyway
2010-11-29 18:44   
http://dffd.wimbli.com/file.php?id=3500 [^]
twilightdusk posted this save at duplicate report 0003742:0014301
2011-01-04 19:40   
The big thing is it would be nice if they used pathfinding instead of direct as the ghost-travels distance. I've got a large magnetite cluster that spans several z-levels, and a smelter plopped right in the middle of the cluster. Rather than picking up the magnetite right next to the shop, dwarves climb down the stairs and pick up one that's "closer" when you compute the distance, but neglect the stone on the same level.

But I guess that may be a tradeoff until we get a pathfinding algorithm that's cheap enough to call every time someone gets materials for a job.
2011-03-24 17:00   
Here is another save. For this save there is a siege operator on z=119 (hotkey F6). He will go to z=139 (+20) and then another 10 or so in the x and y direction. However, there is a granite rock <8 tiles away from the catapult on the same z level. If you turn off the catapult on Z=89 and disable the other siege operator, it is more evident. http://dffd.wimbli.com/file.php?id=4025 [^]
2011-03-25 13:04   
Happening to me too. Dwarves go deep into the caverns to get rocks for stuff like crafts or stone pots, whereas there's perfectly usable stone in the level right below them.
2012-06-08 06:43   
This bug was only a little bit annoying before. It was tolerable, but now it's completely frustrating. It's ruining minecarts, at least for the purpose of stone hauling (probably not other items though). Most of the time, a dwarf goes 10 miles away, walking past stone that's clearly only a few tiles away (literally, only about one or two tiles from the stockpile), walking past the stop where the stone is supposed to be delivered, only to grab stone presumably from where he was standing when he decided to take the job.... and take it all the way back past the destination.
2014-05-19 08:01   
This bug is still present: https://www.dropbox.com/s/w98xh1t15ul2jad/masonbug.zip [^]

In that save the doctor working as a mason will always run into the mountain to fetch stone to build a floor, despite the same stone type being available in a stockpile next to the building site.
2014-05-19 11:40   
(edited on: 2014-05-19 11:43)
johndough: what you're seeing is totally unrelated to this bug report and is behaving exactly as expected, because you designated the floors for construction (and told it which exact stones to use for each tile) before you designated the stockpile and allowed it to fill, and as long as the stones are linked to the "construct building" jobs, they will never be stockpiled.

2014-05-19 16:39   
Quietust: The stockpile to the left most certainly wasn't designated after the floor construction.