September 25, 200916 yr Agtim tells me that the GTL file format is undocumented so I'm providing the below to redress this, and for the benefit of anyone interested in how FU3 generates the Great Wasteland that is the Outer Terrain!File StructureThe outer terrain's .gtl files are binary files and can be read and written to by any programming language capable of opening a file in binary mode and converting each byte to a decimal value. The information in each .gtl file is comprised of as many two-byte groups as are required to fill a 256x256 (65536 'cell') matrix. The second byte in each two-byte group sets the terrain type and is an integer value between 0 and 25, representing the 26 possible terrain types allowed by the alphabetic 'a to z' terrain type identifiers defined in your C:\Program Files\Flight3\Gentiles\rules.txt file. The default outer terrain uses just 13 of these identifiers; the remainder are user definable. The terrain types are numbered according to their position in your rules.txt file, as per the below:TERRAINTYPES f w s u h l a g m b d x p 'f = 0, w = 1, s = 2, u = 3, and so onThe first byte in each two-byte group sets the number of 'cells' to which the texture type is to be applied. Also an integer, possible values are 1 to 255. This means that a single two-byte group can't quite populate an entire row of 256 'cells'. The GTL matrix is populated starting from the cell in the bottom left hand corner.Reading a .gtl fileIf we open l0aaaa.gtl with a hex editor then we see that the first two byte group is FF and 01, or 255 and 01 in decimal. This tells FU3 to apply texture type 1 (water - see above) to 255 'cells', starting in the bottom left hand corner of the matrix. The second two-byte group is also 255 and 01, so FU3 applies the water texture to another 255 cells starting where it left off, which in this case is the 256th 'cell' of the very bottom row. This process is repeated for all the two-byte groups in the file. The sum total of all the first bytes in all the two-byte groups is 65536, the total number of 'cells' in the matrix.Writing a .gtl fileWriting the gtl structure to file is very simple: count the number of cells (byte 1) that form a contiguous block* made up of a single terrain type (byte 2) and then write the values to file a byte at a time. Again, this process starts from the cell in the bottom left hand corner of the matrix. This is the process used to save files in my own spreadsheet-based GTL editor.* maximum of 255 cells per blockHow FU3 interprets a .gtl fileAlthough the terrain matrix is a 256x256 grid (65536 'cells') FU3 will only insert 64x64 actual tiles into the megatile. The reason FU3 uses a 256x256 grid for the .gtl files is, in terms of painting textures into the matrix, all to do with transition tiles. Although the default outer terrain uses just 13 basic texture tiles each texture comes with a number of variation and transition tiles. These tiles prevent textures being rendered as unnatural rectangular blocks and prevent the transition from one terrain type to another appearing as a straight line. So, although there are only 13 basic terrain tiles there are over 300 actual tiles, most of which are transition tiles that contain two different terrain types on a single tile. So, the 256x256 matrix allows us to paint two different textures into each of the 4096 tiles that form each megatile, the idea being that FU3 will apply the relevant transition tile to that area of the outer terrain. Without transition tiles and a 256x256 grid it would be impossible to set a lake within a forest area, without the lake being rendered as a solid rectangular block.Unfortunately, LGS didn't provide a full set of transition tiles, which means that placing certain textures within other textures results in the sort of unnatural rectangular blocks that transition tiles were supposed to prevent. This is the central problem with creating new terrain textures for the outer terrain: many, many transition tiles (and many hours of labour!) would be required to produce more natural looking terrain. This, I think, is the main reason why this huge area remains largely untouched.
Create an account or sign in to comment