Terrain Information Layers and Radiant

 

Overview

 

����������� �Terrain Information Layers� are tools used by designers and artists to allow them to define a terrain�s regional responses and behaviors based on a 2D bitmap created in Adobe Photoshop.They are designed as a �short cut� or �speed optimization� around otherwise expensive game-side computations and also create a nice interface to allow visualization of localized environmental effects. Artists and designers literally �paint� areas of response on separate Photoshop layers and through appropriate naming of these layers, define how that layer will affect the in-game environment.Radiant also has a feature whereby the artist or designer can graphically preview these layers (a �PSD� file can be imported) in Radiant�s �XY Map� (The top-down view).Radiant also has the ability to convert a Photoshop �PSD� file into the MOHPA �TIL� file format for use by an individual game level.The exported �TIL� file will assume the name (and path) of the current Radiant map being edited. (IE: If one is editing and exporting �maps/5_5_foo.bsp�, then the �TIL� exporter will create �maps/5_5_foo.TIL�).The behavior of the currently supported set of layers will be described next.


Supported Layers

 

auto_farplane

 

����������� This layer controls the distance of the far plane used for visibility culling of geometry in the game. It updates the far plane distance linearly and smoothly in a range defined by the key/value pairs of �auto_farplane_near� and �auto_farplane_far�. The information of the layer data is defined in the range from 0.0 to 1.0. A value of 0.0 is the �All-clear� (no opacity) attribute of a PSD layer pixel. A value from the layer near 0.0 will cause the in-game far plane to approach the value of the �auto_farplane_near� setting. Similarly, a value of 1.0 is the �full bright� (full opacity) attribute of a PSD layer pixel.Layer values close to 1.0 will cause the in-game far plane distance to approach the value of the �auto_farplane_far� setting.All values from this layer will apply a far plane distance within the range of these two values.

 

obfuscation

 

����������� The values in the obfuscation layer serve to attenuate or �dumb down� an AI character�s ability to detect other AI characters and the player. The values in the obfuscation layer range from 0.0 (No obfuscation�clear L.O.S.) to 1.0 (Complete concealment�minimal chance of detection). Calculations to determine �effective detectability� of an obfuscated character also consider the distance between the 2 characters.Characters farther away have a higher bias of obfuscation whereas closer characters gain less benefit from the values in the obfuscation layer.

 

particle_filter

 

����������� The particle filter layer allows the artist to control the types of particles that will be produced in different regions of the map. In the �TIK� file for a particle effect, the following directive is issued:

 

����� originemitter a_particle_effect

����� (

����������� particle_filter 128

�����������

����� )

 

����������� This means that when the player character traverses over any section of the particle-filter layer and the value at that location is �128� (NOTE: This layer should be monochromatic), then the particle effect �a_particle_effect�, will begin emitting. When the player character leaves this region, the effect will cease. Using different values for the TIK �particle_filter� directive, a set of up to 256 different effects can be varied throughout a landscape.

 


Radiant �Terrain Info Layer� Dialog Options

 

����������� The �Terrain Info Layer� dialog can be invoked from the main menu by selecting �Misc->Info Layer�. The options on this dialog are:

 

�Load�

�����������

����������� This allows the artist or designer to load any PSD file for viewing and exporting.The filename of the PSD file is not important as the TIL Exporter will use the map name with the �TIL� extension when it creates the resultant output file.

�����������

�Refresh�

�����������

����������� This option allows the designer or artist to quickly reload the current PSD file.It allows them to bypass the �Open File� dialog altogether.

�����������

�View�

 

����������� Selecting this option will produce a dropdown box containing the names of ALL the layers contained in the PSD file (Not just TIL layers).Selecting any of them will cause that layer to visually overlay in the �XY Map� top-down map.Select the �none� entry to suppress this overlay display.

�Export�

 

����������� This option creates the output TIL file in the same directory as the BSP file. The resultant file will be of the same filename as the BSP file save for the BSP extension (It will have a �.TIL� extension).This step is required if any changes to the PSD layer are to be propagated to the game. Note: Only layers with the �TIL_� prefix and a valid layer name will be exported. The valid layer names to date are �auto_farplane�, �obfuscation�, �particle_filter�, and �contact_sounds�.

 

�Clear�

 

����������� This option completely disassociates (unloads from memory) the current PSD file being used.�� If the �View� option was used previously and is still active, the �XY Map� overlay will disappear as well.

 

�Done�

�����������

����������� This option hides the �Terrain Info Layer� dialog.It can be invoked again from the main menu by selecting �Misc->Info Layer�.

 


Operation Checklist

 

1)                  In Radiant, load a map for editing.In this example, �foo.map�

2)                  Choose the settings for the �XY Map� that will make it easiest to visualize the terrain from a top-down view (�Grid off�, �TERin2D��etc).

3)                  From the �file� menu in Radiant, use the �Reference Snapshot� option. You will be prompted to save a TGA file containing an accurate full-map top-down image of your level.

4)                  Save this TGA image in your �map_source� folder and append the word �ref� to the filename (For clarity).In this example, save it to �foo_ref.tga�.

5)                  Open up Photoshop and load this TGA file as your �background� layer

OR

6)                  Open the PSD file associated with your level (It is OK if it has �scatter� layers in it, these are ignored by the TIL exporter.

7)                  Create a new layer called �TIL_auto_farplane�.The �TIL_� prefix is how the TIL exporter recognizes valid layers.

8)                  Paint an image on this layer (Do not �flatten� the image.Keep the layers insulated from each other). Save the PSD file.

9)                  In Radiant, find the �worldspawn� entity and set the key/value pairs for �auto_farplane_near� and �auto_farplane_far� (optional�the defaults are 1000 near and 10000 far).

10)              In Radiant on the main menu, select �Misc->Info Layers� and a dialog box will appear.

11)              Select the �Load� option and open the PSD file you have just edited.

12)              Optionally, you can select the �View� option and a dropdown box will appear. Select the layer you wish to view (�TIL_auto_farplane� is this example.).You will an overlay of that layer on the �XY Map� top-down window. Select �View->none� to clear it again.

13)              Press the �Export� button.

14)              Run MOHPA.EXE with your map.In this example using �foo.bsp�, you should see the far plane distance advance and recede accordingly.

 

 

Final Notes:

 

1)      The only PSD layers the TIL exporter will recognize are those with the prefix �TIL_� and with a valid layer name.At the time of this writing, the valid layer names are �auto_farplane�, �obfuscation�, �particle_filter�, and �contact_sounds�.

2)      TIL files have can have a substantial memory footprint. This will be addressed as a memory optimization in the TIL exporter/reader.

3)      All �scatter� information and TIL information can coexist safely in the PSD file. This method should be employed so as to reduce the number of source assets associated with any given level.