Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Flying races  (Read 826 times)

varkarrus

  • Bay Watcher
  • Insanity and a knife go well together.
    • View Profile
Flying races
« on: December 08, 2008, 04:09:54 pm »

There was one thing I noticed when I gave my Dwarves the [FLIER] tag. They would wander into chasms or abysses, land on a ledge, and not move until I dug stairs for them. Also, they would cancel their job due to dangerous terrain every time they "walked" down a slope.

There are 2 things I would like to see in Dwarf Fortress: Flier's pathfinding, and flying buildings to be built by flying races:

Propellor: Like  a support, but can be built in the air. If connected by mechanisms to a control pad, the entire building can move around (so long as all propellors are connected, and that there is no part where the buildings touch the ground.

Control Pad; See above

Connector: When 2 buildings touch connectors, they can combine and be treated as one building.

Also, flying buildings should be able to land if you have channels built where the propellors need to go.
« Last Edit: December 08, 2008, 04:53:20 pm by varkarrus »
Logged
Dip Stick! The newest candy! Just dip it, then lick it!
Or try FUBAR! The best chocolate bar ever!
And you can't eat them, either, sadly. Even though it'd make sieges so much more fun; dwarves lining the walls, drooling and carrying sharp knives and forks, ready for the upcoming meals.

Tormy

  • Bay Watcher
  • I shall not pass?
    • View Profile
Re: Flying races
« Reply #1 on: December 08, 2008, 05:11:53 pm »

Flying buildings?  :o
Erm....that sounds a bit odd, since creating a flying/levitating building requires high/modern technologies.
I think that fliers in DF should live on/in trees/high peaks/caves etc.  ;)
Logged

varkarrus

  • Bay Watcher
  • Insanity and a knife go well together.
    • View Profile
Re: Flying races
« Reply #2 on: December 08, 2008, 07:06:27 pm »

Magic.
Logged
Dip Stick! The newest candy! Just dip it, then lick it!
Or try FUBAR! The best chocolate bar ever!
And you can't eat them, either, sadly. Even though it'd make sieges so much more fun; dwarves lining the walls, drooling and carrying sharp knives and forks, ready for the upcoming meals.

Fieari

  • Bay Watcher
    • View Profile
Re: Flying races
« Reply #3 on: December 08, 2008, 07:47:56 pm »

There is flying pathfinding.  There isn't flying connectivity.

A* is the pathfinding algorithm.  It's a very efficient algorithm that works for ANY connectivity map.  DF uses it for all movement.  When flying, it enables creatures to quickly find the shortest distance between two points.  Same with swimming.  Same with everything.

A* has major advantages over Dijkstra's algorithm, which will also find the shortest distance between two points, but does so by first calculating EVERY path, including paths that go the opposite direction.  In an open field, Dijkstra is ASTRONOMICALLY slow.  It tests EVERY path. Every combination of paths.  Every variation of paths.

A*, in the worst case scenario, is equivalent to Dijkstra's algorithm, which is very slow.  One of these worst case scenarios is the case where the two points CANNOT be reached, ever, because they are not connected.

Now, there are two ways to handle this problem.  The first is to make it a non-issue.  Most games do this.  Simply make it so that there is nowhere that is unconnected.  The other is to use a different algorithm to calculate connectivity, the "flood-fill" method, which is pretty fast (you use it every time you use the paintbucket in MSPaint) and store what areas are connected in an array, and then when a pathfind request is made, check if it's connected first and THEN use A*.  DF does this.  It has to, because a cavein, construction, or flow could cut off movement at any time.

But, DF does this ONLY for walking.  It makes a connectivity map for every location it is possible to walk to.  All pathfinding checks connectivity first, and then uses A* to get to where it's trying to get.  ALL pathfinding.  There isn't a separate connectivity map for flight, and there isn't a separate map for swimming either.

So if it's possible to walk there, you can fly there (and will fly there via the fastest flight route possible, not the walk route).  If you can't walk there, the game can't tell that you can't get there at all.

So, why can't we just test for flight, water-swimming, and magma-swimming?  And for combinations thereof?  Partly because of memory and diskspace concerns.  The connectivity maps have to be stored as part of the map data, and EVERY BIT COUNTS.  Consider how many tiles you have in a standard map, particularly one with a lot of Z-levels.  Multiply that by the number of bits you need to add.  It adds up, rapidly, especially with everything else the game needs to keep track of.

It's probably important enough to do at some point though, and Toady probably will.  But my understanding is that it's non-trivial.  He's working on other things at the moment.  He knows about it though.
Logged

Align

  • Bay Watcher
    • View Profile
Re: Flying races
« Reply #4 on: December 08, 2008, 08:01:01 pm »

How do you know these things?
Logged
My stray dogs often chase fire imps back into the magma pipe and then continue fighting while burning and drowning in the lava. Truly their loyalty knows no bounds, but perhaps it should.

Fieari

  • Bay Watcher
    • View Profile
Re: Flying races
« Reply #5 on: December 08, 2008, 08:12:00 pm »

Two years of a computer science degree.
Logged