Terrain files of type .t contain elevation and texture information. The structure and elevation data for normal size tiles:
terrain (
terrain_samples (
terrain_nsamples ( 256 )
terrain_sample_floor ( 934.403 )
terrain_sample_scale ( 0.00239484 )
terrain_sample_size ( 8 )
terrain_sample_ybuffer ( -01a186e8_y.raw )
terrain_sample_ebuffer ( -01a186e8_e.raw )
terrain_sample_nbuffer ( -01a186e8_n.raw )
)
And for lo tiles:
terrain (
terrain_samples (
terrain_nsamples ( 64 )
terrain_sample_floor ( 742.356 )
terrain_sample_scale ( 0.0241534 )
terrain_sample_size ( 256 )
terrain_sample_ybuffer ( _01a184_y.raw )
terrain_sample_ebuffer ( _01a184_e.raw )
terrain_sample_nbuffer ( _01a184_n.raw )
)
The tiles are a 2-dimensional grid of terrain_nsamples. The size of sample is terrain_sample_size in meters. The terrain_sample_ybuffer is an array of 2-byte unsigned integer in meters.
For normal tiles there are 256 by 256 samples each 8 meters, so the tile size is 2048 meters square. With each sample at 2 byte the file size is 131,072.
For lo tiles there are 64 by 64 samples each 256 meters, so the tile size is 16,384 meters square. With each sample at 2 bytes the file size is 8,192 bytes
When _y.raw has a value of 0 the elevation is terrain_sample_floor. To calculate the elevation at a sample multiply by terrain_sample_scale adding terrain_sample_floor. The maximum elevation is 65,536 times terrain_sample_scale plus terrain_sample_floor. The two bytes are in little endian order.
The name of the _y.raw file is in terrain_sample_ybuffer. Lo tiles have shorter names because they are earlier in the quad tree. Each quad tree division adds two bits to the file name of the tile as each division splits a tile into four parts.
Which tiles are split and selected is encoded in TD and TDL files in the TD directory.
The lo tiles will only be displayed in MSTS when mountains are active in the route definition file (.trk) with Mountains ( 00000001 ),