*.geom


The format was disassembled by Haper (not completely disassembled, adjustments are needed)

About

Contains all visible map geometry. It contains all vertices with normals and coordinates for textures and indexes for building geometry, as well as synchronization.


Technical information

The file consists of the following blocks


Types of variables

Type codeValue
1DWord(4) + DWord(4)
4Byte(1) + Byte(1) + Byte(1) + Byte(1)
6Word(2)/32768 + Word(2)/32768
7(Byte(1)-128)/128 + (Byte(1)-128)/128 + (Byte(1)-128)/128 + (Byte(1)-128)/128

Map compiler version (the block is the same for all maps)

ValueSize
Block code1Word(2)
Data compression (0 - no, 32768 - yes)0Word(2)
Block size (bytes)4DWord(4)
Version number (same for all)13DWord(4)

Vertex description

ValueSize
Block code9Word(2)
Data compression (0 - no, 32768 - yes)0Word(2)
Block size (bytes)4DWord(4)
Number of vertex description blocks-DWord(4)
Vertex description block--

Vertex description block

ValueSize
Beginning of a new block0DWord(4)
Beginning of the vertex format description2DWord(4)
Vertex format--
End of vertex format description255DWord(4)
Beginning of the vertex description17DWord(4)
Number of vertices-DWord(4)
Vertexes--

A few words about the vertex format

As you already know, there are several vertex description blocks in the file. Not all objects in the game are the same: you have to specify coordinates of lightmaps for brushes, and coordinates of textures for trees can be simplified. Therefore, vertices specified in different blocks may be different. The vertex format is specified using several structures - this is the standard D3D vertex buffer format. That is, the file contains ready assembled vertex buffers for D3D:

ValueSize
???(always zero)0Word(2)
Offset-Word(2)
Type of variables-Word(2)
What the variables describe-Word(2)

At the very beginning of any vertex are the coordinates of its placement, so the vertex format does not include a description of the coordinates. There are only three vertex formats in the 2215 maps:

Vegetation

ValueSize
zero0Word(2)
Offset12Word(2)
Type of variables4Word(2)
Normals3Word(2)
Light factor(?)?Word(2)
Offset16Word(2)
Type of variables4Word(2)
Tangents6Word(2)
Texture corrector X coordinate0/1Word(2)
Offset20Word(2)
Type of variables4Word(2)
Bi-Tangents7Word(2)
Texture corrector Y coordinate0/1Word(2)
Offset24Word(2)
Type of variables7Word(2)
Texture coordinates5Word(2)

Thus, the total length of one vegetation vertex equals 32 bytes.

Brush

ValueSize
zero0Word(2)
Offset12Word(2)
Type of variables4Word(2)
Normals3Word(2)
Light factor(?)?Word(2)
Offset16Word(2)
Type of variables4Word(2)
Tangents6Word(2)
Texture corrector X coordinate0/1Word(2)
Offset20Word(2)
Type of variables4Word(2)
Bi-Tangents7Word(2)
Texture corrector Y coordinate0/1Word(2)
Offset24Word(2)
Type of variables1Word(2)
Texture coordinates5Word(2)
zero0Word(2)
Offset32Word(2)
Type of variables6Word(2)
Lightmap coordinates261Word(2)

The total length of one brash vertex is 36 bytes.

Entity

ValueSize
zero0Word(2)
Offset12Word(2)
Type of variables4Word(2)
Normals3Word(2)
Light factor(?)?Word(2)
Offset16Word(2)
Type of variables4Word(2)
Tangents6Word(2)
Texture corrector X coordinate0/1Word(2)
Offset20Word(2)
Type of variables4Word(2)
Bi-Tangents7Word(2)
Texture corrector Y coordinate0/1Word(2)
Offset24Word(2)
Type of variables4Word(2)
???10Word(2)
zero0Word(2)
Offset28Word(2)
Type of variables1Word(2)
Texture coordinates5Word(2)

The total length of one vertex of an entity is 36 bytes. Based on this, we get, for example, this view of the vertex:

Brush

ValueOffsetSize
Coordinate X30.760DWord(4)
Coordinate Z0.24DWord(4)
Coordinate Y51.48DWord(4)
Normal at X12712Byte(1)
Normal at Z25513Byte(1)
Normal at Y12714Byte(1)
Light factor(?)115Byte(1)
Tangent at X12716Byte(1)
Tangent at Z25517Byte(1)
Tangent at Y25518Byte(1)
Texture corrector X coordinate019Byte(1)
Bi-Tangent at X020Byte(1)
Bi-Tangent at Z12721Byte(1)
Bi-Tangent at Y12722Byte(1)
Texture corrector Y coordinate023Byte(1)
Texture coordinate X3.180224Single(4)
Texture coordinate Y2.214328Single(4)
Lightmap coordinate X0.402332ShortSingle(2)
Lightmap coordinate Y0.00009734ShortSingle(2)

Indexes description

ValueSize
Block code10Word(2)
Data compression (0 - no, 32768 - yes)Word(2)
Block size (bytes)-DWord(4)
Number of index description blocks-DWord(4)
Index description block--

Index description block

ValueSize
Number of indexes in a block-DWord(4)
Indexes-DWord(4)

Index: Word(2) The number of indexes must always be a multiple of three, because triangles are constructed using indexes.

Synchronization description

(what they synchronize is still a mystery to scientists)

ValueSize
Block code11Word(2)
Data compression (0 - no, 32768 - yes)0Word(2)
Block size (bytes)-DWord(4)
Number of synchronization units-DWord(4)
Synchronization units--

Synchronization block

ValueSize
???0DWord(4)
???0DWord(4)
???0DWord(4)
???0DWord(4)
Number of synchronization units-DWord(4)
Synchronization units--
Synchronization unit
ValueSize
???DWord(4)
???Word(2)
???Word(2)

Sources

Source