Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Here's hoping pathing AI improves at some point...  (Read 1520 times)

SkyRender

  • Bay Watcher
    • View Profile
    • Sky Render's Domain
Here's hoping pathing AI improves at some point...
« on: November 10, 2014, 09:03:21 pm »

I cannot count how many Dorfs I've seen do insanely stupid things while mining and building.  Channel out a tile that's supporting the one they're standing on?  Sure!  Walk through a newly created channel as a shortcut across to the other side when that channel is currently sporting a water or magma flow?  Happy to oblige!  Dig literally everywhere except the one part of the map I want them to dig in?  Every freaking time.  Trap themselves on the wrong side of a construction?  Almost assured.  Dwarven emotions are nifty and all (even if they do currently cause most immigrants to turn into raging monsters because they can't stop harping on everyone they left behind back home), but I think Dwarven pathfinding is a slightly more practical priority to focus on...
Logged
Sanity is for the weak.

pisskop

  • Bay Watcher
  • Too old and stubborn to get a new avatar
    • View Profile
Re: Here's hoping pathing AI improves at some point...
« Reply #1 on: November 10, 2014, 09:04:58 pm »

Its add some random fun.  Ill be almost sad to see it go.  There's traffic designations, and one thing you have in DF is quite literally an eternity to micromanage.
Logged
Pisskop's Reblancing Mod - A C:DDA Mod to make life a little (lot) more brutal!
drealmerz7 - pk was supreme pick for traitor too I think, and because of how it all is and pk is he is just feeding into the trollfucking so well.
PKs DF Mod!

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: Here's hoping pathing AI improves at some point...
« Reply #2 on: November 10, 2014, 09:08:54 pm »

Well, the emotions thing is a bug with goblin kidnap victims not registering properly apparently, due to be fixed in .16 or .17 I think.

The digging is a source of cheap comedy, but honestly I haven't used channels unless I specifically need to remove a floor I for some reason didn't already up-ramp away, as they're superior for removing ground safely. I consider it lucky to get rid of 30 blocks with no deaths if I channel designate them all, but I've removed nearly complete layers to build massive underground chambers in 2x2 embarks and the only problems I ever get from massive designations are slowdown related as long as I remember to go one layer at a time downwards.
Logged

Witty

  • Bay Watcher
    • View Profile
Re: Here's hoping pathing AI improves at some point...
« Reply #3 on: November 10, 2014, 11:12:16 pm »

Pathfinding is such a fickle and unfun thing to work on (since apparently it isn't very pretty codewise). It's great for going through mazes! Other than that, well yeah.

I wouldn't hold your breath is all I'm saying  :P
Logged
Quote from: Toady One
I understand that it is disappointing when a dwarf makes a spiked loincloth instead of an axe.

MrWiggles

  • Bay Watcher
  • Doubt Everything
    • View Profile
Re: Here's hoping pathing AI improves at some point...
« Reply #4 on: November 10, 2014, 11:45:30 pm »

A lot of your complaints aren't path finding issues. You only listed one, and that was pathing through dangerous terrain. That happens because, the dorfs don't constantly update their path. They get a destination, plan a path then execute it until they can't. And you can't really have them constantly update their paths.
Logged
Doesn't like running from bears = clearly isn't an Eastern European
I'm Making a Mush! Navitas: City Limits ~ Inspired by Dresden Files and SCP.
http://www.bay12forums.com/smf/index.php?topic=113699.msg3470055#msg3470055
http://www.tf2items.com/id/MisterWigggles666#

Miuramir

  • Bay Watcher
    • View Profile
Re: Here's hoping pathing AI improves at some point...
« Reply #5 on: November 11, 2014, 03:12:53 pm »

I cannot count how many Dorfs I've seen do insanely stupid things while mining and building. 

Most of the issues you list are not really pathfinding AI issues; they are more general "why doesn't DF guess what I meant to do rather than what I told it?" issues, which is very high-level AI indeed. 

Pathfinding in general asks "What is the fastest way to get from A to B that can be easily found? (Or is there no path at all?)"  Much of the optimization has to do with tradeoffs between "fastest path" and "easiest path to find in limited computer time"; and on dealing with changes to the paths. 

Quote
Channel out a tile that's supporting the one they're standing on?  Sure! 

This is user error; you told them they were supposed to do that, and they trusted you wouldn't give them bad instructions.  Dwarves in general do not have the ability to "look ahead"; they are reactive, not predictive, intelligences.  Their overseer / the will of Armok has to do all the thinking ahead. 

Quote
Walk through a newly created channel as a shortcut across to the other side when that channel is currently sporting a water or magma flow?  Happy to oblige! 

While avoidance of lethal situations could be better, again the dwarves don't have the ability to consider the consequences of their actions.  They need to go "over there", they check to see what the best path the overseer has laid out for them, and they take it.  Traffic zones are there for a reason, but they can only help so much if there isn't a readily available alternate path.  It helps if you think of the dwarves as fairly short-sighted as well. 

In the most general case, with default settings, a single square of Restricted has a value of 25, where a normal square has a value of 2.  So, if you had a safe bridge 7 tiles upstream, the cost to go around would be 7 up + 1 over + 7 down, or 15, * 2 = 30; it's "cheaper" to go across the Restricted tile.  So despite it seeming to a player that there was a readily available alternative, it was out of the dwarf's "sight range" for optimization purposes. 

It may be useful to increase the value of Restricted; but in general, if dwarves shouldn't be going there, there should be a locked door or other barrier to keep them away.  This will also speed up path calculations as the game can skip worrying about things on the other side.  Note that if you put Restricted up *too* high, it will slow your game down as the path algorithm will need to search huge portions of your map if something goes awry. 

Quote
Dig literally everywhere except the one part of the map I want them to dig in?  Every freaking time. 

All reachable dig designations are of equal priority by definition.  If you want them to focus on one area, don't distract them with other instructions that you don't need yet.  I find it useful when laying out a complex area to leave key squares not designated for digging, so that the dwarves will focus on particular areas; I can then just designate the single square to "toggle" which area they should work on next. 

Quote
Trap themselves on the wrong side of a construction?  Almost assured. 

This can be tricky, but dwarves have directions they like to build things from.  If you have plenty of room and/or proper scaffolding this isn't an issue, but if you're doing something complex knowing the way their little brains work is important.  IIRC the old guideline was:

1) West is preferred over East
2) North is preferred over South
3) West and East are preferred over North and South
4) Orthogonal is preferred over Diagonal (Diagonal preferences follow the rules)

Thus:

W > E > N > S > NW > SW > NE > SE

but I've not tested this recently; has anyone done directional Science! in 0.40.xx? 
Logged

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: Here's hoping pathing AI improves at some point...
« Reply #6 on: November 11, 2014, 04:04:24 pm »

That... is amazing, I could never figure out why I would get dorfs that would rush to build the top and left walls, especially if a pig or yak was standing on one of the east tiles.

I'd designate the wall around the wagon and end up with like this:

--WWW
W...X...W
W ### ...
W ### W
....W.....W

How is this not listed in a more easy to find place?

I do know that I had better luck building towers if I do this:

W --- W
----X----
W --- W

Then have them fill in the middle sections, if I try to get them to do one side completely and then fill in the rest it can take a while, but forcing the diagonal first means the orthogonal sections get slammed in instantly afterwards.
Logged

MrWiggles

  • Bay Watcher
  • Doubt Everything
    • View Profile
Re: Here's hoping pathing AI improves at some point...
« Reply #7 on: November 11, 2014, 09:59:07 pm »

Mining also works with similar weights. Lowest north west corner first.

I want to say that construction is first in, last out. They'll start the "newest" construction designation first. I've gotten out of practice playing DF, but once you know how dorfs like to do things, you can get a lot more cooler things done with less frustration and less time wasting.

Once you know how dorfs they dig, then you start to do do massive floor collapses to make large cisterns or other large wholes.
Logged
Doesn't like running from bears = clearly isn't an Eastern European
I'm Making a Mush! Navitas: City Limits ~ Inspired by Dresden Files and SCP.
http://www.bay12forums.com/smf/index.php?topic=113699.msg3470055#msg3470055
http://www.tf2items.com/id/MisterWigggles666#

Icefire2314

  • Bay Watcher
  • Programmer and Space Enthusiast
    • View Profile
Re: Here's hoping pathing AI improves at some point...
« Reply #8 on: November 11, 2014, 10:19:43 pm »

It was inevitable.
Logged
"ERUTH PULL THE DAMN LEVER THE ZOMBIES ARE ABOUT TO GET INSIDE!"
"zzz"
BAY 12 MINI CITY: http://bay-12.myminicity.com/