Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Water in the sea doesnt flow downward.  (Read 2198 times)

chewd

  • Bay Watcher
    • View Profile
Water in the sea doesnt flow downward.
« on: February 22, 2009, 12:52:29 pm »

Or more accurately, "bubbles" dont flow straight up to the surface.

A little backstory.... For my current megaproject i needed a vast source of water (the sea) but, in an effort to get an uninterrupted supply, i ran my pumps to a couple levels below sea level & dug into the sea from there to feed it.

Well it feeds the pumps beautifully, but when the water-flow algorithms go to refill what ive just pumped out, it of course needs to pull water from the level directly above.

I was startled to notice that on the surface above my water intake, it was still all 7's... i had to scroll all the way to the NE corner of the map to find the 6's and 5's indicating where my water really was coming from.

So when the game needs to fill a water square, it doesnt fill it from the same XY coords directly above, it does some horrific pathfinding & ends up taking it from somewhere far far away. This results in a huge slowdown, rendering my system completely unusable (although i have hacked together a way to pull from the surface instead, ugh)

Is there some reason it has to work this way? It seems to me that if when the water flow system found an empty square at the bottom of a large body of water, it would be more sensible to fill it from directly above.. & fill that one from directly above etc etc etc until it hits the surface & then all the pathfinding would occur.

Seems like theres some ugliness going on in waterflow calculations dealing with z-levels.... just thought id bring it up.
Logged

Variance

  • Bay Watcher
  • Let's scare some woodcutters, Billy.
    • View Profile
Re: Water in the sea doesnt flow downward.
« Reply #1 on: February 22, 2009, 05:32:12 pm »

Interesting, I wonder if the game considers all the water in the ocean to be, effectively, a single unit of water for the purposes of creating things like waves. That way, only a few complete wave patterns would be generated at a time, and you wouldn't have individual squares producing random tiny waves at the shoreline. Though, of course, the water at the bottom of the ocean is undoubtedly heavily pressurized, so it may just be a bug relating to the pressure causing the square to be quickly filled by adjacent XY squares, and that continues with a few random Z-level transfers until it moves somewhere way over to the corner of the map.
Logged
Why is everyone so angry?

Warlord255

  • Bay Watcher
  • Master Building Designer
    • View Profile
Re: Water in the sea doesnt flow downward.
« Reply #2 on: February 24, 2009, 12:08:16 am »

It's likely reflowing/Z-level transfers due to draining from the bottom of the ocean with a pump.

Now, digging out 5 entire Z-levels underwater and punching out a hole in the ocean....
Logged
DF Vanilla-Spice Revised: Better balance, more !!fun!!
http://www.bay12forums.com/smf/index.php?topic=173907.msg7968772#msg7968772

LeadfootSlim on Steam, LeadfootSlim#1851 on Discord. Hit me up!

Kanddak

  • Bay Watcher
    • View Profile
Re: Water in the sea doesnt flow downward.
« Reply #3 on: February 24, 2009, 05:58:19 pm »

Well it feeds the pumps beautifully, but when the water-flow algorithms go to refill what ive just pumped out, it of course needs to pull water from the level directly above.

I was startled to notice that on the surface above my water intake, it was still all 7's... i had to scroll all the way to the NE corner of the map to find the 6's and 5's indicating where my water really was coming from.

I don't know if I'd call that a bug, really. You could post it to suggestions, asking for a more realistic water-flow algorithm, but I think it's working as intended.

How you expected water flow to be calculated:
1. Hi, I'm some tile! I'm going to figure out if there should be water in me this frame.
2. No, nothing's going on here.
3. Hi, I'm some other tile! I'm going to do like that other tile did.
4. No, nothing's going on here.
...
5137. Hi, I'm the dry tile under chewd's pump intake at the bottom of the ocean! Now it's my turn!
5138. Whoa! There's water over me!
5139. I'll take the water from tile above.

How it actually works:
1. Hi, I'm a tile full of water! I'm going to figure out what my water is going to do for this frame. And specifically, I'm whichever tile goes first when flows are calculated, possibly the one in the northeast corner of chewd's map.
2. Oh look, I'm resting on top of 7/7 water which has a path, through more 7/7 water, to a tile not full of water on a lower z-level.
3. I'll teleport to the not-full tile.
4. Hi, I'm the next tile full of water figuring out my flows.
5. Well, I'm resting on top of some 7/7 water, but it's not connected to any non-full tiles on any lower z-levels, because that last tile went ahead and filled the pump intake tile already. So I'm not going to move around under pressure.
6. I'm next to that now-empty tile though! I'll spill some water into there. Now I'll be 4/7 and it can be 3/7 or something like that.
...
(tiles in the corner shuffle water around until you've got seven 6/7 tiles instead of one empty one)
...
3214. Hi, I'm a tile full of water, and I happen to be directly over chewd's pump intake. It's finally my turn.
3215. I'm on top of an ocean full of water, but that pump intake got filled a long time ago, so I'm not going anywhere under pressure.
3216. I and all my neighbors are at 7/7, too, because we're nowhere near that corner where a little water got shuffled around earlier. I guess I'll just sit here.
« Last Edit: March 17, 2009, 10:34:47 pm by Kanddak »
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.