Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Pathfinding?  (Read 5794 times)

SeveQ

  • Bay Watcher
    • View Profile
Pathfinding?
« on: July 29, 2010, 04:29:28 am »

I'm just curious... how does pathfinding work in DF? Is the algorithm repeatedly called for every single creature on every single frame? Or is there some kind of optimization, for example that the algorithm is only called again when a creature hits an obstacle on its last calculated path that wasn't there when the path was calculated?

Just curious... Thanks!  :)
Logged

IronValley

  • Bay Watcher
  • Purple Smile!
    • View Profile
Re: Pathfinding?
« Reply #1 on: July 29, 2010, 08:21:55 am »

Judging by how the game slows down in regards to population number, general chatter on the forum, and some processor benchmarks some guy posted lord knows when, I'ts rather safe to assume that pathfinding in DF can be drastically improved ;)
Logged

Shrugging Khan

  • Bay Watcher
    • View Profile
Re: Pathfinding?
« Reply #2 on: July 29, 2010, 08:59:51 am »

http://www.bay12forums.com/smf/index.php?topic=56041.0

No need to thank me. Or that OP. Its already done, after all...ehm. Whatever.
Logged
Not a troll, not some basement-dwelling neckbeard, but indeed a hateful, rude little person. On the internet.
I'm actually quite nice IRL, but you people have to pay the price for that.

Now stop being distracted by the rudeness, quit your accusations of trollery, and start arguing like real men!

NW_Kohaku

  • Bay Watcher
  • [ETHIC:SCIENCE_FOR_FUN: REQUIRED]
    • View Profile
Re: Pathfinding?
« Reply #3 on: July 29, 2010, 10:35:25 am »

... I wonder if that thread should just be put onto the wiki, and be done with it... It's too useful a reference not to be.
Logged
Personally, I like [DF] because after climbing the damned learning cliff, I'm too elitist to consider not liking it.
"And no Frankenstein-esque body part stitching?"
"Not yet"

Improved Farming
Class Warfare

ILikePie

  • Bay Watcher
  • Call me Ron
    • View Profile
Re: Pathfinding?
« Reply #4 on: July 29, 2010, 10:46:15 am »

Toady mentioned he uses A* somewhere. I think it was here.
« Last Edit: July 29, 2010, 12:07:36 pm by ILikePie »
Logged

Shrugging Khan

  • Bay Watcher
    • View Profile
Re: Pathfinding?
« Reply #5 on: July 29, 2010, 11:27:10 am »

Oy Liker of Pies, that link is rather...brief :/
Logged
Not a troll, not some basement-dwelling neckbeard, but indeed a hateful, rude little person. On the internet.
I'm actually quite nice IRL, but you people have to pay the price for that.

Now stop being distracted by the rudeness, quit your accusations of trollery, and start arguing like real men!

ILikePie

  • Bay Watcher
  • Call me Ron
    • View Profile
Re: Pathfinding?
« Reply #6 on: July 29, 2010, 12:08:29 pm »

What? I have no idea what you're talking about, nope, not at all. ;)
Logged

SeveQ

  • Bay Watcher
    • View Profile
Re: Pathfinding?
« Reply #7 on: July 29, 2010, 03:48:13 pm »

http://www.bay12forums.com/smf/index.php?topic=56041.0

No need to thank me. Or that OP. Its already done, after all...ehm. Whatever.

That's quite interesting. Needless or not, thanks. So, since I haven't read the whole thread, yet, I suppose it has already been used to suggest ways of optimization to Toady?
Logged

Shrugging Khan

  • Bay Watcher
    • View Profile
Re: Pathfinding?
« Reply #8 on: July 29, 2010, 05:39:22 pm »

I don't think toady will change something so fundamental anytime soon.
Logged
Not a troll, not some basement-dwelling neckbeard, but indeed a hateful, rude little person. On the internet.
I'm actually quite nice IRL, but you people have to pay the price for that.

Now stop being distracted by the rudeness, quit your accusations of trollery, and start arguing like real men!

SeveQ

  • Bay Watcher
    • View Profile
Re: Pathfinding?
« Reply #9 on: July 29, 2010, 07:10:38 pm »

Well, I don't play DF since its first hour, but I suppose performance has always been an issue. If Toady knows what DF really needs and if he's not too much into new features (like I am, unfortunately, when it comes to software development), he should concentrate on pathfinding and, to mention that again, multi-core support. The latter is predestined for pathfinding.

Anyway! It's pointless to talk about what Toady should or should not do. It's his decision after all... ;D it's late here. I'll go to bed now. Good night, folks!
Logged

Huin

  • Bay Watcher
    • View Profile
Re: Pathfinding?
« Reply #10 on: July 30, 2010, 01:28:54 am »

Let's not forget that DF slowing down when the pathfinder is working harder to support more dwarves doesn't imply that the pathfinder is doing a bad job - it's just got more work to do.

No doubt it could be optimised some more, but let's not forget that pathfinding is an inherently expensive operation, and Toady's implementation has to deal with a difficult environment, and does it (I think) very well considering.
Logged

Ratbert_CP

  • Bay Watcher
    • View Profile
    • The Enraged Primate
Re: Pathfinding?
« Reply #11 on: July 30, 2010, 09:02:13 am »

Let's not forget that DF slowing down when the pathfinder is working harder to support more dwarves doesn't imply that the pathfinder is doing a bad job - it's just got more work to do.

No doubt it could be optimised some more, but let's not forget that pathfinding is an inherently expensive operation, and Toady's implementation has to deal with a difficult environment drunken, psychotic dwarven miners and does it (I think) very well considering.
Fixed...
Logged
Ratbert #CP#Z
"For FUN and HONOR!"

Shrugging Khan

  • Bay Watcher
    • View Profile
Re: Pathfinding?
« Reply #12 on: July 30, 2010, 09:11:46 am »

Problem is that the target-selection AND pathfinding are a little wonky, as far as I'm concerned. See that other thread, where masons travel across half the map to get some stone when there's exactly the same stones lying right in front of their workshops. And the pathfinding is refreshed far too frequently - it ought to reduce its frequency when FPS go down, not keep it constant when it slows the game to a crawl.
Logged
Not a troll, not some basement-dwelling neckbeard, but indeed a hateful, rude little person. On the internet.
I'm actually quite nice IRL, but you people have to pay the price for that.

Now stop being distracted by the rudeness, quit your accusations of trollery, and start arguing like real men!