MOHPA WATER

 

This document explains how to setup the different kinds of water available in MOHPA.

 

Water Types

 

Currently there are four types of water supported in MOHPA, they are:

 

Interactive: Interactive water is water that reacts to bullets and explosions, you can see ripples go through the surface of the water when it gets shot. Because of the overhead in calculating the water simulation, this water type is better suited to small bodies of water, small ponds, puddles or pools.

 

Ocean: Ocean water is the default water type used in MOHPA, it can be modified to look like many types of water by editing the material, it can be used for larger bodies of water such as lakes, oceans and swamps. This water can have waves, the parameters for waves (direction, amplitude) can be tweaked in the material, as well as the colors and transparency.

 

Modeled Water: This is water that is exported from a 3D package (Max or Maya) into a .GR2 file. This is mainly used for rivers which require special texture mapping to work with animated textures. The way the water looks will depend on the material applied to it.

 

Infinite water: This is water that extends out to the horizon, it�s very useful for levels such as those in which you�re in a plane and have substantial visibility. With this water type, no matter where you are in the level, there will always be water underneath the player that extends to the horizon.

 

Creating Infinite Water

 

To set infinite water you must set the following key/value pair in WORLDSPAWN:

 

Key: horizon_water

Value: 1

 

There are a few properties that you can change when working with infinite water, these are all worldspawn key/value pairs:

 

horizon_water_material � this is a string that identifies the material the water should use. Default is �horizon_water�

 

horizon_water_height � this is the height at which the water will be placed. Default is 256.

 

horizon_water_tiling � this is the texture tiling factor of the water. Default is 10.

 

horizon_water_tessellation � this allows you to specify a tessellation factor, this represents the number of vertices along each axis, the default is 32, this means that the horizon water mesh will consist of 32 x 32 vertices.

 

Creating Interactive Water

 

Start by right clicking on the 2D window, go to the �Classes� menu and click on �Water�. This will create a water brush that you can then resize to fit the area where water is necessary.

 

 

 

For physics to work correctly in water (objects sinking or floating), you need to make sure that the brush encompasses not only the area of the water, but the depth as well, as shown in the next figure.

 

 

Select the water brush and press �N� to bring up the entity window. The description window contains the following parameters that you can modify.

 

"num_nodes" - Integer representing the number of vertices, defaults to 16000.

 

num_nodes can be useful to increase or decrease the polycount of a water object (excluding for water that has been modeled using a 3rd party tool).

 

"targetname" - Name of the water brush, can be used to turn water on/off in script.

 

This allows you to manually hide and show water objects from script, this is the syntax:

 

$world show_water <targetname>

$world hide_water <targetname>

 

This can be useful when you go into a ship that�s being intersected by the water, or if you are in an area that the water is not visible, yet due to the size of it, or for some other reason is not being culled, you can manually turn it off for a performance gain.

 

"materialname" - Name of the material to set to the water.

 

The materialname must match a .xmat file located in the �materials� folder in one of the main/pak*.rez files shipped with the game (do not include the .xmat extension).

 

"collision_material_name" - Name of the collision material to apply to the water

 

This only needs to be set in case the collision material is anything other than water, however it is unlikely.

 

"current_strength" - Floating point number specifying a current.

 

This should be a small value, some tweaking may be needed to find the right current strength, 0 means no current, 5 is a very strong current.

 

�current_direction" - Vector specifying direction of the current.

 

This is a 2 dimensional vector that specifies the direction of the current (as if you�re looking top down at the water), alternatively, you can specify

 

�current_angle� � Angle from 0 � 360 which represents the direction of the current.

 

Which is just an angle from 0 � 360, imagine you�re looking top down at the water and 0 angle points to the right.

 

"drawmodel" - If a model is specified, the water type is overriden and water geometry is not created

 

This is used only when the water being used requires an external model, like rivers.

 

NOTE ABOUT MODELED WATER: When you place a water object modeled externally, you will notice that aside from being able to place the water, you can also resize the brush associated with the water object. The size of this brush determines the physical characteristic of the water, this means that whenever the player or NPCs go within the bounds of the brush, they will be affected by the water. Special care must be taken so that the brush does not poke out of the terrain where there is no water, this may cause AI to think there�s water there and behave as such, which is undesirable.

 

Getting physics to work with water

 

This is how you enable water to have a current and allow objects/bodies to float on it.

 

You must begin by setting a texture onto the water brush, you can find a water texture in Textures/common. Once applied, make sure the brush is still selected, and to avoid overwriting surface information, it is advised that you MIDDLE MOUSE click on a face of your water brush to grab the surface properties.Once you�ve done this, press the �S� key. This will bring up the following dialog, check the box labeled �water� and then press �apply�. If you forget to do this, you may experience odd behavior, such as NPC�s or the player walking on water.