Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Pathfinding  (Read 1390 times)

The Chemist

  • Bay Watcher
    • View Profile
Pathfinding
« on: May 17, 2008, 05:25:00 pm »

So I have a tiny stone stockpile next to my masons and stonecrafters, and i recently dug out a bit more space for my woodpile next to the carpenters. Now my stonehaulers are instead of taking stone that is 10 squares away, they are going literally hundreds to mining channels. what insane pathfinding scheme makes them do this and is a better one expected soon?
Logged

Jay

  • Bay Watcher
  • ☼Not Dead Yet☼
    • View Profile
Re: Pathfinding
« Reply #1 on: May 17, 2008, 05:31:00 pm »

AFAIK they take the stuff that's farthest from the stockpile.
I suppose it'll get changed when he gets around to optimizing it.
Logged
Mishimanriz: Histories of Pegasi and Dictionaries

The Chemist

  • Bay Watcher
    • View Profile
Re: Pathfinding
« Reply #2 on: May 17, 2008, 05:42:00 pm »

think baracading access to the mines would work?
Logged

Exponent

  • Bay Watcher
    • View Profile
Re: Pathfinding
« Reply #3 on: May 18, 2008, 10:45:00 am »

In some cases, dwarves will take the stone that was most recently mined, but with stonecrafters and masons, I think they take the nearest stone.  Two points that you need to keep in mind, though:  One, they take the stone nearest to the dwarf when the dwarf takes the job.  If the dwarf has just finished drinking some booze when he takes the carve stone craft job, he'll likely grab a stone out of the booze storage room, if there is one.  Two, pathfinding is not used when determining which stone is nearest.  Rather, naive distance based on the X, Y, and Z coordinates is used.  Thus, if there is a stone five z levels below the dwarf, and there is a stone 10 tiles to the right of the dwarf, the dwarf will choose first stone, even if the actual path to get there is really long.  I tend to design my fortresses accordingly, using stockpiles for stone that are immediately above or below the workshops, rather than to the side of them.

Edit:  Barricading would work, because pathfinding is used to ensure that the stone that is thought to be nearest is indeed accessible.  If the stone cannot be reached, then another stone is tried until the nearest accessible stone is found.  At least, this fits the pattern of stone usage that I have witnessed.

[ May 18, 2008: Message edited by: Exponent ]

Logged

Eb

  • Bay Watcher
    • View Profile
Re: Pathfinding
« Reply #4 on: May 19, 2008, 07:33:00 pm »

I've noticed this happening to everyone that wants to refill a stockpile, they'll go to the complete other side of the map to grab a stone, instead of one that's a tile away from them, it's quite annoying. I had to forbid everything  but what I wanted them to grab.
Logged

The Chemist

  • Bay Watcher
    • View Profile
Re: Pathfinding
« Reply #5 on: May 19, 2008, 08:45:00 pm »

oh no, the crafters are very competent, they take stone close at hand, but to keep the stockpiles that are beneath them brimming my dwarves take stone that is 2 z axi's up, and hundreds of tiles away as opposed to stuff that is RIGHT NEXT TO THEM
Logged

Duke 2.0

  • Bay Watcher
  • [CONQUISTADOR:BIRD]
    • View Profile
Re: Pathfinding
« Reply #6 on: May 19, 2008, 09:26:00 pm »

Even putting a stone stockpile one z-level above or below the workshops seems to not work. They still go way outside of where they are expected.

I guess some oddities with choosing stones. Of course, it could be a map thing. These dwarves won't haul their crap away from their workshops to the designated stockpiles.

Logged
Buck up friendo, we're all on the level here.
I would bet money Andrew has edited things retroactively, except I can't prove anything because it was edited retroactively.
MIERDO MILLAS DE VIBORAS FURIOSAS PARA ESTRANGULARTE MUERTO

Surma

  • Bay Watcher
    • View Profile
Re: Pathfinding
« Reply #7 on: May 20, 2008, 01:37:00 am »

I believe haulers will look for the most recently created stone (or other item)
to fill a stockpile with before (or instead of) looking at how close it is and choosing a closer one.

For craftsdwarfs (this includes everything, masons, carpenters, the works.) they'll look for the closest item they need when they start the job i.e. every time your mason is  at the idle spot and gets a new job, it'll get the closest stone to it at the time, then head over to your mason's workshop. After it finishes the job it repeats the process, grabbing the closest stone at the time.

Again, as I believe has been stated, if an object they're looking for is exactly z +/- 1 from them, regardless of how far the path is, they'll grab it. One solution to that is to forbid or dump any item that could interfere with the efficiency of your stockpiles.

Duke 2.0: I've noticed that sometimes also. The Dwarves seem to get lazy and basically say 'Screw this, I'm going to idle for the next 3 years.' Haven't found a solution to this yet though.  :(

Logged

zagibu

  • Bay Watcher
    • View Profile
Re: Pathfinding
« Reply #8 on: May 20, 2008, 05:20:00 am »

It's pretty strange really. Sometimes, they seem to take what's closest, but ignore z-levels (so they will go fetch a stone that is on the same tile as they are but 12 z-levels down), but at other times, they seem to grab the latest mined stone, which lies on the same z-level as they are, but hundreds of tiles away. It's very inconsistent, actually.
Logged
99 barrels of beer in the pile
99 barrels of beer!
If some dwarves know the way to the pile
0 barrels of beer in the pile!

Loctavus

  • Bay Watcher
  • British Hammerdwarf
    • View Profile
Re: Pathfinding
« Reply #9 on: May 21, 2008, 06:02:00 am »

This is why I now build my fortresses in layers rather than following the instinct of making big sprawling levels. The bonus of this is a relatively compact fortress, especially if you riddle the levels with stairs going between them. This takes full advantage of the fact that stairs have a distance of 1.
Logged
Tea and -Elf Tallow Biscuits- anyone?