Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: Water volume, flow, and absurdity  (Read 1888 times)

Halo

  • Bay Watcher
    • View Profile
Water volume, flow, and absurdity
« on: May 06, 2010, 07:41:51 pm »

I was inspired by The Undergrotto, probably my favorite fortress ever, and I've been thinking about trying something along the same lines. The plan is to create a cavern with an artificial lake in the bottom. What this thread is about is the concept of giving that lake an artificial tide. The lake will be deep (several z-levels), and I want it to automatically rise and lower a few z-levels (maybe 5ish) on a predictable cycle. I know DF liquid physics can be kinda weird, so I thought I'd post my thoughts here and see if anyone with more experience than me sees any major problems. If it matters, I plan on using either the upcoming 40d# version of DF, or if that is not yet available when I start, the old 40d# version.

Simplest version: Water flows into the cavern at a steady rate, let's say a channel 2 squares wide. The drainage channel is larger than the intake channel, 3 squares wide, so in theory, more water is flowing out of the lake than is flowing into the lake, and the water level decreases. Once it reaches a certain low point, it triggers a pressure plate to close off the drainage floodgates, cutting them off entirely. As water is still flowing in, the water level rises. Once the water level rises to a certain point, another pressure plate is triggered, opening up the drainage floodgates. Repeat.

More complex version: Water flows in and out of the lake at a variable rate. To increase the size of the lake, the intake channel is greater than the drainage channel, say a 4 channel wide intake, and a 1 channel wide drain. Once the water reaches a maximum level, a pressure plate is triggered, throttling the intake down to only 1 channel wide, and opening up the drain to 4 channels wide. There is no real justifiable reason to make it more complex, except that I kinda want too. Ideally the water will drain out into a lake or river or something, and the idea of the drainage flow stopping entirely and starting again seems less cool.

Is this conceivably possible? Is there a fixed amount of water that can flow through a channel that is only a single square wide (x amount of water), and does that increase at a fixed predictable rate for wider channels? (a 3 square wide channel would then move 3x water)

Even if this is possible, should I even bother trying it on an average computer, or will I need a Cray to get a framerate that is two digits?
« Last Edit: May 06, 2010, 07:58:51 pm by Halo »
Logged

Andir

  • Bay Watcher
    • View Profile
Re: Water volume, flow, and absurdity
« Reply #1 on: May 06, 2010, 07:45:30 pm »

[/url] ... damn, didn't work
Logged
"Having faith" that the bridge will not fall, implies that the bridge itself isn't that trustworthy. It's not that different from "I pray that the bridge will hold my weight."

Halo

  • Bay Watcher
    • View Profile
Re: Water volume, flow, and absurdity
« Reply #2 on: May 06, 2010, 07:59:24 pm »

Sorry, I fixed that. View preview is for elves.
Logged

haywire

  • Bay Watcher
    • View Profile
Re: Water volume, flow, and absurdity
« Reply #3 on: May 06, 2010, 08:01:24 pm »

If the place the water is exiting can take an infinite amount (like an aquifer, off the edge of the map, a bottomless pit, etc) the water will near instantly (ingamewise that is, as your computer may choke for much longer in real life) drain even if the passage is only 1 square.

You could get a little closer to what you want by using chambers to increase the area of each z-level to slowly lower or raise the water level, but any sort of flow is going to be too fast for what you're wanting I think.
Logged

Djohaal

  • Bay Watcher
  • [PREFSTRING:Utter Insanitiy]
    • View Profile
    • My deviantart
Re: Water volume, flow, and absurdity
« Reply #4 on: May 06, 2010, 08:17:14 pm »

you could make it as a fixed-chamber system with a bajatrillion pumps to make it flow fast enough. The lake itself would be the main chamber, and there would be a secondary cistern that would hold the dynamic volume of water. A system would alternate huge sets of screw pumps (I think you'll need some TEN screw pumps in paralel for this, if not more, if you want the volume to vary more than once per year)  that would pump water in and out of the lake. An additional system would have to be set up to supply the extra water that would be lost due to the lake's natural behavor.

One thing that DF didn't implement yet is flow capacity for pressurized water (eg, water above one Z level of the duct). No matter how wide or tight the duct is, all water will insta-teleport through it to the end. You can drain the whole ocean into a cavern in a mere one game step if you breach its bottom into a cavern.
Logged
I really want that one as a "when". I want "grubs", and "virgin woman" to turn into a dragon. and monkey children to suddenly sprout wings. And I want the Dwarven Mutant Academy to only gain their powers upon reaching puberty. I also have a whole host of odd creatures that only make sense if I divide them into children and adults.

Also, tadpoles.

Kanddak

  • Bay Watcher
    • View Profile
Re: Water volume, flow, and absurdity
« Reply #5 on: May 06, 2010, 08:51:19 pm »

You're thinking about DF water as if it was something like water, which it isn't.
You should probably read the hydrodynamics thread linked in my signature.

Specifically:
Channel width has very little to do with water flow rates confined to a single z-level, and pretty much nothing to do with water movement involving multiple z-levels. Water pressure teleportation only needs a path through 7/7 water to an open space on a lower level.
Your "simplest version" will result in all of the water above the level of the drain instantly moving into any available space beyond the drain when the drain is opened at high tide.
The "more complex version" will have no cyclic behavior. After the z-level where the drain is fills, any water landing on top of the lake will instantly move into the drain.
Logged
Hydrodynamics Education - read this before being confused about fluid behaviors

The wiki is notoriously inaccurate on subjects at the cutting edge, frequently reflecting passing memes, folklore, or the word on the street instead of true dwarven science.

Retro

  • Bay Watcher
  • o7
    • View Profile
Re: Water volume, flow, and absurdity
« Reply #6 on: May 06, 2010, 09:26:18 pm »

Regardless of how well it'd work, you might want to save turning it on until towards the end of the fort. Your FPS will definitely go in the gutter, especially after carving out the cavern itself.

Djohaal

  • Bay Watcher
  • [PREFSTRING:Utter Insanitiy]
    • View Profile
    • My deviantart
Re: Water volume, flow, and absurdity
« Reply #7 on: May 06, 2010, 09:32:04 pm »

Regardless of how well it'd work, you might want to save turning it on until towards the end of the fort. Your FPS will definitely go in the gutter, especially after carving out the cavern itself.

Actually I wonder how much of this FPS drop due to cavern digging holds true in DF 2010 seeing as we already have large expansive natural caverns. I wonder if toady bothered optimizing the pathfinding and yadda a little.
Logged
I really want that one as a "when". I want "grubs", and "virgin woman" to turn into a dragon. and monkey children to suddenly sprout wings. And I want the Dwarven Mutant Academy to only gain their powers upon reaching puberty. I also have a whole host of odd creatures that only make sense if I divide them into children and adults.

Also, tadpoles.

Retro

  • Bay Watcher
  • o7
    • View Profile
Re: Water volume, flow, and absurdity
« Reply #8 on: May 06, 2010, 09:40:30 pm »

It's likely he did at least a little, but already-existing caverns don't bring with them the same FPS drop that dug-caverns do in relation to stone created. Plus Halo's cavern is probably going to be a bit bigger than the little pre-generated ones. Throw in dwarves and animals (and invader trash like clothes), and hey-o.

Halo

  • Bay Watcher
    • View Profile
Re: Water volume, flow, and absurdity
« Reply #9 on: May 06, 2010, 09:46:23 pm »

Yay this is exactly the kind of education I was looking for, many thanks. It's a shame I can't have a constant flow leaving the fortress without it messing up, but alas.

I'm looking at trying something like this:
Spoiler (click to show/hide)

Natural water sources like a lake or a brook or river or whatever are touching the edge of the map, so pouring excess water into those will have no real effect on them correct?
Logged

Djohaal

  • Bay Watcher
  • [PREFSTRING:Utter Insanitiy]
    • View Profile
    • My deviantart
Re: Water volume, flow, and absurdity
« Reply #10 on: May 06, 2010, 09:50:42 pm »

You can make water outlets anywhere*. Dig up to the map's corner, then smooth the stone there, and then tell your dorfs to carve fortifications.

You could turn off the inlet when the lake reaches high tide to save up on FPS, and then flush it down when it is time for low tide.

*layers that spawn water on their corners such as lake maps, underground caverns with lakes and such can lead to fun™
Logged
I really want that one as a "when". I want "grubs", and "virgin woman" to turn into a dragon. and monkey children to suddenly sprout wings. And I want the Dwarven Mutant Academy to only gain their powers upon reaching puberty. I also have a whole host of odd creatures that only make sense if I divide them into children and adults.

Also, tadpoles.

o_O[WTFace]

  • Bay Watcher
    • View Profile
Re: Water volume, flow, and absurdity
« Reply #11 on: May 06, 2010, 10:20:18 pm »

I would recommend you keep your water stagnant as much as possible.  Water thats moving through flow or pressure eats FPS very very quickly, so if you do make something like this, be sure to include an on/off lever. 
Logged
...likes Dwarf Fortresses for their terrifying features...

Fossaman

  • Bay Watcher
    • View Profile
Re: Water volume, flow, and absurdity
« Reply #12 on: May 06, 2010, 11:42:50 pm »

If the way pressure-pathfinding works hasn't changed, you can use diagonal tunnels to get a more natural flow rate:

Code: [Select]
v Pressure
OOO7O
OOO7O
OO7OO
OO7OO
v No pressure
Water flowing through an arrangement like this gets depressurized, so you can precisely control the rate at which water passes through your inputs and outputs.
Logged
Quote from: ThreeToe
This story had a slide down a chute. Everybody likes chutes.

Dorf3000

  • Bay Watcher
    • View Profile
Re: Water volume, flow, and absurdity
« Reply #13 on: May 07, 2010, 03:28:19 am »

Even if this is possible, should I even bother trying it on an average computer, or will I need a Cray to get a framerate that is two digits?

Once, just for a laugh, I embarked on an oceanside map to check out the new caverns in the new version.  Somehow I got an ocean without an aquifer below it, usually they do.  So I dig down and the first cavern is only 5z below the beach, and I start thinking hmm, wouldn't it be fun if I tunnelled up into the ocean and had it drain away?

Well, I dug up with a series of ramps from the cavern floor right into the ocean.  My computer did a good impression of a person giving birth to an alien that was growing inside their brain.  5 or 6 minutes later, I could see half the first layer of ocean had gone and was filling the cavern extremely rapidly, eventually it filled as much as it could before it was draining from the edges faster than it was going down the hole, and I had a nice healthy 3-4 FPS.

tl;dr: your plan is doomed to hair-pulling frustration and will eventually be turned off.
Logged
I had a tigerman get elected mayor and he promptly mandated 3 bowls of cereal.

Shoku

  • Bay Watcher
    • View Profile
Re: Water volume, flow, and absurdity
« Reply #14 on: May 07, 2010, 06:30:09 pm »

I also highly recommend just pumping the water into a cistern for low tide. With pumps you can control the rate considerably and the water won't need to travel so far which means less processor drain for you.

This does mean some engineering work so make a fort with a small scale model so you can be sure the design will function.

There's sort of another issue though. If you want to control the flow with pressure plates a floodgate is suboptimal. They take a little while to close but with the way water skitters around anything besides a full layer of the same number can trigger the plate on and off again and again in a short period of time. The floodgate will ignore all of that so it may end up with your plate being in the wrong state once it is fully flooded or drained at that level. Gears don't have this issue because they toggle instantly.

Now what I would do is create a pump stack the full height of the area you want to drain and have it always running. At each water level you want to toggle to you can have a few pumps that output into channels that drop the water in front of your pump stack. To prevent overflow having just a single channel to there starting at the maximum height of the water would work*. For gradual filling you could have another stack starting down to the bottom of the cistern and just the the waterfall do it while possibly pleasing your dwarves if they walk through the mist.

*Obviously if it is open you would need constantly flowing water to keep the thing full but if you don't mind just a little mud there is an easy way to handle this. If the channel has just one tile in between it and the water and is also near the waterfall most of the next layer of water will flow over and into this channel. Some will inevitably wander over to the floors but you won't be able to severaly flood the fort if it has to glide over a lot of water to get there.

Slightly better is constructing a ring of walls around the waterfall, then a ring of floors, then another ring of walls but with one space leading into the duct. Then you can really force all of the overflow water to go in one direction once it can't fall or teleport to open space.
Logged
Please get involved with my making worlds thread.
Pages: [1] 2