Terrain Development Guide
Chapter 2: In Depth - Basic Terrain
Terrain Descriptor File
The Terrain Descriptor File is a simple text file that ties the various components of the terrain together and instructs the terrain engine how to display the terrain in your virtual world. The filename ends in a ".ter" extension and is pointed to by a scenario file (see the Targetware Developer's Guide for information on creating Scenarios). The general structure of the descriptor file is as follows:
|

|
The overall structure of the Terrain Descriptor File is fairly simple. At the beginning of the file is a Header Section which contains global information about the terrain.
Following the Header is Layer #1 which contains the Ecology Map and associated ecology texture files.
Following the Header and Ecology Map are all optional Layers you want included in your terrain. The order that the Layers are placed in the file determines the order that the Layers are placed in the actual terrain. The Ecology Map is placed first (on the Elevation Map), Layer #2 on the Ecology Map, Layer #3 on top of Layer #2, and so on. Within each Layer Section, the textures associated with that layer are included.
|
Header Section
The following snippet provides an example of the Header Section contents:
#######################################
# This is the Header Section Example #
#######################################
[Terrain]
name = TK_v14
chart = tpc.map
height = elev_h.map
height2 = elev_l.map
scale = 250
max_height = 2449
min_height = 0
num_layers = 16
# - Any line in the file that begins with the symbol '#' is ignored by the terrain engine. Use this feature to add comments to your terrain file, making it easier to follow and debug.
[Terrain] - This is a mandatory label. It tells the terrain engine this is the Header section.
name - The title of your terrain goes here. Use something that uniquely describes your terrain.
chart - Add the file name of the in-flight navigation chart you want presented to the pilots using your terrain. Click here for more information on this.
height - Add the file name of the base elevation map (aka High-byte) you want the terrain to use. Click here for an explanation of High/Low-byte elevation maps.
height2 - (Optional) Add the file name of the Low-byte elevation map you want the terrain to use. Click here for an explanation of High/Low-byte elevation maps.
scale - Provide the scale for the Elevation Map in meters per pixel. For example, if your Elevation Map measures 1000 x 1000 pixels and you want it to represent 250 kilometers x 250 kilometers (250000 x 250000 meters) in the game world, then the scale value you use will be 250 meters/pixel (250km * 1000 km/m / 1000 pixels).
The value that you provide here essentially sets the size of the "polygons" used to draw the terrain (aka resolution). For example, a value of 250 means that the distance between elevation points will be 250 meters in the game-world. The nice thing about the scale setting is you can make your terrain any scale you want without having to build new terrain maps, just raise or lower this value. Click here for more information on what all this means.
max_height - Provide the elevation of the highest point in your terrain, in meters.
min_height - Provide the elevation of the lowest point in your terrain, in meters.
num_layers - Provide the number of layers in your terrain. Minimum number of layer will be 1 (the Ecology map).
Layer Section
For each layer in your terrain (i.e. defined by 'num_layers'), the following block of text is required in the descriptor file:
###################################
# This is a Layer Section Example #
###################################
[Layer 1]
map = ecology.map
scale = 0.25
detail_scale = 2
height = 0
blend = 1
clamp = 0
mipmap = 0
num_textures = 92
[Layer 1 Texture 1]
value = 1
texture = _ecology/urban11.tga
detail = _detail/detail_bumpy2.tga
rotation = 0
detail_rotation = 0
{ Snipped Texture #1 through #91 }
[Layer 1 Texture 92]
value = 92
texture = _ecology/irrigated_grassland3.tga
detail = _detail/detail_grass2.tga
rotation = 0
detail_rotation = 0
[Layer n] - This is a mandatory label. It tells the terrain engine that the data that follows is for Layer n (where 'n' is the Layer ID number).
Map - The file name for the Ecology Map you want the terrain to use goes here.
Scale - The scale you want the terrain textures defined for this layer to take. This scale is not the same as the scale value used in the header, but instead is the scale you want to use relative to the grid spacing of the terrain. This is discussed in more detail here.
Detail_scale - Provide the scale you want any detail textures to take. Example: a value of 2 means that each detail texture defined in the layer will shrunk to a size that allows it to be repeated four times (2x2) within the base texture it has been defined to. Detail textures are described in more detail in Chapter 3.
Height - Each Layer in the terrain can either be laid right on the base elevation or it can be elevated some distance above the terrain. Elevated layers allow the textures defined by that Layer to "hover". Elevated textures can be used to give the terrain additional visual depth for very little cost in drawing performance. See Forests in Chapter 3 for an example of this.
Blend - Set blending to off (0) or on (1). If blending is set on (1), each texture in the layer will blend at the edges with its neighboring texture. Note: blending occurs only between textures in that particular layer, not with other layers.
Clamp - Set whether clamping is to be enabled (1) or disabled (0) for the Layer. In some instances, usually when blending is disabled, you can see an obvious seam between one texture and its neighbor. Setting Clamp to on (1) should remove this artifact.
Mipmap - Set mipmapping to off (0) or on (1). Mipmapping is a technique where objects and textures are reduced in resolution as the distance from the "viewer" increases. Visually, some textures do not respond well to this resolution reduction. Setting mipmap to off (0) disables mipmapping and forces the engine to use the higher resolution textures. Roads, for example, because of their long thin shape, can be affected negatively by mipmapping, so in that Layer mipmapping will most likely need to be disabled. There is a small performance penalty for having mipmapping turned off, so only use if necessary.
Num_textures - Provide the number of individual terrain textures that will be used in this layer.
For each texture (i.e. num_textures) the following block of text is required:
[Layer 1 Texture 1]
value = 1
texture = _ecology/urban11.tga
detail = _detail/detail_bumpy2.tga
rotation = 0
detail_rotation = 0
[Layer n Texture y] - This label is mandatory for each texture in the Layer. 'n' is the Layer ID number, 'y' is the Texture ID number. Texture ID numbers need to be sequential (i.e. 1, 2, 3, 4, etc).
Value - Provide a palette number used in the Layer map. These values do not have to be sequential.
Texture - provide the file name of the texture you want assigned to value (i.e. palette number). The texture you define will be placed wherever value appears in the Layer Map. Note: if the texture is held in another directory/folder, provide the path relative to the directory where the Terrain Description File resides. In the example above, the directory is in the subdirectory "_ecology".
Detail - provide the file name of the texture you want used as a detail texture. Note: if the texture is held in another directory/folder, provide the path relative to the directory where the Terrain Description File resides. In the example above, the directory is in the subdirectory "_detail".
Rotation - Specify the angle you want the texture to be rotated before it is drawn on the terrain. Use a value between 0 and 360 (degrees).
Detail_rotation - Specify the angle you want the detail texture to be rotated before it is drawn on the terrain. Use a value between 0 and 360 (degrees).
|