Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Pathing  (Read 1128 times)

Iamblichos

  • Bay Watcher
    • View Profile
Pathing
« on: September 22, 2016, 11:47:13 am »

Can anyone explain to me how the game calculates pathing?  Here's the situation:

I embarked in a Terrifying biome (reanimating, evil goo rain).  The goo causes unconsciousness.  I define a burrow permitting only the inside portions of the fort.  So far so good.

Merchants dump a pile of goods at the edge of the map.  No problem, right?  I forbid the goods.  I dig a tunnel to the edge, ending in an up stair to the spot directly next to them.  I then create a tiny permitted zone right around the goods, and unforbid them.  I modify the burrow to include the tunnel, but definitely not the area outside the fort.  EVERY DWARF IN THE FORT runs outside, completely ignoring the burrow, and falls unconscious in the goo.  There to be slaughtered by undead ravens, but fine, whatever.  Why the hell didn't they obey the burrow, take the passage, and get the stuff?
« Last Edit: September 22, 2016, 11:49:34 am by Iamblichos »
Logged
I'm new to succession forts in general, yes, but do all forts designed by multiple overseers inevitably degenerate into a body-filled labyrinth of chaos and despair like this? Or is this just a Battlefailed thing?

There isn't much middle ground between killed-by-dragon and never-seen-by-dragon.

PatrikLundell

  • Bay Watcher
    • View Profile
Re: Pathing
« Reply #1 on: September 22, 2016, 12:20:54 pm »

That's a common misconception about burrows. They do NOT specify where dorfs may path, only where they may perform jobs and collect items. Between these locations, they take the "shortest" path. They may also stand outside of burrows to work on a target inside of it if they feel like it (but at times they refuse to work if there isn't a legal place to stand inside so they have something to ignore). Thus, a split burrow, like trying to create emergency bolt holes, is basically useless as they'll try to path through the goblin hordes between these.

You may try traffic designations instead ('d'-'o', if I remember correctly). They occasionally work, but I've found them very unreliable (I had an embark [actually vjek provided it] where the surface was deadly when it rained due to extreme heat, and it was reanimating as well. I painted the whole surface with the highest movement cost and the access tunnels underneath with the lowest, but the morons rushed out onto the surface anyway, despite a physically longer path even when restrictions weren't taken into account).
Logged

Iamblichos

  • Bay Watcher
    • View Profile
Re: Pathing
« Reply #2 on: September 22, 2016, 12:29:48 pm »

Fair enough, I'll just file pathing under "broken" then  :)  thanks.
Logged
I'm new to succession forts in general, yes, but do all forts designed by multiple overseers inevitably degenerate into a body-filled labyrinth of chaos and despair like this? Or is this just a Battlefailed thing?

There isn't much middle ground between killed-by-dragon and never-seen-by-dragon.

wierd

  • Bay Watcher
  • I like to eat small children.
    • View Profile
Re: Pathing
« Reply #3 on: September 22, 2016, 12:43:31 pm »

It was my understanding that DF uses a derivative of A*.

https://en.wikipedia.org/wiki/A*_search_algorithm
Logged

Slogo

  • Bay Watcher
    • View Profile
Re: Pathing
« Reply #4 on: September 22, 2016, 01:17:03 pm »

Yeah it's not really broken, burrows just don't factor into pathing calculations is all.

Otherwise dwarves take the shortest, not the smartest, route to their target so you always need to keep that in mind.

d-r-o for traffic designations are your best friend for off limit areas, I always set Restricted to 99 cost (overall I use 1/2/10/99) which means for a dwarf to step onto a restricted tile the alternate route would have to be 50(ish) tiles shorter of a path (assuming all other tiles are the normal cost of 2).

High traffic is also really useful for getting dwarves to stay in the center of hallways or otherwise influence their pathing slightly.

SebasMarolo

  • Bay Watcher
    • View Profile
Re: Pathing
« Reply #5 on: September 22, 2016, 01:52:46 pm »

What about a burrow with a civilian alert on all the time? Would that do the trick?
« Last Edit: September 22, 2016, 01:54:36 pm by SebasMarolo »
Logged
So uh, yeah you just murdered a until proven otherwise pretty neutral innocent being for no reason.

Iamblichos

  • Bay Watcher
    • View Profile
Re: Pathing
« Reply #6 on: September 22, 2016, 02:35:35 pm »

No, that's what I was using.  They listen right up until they don't.
Logged
I'm new to succession forts in general, yes, but do all forts designed by multiple overseers inevitably degenerate into a body-filled labyrinth of chaos and despair like this? Or is this just a Battlefailed thing?

There isn't much middle ground between killed-by-dragon and never-seen-by-dragon.

WanderingKid

  • Bay Watcher
  • The Overfiend
    • View Profile
Re: Pathing
« Reply #7 on: September 22, 2016, 05:18:39 pm »

To control pathing, you have to use traffic designations, as Slogo mentioned.  To control job assignment, you use burrows.  A ring of 3-4 restricted pretty much can cut off any stairway from being used unless it's the only path available, you don't have to go too crazy.  It's also an effective way to keep dwarves out of the trap hallway for goblin thieves and the like.

All civilian alert does is override burrow settings on the individual dwarves and enforce the burrow settings of the alert on anyone not in an active military squad.

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: Pathing
« Reply #8 on: September 22, 2016, 08:00:24 pm »

Instead of keeping out, can also use pause buttons in pressure plates bit out of the way with traffic designations so that civilians will walk over it when retrieving corpses from grinder. Tested and it works (though might not work as well if they stay to clean, given that job can take a while and doesn't take them away. Workaround is making your grinders aboveground (/inside). )

GhostDwemer

  • Bay Watcher
    • View Profile
Re: Pathing
« Reply #9 on: September 22, 2016, 09:52:58 pm »

If the game had to check whether or not every square was in a burrow when pathing, it would slow down the game immensely. Burrows just control jobs, not pathing, so it is much simpler. As Slogo mentioned, what you could do in a situation like you described is set the outside to restricted. Dwarves will still walk through restricted tiles if that is the only way to get to a job, but each restricted tile counts as 25 tiles for pathing purposes, so the will go up to 24 tiles out of their way rather than walk through 1 restricted tile, if they can.
Logged

Slogo

  • Bay Watcher
    • View Profile
Re: Pathing
« Reply #10 on: September 23, 2016, 01:14:09 pm »

It's one of those things that's actually somewhat reasonable to do if you build it that way from the ground up because of how A* works, but is probably difficult to retrofit in.

muldrake

  • Bay Watcher
    • View Profile
Re: Pathing
« Reply #11 on: September 23, 2016, 07:18:25 pm »

If the game had to check whether or not every square was in a burrow when pathing, it would slow down the game immensely. Burrows just control jobs, not pathing, so it is much simpler. As Slogo mentioned, what you could do in a situation like you described is set the outside to restricted. Dwarves will still walk through restricted tiles if that is the only way to get to a job, but each restricted tile counts as 25 tiles for pathing purposes, so the will go up to 24 tiles out of their way rather than walk through 1 restricted tile, if they can.

I still once designated an area with a "pull a lever and everyone dies" trap in it as restricted and when I went to test it by having someone pull the lever, some dwarf decided it was a good place to have a snack. 

He died, though, so justice was done.
Logged

Pirate Santa

  • Bay Watcher
  • [CURIOUSBEAST_EATER]
    • View Profile
Re: Pathing
« Reply #12 on: September 23, 2016, 11:00:21 pm »

I've used traffic designations extensively in my recent fort with a freezing river.
After they were implemented only animals wandered onto the ice. Mainly cats.
Logged
Welcome to Dwarf Fortress. Where peaceful death of old age is something nobody sees coming.
it turns out Dog Bone Doctors aren't very good at doctoring.

WanderingKid

  • Bay Watcher
  • The Overfiend
    • View Profile
Re: Pathing
« Reply #13 on: September 23, 2016, 11:52:43 pm »

Side note on traffic designations: You can actually significantly reduce pathfinding FPS costs if you set up some basic high travel (main staircase, dining room, etc) and low travel (bedrooms, the rotting room, the forge...) as well as using locked doors to completely take sections of your fort out of play when they're not in use.

GhostDwemer

  • Bay Watcher
    • View Profile
Re: Pathing
« Reply #14 on: September 24, 2016, 05:59:34 pm »

It's one of those things that's actually somewhat reasonable to do if you build it that way from the ground up because of how A* works, but is probably difficult to retrofit in.
Well, the tile cost system already is built in, and I am quite familiar with pathing algorithms, but I can't think of an easy way to do it for arbitrary burrows, where there can be any number of burrows, and any number of dwarfs per burrow. Can you? How would you do it?
Logged