Chapter XV. Water.

Water effects: still water, flowing current, waterfalls, and a draining pool using func_water.

15.1

Basic Water

In this article we will look at several ways to create water. We recommend that you familiarize yourself with the following entity object: The simplest water can be created in two ways. Firstly, you can simply paint a regular brush on all sides with a water texture (the name begins with an exclamation mark !). The Half-Life engine will automatically turn such a brush into water and give it the appropriate properties. You can find quite a lot of different water textures in the standard wad file liquids.wad, which is located in the valve folder.
Secondly, water can be created using an object specially designed for this purpose func_water. Create a brush, color it on all sides with a water texture and turn it into an object func_water.
Below we present the main properties func_water:
Render Mode — Texture (this mode makes the water transparent. In some cases you can also use the Additive mode);
FX Amount — 45 (water transparency. The closer the value is to 0, the more transparent the water and vice versa, the closer to 255, the more opaque. With fx amount = 0, the water becomes completely invisible);
Wave Height — 0 (wave height - ripples of water. Here you can specify both integer and fractional values, for example, 0.3, 1, 2.5, etc. Wave height is measured in units. We recommend not making the wave height too high, because it looks quite ridiculous)
These are the main parameters that need to be changed when creating water. The rest are used in special, rare cases.
Differences between water from a brush and func_water
The water from the brush is opaque and has no waves. In any case, we recommend using the object func_water, because In this case, the water looks more realistic and beautiful. In the picture below you can see the differences between water from a brush (left) and from func_water.
This is what water looks like when created from a regular brush and a func_water object
Tip: if you want to create water in a hole in which in the middle (or somewhere else) there is a piece of rock protruding from the water, then it is not necessary to create several separate objects func_water, which will fill the hole, surrounding the hill on all sides. It is enough to create one object and "fill" the hole through the hill with it.
15.2

Water with Current (Flowing Water)

In this article we will tell you how you can make water with a current that will push the player. To create flowing water we will use the following entities: Ambient_generic — for sounding the stream using the standard file waterrun.wav;
Func_conveyor — to depict water and change the visual (not physical) speed of water flow;
Func_water — to simulate the player being in the water (this object will be invisible);
Trigger_push - to push the player in the direction of the flow at a certain speed.
Let's create a brush in some recess and paint it on all sides with texture SCROLLWATER1 (this is a moving texture, as indicated by the word SCROLL in the title) and turn it into an object func_conveyor (see picture below). This object is intended to create a conveyor, however, we will use it to create the effect of a flow.
Create a func_conveyor that will represent the flow of water
In the normal case, the player who steps on the conveyor moves in the direction indicated by the Angle angle. We need the player to not only step on the conveyor (water flow), but also be able to be inside it, so we'll set the "No Push" and "Not Solid" flags. So, the object func_conveyor will have the following properties:
Render Mode — Texture (this mode will give the stream transparency);
FX Amount — 210 (the degree of transparency of the stream. The closer the value is to 0, the more transparent the stream and the closer to 255, the more opaque);
Conveyor Speed — 50 (the speed of movement of the conveyor (flow). In our case, since it will be possible to pass through the flow, this parameter determines the speed of movement of the SCROLLWATER1 water texture).
Flags:
No Push — does not push the player (the special trigger_push object will push);
Not Solid — this flag makes the stream intangible. This is necessary, otherwise the player will only be able to walk on the surface of the water).
Now let's copy func_conveyor and paste it in the same place. Let's click [Alt-Enter]to call the properties of the object and select from the list func_water.
Note: to select the desired object in 3D view, provided that there are two or more objects in the same place, you must click and hold the left mouse button on the objects. Objects falling under the cursor will be selected one by one. The names of objects are shown in the tooltip line below.
So, by changing one of the objects func_conveyor V func_water, set the following properties for it (func_water):
Render Mode — Texture (this mode will give the water transparency);
FX Amount - 0 (be sure to put a zero here).
Such parameters will make the water absolutely transparent, invisible in the game, because we only need to create the effect of the player being in a stream of water, and the water itself is depicted func_conveyor.
And the last object that directly relates to the thread is trigger_push. Select object func_conveyor or func_water (no matter which one). Copy it and paste it somewhere near the future stream. Replace the water texture on all sides with a special texture AAATrigger. Click [Alt-Enter] and in the list this time select trigger_push. For this object, set only one parameter:
Speed of push — 100 (the speed at which the flow will push the player. It is necessary experimentally, changing this parameter and the speed of movement of the water texture in the object func_conveyor, achieve a match between the pushing speed and the texture movement speed).
Place this object again in the same place where two objects are already located: func_conveyor And func_water (see picture below). Thus, we will have three objects in the same place.
Create a trigger_push that will push the player in the water
So far we haven't said a word about the flow direction (the direction the texture moves and the direction the player pushes). After all, it may turn out that the water will flow perpendicular to the banks, and the player will be pushed along, which is not very correct.
The direction the player pushes is set in the "Angle" parameter of the object trigger_push, and the direction of movement of the texture must be set by the angle at which the texture is applied to the object func_conveyor. This angle is shown in the texture panel Face Properties in the parameter Rotation. Change this angle to 90°, 180°, 270°, or 0° as needed.
It should be noted that on our example map in the top view we get some angles, but in the game we get different ones, so we determined the direction of flow and pushing empirically.
Now let's add some realism to the flow. Let's place two sounds above the water surface (objects ambient_generic, see fig. below):
Create two ambient_generic objects to sound the flow of water
Let us set the following properties for them:
Path/filename.wav of WAV — ambience/waterrun.wav (sound of water flow, you can change it if necessary);
Volume (10=loudest) — 8 (sound volume. Minimum: 0, maximum: 10).
Flags:
Medium Radius — average radius of sound propagation (change if necessary).
Well, after quite a long time of creating and selecting the angles of water movement and player pushing, you should end up with a fairly realistic flow of water. The main thing is that someone needs it :)
If you are too lazy to make such a flow just to see whether it is needed on your map or not, then you can download our example map.
watersteam.zip [71Kb] - in the archive there is an example map in BSP and RMF formats, as well as the necessary sounds.
15.3

Waterfall

In this article we will look at creating a waterfall. For this we need the following entity objects: Let's choose a texture +0WATERFALL1 (this is an animated water texture). Let's build a brush that will be a flow of water (see figure below).
Create a func_illusionary that will represent a falling stream of water
If necessary, align the texture so that it is directed from top to bottom (otherwise the waterfall will flow horizontally :). Let's turn it into func_illusionary and set the following properties:
Render Mode — Texture (this mode will make the water transparent);
FX Amount - 180 (degree of water transparency, the closer to 0, the more transparent and vice versa, the closer to 255, the more opaque).
At the bottom of the falling water stream, you can place a simple water func_water with the same display parameters.
Now let's create the effects of splashes and water vapor at the bottom of the waterfall. For this we will use sprites (files *.spr). We will insert sprites using an object env_sprite. A sprite is good for creating splashes. wsplash3.spr, and for steam - rk_steam.spr (this is a non-standard sprite, we included it in the archive with our example map).
Insert multiple objects env_sprite at the bottom of the waterfall so that they "block" its entire width (see figure below).
Create splashes and water vapor using env_sprite objects
For all objects env_sprite Let's set the following properties:
Render Mode — Additive (this mode will remove the black background from the sprite, leaving only white steam or splashes of water);
FX Amount — 200 (degree of transparency, the closer to 0, the more transparent and vice versa, the closer to 255, the more opaque);
Sprite Name - in the case of steam, the path will be sprites/rk_steam.spr, and in the case of splashes - sprites/wsplash3.spr;
Scale — sprite scale. We set it to 3 for steam and 2 for spray.
And lastly, let's sound the falling water using an object ambient_generic. The properties will be as follows:
Path/filename.wav of WAV — ambience/waterfall3.wav (path to the standard sound of falling water);
Volume (10=loudest) — 8 (sound volume. Minimum: 0, maximum: 10).
Flags:
Medium Radius — average radius of sound propagation.
The waterfall is ready. As a result, you should get a pretty nice waterfall :) And if you also find beautiful textures, it will be absolutely beautiful.
This is what a waterfall looks like in the game
waterfall.zip [85Kb] - in the archive there is an example map in BSP and RMF formats, as well as the necessary sounds and sprites.
15.4

Draining Pool (func_water as a Door)

In this article we will look at creating a pool with drainage water. We will need the following entity objects: Few people pay attention to the properties of water, i.e. object func_water. After all, to create ordinary water, it is enough to set the display parameters so that the water is transparent and the height of the waves.
But water has all the properties of an object func_door (!) such as speed and direction of movement. This way we can make the water move.
So, let's place ordinary water func_water in the pool (see picture below).
Create water in the pool func_water
Let us set the following properties for water:
Angle — Down (the water should go down, so the value is down);
Name — water1 (we will write this name in the properties of the button, when you click on it, the water will begin to descend);
Render Mode — Texture (this mode will make the water transparent);
FX Amount — 50 (the degree of water transparency. The closer to 0, the more transparent and vice versa, the closer to 255, the more opaque);
Speed — 20 (speed of units per second at which the water will descend/rise);
Lip "-2" (a negative value will cause the water to drop 2 units below the bottom of the pool. This is necessary so that the water completely disappears under the pool);
Wave Height 0.5 (wave height in units)
Flags:
Toggle - this flag must be checked so that the water does not rise automatically
At the bottom of the pool we placed several small objects func_water arbitrary shape obtained by cutting with a tool Clip (see picture below). The height of these layers of water is 1 unit. These "puddles" will imitate the remaining water after it drains (goes down).
Create small puddles at the bottom of the pool func_water
The properties of these puddles are as follows:
Render Mode — Texture (this mode makes puddles transparent);
FX Amount — 15 (the degree of water transparency. Note that the puddles are more transparent than the main water. This is done so that from the outside, when the water is still in the pool, these puddles are not noticeable)
Well, one last thing. Let's create a button func_button (see figure below) and write in the "Targeted object" parameter the name of the water, i.e. water1. We will also set "Delay before reset": 7 seconds (during this time the button will be inoperative. The time is calculated based on the size of the water in height and the speed of its movement (height/speed). 124: 20 = ~6 seconds. We added one second just in case :). In the flags we will mark "Don't move" and "Toggle".
Create a button that will flush water
That's it, the pool is ready! When you press the button, the water will slowly drain. When it completely goes under the pool, there will be several small puddles of water at the bottom. Pressing the button again (after 7 seconds) will cause the water to rise.
This is what the pool looks like in the game:
This is what the pool looks like in the game
As you can see, everything is very simple! But if something remains unclear to you or you just want to jump from a diving board into the pool :), then you can download our example map at any time.
swimming_pool.zip [53Kb] - in the archive there is an example map in BSP and RMF formats.