Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Water flows magically upwards  (Read 493 times)

Zhentar

  • Bay Watcher
    • View Profile
Water flows magically upwards
« on: November 07, 2007, 02:00:00 pm »

While destroying my last fortress, I ran into trouble with water violating the laws of physics.

I had a formation that looked like this:

code:
  
____    ____
|    |  |    |
|    |  |    |
|    |  |    |
|    |__|    |
|            |    

Two cliffs, with a river down the middle. I was building my fortress on one side, spanning 6 or so levels. I could see coal & platinum in the cliff face on the opposite side, so I sent a miner over- or rather, under, digging a tunnel from the bottom of my fortress under the river, and then upwards towards the minerals. I dug up into into an aquifer, and oh no! my tunnel started flooding. Once the tunnel filled up, the first floor of my fortress began flooding. Bad news for my fortress, but so far the physics are working right. But then the problem begins. The rest of my fortress should be safe- that bottom floor has 2 openings next to the river; all the water should flow into that floor and pour out into the river. But that's not how it happens. Once the first floor starts to fill up around the stairs, the second floor begins to fill. Then the third, and the fourth, and the fifth. My stairwell has become a magical pump, creating a pillar of water around it as it flows upwards.

Logged

Name Lips

  • Bay Watcher
    • View Profile
Re: Water flows magically upwards
« Reply #1 on: November 07, 2007, 02:09:00 pm »

It shouldn't flow up past the surface level of the aquifer. But anything up to that altitude is fair game. It's weird that it would flow up instead of taking the gravity-sponsored horizontal, though, if such a route is available. Perhaps it was filling up your fortress faster than it could flow out the front door?
Logged

Zhentar

  • Bay Watcher
    • View Profile
Re: Water flows magically upwards
« Reply #2 on: November 07, 2007, 03:15:00 pm »

It didn't go past the level of the aquifer, so no problem there. It was definitely moving upward where there was still horizontal room, though. I don't think the ends of floor one were 7 deep when there was water on floor 5; I know the large entryway by the stairwell was nice and dry on level 4 while level 5 was starting to get wet.
Logged

Core Xii

  • Bay Watcher
    • View Profile
Re: Water flows magically upwards
« Reply #3 on: November 07, 2007, 04:23:00 pm »

It's not magic. It's called pressure.
Logged
Reality is for people who lack imagination

Turgid Bolk

  • Bay Watcher
  • Tacticus Grandmaster
    • View Profile
    • http://...
Re: Water flows magically upwards
« Reply #4 on: November 07, 2007, 05:33:00 pm »

quote:
Originally posted by Core Xii:
<STRONG>It's not magic. It's called pressure.</STRONG>

It's not just pressure. The water should spread out more on each floor before moving up. Sounds like the flow algorithm is acting a little weird in that situation. It doesn't seem like that case would come up often, though, so it may just be "close enough" instead of a bug.

Logged
"This is an engraving of a Dwarf and a Mandrill Leather Skirt. The Dwarf is raising the skirt."
Multiplayer Adventure Mode, the (now defunct) DF roleplaying game.

iluxan

  • Bay Watcher
    • View Profile
Re: Water flows magically upwards
« Reply #5 on: November 07, 2007, 06:52:00 pm »

It sounds like an algorithm balancing problem.

There needs to be a balance between how fast it spreads sideways (giving your dwarves a chance to escape if they need to), and how fast it builds up.  I'm guessing the algorithm works on a local type approximation - each cell checks if there's space to spread to the neighbors, and if there isn't, then it'll spread up.  However in order to get realistic water behavior, you have to run this very often, and it has to spread much faster than it's doing now.  So it's not easy to balance, and probably has performance implications.

Logged

Toady One

  • The Great
    • View Profile
    • http://www.bay12games.com
Re: Water flows magically upwards
« Reply #6 on: November 07, 2007, 08:50:00 pm »

Yeah, I'm aware of this, and there are some performance implications to changing how it works.  I marked down somewhere to mess around with it, but it's not clear how much of a lag the fix would introduce.
Logged
The Toad, a Natural Resource:  Preserve yours today!

axus

  • Bay Watcher
  • Axe Murderer
    • View Profile
Re: Water flows magically upwards
« Reply #7 on: November 09, 2007, 10:28:00 am »

Did the water eventually drain back down the stairs to the lower floors?  I think the steady state (all floors <= aquifer level flooded) is the same either way.  Maybe water needs to drain faster.
Logged