v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

40d:Water flow

From Dwarf Fortress Wiki
Revision as of 10:53, 18 May 2015 by PeridexisErrant (talk | contribs) (Changed quality rating from "Unrated" to "Superior" using the rating script)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
This article is about an older version of DF.

Water flow is an informal term used occasionally by players to denote the ability of specific water tiles to power a water wheel. The direction of the flow does matter for purposes of powering a wheel, though most of the time it's diagonal and thus doesn't matter.

While there obviously is a game feature at work, the mechanics are not completely understood at present. It's a bit of a black box - we know some of what happens, what will work and what won't, but not always why.

The simplest way to see if water is flowing is to watch for it to blink from ~ to ≈ while the game is not paused. Water blinking between ~ and ≈ is flowing, and tiles which flash white indicate the direction in which it is flowing (as they splash against the wall). If you see numbers instead you may want to set SHOW_FLOW_AMOUNTS to NO in your init.txt file. Alternatively, you can just build a water wheel and see if it turns, which again is indicated by blinking.

It is important to understand with flow that there are two very different things going on at the same time. The first is natural flow from a river or brook which traces a path to every tile directly connected to a natural source and sets it to be constantly flowing.

The second is how all fluid mechanics in Dwarf Fortress is handled (including natural flow). In this case any time a unit of water moves from one tile to another, it sets both tiles to be flowing for a short period of time. For a good explanation of how this works you should look at technical explanation by Kanddak from the Bay12 Forum.

Natural flow

Rivers and brooks always have flow which overrides the normal rules to determine if water is flowing. Brooks require that you channel down through the surface to place a wheel, but the flow is there. With natural flow every single tile of a body of water will be constantly flowing even if it is unable to move. The test for whether a tile of water has natural flow occurs very infrequently, perhaps as rarely as once or twice a game season.

Channeling from a Natural Source

Channeling out new area from a flowing river or brook does generate flowing water at the same Z-level. It is worth mentioning that when this channel is first connected it is quite likely that you will see it fill fully to 7/7 and stop flowing for a period of time. After some time passes (a season or so) the channel will suddenly start flowing like a natural source. The shape of this channel does not really matter. Natural sources of water will flow quite happily in a dead end on the far end of the map. Another oddity with natural flow is that a closed floodgate will not stop the flow. Diagonals also have no real effect on water flow although they do have use as a means for controlling water pressure. Moving naturally flowing water to a different z-level has somewhat unpredictable effects. More research is needed.

Natural water and a floodgate

This is a common case of natural flowing water doing weird things, in this case natural flowing water continues to flow despite it being isolated by a floodgate.

    ≈  Natural flowing water as from a River or Brook
    ~  non-flowing water
    X  Floodgate
    ▒  Solid Ground
    %% Screw Pump
    ≈≈≈X≈≈≈▒▒
    ▒▒▒▒▒▒▒▒▒

Taking a natural source uphill with a screw pump

This is an example of natural flowing water doing weird stuff. With a screw pump you can pull water directly from a river, or at least from a channel connected directly to a river and generate a naturally flowing pool at one level above the river in defiance of all logic. Left alone as is this pool will continue to flow forever on every single tile. This could be used as a cheaty way to power a waterwheel. Covering this strange pool with another layer of water may break this effect.


       %%≈≈≈▒
    ≈≈≈▒▒▒▒▒▒

Natural flowing water and pump stacks

Using a pump stack to pull water up from a river to a higher level yields normal water which no longer has that special natural flowing state. Once the water is taken up to a higher level like this it must be treated as still water and can only be made to flow by artificial means.

       ▒ %%~~~~~~
       ▒~%% ▒
       ▒▒%%≈▒
    ≈≈≈≈≈▒▒▒▒
       ▒ %%~~~~~~
       ▒~~%% ▒
       ▒▒%%≈≈▒
    ≈≈≈≈≈▒▒▒▒▒

Water in Motion

This is the accepted rules for how all water moves in Dwarf Fortress. Natural water also follows this rules, but because of its own special case rule natural water is always flowing anyhow. Credit does have to go to Kanddak from the bay 12 forums for some of this information.

As every frame passes in dwarf fortress it is checking every single tile of fluid greater than a depth of 1/7 to determine how this fluid will move. This moves mostly in a manner you might expect preferring to move down first, then to the side, then up. When water is given a choice of two or more equal places to move into it will choose one completely at random. Any time water moves, it generates flow in the tile it moves from And also in the tile it moves too. This flow remains for a short period of time.

    1 -- try to move down
    2 -- try to move to the side
    3 -- try to move up (if under pressure)

Water Teleportation

This is where fluid mechanics in Dwarf fortress get tricky. At each step of the way (down/side/up) water also has the potential to teleport to a distant tile. When water teleports any tiles it skips over are ignored for the purposes of creating flow. Here is an example of how this might work with water being pushed down a hall from a screw pump.

    1-7  Water Level
    ≈  Natural flowing water as from a River or Brook
    ~  non-flowing water
    .    Open Space
    X    Floodgate
    ▒    Solid Ground
    %%   Screw Pump
    ...%%777777777753..
    742▒▒▒▒▒▒▒▒▒▒▒▒▒▒..     
    ▒▒▒▒▒           
    ...%%~~~~~~~~~~≈~..
    ~~.▒▒▒▒▒▒▒▒▒▒▒▒▒▒..
    ▒▒▒▒▒           


With a screw pump it will try to move every single unit of water from the source tile every frame. In this case it is moving 2/7 water. The obvious place to move it is directly to the output tile. However this is at 7/7 and cannot be filled. So the water traces a path forward until it finds the five. Once it does so it puts the 2/7 into the five making it 7/7 and in doing so generates flow both on the tile the 2/7 comes from, and on the 5/7 that it moved into. However the 2/7 was also removed and a 0/7 has no observable flow. The net result of all this is that one tile will now be blinking with flow.

At each frame, a similar test is done against every single tile of water in the game, each of them trying to move down, to the side, and then up. At each step if it fails to move in the desired direction it will then check to see if it can teleport to a distant tile instead. [Verify]

Creating permanent artificial flow

Artificial flow can be generated either by draining from one level to another, or with pumps. Because a waterwheel generates 100 power and a screw pump only costs 10, it's quite possible to create a perpetual motion machine.

Accidental flow in Aquifers

Rarely, when channeling into a level with an aquifer with no adjacent pre-existing channels or water-ways, a single tile of flowing water will be created, enough to power a water wheel. This flow continues even when surrounding tiles are channeled out. With current understanding, this is not predictable or controllable - if it happens, it happens.

(It is theorized that the water that initially flows in to fill that channeled tile somehow gets "stuck" in the flowing state. This is only a theory.)