Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: How is pathfinding affected by dwarves moving over each other?  (Read 780 times)

ArPharazon

  • Bay Watcher
    • View Profile

Is there any difference between moving over open tiles, and moving over other dwarves?

For instance, what happens if a 1-tile wide corridor has a bunch of dwarves in it already?

I seem to recall that dwarves don't like moving over other dwarves (is it slower to move into/out of occupied tiles?), so if a corridor is "occupied" in this way by other dwarves any dwarves that would pass through it will try to find alternative paths. I can't really find anything about this on the wiki or the forums though. So, is it really better to have 3-wide hallways than 1-wide hallways?
Logged

Jenniretta

  • Bay Watcher
    • View Profile
Re: How is pathfinding affected by dwarves moving over each other?
« Reply #1 on: June 22, 2013, 02:02:11 am »

If there is another dwarf in the path, the pathfinding will recalculate to try to find a dwarf-free route, if that fails it works to decide who will lay down, and who will keep walking.
The dwarf who lays down will be a LOT slower, the one who keeps walking seems to lose less, or no, speed.
Dwarves will go a LONG way out of their way to avoid walking over another dwarf - I've had dwarves go 50+ tiles extra going the long way because there was too much traffic on the main pathway.

The best way I have found is to have a 3-wide minimum hallway, with high-traffic zones on the outer paths. The traffic will organize in such a way that dwarves going one way prefer one side, dwarves going the other will use the other side, and if there is a jam the middle lane gets used. it saves a lot of CPU time (thus FPS) by lowering recalculating times, and prevents odd long-ways to avoid traffic.
Logged

ArPharazon

  • Bay Watcher
    • View Profile
Re: How is pathfinding affected by dwarves moving over each other?
« Reply #2 on: June 22, 2013, 02:12:32 am »

Thanks! Is there currently a source on this? Like I said, I also thought it worked like that but couldn't confirm it anywhere.
Logged

Garath

  • Bay Watcher
  • Helping to deforest the world
    • View Profile
Re: How is pathfinding affected by dwarves moving over each other?
« Reply #3 on: June 22, 2013, 02:30:00 am »

http://dwarffortresswiki.org/index.php/DF2012:Path

I originally searched pathfinding though
Logged
Quote from: Urist Imiknorris
Jam a door with its corpse and let all the goblins in. Hey, nobody said it had to be a weapon against your enemies.
Quote from: Frogwarrior
And then everyone melted.

ArPharazon

  • Bay Watcher
    • View Profile
Re: How is pathfinding affected by dwarves moving over each other?
« Reply #4 on: June 22, 2013, 02:31:44 am »

http://dwarffortresswiki.org/index.php/DF2012:Path

Heh heh, I just added that to the wiki myself, since it wasn't anywhere else.
Logged

Garath

  • Bay Watcher
  • Helping to deforest the world
    • View Profile
Re: How is pathfinding affected by dwarves moving over each other?
« Reply #5 on: June 22, 2013, 02:38:34 am »

great :D
Logged
Quote from: Urist Imiknorris
Jam a door with its corpse and let all the goblins in. Hey, nobody said it had to be a weapon against your enemies.
Quote from: Frogwarrior
And then everyone melted.

Miriage

  • Bay Watcher
  • Insane Dwarf.
    • View Profile
Re: How is pathfinding affected by dwarves moving over each other?
« Reply #6 on: June 22, 2013, 02:49:18 am »

Wasn't there a GIF floating around not long ago showing how pathfinding is calculated?

Edit: Nevermind it was the A* search algorithm gif from the associated wikipedia page.
« Last Edit: June 22, 2013, 03:06:49 am by Miriage »
Logged
Don't listen to a word I say, I am completely insane.
Does that mean you shouldn't listen to my pervious sentence and infact listen to everything I say?