# Fluids

Fluid refers to either water, acid, or lava.

The differences are as follows:

• Water (represented by a = or =) doesn't hurt at all, and is mostly decorative.
• Acid (represented by a = or =) does 6 acid damage per action.
• Lava (represented by a = or =) does 12 fire damage per action.
 Technical This article discusses technical aspects of DoomRL and will be of limited interest to most players.

With the exception of fluid rooms, all fluids are placed by random walks as described in this section. For most level types, fluid placement is done after wall placement as a separate step.

For the purposes of placing a fluid, a single random walk of length n proceeds as follows. Start at a random tile in the interior of the map. Replace it with the fluid. Then walk in one of 8 random directions (including diagonals) or don't move, each with probability 1/9. Repeat this n times (so that at most n fluid tiles have been placed). If a move would go into the border of the, it is pushed back into the map.

Depending on dlevel, fluid varies in several ways. Mainly, the type of fluid varies. Also, the number of random walks and length of random walks varies. The data follows:

 dlevel Fluid Number of Walks Length of Walks <6 water 1d3-1 1d40+2 6-10 acid 1d3-1 1d40+2 11-15 lava 1d5-1 1d50+2 >15 lava 1d5+3 1d40+2

Notice that until dlevel 16, there is a chance of 0 random walks. This corresponds to levels with no fluids.

Here are some examples of length length 40 random walks:

Random Walks (Length 40)
```·························································
····=················===·································
·····=···············===···········=···········==········
··==·=·······=·==····=··=·······=·=·=·=·······===····==··
·===·==······=====····==·=·····=·=====········==····===··
··===··=····=====·=····====·=···==··=·=······=====··===··
··==·=··=··========·····==·=····=·····=·····=·===····===·
···=···=····==·=·==······===·········====····=······====·
····=·=···················==··········====··········===··
·····=·················································=·
·························································
```

Notice that the number of tiles covered is less than 40. This is because the walk often returns to a tile it has already visited. The contribution of length to coverage has diminishing returns. Very large areas of fluid are generally the result of several overlapping walks with varied starting points.

## Rivers

Different level types have different chances of generating rivers and different restrictions on river types. First we describe the basic algorithm.

The fluid type of rivers is determined by a roll of 1d(6 + 2 × difficulty) + dlevel.

 Roll Fluid 1-14 water 15-24 acid >24 lava

For levels the allow horizontal rivers, there is a 1/4 chance of a single horizontal river and a 3/4 chance of one or more vertical rivers.

If vertical rivers are chosen, there is a 2/3 chance of 1 river, a 1/4 chance of 2 rivers, and a 1/12 chance of 3 rivers.

Horizontal rivers have a width of 1d3 + 1. The starting y coordinate is given by 1d(2 × width) + 11 - width. (Basically, horizontal rivers tend to start in the center of the map.)

Single vertical rivers have a width of 1d3 + 3. The starting x coordinate is 1d40 + 19.

Double vertical rivers have (independent) widths of 1d3 + 2. The starting x coordinates are 1d22 + 9 and 1d22 + 49.

Triple vertical rivers have widths of 1d3 + 1. The starting x coordinates are 1d20 + 9, 1d16 + 33, and 1d20 + 51.

Rivers always have a bridge. Bridges always have a width of 2. For a horizontal river, the bridge will start with an x coordinate given by 1d60 + 8. For a vertical river, the bridge will start with a y coordinate of 1d14 + 3.

Rivers can also meander (left and right for vertical rivers; up and down for horizontal rivers). Horizontal rivers are generated from left to right and have a 1/9 chance of meandering on each step. (Up and down are equally likely.) Vertical rivers are generated from top to bottom and have a 2/9 chance of meandering each step. Meandering cannot cause a river to reach all the way to the edge of the map.