Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Fortress Mode Flyer Pathfinding  (Read 631 times)

Sorcerer

  • Bay Watcher
  • [magical]
    • View Profile
Fortress Mode Flyer Pathfinding
« on: November 30, 2015, 03:02:51 pm »

Flying pathfinding could use a quick look in fortress mode, fliers will always try to utilize z levels even when their destination is on the same Z level, but will not fly into empty space.
Trees and branches however is a different story. Fliers will path into trees, realize they can't path down without climbing, and get stuck.
This is especially a problem when hauling, as they will drop whatever they were hauling as they move into the tree or roof.
While fliers require a ground path to be able to find a destination, they will move over walls and roofs using their flying, however, if for some reason a path update happens when the creature is an inaccessible place, the creature will get stuck, as it no longer have a valid path.

For most of these issues the creature will be stuck until they get another job, or get hungry or thirsy, upon which they will risk climbing down. 

This is primarily an issue for modded civilizations, but from the sounds of it, minor civs will be able to join your fort in the upcoming version, if that includes bat men and cave swallow men, then the above issue will apply.
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: Fortress Mode Flyer Pathfinding
« Reply #1 on: December 01, 2015, 12:52:24 pm »

I don't know a lot about DF's implementation of A* pathing, but iirc it allocates "rooms" based on chokepoints and holds a network of path costs between "rooms" to speed up the middle part of finding a path (brute-forcing the path in the start "room" and end "room").

If this understanding is correct, the open sky can be sliced into virtual 16x by 16y by 1z "rooms" that have connections on all sides.  The pathing cost for flight can be increased a bit for going up and decreased a bit for going down.  Those "rooms" get recalculated when a map change occurs just like all of the others, but hopefully the overhead isn't too drastic.

Eventually, someone can build a huge 3D maze and fliers under AI control will actually be able to traverse it.
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: Fortress Mode Flyer Pathfinding
« Reply #2 on: December 01, 2015, 01:01:04 pm »

+1 to this suggestion since I encounter it constantly with the modded games I play.  It used to be bad enough in older versions of DF when things would land on top of buildings, but it's much worse now with the trees.

I'm pretty sure Toady has commented on this before and said that it wasn't simple to fix, but all the same I'd love for some work to be done on it.

Maybe he was talking about pathing through water instead...
Logged
Through pain, I find wisdom.