====== Rebuild terrain files with MakeTerrain ======
The purpose of this tutorial is to show step by step how to recreate all the terrain files after we have finished editing and adding new tiles in our theater, in order to have a fully functional terrain system to test it in game.
{{:t1.png |Tip}}For the rest of this page, I'll use the GUI's provided by TerrainEditor program for both ModTerrain and MakeTerrain programs. Remember, these are command-line programs and can be used without TerrainEditor. You can use these GUI's and create the command-line (the textbox at the bottom of these windows), and then apply these parameters later. This can also be used in an installer.
===== Preparation =====
The assumption is that you have finished tiling the L2 terrain file, and finished adding any custom tiles in the ''texture.bin'' file. Furthermore, you have finished editing the L0 elevation of your theater (you can use the old one if you haven't a new one).
The files you need to recreate the terrain are:
*The L2 tile information (''theater.t2'').
*The L0 elevation information (''theater.e0'').
*TGA image with palette information (''theater.tga'').
*Day and night Master Fartiles.
==== L2 Tile Information ====
{{:tutorials:tut_mkterrain_0.jpg|}}
First step is to create the L2 tile information file. Open the ''ModTerrain'' GUI Window and check the options shown in the image above. Alternatively, you can use the following command-line:
ModTerrain.exe -x =t #2 %"" *""
You'll get a file called ''theater.t2'' in your ''''.
==== L0 Elevation information ====
{{:tutorials:tut_mkterrain_1.jpg|}}
Again with the ''ModTerrain'' GUI Window, checking the options showed above in the image, you'll get a ''theater.e0'' file, containing the L0 elevation data. The corresponding command-line is:
ModTerrain.exe -x =e #0 %"" *""
{{:t1.png |Tip}}The L0 elevation file produced by ''ModTerrain'' is exactly the same format as the ''ELV'' file used in editing the L0 elevation in ''TerrainEditor''. You can either create one with ''ModTerrain'' as described above, or create an ''ELV'' file with ''TerrainEditor'' (opening the L0 file and saving it as ''ELV'') and use it instead.
==== TGA Image ====
{{:tutorials:tut_mkterrain_2.jpg |}}While in ''TerrainEditor'', you have two options to create a TGA Image with the L2's palette information.
The first one is to use the existing data stored in your L2. For this option, just select under the ''Tools'' menu, the ''Save PAL info as TGA'' command. This will create a TGA Image with the palette that already exists in ''theater.map'' file and as pixels the palette offset values in L2.
The second one is to create a new TGA Image, taking the new tiling under consideration, by selecting the ''Tools'' menu and clicking on the ''Make New PAL TGA'' command. This command will make a picture from all tiles and convert it to 256 colors TGA. This method is recommended, especially if you have new tiles in your tiling.
==== Day and Night Master Fartiles ====
{{:tutorials:tut_mkterrain_3.jpg|}}
For this we need the ''MakeTerrain'' GUI Window. Select from the dropdown list the ''Make Master Fartiles'' option and define the day and night files that are going to be created, as well the ''texture.bin'' file and the DDS Folder. The day and night master fartiles files can be named as you like with any extension. The command-line you can use is the following:
MakeTerrain.exe c -"" +"" *"" /""
===== Execution =====
Now that we have all the files we need, we can proceed and create the terrain. The files that are going to be created (or overwritten if already exist) are:
*Terrain Folder:
*All Lx and Ox files.
*''Theater.mea'' file
*Texture Folder:
*''Fartiles.dds''
*''FartilesN.dds''
{{:t1.png |Tip}}All other files **are not** going to be created and must exist (or copied in case you use it in an installer), in order to have a functional terrain system. The ''texture.zip'' file is not required at all in an OF install and possibly in a FF install as well.
{{:tutorials:tut_mkterrain_4.jpg|}}
All we have to do is to select the files needed, in the ''MakeTerain'' GUI Window, as shown in the image above, while we have selected ''Make Terrain'' in the dropdown list. Especially for the ''Elevation File'' the dialog will ask you for a ''ELV'' file. If you have a ''theater.e0'' file from the above steps, you can either rename it to ''theater.elv'', or type ''*.*'' in the dialog and press ''Enter''. This will allow you to display all files and then select the ''theater.e0'' file. The filename passed to ''MakeTerrain'' program doesn't make any difference, only the data are important.
Remember that the ''Terrdata Path'' mentioned above is the folder that contains both the ''Terrain'' and ''Texture'' folders.
The command-line you can use directly is:
MakeTerrain.exe -"" +"" %"" *"" /"" $"" @ !