GAT - Ground Altitude File
October 27th, 2005
Gravity Altitude Terrain (GAT), it’s a file that contains every cell altitude.
| * | Field | Size | Type | Description | |
|---|---|---|---|---|---|
| 0 | Header | 6 | bytes | Integer | GRAT.. |
| 6 | Size X | 4 | bytes | Integer | Size of field |
| 10 | Size Y | 4 | bytes | Integer | Size of field |
| { | Tiles (Header offset +14) | ||||
| 0 | Cell | 4 | bytes | Float | Left Bottom |
| 4 | Cell | 4 | bytes | Float | Right Bottom |
| 8 | Cell | 4 | bytes | Float | Left Top |
| 12 | Cell | 4 | bytes | Float | Right Top |
| 16 | Type | 1 | bytes | Byte | See below |
| 17 | ?? | 3 | bytes | Integer | - |
| } | |||||
Tile (Under water level):
- 0 - No walkable
- 1 - Walkable
- 2 - No walkable (No snipable)
- 3 - Walkable
- 4 - ??
- 5 - No walkable (Snipable)
- 6 - No walkable (No snipable)
Number of cells
Calculated by by SizeX* SizeY
Info :
- - Designs a block type
{ } Designs a loop block
Credits :
deufeufeu / ender (previous research)
VCL (update)
8 Responses to “GAT - Ground Altitude File”
Leave a Reply
I believe we have a more correct specification of the GAT file format, at http://www.openkore.com/wiki/index.php/Field_file_format
I’m not sure whether your description of the first 4*4 bytes in the Tiles structure is more accurate than ours, but I’m pretty sure that our description (and the offset) of the type field is more accurate, based on the tests I’ve done.
And the ‘???’ at offset 17 is 3 bytes, not 4 bytes.
Thanks, i’ll fix it in a minute
Is the last header information really correct with 3 bytes? Kinda hard to believe. If I’m not wrong, the tile type should be at least unsigned short, resulting the last value also beeing a short value. But as far as this weird format goes, I would even say that the tile type is an unsigned long.
@Shinryo - the last 3 bytes are probably just padding for alignment.
Shinryo makes a lot of sense though. In my project I am reading it as an unsigned int. Remember that the format is little-endian, so there is no difference between reading an int and a byte unless the number represented grows larger than 255.
hi??
I’ve checked the file format quite some time ago. The header is actually 4 bytes (GRAT), followed by 1 byte major and 1 byte minor version. The original client checks for version ranging from 1.0 to 1.2, however, they are all the same. As far as I can tell, the values starting from offset 14 are called attributes and each is 4 bytes, resulting in a total of 20 bytes (the tile type is indeed a 4 byte value). It is safe to allocate (width * height) * 20 bytes memory and read all the data at once into a buffer, since that’s what the original client does himself.