Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Flight and Underwater pathing  (Read 893 times)

Crandal

  • Bay Watcher
    • View Profile
Flight and Underwater pathing
« on: June 24, 2011, 10:22:02 am »

When a flying, or waterbreathing race is played, a bug with dangerous terrain refuses to let them path properly into the air or underwater.  Is there any reason these remain bugged?  I mean, it doesn't seem too problematic to add a check for flight ability or water breathing to dangerous terrain, but if that's not the only problem with it, what is?
« Last Edit: June 24, 2011, 10:27:30 am by Crandal »
Logged

LordZorintrhox

  • Bay Watcher
    • View Profile
Re: Flight and Underwater pathing
« Reply #1 on: June 24, 2011, 03:39:31 pm »

Pathing is a pain in the butt to code, believe me.  Most solutions are written given a set of assumptions about the legal ways things can move in the simulated (or in the case of robotics, real) environment.  DF's pathing and the simulation system in general was probably originally written with the assumption that movement happens in two dimensions .  That means that it probably thinks about the 2D Moore neighborhood (the eight tiles around any given tile) from a particular tile than it does the up and down directions.  Compound that with how "dangerous terrain" is determined, and you have a mess.

So, yeah, the reason is that it is probably a bit of a kludgey mess inside the pathfinder and that is why it remains bugged.  I imagine Today will have to fix it when he gets to a pathfinding rewrite so it can take advantage of all 26 directions you can travel from a tile, which means major tricks and hacks will have to be employed.
Logged
...but their muscles would also end up looking like someone wrapped pink steel bridge-cables around a fire hydrant and then shrink-wrapped it in a bearskin.

HEY, you should try my Dwarfletter tileset...it's pretty.
I make games, too