====== Terrain Editor Manual ====== //Current Version: 3.7.0// ===== Introduction to Falcon 4.0 Terrain System ===== [[http://en.wikipedia.org/wiki/Falcon_4.0|Falcon 4.0 Flight Simulator]] was released at late 1998, so it's no surprise how complicated the code behind it is, especially if we consider that, those days, every bit of memory that could be spared was valuable. With this principle in mind, the terrain storage and display is a very complicated procedure, involving low resolution pcx graphics (paletted) and various mechanisms to spare memory and storage space. In general, all the terrain information are stored into files with the extension ''%%*%%.lx'', where ''x'' =0,1,2,3,4,5. These files represent a given LOD (//Level Of Detail//), which kicks in, at a given distance between the player and the terrain, with ''%%*%%.l0'' is the maximum detail. The smallest data information in the ''%%*%%.lx'' file is a //Tile//, which represents a 1km by 1km area in l2 LOD. The tiles are stored by packets inside ''%%*%%.lx'' files, called //Segments//, where a //Segment// contains an area of 16×16 //Tiles//. These ''%%*%%.lx'' files come together with a pair ''%%*%%.ox'' file, where ''x'' is again 0,1,2,3,4 and 5, which represent the actual terrain map and contain the position in the ''%%*%%.lx'' file of the //Segment// that needs to be loaded in the specific position. The //Tile// record contains information about the altitude of the terrain at the specific point, the number of the texture to be used, a reference to a color from a palette inside a ''%%*%%.map'' file (the exact function for that is unclear to me, it has to do something with vertex coloring and fog) and some other info (for terrain normals). The control file for terrain textures is a file with extension ''%%*%%.bin''. In there, all the texture information is stored, in a form of //Sets//. Each set can contain up to 16 //Tiles// and has a specific type (e.g. Water, Plains etc). Each //Tile// in this file holds information about the filename of the texture and about Areas and Paths that are drawn on it and used by the program (e.g. for calculating roads and ground troops movement or be aware that there is water on this //Tile//). Finally, the textures themselves, were stored in a file called ''texture.zip'', which is a normal zip file containing the the textures in //pcx// format. The latest versions of Falcon 4.0 (made by user communities) use the //dds// texture format, which has better quality than //pcx//. ===== Program Overview ===== Terrain Editor (TE for the rest of the manual) is a program developed by me in order to edit the terrain and texture data of Falcon 4.0 (described above). The whole program was created with Visual Basic 6 and C++ and the coding was done by me, using the [[http://freeimage.sourceforge.net/|FreeImage]] Library. The need for this software came from the fact that we needed a tool to see the whole terrain of Falcon at once (not in chunks of 16×16 tiles) to evaluate how it's going to be looking inside the sim. Furthermore, we needed some tools to edit some special files of Falcon (such as ''theater.map'' and ''texture.bin''). With time passing, more features were added to the software, trying to create an almost complete tool to edit Falcon's terrain. The needs and inputs for this tool came initially from the [[http://eastmedfront.net/|emf]] theater building community. ==== Main Features ==== Some features of this program are: * Editing of //theater.l2// file. * Real time display of tiles with various addon information and features. * Brush-like tiling function. * Use of DDS images only. No PCX and //texture.zip// file needed anymore. * Import-Export selected areas. * Directly edit L2/L0 elevation data. * Complex search function for tiles. * Editing of //tac// files. * Visual representation of each objective on it's correct position. * Add/Delete objectives, either one by one, or multiple objectives via search function. * Editing of //texture.bin// file. * Full edit of sets and tiles (add new or delete), while updating the opened L2 file. * Full edit of tiles Areas and Paths. * Editing of //theater.map// file. * Full edit of all the information contained in this file, including the stored palette. * Additional functionality. * Creation of new tiles via the [[:manuals:terraineditor:reference:temain:tile_lab_window|Tile Lab Window]]. * Creation of //tga// containing the //theater.map// Palette, or a new one with current tile information. * [[:manuals:mod_terrain:home|ModTerrain]] and [[:manuals:make_terrain:home|MakeTerrain]] Graphical User Interfaces (GUI's). * Creation of THR file and visual representation of it. And much more...