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.

v0.34:Flow

From Dwarf Fortress Wiki
Revision as of 11:16, 30 July 2014 by 137.147.3.135 (talk)
Jump to navigation Jump to search
This article is about an older version of DF.
The term flow can be used to refer to several completely different things in Dwarf Fortress: things like miasma and smoke, and the mechanism by which water and magma move. This article describes the latter.

Flow is a game mechanic used to simulate the motion of fluids. The two fluids that exist in dwarf fortress currently are water and magma. You can identify fluids that are flowing by looking for a tile that is blinking between and ~ tiles. If you have turned on SHOW_FLOW_AMOUNTS you will see the fluid depth indicator of 1 through 7 instead and will not be able to easily tell if the game considers a tile to be flowing or not. Flow is typically present any time a fluid is in motion, but there are some exceptions which confuse things a bit.

  • Note: In the current release flow does not seem to appear in magma. Magma follows the same rules of fluid motion and flow, it simply doesn't have flow in the sense that would allow it to power a water wheel.

Basic Fluid Motion

Water and magma both move in much the same way following a fairly simple set of rules. The only difference between the motion of magma and water is that magma behaves differently with regards to pressure.

Fluids move mostly as one might expect: they will fall straight down if they can, or else they will spread out to the sides. Fluids can flow diagonally on the same z-level, but will never move sideways and down at the same time. Under basic fluid motion, fluid never moves back up, but it can appear to do so if pressure is involved.

Here is a quick example of how fluids can move to adjacent tiles. Also as water moves to an adjacent tile flow is generated in both tiles. This flow will remain for a short time before reverting to being non-flowing water. Falling water does not generate flow, so only the 3rd example will result in flow (in both tiles).

Before (side view)
7  7         
   2  7      
       
After (side view) 
   2         
7  7  43     
       
  • 1. Fluids move down
  • 2. Fluids spread out to the sides

These rules are incomplete, however, without consideration of pressure.

Fluids under pressure, aka Teleportation

Magma, which has no natural pressure, flows according to the rules of basic fluid motion. Water, however, can move by pressure when it falls down on top of full 7/7 water. In addition, pumps create pressure in both water and magma, and water entering the map from a stream or river follows pressure as well.

Fluids moving under pressure do not just move to adjacent tiles, they also trace a path through other full tiles of fluid trying to move to more distant tiles. Fluids moving under pressure can effectively teleport through other tiles that are already filled with fluid. When teleporting, fluids do not generate any flow, neither will they push objects around.

                7 
   Before       7 
                777
                
-------------------- 
                  
   After        77
                777
                

When a fluid tries to move by pressure, it tries to trace a path through full 7/7 fluids going down, and horizontally, but not diagonally. In this way it is like basic flow, except that pressure works faster; fluid from the source is teleported to the open space at the end, rather than having to wait for open space to open up at the source via normal flow. This is why, for example, diagonal squeezes in channels make water flow slower (they block pressure, forcing it to only spread out sideways), and why rivers and streams on the map are usually full of 7/7 water until close to the edge of the map where the rules of basic fluid motion are draining the water off the map while pressure teleports new water from the source all the way down to the end.

What's more, unlike basic flow, the path pressure traces can even go back up--but never higher than the z-level of the first 7/7 tile on the path it was tracing. So it may appear that pressure 'pushes fluids up', but in fact it's only teleporting fluid to a level even or lower.

Thus the result is that pressure movement of fluids (especially water) is common and doesn't create very much flow. However rivers and streams still seem to have some kind of flow that powers water wheels, called natural flow.

Fluid Displacement by Cave-in, aka Pistons

(see also magma piston)

There's one way to push a fluid higher than its starting level, but it might be considered a bug on the flow mechanics and probably will be changed in following versions since allows for what could be considered exploits.

A natural wall of any material falling onto either water or magma will teleport each tile of displaced fluid to open space directly above it, leaving 1 additional tile of open space directly above the wall itself:

 Start              Step 1             Step 2
                                    
  I    Collapse          Fluid         
    ----------->  7  ----------->     
       Support          Spreads    232 
 7                             
                              

When done in an u-bend example the pushing above original fluid level can be easily appreciated, although it breaks the laws of regular fluid physics:

  Start               Step 1               Step 2     
                                          
  I                                          
                                            
                   7                        
        Collapse    7      Fluid             
      ----------->      -----------> 545     
 77   Support    7   Spreads    7    
 7777              777              777    
                                 

This is the basic principle that the magma piston exploit, if you want to anticipate a future fix or simply want to simulate regular physics fluid behaviour, you can do something like this:

 z-level   Start                  Step 1                 Step 2                                 
   z+0