Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Suprising water behavior  (Read 744 times)

Finn

  • Bay Watcher
    • View Profile
Suprising water behavior
« on: November 20, 2011, 10:06:46 pm »

So I found this nifty waterfall on the side of a deep river gorge and I decided to build my fortress in the hollowed out cliff behind it, with the idea that someday I will make this massive draw bridge that will drop down through the waterfall to span the river gorge.  Dwarves will enter and leave by walking through this waterfall and it will be really grand.

Fast forward 5 years of dwarf time and about 5 weeks of real time and I'm finally ready to test my drawbridge.  In order to build it I had to redirect both the upper river and the lower river for a time, but now they are both happily turned back on and I'm pulling the lever to lower the drawbridge.  Imagine the hoopla and celebration as the mayor stands ready to cut the ribbon and a team of crack, legendary miners stands ready to rush across the brige and burrow into the other side of the chasm.

Imagine the horror as the drawbridge comes down and the upper river fills the bridge and begins flooding into my entrance hall.    Imagine the screams of the legendary miners as they attempt to dash across the bridge, only to be swept over the side into the deep river gorge to drown.  I don't know why I didn't see that coming, I only had 5 weeks to think about it as I built it.  But that's not what I'm wondering about...

The upper river is 4-wide and I redirected it by digging up into the bottom of it across it's width.  This drops the entire river into a 4-wide channel one z-level below it which has a string of 4 floodgates across it and drains off the edge of the map.  When I open the flood gates the water flows off the map, when I close them it flows over the waterfall.  What I thought I should be able to do is open just one of the floodgates, say, next to the wall, and then half the water would be drained through my channel and half would go over the waterfall.  This is not what happened.  The entire 4-wide river squeezes through 1 floodgate and channels off the side of the screen stopping the waterfall.  Clearly this makes sense if you understand the waterflow algorithm, and clearly I don't.  I'm guessing that there is no limit to the amount of water that can path through a given square during a given clock-tick.

So, given all that, is there a way that I can reduce the amount of water falling on the bridge when it's open, such that it doesn't sweep dwarves off the side when they try to cross?  Perhaps if I built floodgates at the top of the falls and only opened the center ones?  That's assuming I guess that water won't average out laterally as it falls, which I dont' think it will.  But when the water hits the bridge it will certainly average out to the sides which is when the dwarves get moved, and if that happens twice in a row they will go over, eh?

Also, if I had dug into the side of my river, instead of the bottom, would I have seen different behavior, or would a 1-wide channel effectively rechannel the whole 4-wide river?  My guess is no, but I'm testing it right now.

Thanks for your thoughts,

Finn



Logged
I thought 'complained about the draft lately' meant they didn't have a door to their room.

Aspgren

  • Bay Watcher
  • Every fortress needs a spike pit.
    • View Profile
Re: Suprising water behavior
« Reply #1 on: November 20, 2011, 10:46:53 pm »

sounds like an issue with water pressure... though dwarves freak out pretty easily because of water and might be swept off the side or at the very least drop babies into the gorge even with mildly pressurised water

but who cares about babies amirite? i really can't tell you how to fix this though.
Logged
The crossbow squad, 'The Bolts of Fleeing' wouldn't even show up.
I have an art blog now.

Sphalerite

  • Bay Watcher
    • View Profile
    • Drew's Robots and stuff
Re: Suprising water behavior
« Reply #2 on: November 20, 2011, 10:50:54 pm »

A tile which is completely full of 7/7 water is essentially a superconductor for water flow - water will 'teleport' through it with no movement cost, so once a single tile wide path is completely full of water you can drain an entire ocean through it.  This only applies to passage through tiles directly north/south/west/east/up/down.  Passage through diagonally connected tiles does not display this effect, so you can use a diagonal passage as a pressure reliever/flow restriction to limit how much water is flowing into your waterfall.
Logged
Any intelligent fool can make things bigger and more complex... It takes a touch of genius --- and a lot of courage to move in the opposite direction.

Finn

  • Bay Watcher
    • View Profile
Re: Suprising water behavior
« Reply #3 on: November 21, 2011, 12:15:40 am »

A tile which is completely full of 7/7 water is essentially a superconductor for water flow - water will 'teleport' through it with no movement cost, so once a single tile wide path is completely full of water you can drain an entire ocean through it.  This only applies to passage through tiles directly north/south/west/east/up/down.  Passage through diagonally connected tiles does not display this effect, so you can use a diagonal passage as a pressure reliever/flow restriction to limit how much water is flowing into your waterfall.

Yes, that pretty much explains the behavior I observed, which now makes sense to me.  I have experimented further by shutting off the original drain and burrowing into the side of the riverbed instead of the bottom.  Instead of 4 holes in the bottom of the river I now have 5 holes leading out the side but the water behavior is now totally different.  I now get water in both channels, although the water flowing over the falls is still sufficient to sweep a dwarf off of the bridge despite the fact that a significant amount is being siphoned off beforehand.

Because water attempts to path down before any other direction, opening up the entire width of the riverbed pretty much doomed me to either emptying the river or not, no matter how tight I constrain the water later.  I can understand why the flow algorithm is designed the way it is, because it gives a pretty good simulation while using fewer cpu ticks, but one unfortunate side effect is that is does not simulate back-pressure in any way.  There is no limit to the amount of water that can path through a given square in a given interval.  As you say, the whole ocean for example.

I experimented further by putting floodgates at the top of the falls, effectively narrowing the river to one square.  Now water lands on the center of the bridge and spreads out, although it doesn't seem to drop dwarves into the river gorge anymore.  Well, it hasn't yet, so I can at least say that the frequency is lower, which is a start. 
Logged
I thought 'complained about the draft lately' meant they didn't have a door to their room.

Garath

  • Bay Watcher
  • Helping to deforest the world
    • View Profile
Re: Suprising water behavior
« Reply #4 on: November 21, 2011, 02:18:13 pm »

cant you just rebuild the bridge a bit further downstream? close enough to the fall to get some benefit but not enough to be swept away
Logged
Quote from: Urist Imiknorris
Jam a door with its corpse and let all the goblins in. Hey, nobody said it had to be a weapon against your enemies.
Quote from: Frogwarrior
And then everyone melted.

khearn

  • Bay Watcher
    • View Profile
Re: Suprising water behavior
« Reply #5 on: November 21, 2011, 06:08:04 pm »

What you probably would like better is if you split the river so that it falls on either side of the bridge, just missing it. The falling water will create mist, which will drift over the bridge giving happy thoughts and not sweeping anyone off the bridge.

Rig up floodgates at the top of the fall the width of the bridge (and have space to the sides for the water to flow around. Connect the gates to the same lever as  the bridge. So when the lever sends an "on", the bridge raises and the floodgate opens, letting the water fall over the entire width. When the lever sends on "off", the bridge opens and the gates close, redirecting the water to the sides of the bridge.
Logged
Have them killed. Nothing solves a problem quite as effectively as simply having it killed.

knutor

  • Bay Watcher
  • ..to hear the lamentation of the elves!
    • View Profile
Re: Suprising water behavior
« Reply #6 on: November 21, 2011, 10:58:08 pm »

Pistons.  Link automated inseries floodgates upstream to downstream water-spec'd pressure plates, and maybe a few drink stockpile door civie-spec'd pressure plates.  This will keep an inconsistant flow.  Its the mist your after, so build another N-S bridge overtop it, and link it up as safety roof of sorts.

Sincerely,
Knutor

« Last Edit: November 21, 2011, 11:03:39 pm by knutor »
Logged
"I don't often drink Mead, but when I do... I prefer Dee Eef's.  -The most interesting Dwarf in the World.  Stay thirsty, my friend.
Shark Dentistry, looking in the Raws.