Game Development Community

dev|Pro Game Development Curriculum

HTC : Creating Huge Terrain for TSE

by Vincent BILLET · 09/27/2005 (1:30 pm) · 33 comments

<============= B A S I C === T E R R A I N === C R E A T I O N =============>
I) Installation
You can download HTC demo HERE. Unizip this file in a separate folder (not your exemple directory). HTC zip file contains TSE.exe and all other stuff for a standalone execution.

II) Creating a new Terrain
Launch HTC. Click on Editor button. Click "New Map" button. You should see this screen :
www.solu-si.com/dragonhead/htc/tutorial1.jpgThis screen will help you to size your terrain . Firstly, select your map size with your map size buttons (from 2x2 to 64x64). You can now choose your hex size (256,512 or 1024), click "Apply Button". Now you will see your map properties (4). Map properties show you in the first line heightField size in pixel, and in in the second line, it shows you terrain size in meter (torque unit). You can now Select another pixel scale (3). Click "Apply" button to see impact of pixel scale.
Examples :
4x4 Hex, Hex Size = 256, Pixel Scale = 2 => HeightField Size : 1024x1024; Terrain Size = 2048x2048m
4x4 Hex, Hex Size = 256, Pixel Scale = 4 => HeightField Size : 1024x1024; Terrain Size = 4096x4096m
8x8 Hex, Hex Size = 512, Pixel Scale = 2 => HeightField Size : 2048x2048; Terrain Size = 4096x4096m
64x64 Hex, Hex Size = 1024, Pixel Scale = 8 => HeightField Size : 65536x65536; Terrain Size = 524288x524288m

Playing a little with these parameters will show you the impact of these different parameters. Just click "Apply" button to see changes.

When you've a good map size, click "OK". The Hexmap screen will appear.

III) Tile positionning
Now you're in the Hexmap screen. On the left you've got Hex Selector(1). Just above you've got selected Hex(2). In the center you've got your map (filled with sea) (3). And in the top you've got "Set Starting point" button and "Hex editor" button.
To fill your map, you just need to select a terrain type (1) and click on the map (3) to place it.
www.solu-si.com/dragonhead/htc/tutorial2.jpg
To understand how things goes, in height amplitude, you need to know that each HexTile have a HeightField and a Texture. This HeightField and Textures can be updated in HexEditor. HeightField manage Height amplitude and positionning, but also global "shape" of your terrain. Textures manage colors frequency and placement on the terrain. Click "Hex Editor" Button.

www.solu-si.com/dragonhead/htc/tutorial3.jpgThis screen is divided in two parts. On the left you've got HeightField selector. On the right, you've got Texture Selector. HexTile is showed just above "OK" button. You can select HeightField and textures for the current HexTile in the appropriate list. Note that just above the heightField List, you've got Height Range.

About Height Range. This is very important to understand following points :
* Height Range (and Height field showed) are calculated on a 1024x1024 heightField.
* If you place Hexs with huge difference of Height range, Slope between these two Hexes will be important.
* Hex Size property (setted durring Terrain Creation) will influence slope between two Hexes.

Final word on HexEditor :
You can With HexEditor, select your HeightField and Texture properties. Changing Hexes setting will change all Hexes setting (of this hexTile) on the map.

Setting Starting point :
Click on "Set Starting point" button, click on the map where you want your player to appear, and that's done. Your player position will be a the center of the Hex.

Close all windows to go back to the main menu and click Generate.

IV) Generation

www.solu-si.com/dragonhead/htc/tutorial4.jpg
This screen is divided in four parts:
1) Parameters save and load
Set your parameters fileName and click "Saveparameters" or "Loadparameters". Parameters files contains all data needed to compute your map (HexMap, HexTiles, HeightFields, Textures,etc...). These files are saved into "client/scripts" directory. They are .cs files.

2) Map and light properties
LightFactor : this factor allow you to ajust shadows. more this setting is big more the sun light will be high. (Try these values to see impact : 1; 0.5; 1.5; 2).
HexSize : You can change your hexSize just before generation.
Scale facture : You cans also change ScaleFactor just before generation.

3) FileNames
Terrain file Name : This file name will be used to generate .raw, .jpg, .chu, .tqt and .mis files.
Mission file Name : This file name will be used in .mis file to set the mission title.

4) Generate buttons
Generate RAW and JPEG :
This button will generate .raw and .jpg files. These files are stored in "data/terrains" directory. There is no progress bar or other stuff like this. The only way to know advancement state is to follow ".raw" file size in "data/terrains" directory. To have an idea of your final file size :
512x512 HieghtField : 513x513x2 bytes = 514 KB
1024x1024 HieghtField : 1025x1025x2 bytes = 2052 KB
2048x2048 HieghtField : 2049x2049x2 bytes = 8200 KB
4096x4096 HieghtField : 4097x4097x2 bytes = 32784 KB
and so on...

Generate CHU and TQT :
Set Min depth for CHU generation (see TSE documentation). I used these parameters :
HeightField : 512 and 1024 : Min depth : 1
HeightField : 2048 : Min depth : 4
HeightField : 4096 : Min depth : 5
HeightField : 8192 : Min depth : 7
Setting lower Min depth may crash CHU generation.

Click this button to translate .raw and .jpg into .chu and .tqt files.

Generate Mission File :
Click this button to generate Mission File.

You can now leave HTC and click "start mission" button, and play with your map.

V) Samples
Some samples are provided with HTC demo :
htc_Dark_Mountains
htc_Golden_Mountains
htc_RockyPass
htc_twin_isle
To view these samples : go to generate, type one of these names into FileName, click "Load parameters" button. Do generation process. (You can also see Hexmap before generating).

<============= B A S I C === H E I G H T F I E L D === P R O P E R T I E S =============>

Height fields are used in HexMap to set HexTile's global shape. To build your dream terrain, you'll have to adjust HeightFields. Go to Editor=>HeightField properties. Select "Plains 1" and set window in fullscreen.

Height fields properties overview
www.solu-si.com/dragonhead/htc/tutorial5.jpgHeightField properties are divided in 5 rows. Each row represent one fractal. The 3 first colunms (Act, Method, Op) are used by Fractal generator to combine different fractals. Parameters H,Lac,octave,Offset,Gain will adjust one fractal. Parameters AC and AF are used to adjust HeightRange and global Z positionning. X and Y parameters are used to set Fractal Scale. Following sections explains more about these parameters.

Your first HeightField
Select Plains 1.
Click "clear" Button.
Set on the first row Method to 1, Op to 0, AC to 0 and AF to 300.
Click "Apply" Button.
This HeightField should appear :
www.solu-si.com/dragonhead/htc/tutorial6.jpgThis HeightField will show you a 1024x1024 height field. Notice Height range (-173 to 201).
You can now create a 2x2Hex, filling the four Hexes with plains (Green HexTile without drawing), and Generate it. play al little with it and return to HeightFieldProperties to find correspondance with your terrain and HeightField. Notice that your terrain (2x2 Hexes should be a 512x512 HeightField) so the right bottom map should correspond with center of the previewed heightField.

Adjusting X and Y Scale
Let's talk about X and Y Scale. Each fractals have a size. Each fractals will have similar feature along the map. You can Now Change X and Y to 256 and click apply. let change it to 64x64. You can see now This parameters inflence. Remember that if you go smoothly from black to white, you'll have a small slope on terrain.
Another tips : Set X to 256 and Y to 512 to see what happens... Playing with different X and Y can be usefull for dunes for example.

Adjusting HeightRange
Set X and Y to 1024. You should have a height range from -173 to 201. OK This mean that your terrain is going to be between -173 to 201 meter (in a 1024x1024 HeightMap). Now Set AC to 173. What's happen? Height Range is now 0 to 374. You have adjusted your heightfield Z position.
Now Set AC to 0 and AF to 100. Your Height Range is now from -57 to 67. You have adjusted your Height Amplitude. Setting AC to 57 will give you a Height Range from 0 to 124.

HeightField Methods
HTC can build Height Fields with 5 Methods. Actual method is Basic (fBm) fractals. Set Method to 5. Click Apply. You now have a small mountain. Playing with X,Y,AC,AF as explained above will allow you to adjust your global HeightField properties.
1 : Basic (fBm)
Meth = 1; Lac=3; Octave=4; Offset = 0.5; AC=0;AF=300; X=256; Y=256
www.solu-si.com/dragonhead/htc/tutorial7.jpg
2 : MultiFractal
Meth = 2; Lac=1; Octave=2; Offset = 0.5; AC=0;AF=300; X=256; Y=256
www.solu-si.com/dragonhead/htc/tutorial8.jpg
3 : Hetero MultiFractal
Meth = 3; Lac=2; Octave=2; Offset = 0.5; AC=0;AF=300; X=256; Y=256
www.solu-si.com/dragonhead/htc/tutorial9.jpg
4 : Hybrid MultiFractal
Meth = 4; Lac=3; Octave=4; Offset = 0.5; AC=0;AF=300; X=256; Y=256
www.solu-si.com/dragonhead/htc/tutorial10.jpg
5 : Ridged MultiFractal
Meth = 5; Lac=8; Octave=2; Offset = 0.5; Gain=0.9; AC=0;AF=300; X=512; Y=512
www.solu-si.com/dragonhead/htc/tutorial11.jpg
So now you can make very different Terrains, but there is more parameters.

Adjusting Fractal parameters
Lacunarity (Lac), Octave, Offset and Gain will allow you to change the shape of your terrain.

Let's go with some sample :
1) Using Basic fBm
Let's start with Lac : 1 - Octave : 2 Offset : 0.5 (AC = 0, AF = 100, X=256, Y=256)
Now Let's Try Lac Modifications, try this successive values : 1,2,3,5,8,16,0.5,0.1

Octave : Octave values must be integer values >= 1
Now Set Lacunarity to 2, and after, Try the following values : 1,4,6,8,16
Note : Octave will increase drastically compute time.

Basic fBm allow you to udjust only Lac and Octave (That's why it's Basic)

2) Multi Fractals
Multi fractals, are very similars to Basic fBm, but their is another parameter : Offset give ranges from -10 to 10 to see what Happens. Values from 0 to 1 gives the best results in my opinion (0.5, 0.2,0.9,1). Offset is Octave dependant (multiplicative). So if you give a negative offset it will be the same result as positive offset if octave is paire.

3) Hetero Multi fractals
Hetero Fractals is similar to Multi Fractals. It will use Lac and octave (of course) and Offset, in additive maner. Like Multi fractals you can change Offset Values to see what happens.

4) Hybrid Multifractals
Hybrid multi fractals are similar to Hetero. It uses Lacunarity, Octave and Offset. They interested to create terrains with High Slope. (Pics, canyons, etc...)

5) Ridged Multifractal
Ooohhh, Ridged Multi fractals! They help you to build mountains.They use Lacunarity, Octave, Offset, and Gain.
Lacunarity >0 to 10 or more : Increase ravines in mountain side
Octave : To increase if you have a High lacunarity
Offset, and gain will adjust slope and Z amplitude.

Testing your HeightField
To test your heightFields, create a simple 2x2 map, Fill it with your terrain, make sure you are on a 256 HexSize, Generate It. So with this parameters, you can see quickly How Your terrain is shaped.

Final Words on basic HeightField
Finding good parameters is long, Testing and re-testing is the way.

<============= A D V A N C E D === H E I G H T F I E L D === P R O P E R T I E S =============>

Let's start with a small sample
Select a terrain type Hills (Hills 2 for example), click clear button. Let's create in the first Line a Basic fBm.
Method = 1; Op = 0; H=0.5; Lac = 2; Octave = 2; Offset = 0.5; AC = 81; AF = 100; X =300;Y=300.
Click Apply. You will see a nice Hill HeightField.
www.solu-si.com/dragonhead/htc/tutorial12.jpg
So, And that's why HTC is powerfull, we can now add a Second Fractal.

On the second Line put an Hybrid Multi fractal with these parameters :
Method = 4; Op = 0; H = 0.5; Lac=1; Octave=8;Offset = 0.4; AC = 300; AF = 300; X =64; Y = 64.
Click Act on the first row to deactivate the first Hill fractal, Click Act On the second Row to Activate the Hybrid Multifractal. You can now Click Apply to see what is the global shape of the Hybrid Multifractal.
www.solu-si.com/dragonhead/htc/tutorial13.jpg
Then, Activate the two fractals. (Both Act CheckBoxes activated). And See What Happens!
Generate It and it should give you a result similar to this :
www.solu-si.com/dragonhead/htc/tutorial14.jpgIn game screenShot :
www.solu-si.com/dragonhead/htc/tutorial15.jpg
Now We Have added Two Fractals, We substract them. Set 1 in Op of the Hybrid MultiFractal. and see What Happens. Peaks are transformed in holes. Powerfull, ain't it?

Now Let's go with a full sample
Click Clear To reset fractals settings. Let's enter the following Ridged Fractal :
Method = 5; Op = 0; H = 0.5; Lac=8; Octave=4;Offset = 0.5; Gain = 0.9; AC = 5; AF = 10; X =1024; Y = 1024
Click Apply, Notice the Height Range (0 to 1)
www.solu-si.com/dragonhead/htc/tutorial16.jpg
Now We Add a basic fBm :
Method = 1; Op = 0; H = 0.5; Lac=5; Octave=3;Offset = 0.9; AC = 5; AF = 5; X =5; Y = 5
Leave Only Basic fBm active, and see the result (Height range from 0 to 9) and the terrain seems to be filled with small peaks (from 0 to 9 meters height)
www.solu-si.com/dragonhead/htc/tutorial17.jpg
Now Check the 2 fractals and in the second row (Basic fBm) set op to 2 : Multiplication. Click Apply. What happens? The terrain is now filled with small rocks on where Ridged fractal is High. The less High Ridged is, The less High basics rocks are. We have now a Height range from 0 to 13
www.solu-si.com/dragonhead/htc/tutorial18.jpg

Now Add a thrid row with the same fractal as in the first row except bold values
Method = 5; Op = 0; H = 0.5; Lac=8; Octave=4;Offset = 0.5; Gain = 0.9; AC = 1500; AF = 2200; X =1024; Y = 1024
www.solu-si.com/dragonhead/htc/tutorial19.jpg
We have adjusted our Height field to have a mountain with rocks. Note that rocks are not visible on the height map. To view them you'll need to bypass High height ranges fractals.
Now the final touch.
Method = 5; Op = 0; H = 0.5; Lac=8; Octave=1;Offset = 0.2; Gain = 0.3; AC = 100; AF = 200; X =150; Y = 150
This fractal make small ravines in the overall terrain.
www.solu-si.com/dragonhead/htc/tutorial20.jpg
Addition and substraction
You can add and substract every fractals in your fractal scheme. for example, you can put a ridged fractal on the first line and switch Op from 0 to 1.
The following settings add a Ridged fractal.
Method = 5; Op = 0; H = 0.5; Lac=8; Octave=4;Offset = 0.5; Gain = 0.9; AC = 1500; AF = 2200; X =1024; Y = 1024
The Following settings substract the same Ridged fractal.
Method = 5; Op = 1; H = 0.5; Lac=8; Octave=4;Offset = 0.5; Gain = 0.9; AC = 1500; AF = 2200; X =1024; Y = 1024
www.solu-si.com/dragonhead/htc/tutorial21.jpg
Check and generate these fractals, to understand how it works.

Multiplication
I used multiplications to create small rocks, but multifractals (Multifractal, Hetero and Hybrid) can have some sparse effects along the terrain. Here is an example :
Method = 1; Op = 0; H = 0.5; Lac=2; Octave=3 ;Offset = 0.5; Gain = 0.9; AC = 240; AF = 75; X =256; Y = 256
Method = 4; Op = 2; H = 0.5; Lac=1; Octave=12;Offset = 0.8; Gain = 0.9; AC = 2; AF = 2; X =256; Y = 256

Updating the example above like this
Method = 5; Op = 0; H = 0.5; Lac=8; Octave=3 ;Offset = 0.5; Gain = 0.9; AC = 150; AF = 300; X =128; Y = 128
Method = 4; Op = 2; H = 0.5; Lac=1; Octave=12;Offset = 0.8; Gain = 0.9; AC = 2; AF = 2; X =256; Y = 256

will give some interesting stuff.

The rule of 3
To build realistic terrain I use the rule of 3. I mean 3 detail levels must be build. One detail level for global shape. One detail for giving global shape a smoothless appearance. And One detail level for details.
In the full example, The first 2 fractals are for detail level.
The thrid fractal is for global shape. And finaly smoothless fractal is the fourth.
Detail fractals must have low height range, or represents some original shapes (peaks in the first example of this article)
Smoothless fractal must have a medium height range (from 25 % to 50% of master shape)
And Finaly Global Shape fractal must be Highest height range (depending on terrain of course)
For the overall terrain, choose your heightfield HeightRange in "layers". I used 3 layer above and under water level (Plains ~7-100m; hills : ~120m-350m; mountains : ~300m-750m). You can easily change these stuff.

And now What to do?
Then, you have all the details to create your own HexTiles. You have to create, test, and have fun with this heightField Editor.

<============= T E X T U R I N G =============>

Texture Basics
www.solu-si.com/dragonhead/htc/tutorial22.jpgGo to Texture properties. Select a texture and click "Clear" button. In the first row, enter "24 60 16" in RGB value. Set Bump to 0 and Click "Apply" button. In preview you will see a full green square. Then set Bump to 0.5, set Co to 1 click "Apply" you will see the bumped texture.
Next you can play with X and Y feature size to see how you can play with this stuff.
Next, in the second row enter "142 104 41" set the following parameters : bump = 0.5 ; Co = 1; X = 100 ; Y=100. Click apply.
Bump limits: don't exceed 0.5 in Bump, or you might have some troubles with colors.
What's Co? Co is Coverage. More this number is great, more the current color appear on the texture. You can adjust this parameter to give more importance to a color.
What's X and Y : X and Y are feature size of Bump fractal (Basic fBm). Ajusting them Allow you to create more or less great lighted or shadowed area. (From terragen Multiply Feature size by 10).

Color sets
Managing colors is difficult, but this table will help you to choose good colors :
RGB Values
20 - 40 : Dark rocks, Grass
40 - 70 : Medium colors
70 - 90 : Light rock, sand
190 - 210 : Ice / Snow

Examples :
Grass : 24 40 16
Light Grass : 64 56 32
Dark Grass : 16 24 8
Rocks : 64 64 64
Dark Rocks : 32 32 32
Light Rocks : 80 80 80
etc..

Combining colors
A HexTile can combine up to 8 colors. But in most case, their is Two main colors. For example : Grass and Rocks. For each of these materials, you should take 2 or 3 colors. Each of this colors should be a dark, a medium or a light color. For example a Grass and rock HexTile could have all the colors of the previous section.

Altitude and slope
Altitude is the min and max altitude where this color is placed.
Slope : Min and max slope where this color is placed. Slope is equal to the height amplitude between two points. So if you a point(x=0; z=10) and the next point (x=1; z=11) your slope is equal to 1. (x=0;z=10) => (x=0;z=12) slope = 2.
Using Altitude and slope give realism to your terrain. If you use Altitude make sure feature sizes are not too high if you don't want to have some color cutting.

The rule of 2 and 3
2 Main colors By textures.
3 Colors (dark, medium and light) per Main colors.
You have 2 free slots for other colors.

Final words on Texture
Creating textures is long. You can also be inspired by textures from terragen. I have made some samples available in HTC.

<============= KNOWN === B U G S =============>
* Starting position when generating Mission file don't match (Keep 0,0)
* Limit your HeightField Size to 4096 (Otherwise it may crash during play time)
* H Factor seems to have no effect in HeightField Properties
* Noise seems to have no effect in Texture properties

<============= T I M E === I S S U E =============>
Generating RAW and JPG can take time.
2048x2048 : ~5 min
4096x4096 : ~10-15 min
It essentially depends on Terrain size, but also fractals used. Remember that incrasing Octaves increase copmute time.

Enjoy and Have Fun!
Page«First 1 2 Next»
#21
03/11/2006 (3:32 am)
Vincent, I am still unable to download this file! Please can you post here with an alternative way of getting the file - I really want to try this tool!

Thanks,

Mike
#22
03/13/2006 (8:09 am)
Try to retrie... I Leave my computer open for the next days.
#23
03/13/2006 (9:10 am)
Thanks Vincent - I have it now :o)
#24
03/15/2006 (4:15 pm)
Vincent, tool looks great, I contacted you about getting an extension on your 15 day trial, but no word yet. Would be cool if you could drop me a line, let me know whats up.
#25
03/16/2006 (12:52 am)
@Raymond : I'm having a lot of work to build my new site (in which you can buy HTC for a small price). So Wait a little, you can buy it soon... Very soon...
#26
03/22/2006 (1:44 pm)
HTC is available for sell here : www.solu-si.com/dragonhead. You can buy either Binaries, either full source code.
#27
04/10/2006 (9:21 pm)
I just paid for HTC and dowloaded it, but Its missing some FPS content or something and all the links are always down. I started going through it and I can't find what is missing or why it wont work
#28
04/11/2006 (3:52 am)
@Chad : You're right. material.cs is missing in ~/data/terrains. here is the code of this file :
//*****************************************************************************
// Environmental Materials
//*****************************************************************************

new CustomMaterial(AtlasMaterial)
{
   shader = AtlasShader;
   version = 1.1;
};

new CustomMaterial(TerrainMaterial)
{
   shader = TerrShader;
   version = 1.1;
};

new CustomMaterial(TerrainBlenderPS20Material)
{
   shader = TerrBlender20Shader;
   version = 2.0;
};

new CustomMaterial(TerrainBlenderPS11AMaterial)
{
   shader = TerrBlender11AShader;
   pixVersion = 1.1;
};

new CustomMaterial(TerrainBlenderPS11BMaterial)
{
   shader = TerrBlender11BShader;
   pixVersion = 1.1;
};

*** Edit : Fixed on web site
#29
04/13/2006 (12:04 am)
Back @ Vincent...

Yeah I figured that out like 10 mins after I posted that...

but thanx anway.

I have the reg. version of Terragen and it works great but for people who want to make a more game style map better suited for TSE, it's best to get HTC, even though it's new and in early stages. Once you learn how it all works, it's easy to make realy big vast terrains. After tweeking the textures and setting up the hieght fields, I was able to gain full control over what I needed to build (including shores, beaches, rivers, vallys, lakes, cliffs, mountains w/ snow caps, lagoons, deserts, platues/canyons, and swamps) all in one giant map!
#30
04/13/2006 (2:58 am)
@Chad : Thank you for your comment ;)
#31
09/14/2006 (8:42 pm)
Anybody has HTC demo...??? The download link in http:\\solu-si.com\dragonhead has downed... what happened...

"Warning: mysql_connect(): Access denied for user: 'my62152@62.193.246.108' (Using password: YES) in C:\Inetpub\vhosts\solu-si.com\httpdocs\dragonhead\php\en_tete.php on line 68
Could not connect"
#32
09/15/2006 (9:43 am)
@Chan

http://www.dragonheadstudio.com/index.php?c=en&a=htcdown&_static=database/htcdowns

this one works as of 9-15-2006
#33
09/13/2007 (3:44 am)
I'm not able to download the file, i founded different links around some posts but i end everytime in a dead page.
Can someone send me please? If interested i can upload it in my FTP space, i have unlimited space and huge band...of course i upload for free.

Thanks a lot!
Page«First 1 2 Next»