# GEM RTS Binary File Formats

Most of the binary files GEM RTS are chunk-based containers.

Any chunk starts with a four-byte magic identifier (`Chunk_ID`), usually a human-readable combination of four ascii chars, and the following data is optional.

Chunks do not have size, so a parsing program should calculate it based on a certain structure.

## File name

<table><thead><tr><th width="135.3125">File name</th><th>Description</th></tr></thead><tbody><tr><td><code>.mesh</code></td><td>Container file that stores one or more mesh resources in <code>.ply</code> format. Used to reduce the number of individual files in the file system.</td></tr><tr><td><code>.cmesh</code></td><td>Container file that stores one or more collision and physics mesh resources in <code>.vol</code> format. Used to reduce the number of individual files in the file system.</td></tr><tr><td><code>.animation</code></td><td>Container file that stores one or more animation resources in <code>.anm</code> format. Used to reduce the number of individual files in the file system.</td></tr></tbody></table>

## File extensions

<table><thead><tr><th width="121.28125">Extension</th><th>Description</th></tr></thead><tbody><tr><td><code>.ply</code></td><td>Mesh resource stored inside a <code>.mesh</code> container.</td></tr><tr><td><code>.anm</code></td><td>Animation resource stored inside a <code>.animation</code> container.</td></tr><tr><td><code>.vol</code></td><td>Collision and physics mesh resource stored inside a <code>.cmesh</code> container.</td></tr></tbody></table>

## Data types

<table><thead><tr><th>Type</th><th width="328.2109375">Description</th><th>Size</th></tr></thead><tbody><tr><td>chunk</td><td>Quadruple byte magic identifier, four ASCII symbols.</td><td>4</td></tr><tr><td>int8 / uint8</td><td>Single byte signed / unsigned integer.</td><td>1</td></tr><tr><td>int16 / uint16</td><td>Double byte signed / unsigned integer.</td><td>2</td></tr><tr><td>int32 / uint32</td><td>Quadruple byte signed / unsigned integer.</td><td>4</td></tr><tr><td>float</td><td>Quadruple byte floating point number.</td><td>4</td></tr><tr><td>string8</td><td><p>Short string:</p><ul><li>uint8 length</li><li>char - uint8[length] symbols, <strong>no null terminator</strong>.</li></ul></td><td>1+</td></tr><tr><td>string8/24<br>or <br>string24</td><td><p>Smart long string.<br>For short strings, where length is less than 255, the structure is the same as string8. <br>If length is greater than or equal to 255:</p><ul><li>uint8 signature </li><li>0xFF - uint24 long_length</li><li>char - uint8[long_length] symbols, <strong>no null terminator.</strong></li></ul></td><td>1+</td></tr><tr><td>string32</td><td><p>Legacy format: </p><ul><li>uint32 long_length</li><li>char - uint8[long_length] symbols, <strong>no null terminator</strong>.</li></ul></td><td>4+</td></tr></tbody></table>

## Other conventions

| **Convention**     | **Description**                                                                                                                           |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- |
| struct             | Nested data structure.                                                                                                                    |
| `<type>[<number>]` | Fixed-size array of type `<type>` containing `<number>` elements.                                                                         |
| `<type>[<name>]`   | Variable-size array of type `<type>`. The number of elements is specified by the value stored in field `<name>`.                          |
| `unorm8`           | Representation of fractional floating-point values in the range \[0..1] using an 8-bit unsigned integer (`uint8`) in the range \[0..255]. |
| Little-endian      | Byte order convention used for multi-byte integer values. The least significant byte is stored first.                                     |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bestway.com.ua/foundational-knowledge/gem-rts-binary-file-formats.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
