> This is part 1 of 3 of the full documentation (pages 1–100 of 250).
> The content is paginated: fetch every part to see all of it.
> Next part: https://docs.bestway.com.ua/llms-full.txt/1
> Page index: https://docs.bestway.com.ua/llms.txt

# GEM RTS Documentation

Welcome to the GEM RTS development documentation server!

These are the guides for setting up the game’s configuration files, using the GEM RTS game editor, and other game-related systems.


# Foundational Knowledge

This section outlines the fundamentals of working with resources in games powered by the Gem RTS engine.\
The presented materials explain the basic principles of resource architecture and form a foundation for further study of development and modding systems.<br>

<table data-view="cards"><thead><tr><th></th><th data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>Locations of local game files and player profile across different operating systems. Includes paths to user settings, saves, and logs.</td><td><a href="/foundational-knowledge/game-local-files-and-player-profile-locations">Game local files and Player Profile locations</a></td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FXqe0ZKqSICsAK0XgCyMC%2Fsplash_editor_3.jpg?alt=media&amp;token=ecb5bb0d-d794-4925-a780-f7d98f315d42">default_cover.jpg</a></td><td><a href="/foundational-knowledge/game-local-files-and-player-profile-locations">Game local files and Player Profile locations</a></td></tr><tr><td>Overview of the game resource architecture: package structure, resource categories (global and scene), and rules for loading and usage in different modes.</td><td><a href="/foundational-knowledge/game-resource-architecture">Game resource architecture</a></td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2Fs2PVHmzN64Nzij1bW3ei%2Fresoures.png?alt=media&amp;token=0b0c37a4-e1ce-49b7-b9c7-54c5e3865422">resoures.png</a></td><td></td></tr><tr><td>Basic information about configuration files of game components: syntax, structure, parameter types, and usage rules.</td><td><a href="/foundational-knowledge/basic-knowledge-about-configuration-files">Basic knowledge about configuration files</a></td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FXqe0ZKqSICsAK0XgCyMC%2Fsplash_editor_3.jpg?alt=media&amp;token=ecb5bb0d-d794-4925-a780-f7d98f315d42">default_cover.jpg</a></td><td></td></tr></tbody></table>


# Game local files and Player Profile locations

Step-by-step instructions for opening the local game files of "Men of War II" and the player's profile folder for Windows and Ubuntu platforms. It covers two platforms: Steam and Epic Games Store

## Steam version of the game

The default paths to the game's root folder are based on the assumption that the game was installed using default settings.

<table><thead><tr><th width="188">Platform</th><th>Path to the Game's Root Folder</th></tr></thead><tbody><tr><td>Windows</td><td><code>C:\Program Files (x86)\Steam\steamapps\common\Men of War II</code></td></tr><tr><td>Ubuntu</td><td><code>~/.steam/steam/steamapps/common/Men of War II</code></td></tr></tbody></table>

If you chose a different folder during installation, use the below instructions to access the game root folder.

1. Launch the **Steam client**
2. Navigate to the **Library** section
3. Locate the game in the list and right-click on it
4. Select **Manage** from the dropdown menu
5. Click on the **Browse Local Files**

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FRN9sJDkXhQiY0uGNIRXq%2FOpening%20local%20game%20files%20on%20Steam.png?alt=media&amp;token=89ba614e-1217-4454-bb9e-eacfa3ed2e4f" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2Fe1RIhFU6DvxUITRhzZIm%2F%D0%A1%D0%BE%D0%B4%D0%B5%D1%80%D0%B6%D0%B8%D0%BC%D0%BE%D0%B5%20%D0%BA%D0%BE%D1%80%D0%BD%D0%B5%D0%B2%D0%BE%D0%B8%CC%86%20%D0%BF%D0%B0%D0%BF%D0%BA%D0%B8%20%D0%B8%D0%B3%D1%80%D1%8B.png?alt=media&amp;token=9a1fbca7-ca76-4484-b1fa-4c365027e893" alt=""><figcaption></figcaption></figure>

## Epic Games Store version of the game

The specified paths assume the game was installed with default settings.

<table><thead><tr><th width="199">Platform</th><th>Path to the Game's Root Folder</th></tr></thead><tbody><tr><td>Windows</td><td><code>C:\Program Files\Epic Games\MenOfWarII</code></td></tr><tr><td>Ubuntu</td><td><code>~/.local/share/EpicGamesStore/MenOfWarII</code></td></tr></tbody></table>

If you specified a different folder during installation, use the instructions below to open the game root folder.

* Open the **Epic Games Launche**r
* Navigate to the **Library** section
* Find the game in the list and click on the three dots next to its name
* Select **Manage**
* Click on the **Open Install Location** button

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F9TktDWBbgw2MNwNgOGeh%2FOpening%20game%20local%20files%20on%20EGS%201.png?alt=media&amp;token=3cddee34-9634-4165-8329-6d280c8a4876" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2Fg3D1IKy201AVAn8lvRj2%2FOpening%20game%20local%20files%20on%20EGS%202.png?alt=media&amp;token=8b63e03f-f079-49d1-992b-a3446429ad4f" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FvR5l5WsXFH4rKvVvBCMJ%2Fgame%20root%20folder.png?alt=media&amp;token=584b6d47-dafc-471f-b86d-2e8a8f5034a5" alt=""><figcaption></figcaption></figure>

## Default path to the Player Profile folder

The specified paths assume the game was installed with default settings. If you specified a different folder during installation, the player profile folder can be found in the user's directory.

<table><thead><tr><th width="202">Platform</th><th>Path to the Player Profile Folder</th></tr></thead><tbody><tr><td>Windows</td><td><code>C:Users\[User Name]\AppData\Local\Men of War II\</code></td></tr><tr><td>Ubuntu</td><td><code>~/Men of War II/</code></td></tr></tbody></table>


# Game resource architecture

## Resource modules

Game resources consist of two parts

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2Fs2PVHmzN64Nzij1bW3ei%2Fresoures.png?alt=media&amp;token=0b0c37a4-e1ce-49b7-b9c7-54c5e3865422" alt=""><figcaption><p>Root directory</p></figcaption></figure>

<table><thead><tr><th width="234">Directory</th><th>Description</th></tr></thead><tbody><tr><td>resource/</td><td>Basic resources</td></tr><tr><td>packages/</td><td>Packages are represented as folders containing resources related to game components or mods. Each package contains its own folder.</td></tr></tbody></table>

## Types of packages

<table><thead><tr><th width="234">Package type</th><th>Description</th></tr></thead><tbody><tr><td>DLC</td><td>Game add-on package.<br>It is a commercial package that can be purchased as standalone DLC or as part of bundles with other Steam products.<br>Only the developer can add DLC packages</td></tr><tr><td>Regular</td><td><p>Game component.<br>This is a part of the game or DLC.</p><p>Only the developer can add game component packages</p></td></tr><tr><td>Workshop Item</td><td><p>A custom modification package published through the Workshop as a custom mod.</p><p>Anyone who makes mods can add Workshop Item packages</p></td></tr><tr><td>Raw package</td><td>A package of a created but unpublished mod</td></tr></tbody></table>

**The main game folder contains** :

* basic resources;
* regular packages;
* DLC packages

### Package Manager <a href="#paket-menedzher" id="paket-menedzher"></a>

The Package Manager is an integral component of the Gem RTS engine, designed to coordinate resource loading upon application startup.\
Basic resources are loaded first.\
Then the Package Manager determines the loading order of files from packages based on their properties specified in the .info files.

When loading files from packages, the global or scene context is also taken into account. This context defines the general principles of organizing game resources in the packages, allowing for the inclusion or exclusion of specific resources depending on the loaded content, such as modifications, campaigns, specific missions or maps in the game or editor.

{% hint style="info" %}
The Package Manager is a built-in feature of the Gem RTS engine, and users do not have direct access to modify its settings.\
This ensures consistent and efficient management of resources without manual intervention, streamlining gameplay and development workflows.
{% endhint %}

***

Learn more

<table data-view="cards"><thead><tr><th></th><th data-card-target data-type="content-ref"></th><th></th><th data-hidden></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td></td><td><a href="/foundational-knowledge/game-resource-architecture/packages">Packages</a></td><td></td><td></td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FXqe0ZKqSICsAK0XgCyMC%2Fsplash_editor_3.jpg?alt=media&amp;token=ecb5bb0d-d794-4925-a780-f7d98f315d42">default_cover.jpg</a></td></tr><tr><td></td><td><a href="/foundational-knowledge/game-resource-architecture/package-file-structure">Package file structure</a></td><td></td><td></td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FXqe0ZKqSICsAK0XgCyMC%2Fsplash_editor_3.jpg?alt=media&amp;token=ecb5bb0d-d794-4925-a780-f7d98f315d42">default_cover.jpg</a></td></tr></tbody></table>


# Packages

### Directory Structure Overview

All packages are located in the packages/ folder in the main game folder.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FCDCbi7dGWp8KKRAW7PhY%2Fpackages.png?alt=media&amp;token=81dcd20c-f325-4f6d-8428-3f02e4a2fd91" alt=""><figcaption><p>Root folder of the game</p></figcaption></figure>

Each package is in its own folder.\
The package ID is written in the **.info** file.\
Package resources are divided into two main sections based on usage principles.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FR7XPv33Gmo2WKUwy5Jy0%2Fpackage%20folder.png?alt=media&amp;token=84d47df6-b01e-4396-bca7-9d2d79d6e6f1" alt=""><figcaption><p>Main package folder</p></figcaption></figure>

<table><thead><tr><th width="209">Directory</th><th>Description</th></tr></thead><tbody><tr><td>global</td><td>Resources in the 'global' section are applied once upon application launch and when enabling/disabling packages in the game settings.</td></tr><tr><td>scene</td><td>Resources in the 'scene' section are applied before scene loading, when creating a new session or when connecting to a session.</td></tr></tbody></table>

### Localization <a href="#lokalizaciya" id="lokalizaciya"></a>

Packages support localization.\
Localizable resources are placed in the .lang/ folders ("lang" is the language code, usually two characters).

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FHhFRXP3dAl6Or5shy1EN%2Flocalization.png?alt=media&amp;token=f9cc706e-242d-488a-9246-d0d5cf39fa5c" alt=""><figcaption><p>Localization archives</p></figcaption></figure>

{% hint style="info" %}
**See also:** [Package file structure](/foundational-knowledge/game-resource-architecture/package-file-structure)\
\&#xNAN;*(detailed description of `global/`, `scene/`, and their subdirectories and localization archives.)*
{% endhint %}

## Package property settings

Package properties are defined by parameters in the `.info` file, located at the root of the package folder.

<table><thead><tr><th width="252">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>id</code></td><td>Unique Package Identifier.<br>This identifier is essential for distinguishing packages.<br>If the package is related to Steam DLC or Steam Workshop, Steam automatically assigns the identifier.<br>For packages created via the Settings interface, a unique identifier is automatically assigned. In all other scenarios, it is advisable to use a suitable GUID generator to create the identifier (for example, <a href="http://www.guidgen.com/">http://www.guidgen.com/</a>).</td></tr><tr><td><code>legacy_id</code></td><td>During the assignment of a Steam DLC ID or Workshop ID to a package, the 'id' parameter is substituted with 'legacy_id'. The value for 'legacy_id' is sourced from the original 'id'.<br>This substitution ensures that older references, such as save game links, continue to correctly identify the package.</td></tr><tr><td><code>name</code></td><td>Package Name.<br>This is an optional parameter.<br>If the package name is not specified, the system will use the name of the folder containing the package as the default.<br>In the case of Steam downloadable content (DLC), this parameter is ignored.</td></tr><tr><td><code>author</code></td><td>Package author.<br>Optional parameter.<br>Displayed in the package properties.</td></tr><tr><td><code>order</code></td><td>Order in the list of packages.<br>The value can be either positive or negative and influences the sequence in which packages are displayed in the settings.<br>By default, the order is set to 0, positioning the package at the top of the list.</td></tr><tr><td><code>default_disabled</code></td><td>This option indicates that the package is disabled by default and remains so until the player enables it in Game Settings. If this option is not set, the package is considered enabled upon installation.</td></tr><tr><td><code>hidden</code></td><td>This parameter determines whether the package is visible in the game settings window.<br>If it is not specified, the package will be visible by default.</td></tr><tr><td><code>dependency &#x3C;package id></code></td><td>Dependency on another package.<br>The dependency parameter block can be repeated to establish multiple dependencies. Packages are processed in the order that the dependency blocks are specified.</td></tr><tr><td><code>incompatible &#x3C;package id></code></td><td>Used to specify the IDs of packages that are incompatible with this package. The game will disable any package with the specified ID when this package is activated.</td></tr><tr><td><code>min_core_version</code></td><td>The minimum game version with which the package is compatible.<br>If this parameter is not specified, the corresponding check is absent.</td></tr><tr><td><code>max_core_version</code></td><td>The maximum game version with which the package is compatible.<br>If this parameter is not specified, the corresponding check is absent.</td></tr><tr><td><code>delete_global</code></td><td>List of virtually deleted resources when the 'global' section is activated.</td></tr><tr><td><code>delete_scene</code></td><td>List of virtually deleted resources when the 'scene' section is activated.</td></tr><tr><td><code>activate_always</code></td><td>Forcibly loads the package in every session, regardless of scene requirements; may cause instability or desync in multiplayer.</td></tr><tr><td><strong><code>activate_implicit</code></strong></td><td>Marks the package for global loading when it modifies core gameplay systems or global rules (e.g., balance, UI, entity behavior).<br>Recommended for use in the mod’s info file when the package introduces global changes that must be available across all scenes</td></tr><tr><td><code>always_activate_scene</code></td><td>Always activate the 'scene' section of this package if the 'global' section is active. By default, the 'scene' section is activated if a map from the 'global' section of this package is loaded.</td></tr><tr><td><code>always_activate_global</code></td><td>This parameter indicates that the package modifies global game settings. When this package is enabled, it is consistently marked in the list for creating a host, in game saves, and other relevant areas.</td></tr><tr><td><code>client_only</code></td><td>The package content is available only on the client, it is not loaded on the server and does not affect gameplay.</td></tr><tr><td><code>obsolete</code></td><td>Allows hiding package resources (objects and textures) in the lists of available resources in the editor.</td></tr><tr><td><code>hash</code></td><td>The hash parameter value allows for pre-determining that the package content is the same among different users and on the server when playing together.<br>The hash parameter value is automatically updated when the package is published in the Workshop.</td></tr><tr><td><code>sign</code></td><td><p>Digital signature.<br>Only for packages released by Best Way.<br>Packages with such a signature do not allow any modification.</p><p>If the signature is not verified, the package is considered corrupted and not loaded.</p></td></tr><tr><td><code>token_count</code></td><td>The number of tokens that this package provides.<br>Tokens can only be assigned to packages released by Best Way.</td></tr><tr><td><code>token_sign</code></td><td>Digital signature for tokens. If authenticity is not verified, the tokens are ignored.</td></tr></tbody></table>

<details>

<summary>Example of .info file content</summary>

```
{id "cc507d63-2143-4598-99de-237a5ea5e621"}
{name "Example Package"}
{order 1}
{dependency "02f8e8f9-91d9-45e0-8ee6-dc56adae4763"}; main package
{incompatible "01f8e8f9-91d9-45e0-8ae6-dc56afae46dd"}; Realism mod
{default_disabled}
{max_core_version 1.302}
{author "Created by Best Way, at Mon Apr 15 16:39:49 2024"}
```

</details>

### **Examples of package property parameters**

<table><thead><tr><th width="299.1640625">Example block</th><th>Explanations</th></tr></thead><tbody><tr><td><code>{order -100}</code></td><td>Lower the package in the package list by 100 points</td></tr><tr><td><code>{order +4000}</code></td><td>Raise the package higher in the package list by 4000 points</td></tr><tr><td><code>{default_disabled}</code></td><td>Default state is disabled (the same as <code>{default_disabled 1}</code></td></tr><tr><td><code>{hidden 0}</code></td><td>The package is displayed in the package list</td></tr><tr><td><code>{hidden}</code></td><td>The package is not visible in the package list (the same as <code>{hidden 1}</code></td></tr><tr><td><code>{dependency "b86c6020-9b25-4659-bcdf-53b12715a0a1"}</code></td><td>The package depends on the package with ID "b86c6020-9b25-4659-bcdf-53b12715a0a1"</td></tr><tr><td><code>{delete_global "/map/single/2-fra" "/video/menu.avi"}</code></td><td>When loading the global section the folder /map/single/2-fra and file /video/menu.avi are ignored</td></tr><tr><td><code>{delete_scene "/entity/service/flag"}</code></td><td>When loading the scene section the entity "flag" from the folder /entity/service/ is ignored.</td></tr></tbody></table>


# Package file structure

Overview of game resource organization in global and scene directories

The correct organization of game resources into "global" and "scene" directories is crucial not only for maintaining clarity but also for controlling the loading of game resources depending on whether they are needed in a "global" or "scene" context. This structured approach ensures that resources are loaded efficiently and only when required, which enhances the game’s performance.

{% hint style="info" %}
For more comprehensive details, please refer to the article on [**Packages**](/foundational-knowledge/game-resource-architecture/packages).
{% endhint %}

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FR7XPv33Gmo2WKUwy5Jy0%2Fpackage%20folder.png?alt=media&amp;token=84d47df6-b01e-4396-bca7-9d2d79d6e6f1" alt=""><figcaption><p><strong>Contents of the root package folder</strong></p></figcaption></figure>

## **Global section content**

<table><thead><tr><th width="201">Directory</th><th>Description</th></tr></thead><tbody><tr><td><code>interface</code></td><td>Contains files describing the game's user interface in game lobby</td></tr><tr><td><code>map</code></td><td>The folder with maps and missions</td></tr><tr><td><code>music</code></td><td>The folder containing music files and music playback configuration files</td></tr><tr><td><code>set</code></td><td>Global game settings</td></tr><tr><td><code>set\difficulty</code></td><td>Game difficulty settings</td></tr><tr><td><code>set\multiplayer</code></td><td>Settings for multiplayer modes and unit presets for these modes</td></tr><tr><td><code>set\side</code></td><td>This directory contains configuration files for the global nations in the game</td></tr><tr><td><code>set\registry</code></td><td>This directory contains files with simple settings for the game engine, which are used to configure basic operational parameters.</td></tr><tr><td><code>sound</code></td><td>Sound effects and configuration files for sound playback settings</td></tr><tr><td><code>video</code></td><td>Video files and configuration files for video playback within the game</td></tr></tbody></table>

## **Scene section content**

<table><thead><tr><th width="244.6640625">Directory</th><th>Description</th></tr></thead><tbody><tr><td><code>at</code></td><td>Files with default settings for console commands</td></tr><tr><td><code>entity</code></td><td>Folder containing model files for game entities and their configuration files</td></tr><tr><td><code>interface</code></td><td>Descriptions of in-game interface elements</td></tr><tr><td><code>properties</code></td><td>Descriptions of game component properties</td></tr><tr><td><code>set</code></td><td>Configuration files inside game components</td></tr><tr><td><code>set\ability</code></td><td>Descriptions of unit abilities</td></tr><tr><td><code>set\blow</code></td><td>Descriptions of explosion mechanics</td></tr><tr><td><code>set\colliders</code></td><td>Descriptions of breeds – includes presets for units (weapons, equipment, perks, and inventory contents). Editable in the Breed Editor</td></tr><tr><td><code>set\environment</code></td><td>Environmental settings and weather effect files.<br>Editable in the Environment Editor.</td></tr><tr><td><code>set\interaction_entity</code></td><td>Configuration files for unit interaction settings</td></tr><tr><td><code>set\interaction_terrain</code></td><td>Territory type configuration files</td></tr><tr><td><code>set\vision</code></td><td>Settings for unit vision parameters</td></tr><tr><td><code>textures</code></td><td>The folder with textures</td></tr></tbody></table>

{% hint style="info" %}
When adding new files, it is essential to follow the original folder structure in the **Main Package** to ensure compatibility and functionality.
{% endhint %}

{% hint style="warning" %}
Misplacing game resources can lead to errors during game loading.
{% endhint %}

## **Localization folder content**

<table><thead><tr><th width="238">Directory</th><th>Description</th></tr></thead><tbody><tr><td><code>interface\text</code></td><td>Interface localization files</td></tr><tr><td><code>sound\mission</code></td><td>Sound files for localized texts</td></tr></tbody></table>

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2Ffr4qu9VVmTCPUFJJwPt0%2Flocalization%20files.png?alt=media&amp;token=65645e13-8f2f-40b0-9562-c801b5d7756a" alt=""><figcaption><p>Typical contents of a <code>.pak</code> archive for language files</p></figcaption></figure>


# Basic knowledge about configuration files

This section contains the basic principles for describing game components.

## SDL files

SDL (structure definition language) - a common format for configuration files used by the Gem RTS game engine. SDL files of Gem RTS have nothing in common with the graphic modeling language and SDL files from Microsoft Visual Studio.

SDL files are used to describe most of the game's components.

Examples of use:

* descriptions of game objects;
* descriptions of interface elements;
* unit settings;
* game mode settings;
* game level files (maps);
* descriptions of mission logic;
* descriptions of special effects (VFX) and sound effects (SFX);
* descriptions of units' properties and behavior;
* descriptions of animations; ...

SDL files are text documents that are saved in UTF-8 encoding.\
These files can be viewed and edited with any standard text editor, including Sublime, Notepad++, Vim, among others.

For certain SDL files, specialized editors are available within the Editor application (refer to the EDITOR section of the documentation for more details). If the editor features a built-in game component editor, it is advised to utilize this tool for creating and editing the corresponding SDL files. Using the integrated component editor ensures optimal compatibility and functionality for these files. Use of generic text editors should be limited to scenarios where it is absolutely necessary.

## Rules for naming SDL files

SDL files can have different extensions, but they always share the same syntax. The most common extensions of SDL files are presented in the table.

| Extension | Description of File Contents                                                                                                                                                                                                  |
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| .def      | Descriptions of game objects                                                                                                                                                                                                  |
| .ext      | Additional descriptions of objects                                                                                                                                                                                            |
| .set      | Descriptions of game components and settings parameters                                                                                                                                                                       |
| .inc      | Used for structuring descriptions and extracting common descriptions for groups of components. The content of .inc files is inserted by the engine parser into the final SDL at the places from which the .inc file is called |
| .info     | Game component settings                                                                                                                                                                                                       |
| .mi       | Descriptions of mission logic                                                                                                                                                                                                 |

## Location of SDL files

The location of SDL files depends on which game component is described in them. The location of the file affects the format and structure of the description.

{% hint style="warning" %}
Most files must be located in a strictly defined folder or have a specific name.
{% endhint %}

{% hint style="info" %}
More details on the principle of file placement are discussed in the article [Game Resource Architecture](/foundational-knowledge/game-resource-architecture).
{% endhint %}

## Contents of SDL files

The content of an SDL file depends on which game component it describes.

<table><thead><tr><th width="358">Files</th><th>Explanation</th></tr></thead><tbody><tr><td>...\scene\set\interaction_entity\human.inc<br>...\scene\set\target\human.inc<br>...\scene\properties\selection\human.inc</td><td>SDL files have the same name and extension, but contain different description formats depending on the location of the file in the game resource structure.</td></tr><tr><td>..\scene\set\environment</td><td>SDL files from the environment folder describe the same game component: weather and visual environmental effects.<br>They have the same format for describing parameters and settings of effects. The content of files from the environment folder differs only in the values of weather parameters, names of effects, and textures.</td></tr></tbody></table>

## Syntax

An SDL file structure consists of blocks. The smallest unit of a block is a line enclosed in curly braces and contains the parameter name.

{% hint style="danger" %}
Each SDL block must have an opening and closing curly brace. Missing a brace causes critical errors in the game.
{% endhint %}

Optionally, a block can contain one or more parameter values.\
A parameter value can be a number or a variable name.\
Variable names containing space are enclosed in double quotes.

> **SDL block template**
>
> `{parameter [data]}`

<details>

<summary>Example</summary>

```
{actor}
{health 1000}
{tag "oficer t34"}
```

</details>

If there are multiple values, they are listed separated by spaces.

<details>

<summary>Example</summary>

```
{actor m2 m3 “oficer t34”}
```

The parameter actor has three values: m2, m3, and "officer t34"

</details>

Blocks can be nested.\
Tabs and line breaks are optional but recommended for easier understanding of descriptions.

<details>

<summary>Example</summary>

```
{rules
    {“vehicle”
       {“actor” “m2”
          {“icon” “m2_icon”}
       }
    }
}
```

</details>

## Conditions

SDL files that set game component settings can contain conditions for calling or setting parameters.

> **Condition Format**
>
> `{if condition [data]}`
>
> *\[data] - optional the parameter value (if required)*

Conditions can also be nested. Conditions are evaluated in sequence. The parameter value from the first condition that triggers is selected.

<details>

<summary>Example</summary>

```
{vision 1
    {if human 0.2
        {if mp_team "a" 0.5}
    }
    {if tags “xxx” 0.8}
}
```

*The parameter vision defaults to a value of 1.*\
*If the unit is of type human, the vision parameter is set to 0.2.*\
*If multiplayer mode is enabled and the human unit belongs to team "a", the vision parameter is set to 0.5.*\
*If the "human" condition does not apply and the unit has the tag "xxx", the vision parameter is set to 0.8*

</details>

## Comments

You can make a single-line comment with a semicolon. Anything written on the line after the semicolon is ignored by the engine during loading.

<details>

<summary>Example</summary>

```
{armor ; unit defence 
    ; {value 17} 
    {value 5} 
}
```

*The phrase "unit defence" is a single-line comment for the armor parameter, and it will be ignored during loading.*

*The block {value 17} will be ignored during loading.*

</details>

{% hint style="warning" %}
All single-line comments are removed during loading. Do not use single-line comments in SDL files created and edited with game Editors.
{% endhint %}

With a double hash symbol ##, the game Editor creates marks in the SDL file for disabled blocks. During loading, blocks marked with a double hash are not ignored or deleted. They appear in the editor marked as disabled.

<details>

<summary>Example</summary>

```
{##health
   {max 17}
}
```

*The commented-out block named health will appear as disabled in the Editor. The game will not consider the parameter values described in it. If necessary, you can enable the health block in the Editor, and the double hash symbol will be removed from the SDL file.*

</details>

## SDL assembly

Loading SDL files supports staged assembly of the final file. Using the package system, you can completely "override" the base file or supplement it.

<details>

<summary>Example</summary>

* core\global\set\difficulty\normal.dl
* main\global\set\difficulty\normal.dl

*When the main package is connected, the content of the normal.dl file from the core package will be completely replaced by the content of the normal.dl from the main package.*

</details>

<details>

<summary>Example</summary>

* main\global\set\difficulty\mk10.def
* special\global\set\difficulty\mk10+.def

*When the special package is connected, the content of the mk10.def file from the main package will be supplemented by the content of the mk10+.def file from the special package.*

</details>

A SDL file located on the wrong path can lead to a loading error or be ignored.

## Debugging assembly

The game editor allows you to assemble the final version of the processed SDL file using the console command preprocess\_sdl “path\_to\_file” for debugging purposes. The result of this command is available in the folder “...\Users\<user>\AppData\Local\Men of War II\preprocess\”

<details>

<summary>Example</summary>

```
preprocess_sdl “/set/damage_report.set”
```

If you type the specified line in the Editor's Console, the SDL parser will compile a complete description for the damage\_report.set file considering all its components and place it in the folder: \<user>\AppData\Local\Men of War II\preprocess\\

</details>

## Instructions

An instruction is a repeating part of an SDL description, which is moved to a separate file or fragment for further calling in needed places of descriptions and settings.

Instructions are used for:

* avoiding repetitions in descriptions of game components;
* structuring descriptions;
* globally modifying parameters and settings of game components depending on the game mode.

### **Instruction syntax**

Instructions are called at the needed places in an SDL file. You can call the same instruction multiple times in needed places.

An instruction is indicated by a SDL fragment enclosed in parentheses.

{% hint style="info" %}
The format for describing and calling an instruction depends on its [type](#types-of-instructions).
{% endhint %}

The instruction description contains the type name and name. The instruction name is enclosed in double quotes. Optionally, the instruction description can contain an SDL fragment. An instruction is called by its name.

<details>

<summary>Example</summary>

```
(define “example” [...])
...
("example")
```

*The first line contains a description of a define-type instruction named "example".*\
*An SDL description fragment can be included as \[...]. In empty instructions, the SDL fragment is absent.*\
*The third line contains a call to the instruction by its name*

</details>

<details>

<summary>Example</summary>

```
(include "file.inc") 
```

*The instruction name corresponds to the name of the file whose content needs to be included at the instruction call site during the assembly of the final SDL*

</details>

Instructions can be nested.

<details>

<summary>Example</summary>

```
(define "event3" 
    ("event1") 
    ("event2")
)
```

The instruction event3 calls the instructions event1 and event2.

</details>

### Types of instructions

<table><thead><tr><th width="146">Name</th><th>Description</th></tr></thead><tbody><tr><td>include</td><td>The instruction includes content of an SDL file in other files where needed. This allows structuring descriptions by topics and avoiding duplication of descriptions.</td></tr><tr><td>define</td><td>The instruction is used to create macros, which helps avoid duplication of descriptions or similar pieces of descriptions that only differ by parameter values.</td></tr><tr><td>mod</td><td>The instruction allows including/excluding part of the code or changing parameter values depending on the game mode.</td></tr></tbody></table>

## Arguments

Arguments are used to call the same instruction but with different parameter values. In the instruction description, an argument is indicated by the percent symbol %.

Arguments can be specified in two ways:

* by ordinal number;
* by variable name

Argument values can be numbers or sets of characters, such as variable names.

### **Arguments by ordinal number**

When describing an instruction, you can use integers, starting from zero. When calling the instruction, use the word args and list the argument values strictly from 0 and in order.

> **Template for specifying arguments by ordinal number**
>
> `%0 %1 %2`

> **Template for specifying argument values by their ordinal number**
>
> `args data%0 data%1 data%2`

<details>

<summary>Example</summary>

```
(define "seismic" 
    {damage blast 
        {energy %1}
        {radius %0}
        {light %2}
    }
)
...
("seismic" args 10 8 3000)
...
("seismic" args 45 300 3000)
```

At the first call of the "seismic" instruction, the arguments take the following values:\
%0=10, %1=8, %2=3000\
At the second call of the "seismic" instruction, the arguments take the values:\
%0=45, %1=300, %2=3000\
The result of the "seismic" instruction call will be SDL, containing at the call sites the lines:

```
...
{damage blast 
     {energy 8}
     {radius 10} 
     {light 3000}
}
...
{damage blast 
     {energy 300}
     {radius 45} 
     {light 3000}
}
```

</details>

{% hint style="danger" %}
When calling an instruction with arguments specified by ordinal number, you must strictly observe the order of listing the arguments.\
Failing to follow the order leads to errors.
{% endhint %}

### **Named arguments**

Variable names are used to describe named arguments.

> **Template for specifying named arguments**
>
> `%name`

> **Template for calling named arguments**
>
> `name(data)`

When calling an instruction with named arguments, the order of listing the arguments is not important.

<details>

<summary>Example</summary>

```
(define "seismic" 
    {damage blast 
        {energy %energy} 
        {radius %radius}
    }
)
...
("seismic" energy(10) radius(8))
...
("seismic" radius(300) energy(45))
```

The result of the "seismic" instruction call will be SDL, containing at the call sites the lines:

```
...
{damage blast 
     {energy 10}
     {radius 8} 
}
...
{damage blast 
     {energy 45}
     {radius 300}
}
```

</details>

{% hint style="warning" %}
It is important to ensure that arguments do not contain the names of other arguments passed above unless this is your intention.
{% endhint %}

<details>

<summary>Example</summary>

```
(instruction "example" sx(1) sy(3))
```

*If there was a reference to the argument s before the call to the instruction example, then at the places of parameters sx and sy, the value of the parameter s will be set with the prefixes x and y. For example, if s=5, the arguments will take the values 5x and 5y.*

</details>


# Include instruction

The content of an SDL file can conveniently be divided into thematic files.\
It's also possible to extract common fragments of component descriptions and settings into separate files.\
Such files use the **.inc** or **.ext** extensions.

The content of these files can be invoked at the required location using the `include` instruction with the filename enclosed in double quotes.\
If the file is not in the same folder as the SDL being assembled, then the path from the root folder of the package should be specified.

> **Template for calling the `include` instruction**
>
> ```plaintext
> (include "[path]\filename" [args])
> ```
>
> * `[path]` - the file path, optional
> * `filename` - the file name
> * `[args]` - arguments, optional

<details>

<summary>Example of <strong>calling the <code>include</code> instruction</strong></summary>

```
;SDL
(include "human_grenade_throw_type.inc")
(include "human_lie.inc")
(include "human_swim.inc")
(include "human_snipe.inc")
(include "human_squat.inc")
(include "human_bazooka.inc")
(include "human_inventory.inc")
(include "human_look.inc")
(include "human_stand.inc")
(include "human_idle.inc")
(include "human_idle_temp.inc")
(include "human_hands.inc")
(include "human_death.inc")
```

*The content of the `human.set` file is assembled from several SDL files that are located in the same folder as the `human.set` file*

</details>

When calling the `include` instruction, you can pass argument values.

<details>

<summary>Example</summary>

`(include "shadow/stone.inc" sx(1) sy(3))`

</details>

Other examples of using the `include` instruction are provided in the table below.

<table><thead><tr><th width="198">Filename</th><th>Description</th></tr></thead><tbody><tr><td>human_death.inc</td><td>For convenience, this file contains the description of death animations for a human unit.<br>The contents of <code>human_death.inc</code> are included in the <code>human.set</code> file using the <code>include</code> instruction.</td></tr><tr><td>vehicle.ext</td><td>This file contains common properties for vehicle type units.<br>Its contents are called in files describing properties of units that are subtypes of vehicle: car, moto, airborne, marine, etc.</td></tr><tr><td>presets_vehicles.inc</td><td>This file contains settings for vehicle unit presets.<br>The contents of this file are called using the <code>include</code> instruction in all files describing game modes that use the presets described in <code>presets_vehicles.inc</code>.</td></tr></tbody></table>

{% hint style="info" %}
If you have difficulties understanding the terminology and the essence of the instruction description, please refer to the article [**Basic knowledge about configuration files**](/foundational-knowledge/basic-knowledge-about-configuration-files).
{% endhint %}

Additionally, you can explore other types of Instructions.

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td>Define Instruction</td><td></td><td></td><td><a href="/foundational-knowledge/basic-knowledge-about-configuration-files/define-instruction">Define instruction</a></td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FXqe0ZKqSICsAK0XgCyMC%2Fsplash_editor_3.jpg?alt=media&amp;token=ecb5bb0d-d794-4925-a780-f7d98f315d42">default_cover.jpg</a></td></tr><tr><td>Mod Instruction</td><td></td><td></td><td><a href="/foundational-knowledge/basic-knowledge-about-configuration-files/mod-instruction">Mod instruction</a></td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FXqe0ZKqSICsAK0XgCyMC%2Fsplash_editor_3.jpg?alt=media&amp;token=ecb5bb0d-d794-4925-a780-f7d98f315d42">default_cover.jpg</a></td></tr></tbody></table>


# Define instruction

Repetitive SDL fragments can be described using the define instruction for further multiple calls in the required places.

## Template for the define instruction

> **Template for the `define` instruction**
>
> ```plaintext
> (define "name" [code])
> ```
>
> * "name" - the identifier for the **define instruction**, enclosed in double quotes.
> * \[code] - an optional SDL fragment that will be inserted wherever the define is called.

{% hint style="warning" %}
The parentheses `(...)`are mandatory and encapsulate the entire instruction, ensuring that the parser SDL recognizes and correctly processes the definition as a single cohesive unit.
{% endhint %}

## **Arguments in a define instruction**

The SDL fragment can contain arguments, the values of which usually change from one call to another.

<details>

<summary>Example of a <code>define</code> instruction without arguments</summary>

```
(define "seismic_custom"
    {damage seismic {energy 10} {radius 8}}
)
```

</details>

<details>

<summary>Example of a <code>define</code> instruction with numeral arguments</summary>

```
(define "seismic_custom"
    {damage seismic {energy %0} {radius %1}}
)
```

</details>

<details>

<summary>Example of a <code>define</code> instruction with named arguments</summary>

```
(define "seismic_custom"
    {damage seismic {energy %energy} {radius %radius}}
)
```

</details>

## **Calling a define instruction**

The **define instruction** is called by its name, which is enclosed in double quotes.

> **Template for calling a `define` instruction**
>
> ```
> ("name" [args])
> ```
>
> * \[args] - arguments are optional

When calling a define instruction that does not require arguments, you simply use the name of the defined term within the SDL script where you need the defined contents to appear. The syntax is straightforward; since no arguments are involved, you only need to reference the defined name within double quotes.

<details>

<summary>Example of calling a <code>define</code> instruction without arguments</summary>

**Source SDL fragment:**

```
(define "seismic_custom” 
    {damage blast 
        {energy 10}
        {radius 8}
    }
)
...
(“seismic_custom”)
```

*In this example, whenever `"seismic_custom"` is used in the SDL script, it will insert the set of commands defined under `“seismic_custom”`description.*\
*Since no arguments are used, you don't need to enclose anything other than the double-quoted name in parentheses.*

***Result SDL fragment**:*

```
...
{damage blast 
        {energy 10}
        {radius 8}
}
...
```

</details>

<details>

<summary>Example of calling a <code>define</code> instruction with ordinal arguments</summary>

```
(define "seismic" 
    {damage blast 
        {energy %1}
        {radius %0}
        {light %2}
    }
)
...
("seismic" args 10 8 3000)
...
("seismic" args 45 300 3000)
```

At the first call of the "seismic" instruction, the arguments take the following values: %0=10, %1=8, %2=3000 At the second call of the "seismic" instruction, the arguments take the values: %0=45, %1=300, %2=3000 The result of the "seismic" instruction call will be SDL, containing at the call sites the lines:

```
...
{damage blast 
     {energy 8}
     {radius 10} 
     {light 3000}
}
...
{damage blast 
     {energy 300}
     {radius 45} 
     {light 3000}
}
```

</details>

<details>

<summary>Example of calling a <code>define</code> instruction with named arguments</summary>

```
(define "seismic" 
    {damage blast 
        {energy %energy} 
        {radius %radius}
    }
)
...
("seismic" energy(10) radius(8))
...
("seismic" radius(300) energy(45))
```

The result of the "seismic" instruction call will be SDL, containing at the call sites the lines:

```
...
{damage blast 
     {energy 10}
     {radius 8} 
}
...
{damage blast 
     {energy 45}
     {radius 300}
}
```

</details>

When calling the instruction, values for named arguments may be empty.

<details>

<summary>Example of calling a <code>define</code> instruction with an empty argument</summary>

***Source SDL:***

```
(define "seismic" 
    {damage blast 
        {energy %energy} 
        {radius %radius}
    }
)
...
(“seismic” energy() radius(8))
```

***Result SDL:***

<pre><code><strong>...
</strong><strong>{damage blast 
</strong>        {energy  } 
        {radius 8}
}
</code></pre>

</details>

## **Nested define instruction**

Nested define instructions allow you to build complex configurations by combining simpler defined components into more sophisticated structures. Here's how you can define and use nested `define` instructions in SDL

1. **Defining basic components**

Define some basic components that we'll use in our nested setup.

<details>

<summary>Example</summary>

```
(define "AmbientLight" {light_intensity 1.0})
(define "SetBackgroundColor" {background_color "blue"})
```

</details>

2. **Creating a nested `define` instruction**

Next, you can define a more comprehensive setup that includes these previously defined components. This is where the nesting comes into play.

<details>

<summary>Example of a nested <code>define</code> instruction</summary>

```
(define "StandardSceneSetup" 
    ("AmbientLight")
    ("SetBackgroundColor")
    [code]
)
```

*In this nested `define`, `"StandardSceneSetup"` calls both `"AmbientLight"` and `"SetBackgroundColor"` within its definition.*

</details>

3. **Calling a nested define instruction**

Finally, you use the nested definition in your SDL script where needed, just like any other defined instruction

<details>

<summary>Example of calling a nested <code>define</code> instruction</summary>

```
("StandardSceneSetup")
```

*Calling the "StandardSceneSetup" will execute all the commands in `"StandardSceneSetup"`, including the nested definitions of `"AmbientLight"` and `"SetBackgroundColor"`, along with any additional commands defined directly within `"StandardSceneSetup"`*

***Result SDL:***

```
...
{light_intensity 1.0}
{background_color "blue"}
[code]
...
```

</details>

**Benefits of nested define instructions**

* **Modularity**\
  You can create modular blocks of SDL that can be reused and combined in various ways.
* **Maintainability**\
  It’s easier to update and maintain your SDL scripts, as changes to a single defined block will propagate wherever it is used.
* **Clarity**\
  Nested definitions can help clarify the structure of complex setups by breaking them down into manageable parts.

Nested define instructions thus provide a powerful way to structure and simplify complex SDL configurations in a scalable and maintainable manner.

## Using arguments as a part of a define instruction name

Using arguments as a part of define instruction name can offer several benefits in scripting:

* to create generic instructions that dynamically call relevant content definitions based on the arguments passed;
* to reduce a code duplication;
* to disable one or several nested instructions if it is necessary

The empty define instructions are used when it is necessary to disable one or several nested instructions. In this case, an argument is often used in the name of the nested instruction when calling.

<details>

<summary>Example of using an empty <code>define</code> instruction</summary>

```
(define "content_none")
(define "content_v" {content data1})
(define "content_v_officer" {content data2})
(define "set_default" ("content_%con"))
...
("set_default" con(none))
("set_default" con(v) )
("set_default" con(v_officer))
```

*In this example, we are dealing with dynamically selecting and invoking specific content definitions based on arguments provided to a define instruction.*

* *`"content_none"` is an empty definition, used when no content is necessary.*
* *`"content_v"` and `"content_v_officer"` include specific data content (`data1` and `data2` respectively).*
* *`"set_default"` demonstrates a dynamic content selection mechanism using the argument `%con`. This setup allows the `set_default` instruction to dynamically call one of the content definitions based on the suffix provided.*
* *The calls to `"set_default"` pass different arguments (`none`, `v`, and `v_officer`) to the `%con` argument, determining which of the `"content_*"` definitions is executed. For instance, `("set_default" con(none))` will call `"content_none"`.*

</details>

## **More examples**

An alternative name for the define instruction is **macro**.

<details>

<summary>Example of a basic macro with a basic set of parameters</summary>

```
(define "set_generic"
  {charge %ch}
  ("score" sc(%sc))
  {tags "%tag %side"}
  ("cw_%cw")
  {cp %cp}
  {level %lvl}
  {cost 0}
  {fore 1}
)
```

</details>

<details>

<summary>Example of a macro with a standard set of settings</summary>

```
(define "set_default"
    ("content_%con" side(%side) n(%n))
    ("set_generic" ch(%ch) sc(%sc) tag(%tag) side(%side) cw(%cw) cp(%cp) lvl(%lvl))
    ("spawn_distance_%sd")
    ("territory_holder_%th")
)
```

</details>

<details>

<summary>Example of a top-level macro that uses standard settings</summary>

```
(define "set_v" ("set_default" con(v) ch(0) sc(%sc) tag(%tag) side(%side) n(%n) cw(%cw) cp(%cp) lvl(%lvl) sd(default) th(%th)))
```

The result of calling the set\_v instruction will be the final setting for the PZ1b

```
{"pz1b" ("set_v" 
        lvl(1) 
        tag(all tnk_light level_1) 
        side(ger) 
        n(2) 
        sc(10) 
        cw(s2) 
        cp(3) 
        th(tanks)
    )
}
```

</details>

{% hint style="info" %}
If you have difficulties understanding the terminology and the essence of the instruction description, please refer to the article [**Basic knowledge about configuration files**](https://bestway-1.gitbook.io/documentation/foundational-knowledge/basic-knowledge-about-configuration-files).
{% endhint %}

Additionally, you can explore other types of instructions.

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td>Include instruction</td><td></td><td></td><td><a href="/foundational-knowledge/basic-knowledge-about-configuration-files/include-instruction">Include instruction</a></td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FXqe0ZKqSICsAK0XgCyMC%2Fsplash_editor_3.jpg?alt=media&amp;token=ecb5bb0d-d794-4925-a780-f7d98f315d42">default_cover.jpg</a></td></tr><tr><td>Mod instruction</td><td></td><td></td><td><a href="/foundational-knowledge/basic-knowledge-about-configuration-files/mod-instruction">Mod instruction</a></td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FXqe0ZKqSICsAK0XgCyMC%2Fsplash_editor_3.jpg?alt=media&amp;token=ecb5bb0d-d794-4925-a780-f7d98f315d42">default_cover.jpg</a></td></tr></tbody></table>


# Mod instruction

The **mod instruction** is designed to control the inclusion or exclusion of blocks of descriptions and settings based on the global mode of operation. This feature is especially useful in cases where different game modes require different configurations.

## **Global modes in the Men of War II game**

<table><thead><tr><th width="211">Mode</th><th>Description</th></tr></thead><tbody><tr><td><strong>Multiplayer (mp)</strong></td><td>This mode activates configurations that are specifically tailored for multiplayer gameplay.</td></tr><tr><td><strong>Everything else</strong></td><td>This includes single-player missions and the game editor mode</td></tr></tbody></table>

## Template for a mod instruction

> **Template for the mod instruction**
>
> ```
> (mod mode_name {code})
> ```
>
> mode\_name specifies the mode for which the enclosed code block `{code}` should be active

<details>

<summary>Example</summary>

```
(mod mp {code})
```

If the game sets the `mp` modifier (indicating that the player has launched multiplayer mode), then the `{code}` block is inserted into the SDL.

</details>

For instance, if the mode is set to mp, the code block will only be executed in multiplayer mode.

The **mod instruction** can also be used in a prohibitive format, which means you can specify that certain code blocks should only be excluded in certain modes rather than included. This is useful for disabling specific features or settings in a particular mode without having to explicitly include them in all other modes.

<details>

<summary>Example</summary>

```
(mod not_mp {code})
```

</details>

This structured approach using the mod instruction allows developers to neatly organize their code and ensure that the correct settings and features are active based on the game mode, enhancing both maintainability and gameplay experience.

{% hint style="info" %}
If you have difficulties understanding the terminology and the essence of the instruction description, please refer to the article [**Basic knowledge about configuration files**](https://bestway-1.gitbook.io/documentation/foundational-knowledge/basic-knowledge-about-configuration-files).
{% endhint %}

Additionally, you can explore other types of instructions.

<table data-view="cards"><thead><tr><th></th><th data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td>Include instruction</td><td><a href="/foundational-knowledge/basic-knowledge-about-configuration-files/include-instruction">Include instruction</a></td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FXqe0ZKqSICsAK0XgCyMC%2Fsplash_editor_3.jpg?alt=media&amp;token=ecb5bb0d-d794-4925-a780-f7d98f315d42">default_cover.jpg</a></td></tr><tr><td>Define instruction</td><td><a href="/foundational-knowledge/basic-knowledge-about-configuration-files/define-instruction">Define instruction</a></td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FXqe0ZKqSICsAK0XgCyMC%2Fsplash_editor_3.jpg?alt=media&amp;token=ecb5bb0d-d794-4925-a780-f7d98f315d42">default_cover.jpg</a></td></tr></tbody></table>


# GEM RTS Binary File Formats

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

Each chunk begins with a four-byte magic identifier (FourCC), usually a human-readable combination of four ascii chars, and followed by a data block of variable or zero length.

{% hint style="warning" %}
Because these chunks do not have total size, a parser should calculate it based on a certain structure.
{% endhint %}

All multi-byte values in GEM RTS binary formats are stored in Little-endian format, where the least significant byte is stored first.

## Binary containers

<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 <strong>.ply</strong> format.</td></tr><tr><td><code>.cmesh</code></td><td>Container file that stores one or more collision and physics mesh resources in <strong>.vol</strong> format.</td></tr><tr><td><code>.animation</code></td><td>Container file that stores one or more animation resources in <strong>.anm</strong> format.</td></tr></tbody></table>

## Binary files (legacy)

<table><thead><tr><th width="121.28125">Extension</th><th>Description</th></tr></thead><tbody><tr><td><code>.ply</code></td><td>Mesh resource.<br>In GEM RTS it is stored inside a <code>.mesh</code> container.</td></tr><tr><td><code>.anm</code></td><td><p>Animation resource.</p><p>In GEM RTS it is stored inside an <code>.animation</code> container.</p></td></tr><tr><td><code>.vol</code></td><td><p>Collision and physics mesh resource.</p><p>In GEM RTS it is stored inside a <code>.cmesh</code> container.</p></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>FourCC</td><td>Chunk ID. <br>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>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 0xFF</li><li>uint24 long_length</li><li>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>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.                                     |


# Binary file containers (.mesh, .cmesh, .animation)

Files **.mesh**, **.cmesh**, and **.animation** are containers designed to store multiple files of the same type within a single binary file. The primary purpose of these containers is to reduce the number of individual files in the file system and improve resource loading performance.

Data inside a container is organized as a sequence of chunks. Each chunk begins with a four-character identifier (FourCC, Chunk ID), which defines the type of data stored in the chunk.

The container includes a file table, where each file is represented by its name and `data_offset`.

The size of each file inside the container, except the last one, is determined by the following formula:

```
data_size = entries[N + 1].data_offset - entries[N].data_offset
```

For the last file in the container, its end coincides with the end of the container.

When reading a file, the parser processes chunks sequentially and determines their type by the FourCC value.

{% hint style="danger" %}
Encountering an unknown FourCC value is considered a fatal error. The parser must not skip unknown chunks.
{% endhint %}

**Data structure**

```
PMSH | ANIM | CMHR
MTBL
   entry_count
   entries[entry_count]
       entry_name
       data_offset
   resources[entry_count]
       MESH | EANM | EVLM
           resource_data
```

## Container identifiers

<table><thead><tr><th width="105.73046875">FourCC</th><th width="121.22265625">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>PMSH</code></td><td>uint8[4]</td><td>Mesh container. <br>Contains <code>.ply</code> resources.</td></tr><tr><td><code>ANIM</code></td><td>uint8[4]</td><td>Animation container. <br>Contains <code>.anm</code> resources.</td></tr><tr><td><code>CMHR</code></td><td>uint8[4]</td><td>Physics and collision volume container. <br>Contains <code>.vol</code> resources.</td></tr></tbody></table>

## Chunk `MTBL`

Contains a list of all files stored inside the container, as well as offsets to the corresponding data.

**Data structure**

```
MTBL
   entry_count
   entries[entry_count]
       entry_name
       data_offset
   resources[entry_count]
```

<table><thead><tr><th width="121.75390625">Name</th><th width="176.37109375">Type</th><th width="88.15234375">Size</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td>4</td><td><code>MTBL</code></td></tr><tr><td>entry_count</td><td>uint32</td><td>4</td><td>Number of entries in the table</td></tr><tr><td>entries</td><td>struct[entry_count]</td><td></td><td>Array of container entries</td></tr></tbody></table>

### Container entry array (struct)

<table><thead><tr><th width="130.69921875">Name</th><th width="93.1171875">Type</th><th width="76.21875">Size</th><th>Description</th></tr></thead><tbody><tr><td>entry_name</td><td>string8</td><td>1+</td><td>Entry name</td></tr><tr><td>data_offset</td><td>uint32</td><td>4</td><td>Offset of the resource data. It’s relative, the end of the <code>MTBL</code> chunk is considered as 0.</td></tr></tbody></table>

## Chunk `MESH`

Contains data in the **.ply** format.

<table><thead><tr><th width="107.140625">Name</th><th width="110.5546875">Type</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td><code>MESH</code></td></tr><tr><td>ply_data</td><td>.ply</td><td>Mesh data in the <strong>.ply</strong> format.</td></tr></tbody></table>

## Chunk `EANM`

Contains data in the **.anm** format.

<table><thead><tr><th width="123.5703125">Name</th><th width="112.66796875">Type</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td><code>EANM</code></td></tr><tr><td>anm_data</td><td>.anm</td><td>Animation data in the <strong>.anm</strong> format.</td></tr></tbody></table>

## Chunk `EVLM`

Contains data in the **.vol** format.

<table><thead><tr><th width="107.9296875">Name</th><th width="99.33984375">Type</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td><code>EVLM</code></td></tr><tr><td>vol_data</td><td>.vol</td><td>Volume data in the <strong>.vol</strong> format.</td></tr></tbody></table>


# PLY format (.ply)

## Overview

The `.ply` is a chunk-based format used to store meshes in engines of the GEM family.

{% hint style="warning" %}
Chunk loading must continue until the end of the file.
{% endhint %}

{% hint style="warning" %}
Because chunk size is not stored, it must be calculated by the parser based on the chunk data structure.
{% endhint %}

Each file may contain:

* static meshes;
* skinned meshes;
* landscape meshes;
* terrain grids;
* adjacency data;
* shadow data;
* multiple UV channels;
* tangent space;
* skinning
* materials and textures

**File structure**

```
EPLY | BPLY | PM01
chunk ID loop
   INDX | IND4
   VERT
   BAS2
   InfG
   BNDS
   ADJA
   SHDW
   MROR
   MARK
   SKIN
   MESH | SBM1 | SUBM
```

{% hint style="warning" %}
The order of chunks inside the loop is not fixed, and some of them may not be present. \
The parser must determine the chunk type from its FourCC value and process the data accordingly.
{% endhint %}

## File header

Each `.ply` file begins with one of the following identifiers:

| Name | Type      | Size | Description                         |
| ---- | --------- | ---- | ----------------------------------- |
| EPLY | uint8\[4] | 4    | Regular mesh with 16-bit indices    |
| BPLY | uint8\[4] | 4    | Landscape mesh with 32-bit indices. |
| PM01 | uint8\[4] | 4    | GEM3 mesh format                    |

The starting FourCC is a file format identifier, it is not a regular chunk. After reading the starting FourCC, the parser reads the rest of the file as a sequence of chunks.

## Chunk IDs

| FourCC         | Purpose                 |
| -------------- | ----------------------- |
| INDX           | Mesh indices (16-bit)   |
| IND4           | Mesh indices (32-bit)   |
| VERT           | Vertex data             |
| BAS2           | Terrain grid basis      |
| InfG           | Terrain grid            |
| BNDS           | Bounding box            |
| ADJA           | Adjacency               |
| SHDW           | Shadow data             |
| MROR           | Mirrored mesh flag      |
| MARK           | Markup data             |
| SKIN           | Bone map                |
| MESH           | Legacy submesh          |
| SBM1           | GEM RTS 1.1+ submesh    |
| SUBM (GEM RTS) | GEM3 / GEM RTS submesh  |
| SUBM (AS2)     | Assault Squad 2 submesh |

{% hint style="warning" %}
There are two incompatible variants of the `SUBM` chunk. The chunk structure depends on the resource starting FourCC value. The parser must choose the appropriate `SUBM` variant according to the starting FourCC.
{% endhint %}

## Chunk ID loading loop

### Chunk `INDX` | `IND4`

**Data structure**

```
INDX | IND4
   index_count
   indices[index_count]
```

#### Chunk `INDX`

<table><thead><tr><th width="130.00390625">Name</th><th width="180.3828125">Type</th><th width="83.71875">Size</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td>4</td><td><code>INDX</code><br>Mesh indices</td></tr><tr><td>index_count</td><td>int32</td><td>4</td><td>Number of indices</td></tr><tr><td>indices</td><td>uint16[index_count]</td><td>2</td><td>Index array. <br>Index size is determined by the starting chunk ID</td></tr></tbody></table>

#### Chunk `IND4`

<table><thead><tr><th width="136.6328125">Name</th><th width="184.02734375">Type</th><th width="82.171875">Size</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td>4</td><td><code>IND4</code><br>Mesh indices</td></tr><tr><td>index_count</td><td>int32</td><td>4</td><td>Number of indices</td></tr><tr><td>indices</td><td>uint32[index_count]</td><td>4</td><td>Index array. <br>Index size is determined by the starting chunk ID</td></tr></tbody></table>

### Chunk `VERT`

```
VERT
   vertex_count
   vertex_size
   vertex_flags

   vertices[vertex_count]
       vertex data
```

<table><thead><tr><th width="128.1015625">Name</th><th width="179.78515625">Type</th><th width="94.51953125">Size</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td>4</td><td><code>VERT</code></td></tr><tr><td>vertex_count</td><td>int32</td><td>4</td><td>Number of vertices</td></tr><tr><td>vertex_size</td><td>uint16</td><td>2</td><td>Size of a single vertex in bytes. <br>The engine primarily relies on this value even if the size calculated from flags is smaller</td></tr><tr><td>vertex_flags</td><td>uint16</td><td>2</td><td>Vertex flag bit mask</td></tr><tr><td>vertices</td><td>struct[vertex_count]</td><td></td><td>Vertex array. <br>Vertex structure depends on the submesh format</td></tr></tbody></table>

#### FVF

Vertex flags are combined using a bit mask.

<table><thead><tr><th width="119.578125">Bit</th><th>Description</th></tr></thead><tbody><tr><td>0x0001</td><td>Full color. <br>If the flag is absent, vertex colors are multiplied by 2 after loading</td></tr><tr><td>0x0002</td><td>Optimized vertex order. <br>If the flag is absent, the engine may attempt to optimize the mesh automatically after loading</td></tr><tr><td>0x0004</td><td>Color verified. <br>*) Not used in GEM RTS</td></tr></tbody></table>

#### Vertices struct\[vertex\_count]

<table><thead><tr><th width="160.82421875">Name</th><th width="107.59375">Type</th><th width="69.90625">Size</th><th>Description</th></tr></thead><tbody><tr><td>position</td><td>float[3]</td><td>12</td><td>Vertex position in local coordinates</td></tr><tr><td>normal</td><td>float[3]</td><td>12</td><td>Normal vector in local coordinates</td></tr><tr><td>tangent</td><td>float[3]</td><td>12</td><td>Tangent vector in local coordinates. Optional</td></tr><tr><td>uv</td><td>float[2]</td><td>8</td><td>Texture UV coordinates. Multiple UV sets are supported</td></tr><tr><td>bone_indices</td><td>uint8[4]</td><td>4</td><td>Indices into the local submesh bone remap</td></tr><tr><td>bone_weights</td><td>uint8[4]</td><td>4</td><td>Bone weights stored in UNORM8 format (0..1)</td></tr></tbody></table>

### Chunk `BAS2`

Terrain grid basis.

```
BAS2
   polygons
       center
       axis_x
       axis_y

   texture
       center
       axis_x
       axis_y
```

| Name             | Type      | Size | Description                                         |
| ---------------- | --------- | ---- | --------------------------------------------------- |
| FourCC           | uint8\[4] | 4    | `BAS2`                                              |
| polygons.center  | float\[2] | 8    | Origin of the triangle generation coordinate system |
| polygons.axis\_x | float\[2] | 8    | X axis of the triangle generation coordinate system |
| polygons.axis\_y | float\[2] | 8    | Y axis of the triangle generation coordinate system |
| texture.center   | float\[2] | 8    | Origin of the UV coordinate system                  |
| texture.axis\_x  | float\[2] | 8    | X axis of UV space                                  |
| texture.axis\_y  | float\[2] | 8    | Y axis of UV space                                  |

### Chunk `InfG`

Terrain triangle grid.

```
InfG
   grid_start_xy
   grid_end_xy
   face_count

   faces[face_count]
       submesh : 15
       invalid : 1
```

<table><thead><tr><th width="134.56640625">Name</th><th width="174.63671875">Type</th><th width="80.75390625">Size</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td>4</td><td><code>InfG</code> <br>Terrain grid</td></tr><tr><td>grid_start_xy</td><td>int32[2]</td><td>8</td><td>Grid starting coordinates</td></tr><tr><td>grid_end_xy</td><td>int32[2]</td><td>8</td><td>Grid ending coordinates</td></tr><tr><td>face_count</td><td>uint32</td><td>4</td><td>Number of triangles</td></tr><tr><td>faces</td><td>uint16[face_count]</td><td></td><td>Triangle data array</td></tr></tbody></table>

#### Bit layout of `faces`

<table><thead><tr><th width="130.953125">Bit</th><th>Description / Value</th></tr></thead><tbody><tr><td>0x7FFF</td><td>Submesh index <code>submesh: 15</code></td></tr><tr><td>0x8000</td><td>Invalid triangle flag <code>invalid: 1</code></td></tr></tbody></table>

### Chunk `BNDS`

Axis-aligned mesh bounding box.

```
BNDS
   min
   max
```

<table><thead><tr><th width="113.6484375">Name</th><th width="105.11328125">Type</th><th width="80.0859375">Size</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td>4</td><td><code>BNDS</code><br>Mesh bounding box</td></tr><tr><td>min</td><td>float[3]</td><td>12</td><td>Minimum XYZ coordinates</td></tr><tr><td>max</td><td>float[3]</td><td>12</td><td>Maximum XYZ coordinates</td></tr></tbody></table>

### Chunk `ADJA`

Information about adjacent triangles.

\*) Not used in GEM RTS.

```
ADJA
   face_count
   adjacencies[face_count]
       neighbours[3]
```

<table><thead><tr><th width="125.87109375">Name</th><th width="167.296875">Type</th><th width="78.6640625">Size</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td>4</td><td><code>ADJA</code><br>Adjacency information</td></tr><tr><td>face_count</td><td>int32</td><td>4</td><td>Number of triangles</td></tr><tr><td>adjacencies</td><td>struct[face_count]</td><td></td><td>Triangle neighbour information</td></tr></tbody></table>

#### Adjacencies (struct)

<table><thead><tr><th width="110.2578125">Name</th><th width="97.23828125">Type</th><th width="82.93359375">Size</th><th>Description</th></tr></thead><tbody><tr><td>neighbours</td><td>uint16[3]</td><td>6</td><td>Indices of neighbouring triangles.<br> <code>0xFFFF</code> means no neighbour</td></tr></tbody></table>

### Chunk `SHDW`

Shadow information.

\*) Not used in GEM RTS.

```
SHDW
   face_count
   shadow_infos[face_count]
```

<table><thead><tr><th width="134.32421875">Name</th><th width="159.14453125">Type</th><th width="80.99609375">Size</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td>4</td><td><code>SHDW</code> <br>Shadow information</td></tr><tr><td>face_count</td><td>int32</td><td>4</td><td>Number of triangles</td></tr><tr><td>shadow_infos</td><td>uint8[face_count]</td><td></td><td><p>Shadow casting flags: </p><ul><li>0: does not cast shadows </li><li>1: casts shadows</li></ul></td></tr></tbody></table>

### Chunk `MROR`

Mirrored mesh flag.

<table><thead><tr><th width="90.2734375">Name</th><th width="115.2578125">Type</th><th width="94.84765625">Size</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td>4</td><td><code>MROR</code> <br>Indicates a mirrored mesh</td></tr></tbody></table>

### Chunk `MARK`

Triangle markup.

\*) Not used in GEM RTS.

```
MARK
   mark_size
   marks[mark_size]
```

<table><thead><tr><th width="118.75390625">Name</th><th width="155.1875">Type</th><th width="80.4296875">Size</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td>4</td><td><code>MARK</code></td></tr><tr><td>mark_size</td><td>uint32</td><td>4</td><td>Size of markup data</td></tr><tr><td>marks</td><td>uint8[mark_size]</td><td></td><td>Binary markup data</td></tr></tbody></table>

### Chunk `SKIN`

Bone map for a skinned mesh.

```
SKIN
   bone_count

   bone_names[bone_count]
       bone_name
```

<table><thead><tr><th width="129.66015625">Name</th><th width="179.41015625">Type</th><th width="82.44921875">Size</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td>4</td><td><code>SKIN</code></td></tr><tr><td>bone_count</td><td>uint32</td><td>4</td><td>Number of bones</td></tr><tr><td>bone_names</td><td>string8[bone_count]</td><td></td><td>Bone names</td></tr></tbody></table>

### Chunk `SUBM` (GEM RTS, GEM3)

Submesh description format used by GEM3 and GEM RTS models.

The file must start with the `PM01` format identifier.

```
SUBM
   vertex_format
   face_start
   face_count
   vertex_start
   vertex_count
   mesh_flags

   [if mesh_flags contains skin]
       bone_count
       bone_map[bone_count]

   material_name
```

<table><thead><tr><th width="156.01953125">Name</th><th width="116.69140625">Type</th><th width="84.8515625">Size</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td>4</td><td><code>SUBM</code></td></tr><tr><td>vertex_format</td><td>uint16</td><td>2</td><td>Vertex format bit mask</td></tr><tr><td>face_start</td><td>uint16</td><td>2</td><td>Index of the first triangle in the submesh</td></tr><tr><td>face_count</td><td>uint16</td><td>2</td><td>Number of triangles in the submesh</td></tr><tr><td>vertex_start</td><td>uint16</td><td>2</td><td>Index of the first vertex in the submesh. Not used in GEM RTS</td></tr><tr><td>vertex_count</td><td>uint16</td><td>2</td><td>Number of vertices in the submesh. Not used in GEM RTS</td></tr><tr><td>mesh_flags</td><td>uint16</td><td>2</td><td>Bit flags describing mesh properties</td></tr><tr><td>material_name</td><td>string8/24</td><td>1+</td><td>Material name</td></tr></tbody></table>

#### Bit field `vertex_format`&#x20;

<table><thead><tr><th width="119.0546875">Value</th><th width="123.96875">Type</th><th>Comment</th></tr></thead><tbody><tr><td>0x0001</td><td>float[3]</td><td>Position</td></tr><tr><td>0x0002</td><td>float[3]</td><td>Normal</td></tr><tr><td>0x0004</td><td>uint8[4]</td><td>Color 0, RGBA</td></tr><tr><td>0x0008</td><td>uint8[4]</td><td>Color 1, RGBA</td></tr><tr><td>0x0010</td><td>float[2]</td><td>Texture coordinates 0</td></tr><tr><td>0x0020</td><td>float[2]</td><td>Texture coordinates 1</td></tr><tr><td>0x0040</td><td>float[2]</td><td>Texture coordinates 2</td></tr><tr><td>0x0080</td><td>float[2]</td><td>Texture coordinates 3</td></tr><tr><td>0x0100</td><td>float[4]</td><td>Tangent</td></tr><tr><td>0x0200</td><td>uint8</td><td>Skinning with 2 bones</td></tr><tr><td>0x0400</td><td>uint8[2]</td><td>Skinning with 3 bones</td></tr><tr><td>0x0600</td><td>uint8[3]</td><td>Skinning with 4 bones. Both 0x0200 and 0x0400 bits are set simultaneously</td></tr><tr><td>0x0800</td><td>float</td><td>Wind amplitude</td></tr></tbody></table>

#### Bit mask for `mesh_flags`&#x20;

<table><thead><tr><th width="121.30078125">Value</th><th>Description</th></tr></thead><tbody><tr><td>0x0001</td><td>Double-sided mesh</td></tr><tr><td>0x0002</td><td>Skin</td></tr></tbody></table>

#### Skin data

Present only if the `0x0002` (`skin`) flag is set in `mesh_flags`.

```
bone_count
bone_map[bone_count]
```

<table><thead><tr><th width="120.35546875">Name</th><th width="169.41015625">Type</th><th width="115.30859375">Size</th><th>Description</th></tr></thead><tbody><tr><td>bone_count</td><td>uint8</td><td>1</td><td>Number of bones used by the skin</td></tr><tr><td>bone_map</td><td>uint8[bone_count]</td><td>bone_count</td><td>Bone indices in the bone map</td></tr></tbody></table>

{% hint style="info" %}
Vertex `bone_indices` reference entries in the local `bone_map` array rather than directly indexing the global `SKIN` chunk. This local remapping allows each submesh to use only the subset of bones required for its vertices.
{% endhint %}

#### Values of `bone_map`&#x20;

<table><thead><tr><th width="107.1015625">Value</th><th>Meaning</th></tr></thead><tbody><tr><td>0</td><td>Use the mesh's global transform matrix</td></tr><tr><td>N > 0</td><td>Use <code>SKIN.bones[N - 1]</code></td></tr></tbody></table>

### Chunk `SBM1`

GEM RTS 1.1+ submesh format used for map meshes.

```
SBM1

vertex_elements[] loop
   type_usage
   usage_index
   stream_index

tags[] loop
   tag_index
   tag_chunk

face_start
face_count
mesh_flags
material_name
```

<table><thead><tr><th width="164.7890625">Name</th><th width="111.14453125">Type</th><th width="76.7265625">Size</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td>4</td><td><code>SBM1</code></td></tr><tr><td>vertex_elements</td><td>struct[]</td><td></td><td>Vertex element descriptors</td></tr><tr><td>tags</td><td>struct[]</td><td></td><td>List of custom vertex tags</td></tr><tr><td>face_start</td><td>int32</td><td>4</td><td>Index of the first triangle in the submesh</td></tr><tr><td>face_count</td><td>int32</td><td>4</td><td>Number of triangles in the submesh</td></tr><tr><td>mesh_flags</td><td>uint32</td><td>4</td><td>Mesh bit flags</td></tr><tr><td>material_name</td><td>string8/24</td><td>1+</td><td>Material name</td></tr></tbody></table>

#### Vertex format elements

The `vertex_elements[]` array describes the vertex layout.

The list does not contain an element count and is read sequentially until a terminator element is encountered.

The `type_usage` field stores both the element type and its semantic:

* `(type_usage & 0x0F)` specifies the element type.
* `(type_usage & 0xF0) >> 4` specifies the element usage.

The value `0xFF` is used as the list terminator and ends vertex format parsing.

#### Element structure

<table><thead><tr><th width="125.26953125">Name</th><th width="86.48828125">Type</th><th width="79.5859375">Size</th><th>Description</th></tr></thead><tbody><tr><td>type_usage</td><td>uint8</td><td>1</td><td>Element type and semantic</td></tr><tr><td>usage_index</td><td>uint8</td><td>1</td><td>Usage index</td></tr><tr><td>stream_index</td><td>uint8</td><td>1</td><td>Stream index</td></tr></tbody></table>

#### Element type

Determined by the lower four bits of `type_usage`.

<table><thead><tr><th width="86.5859375">Value</th><th width="112.00390625">Name</th><th width="90.15625">Type</th><th>Comment</th></tr></thead><tbody><tr><td>0</td><td>FLOAT1</td><td>float</td><td></td></tr><tr><td>1</td><td>FLOAT2</td><td>float[2]</td><td></td></tr><tr><td>2</td><td>FLOAT3</td><td>float[3]</td><td></td></tr><tr><td>3</td><td>FLOAT4</td><td>float[4]</td><td></td></tr><tr><td>4</td><td>SHORT2</td><td>int16[2]</td><td></td></tr><tr><td>5</td><td>BYTE4</td><td>uint8[4]</td><td></td></tr><tr><td>6</td><td>COLOR</td><td>uint8[4]</td><td>RGBA</td></tr><tr><td>7</td><td>HALF4</td><td>float[4]</td><td>Half-precision</td></tr><tr><td>8</td><td>BYTE4N</td><td>uint8[4]</td><td>UNORM8</td></tr></tbody></table>

#### Element usage

Determined by the upper four bits of `type_usage`.

```
usage = high nibble of type_usage
```

| Value | Description   |
| ----- | ------------- |
| 0     | POSITION      |
| 1     | NORMAL        |
| 2     | COLOR         |
| 3     | TEXCOORD      |
| 4     | BLEND WEIGHT  |
| 5     | BLEND INDICES |
| 6     | TANGENT       |

#### Vertex tags

The `tags[]` list contains additional user-defined tags for vertex elements.

The list does not contain an element count and is read sequentially until a terminator element is encountered.

The value `0xFF` is used as the tag list terminator.

#### Tag structure

| Name       | Type   | Size | Description          |
| ---------- | ------ | ---- | -------------------- |
| tag\_index | uint8  | 1    | Vertex element index |
| tag\_chunk | uint32 | 4    | Tag identifier       |

#### Bit mask for  `mesh_flags`&#x20;

<table><thead><tr><th width="128.30859375">Value</th><th>Description</th></tr></thead><tbody><tr><td>0x0001</td><td>Two-sided mesh (render without back-face culling)</td></tr><tr><td>0x0002</td><td>Use alpha (compatibility mode)</td></tr><tr><td>0x0004</td><td>Use realtime scene lighting</td></tr><tr><td>0x0008</td><td>Use player color lighting</td></tr><tr><td>0x0010</td><td>Skinned mesh</td></tr><tr><td>0x0020</td><td>Shadow volume mesh</td></tr><tr><td>0x0040</td><td>Mirrored mesh (negative scaling)</td></tr><tr><td>0x0080</td><td>Blend by second texture alpha</td></tr><tr><td>0x0100</td><td>Bump mapping (compatibility mode)</td></tr><tr><td>0x0200</td><td>Specular color is stored</td></tr><tr><td>0x0400</td><td>Uses materials instead of textures</td></tr><tr><td>0x0800</td><td>Sub-skin feature</td></tr><tr><td>0x1000</td><td>Two textures share a single texture coordinate set</td></tr><tr><td>0x2000</td><td>Uses VD (compatibility mode)</td></tr><tr><td>0x4000</td><td>Contains a lightmap</td></tr></tbody></table>

### Chunk `MESH`

Legacy submesh format used in [*Faces of War*](https://bestway.com.ua/games/faces-of-war/) and [*Men of War*](https://bestway.com.ua/games/men-of-war/).

```
MESH
   fvf
   face_start
   face_count
   mesh_flags

   [if mesh_flags contains specular]
       specular_color

   [if mesh_flags contains use material]
       material_name

   [otherwise]
       texture data
           [if mesh_flags contains specular or bump]
               diffuse
                   [if mesh_flags contains specular]
                       specular_texture
                   [if mesh_flags contains bump]
                       bump_texture
           [otherwise]
               [if uv == 2 or mesh_flags contains "two textures with one texcoord"]
                   diffuse_0
                   diffuse_1
               [otherwise]
                   diffuse

   [if mesh_flags contains skinned mesh]
       bone_map_size
       bone_map[bone_map_size]
```

| Name        | Type      | Size | Description                                       |
| ----------- | --------- | ---- | ------------------------------------------------- |
| FourCC      | uint8\[4] | 4    | <p><code>MESH</code><br>Legacy submesh format</p> |
| fvf         | uint32    | 4    | Vertex format bit mask                            |
| face\_start | int32     | 4    | Index of the first triangle                       |
| face\_count | int32     | 4    | Number of triangles                               |
| mesh\_flags | uint32    | 4    | Mesh bit flags                                    |

#### Vertex format flags (FVF)

Bit mask describing the vertex format.

The `fvf` field contains a `uint32` bit mask. The values shown below represent vertex layouts encountered in the format. If a value not listed in the table is found in a file, it should be interpreted as a combination of the corresponding flags.

For example, the value `0x00000012` is stored in the file as the byte sequence `12 00 00 00` (Little-endian). If flags `0x00000002` and `0x00000010` correspond to `position` and `normal`, then `0x00000012` indicates that both fields are present in the vertex.

| Mask       | Description                                                      |
| ---------- | ---------------------------------------------------------------- |
| 0x002      | `position float[3]`                                              |
| 0x006      | `position float[3] blend_weight uint8 blend_indices uint8[4]`    |
| 0x008      | `position float[3] blend_weight uint8[2] blend_indices uint8[4]` |
| 0x00A      | `position float[3] blend_weight uint8[3] blend_indices uint8[4]` |
| 0x010      | `normal float[3]`                                                |
| 0x040      | `diffuse_color uint8[4]`                                         |
| 0x080      | `specular_color uint8[4]`                                        |
| 0xN00      | `texcoord_mask N × float[2]`                                     |
| 0x8000E000 | `tangent float[4]`                                               |

#### Bit mask for  `mesh_flags`&#x20;

<table><thead><tr><th width="119.578125">Value</th><th>Description</th></tr></thead><tbody><tr><td>0x0001</td><td>Two-sided mesh (render without back-face culling)</td></tr><tr><td>0x0002</td><td>Use alpha (compatibility mode)</td></tr><tr><td>0x0004</td><td>Use realtime scene lighting</td></tr><tr><td>0x0008</td><td>Use player color lighting</td></tr><tr><td>0x0010</td><td>Skinned mesh</td></tr><tr><td>0x0020</td><td>Shadow volume mesh</td></tr><tr><td>0x0040</td><td>Mirrored (negative scaling)</td></tr><tr><td>0x0080</td><td>Blend by second texture alpha</td></tr><tr><td>0x0100</td><td>Bump (compatibility mode)</td></tr><tr><td>0x0200</td><td>Specular</td></tr><tr><td>0x0400</td><td>Use material</td></tr><tr><td>0x0800</td><td>Sub-skin feature</td></tr><tr><td>0x1000</td><td>Two textures with one texcoord</td></tr><tr><td>0x2000</td><td>Using VD (compatibility mode)</td></tr><tr><td>0x4000</td><td>Has lightmap</td></tr></tbody></table>

#### Specular color

Present if `mesh_flags` contains `0x0200` (`specular`).

| Name            | Type      | Size | Description    |
| --------------- | --------- | ---- | -------------- |
| specular\_color | uint8\[4] | 4    | Specular color |

#### Material name

Present if `mesh_flags` contains `0x0400` (`use material`).

| Name           | Type       | Size | Description   |
| -------------- | ---------- | ---- | ------------- |
| material\_name | string8/24 | 1+   | Material name |

#### Texture data

Texture data is loaded when `mesh_flags` does not contain `0x0400` (`use material`). The structure depends on the `specular`, `bump`, number of texture coordinate sets (UV), and the `two textures with one texcoord` flag.

#### Texture data for standard material

Used when `mesh_flags` contains `specular` or `bump`.

<table><thead><tr><th width="162.1328125">Name</th><th width="104.28515625">Type</th><th width="76.80078125">Size</th><th>Description</th></tr></thead><tbody><tr><td>diffuse</td><td>string8/24</td><td>1+</td><td>Diffuse texture name</td></tr><tr><td>specular_texture</td><td>string8/24</td><td>1+</td><td>Specular texture name. Present if <code>mesh_flags</code> contains <code>specular</code></td></tr><tr><td>bump_texture</td><td>string8/24</td><td>1+</td><td>Normal map texture name. Present if <code>mesh_flags</code> contains <code>bump</code></td></tr></tbody></table>

#### Texture data for two textures

Used if the standard material path is not used and one of the following conditions is true:

* `uv == 2`
* `mesh_flags` contains `two textures with one texcoord`

| Name       | Type       | Size | Description            |
| ---------- | ---------- | ---- | ---------------------- |
| diffuse\_0 | string8/24 | 1+   | Diffuse texture 0 name |
| diffuse\_1 | string8/24 | 1+   | Diffuse texture 1 name |

#### Texture data for one texture

Used if the standard material path is not used and the conditions for using two textures are not met.

| Name    | Type       | Size | Description          |
| ------- | ---------- | ---- | -------------------- |
| diffuse | string8/24 | 1+   | Diffuse texture name |

#### Skin data

Skin data is present if `mesh_flags` contains `skinned mesh`.

<table><thead><tr><th width="152.015625">Name</th><th width="192.71484375">Type</th><th width="148.43359375">Size</th><th>Description</th></tr></thead><tbody><tr><td>bone_map_size</td><td>uint8</td><td>1</td><td>Size of the local bone remapping table</td></tr><tr><td>bone_map</td><td>uint8[bone_map_size]</td><td>bone_map_size</td><td>Local bone remapping table</td></tr></tbody></table>

The `bone_map` table is used to map submesh bones to the global bone map stored in the `SKIN` chunk.

Each array element contains the index of a bone from `SKIN`, incremented by 1.

Vertex `bone_index` values reference entries in the `bone_map` array rather than directly indexing bones in `SKIN`.

This allows a submesh to use only the subset of bones required by its vertices.

#### Values of `bone_map`&#x20;

<table><thead><tr><th width="88.81640625">Value</th><th>Meaning</th></tr></thead><tbody><tr><td>0</td><td>Use the mesh's global transform matrix</td></tr><tr><td>N > 0</td><td>Use <code>SKIN.bones[N - 1]</code></td></tr></tbody></table>

### Chunk `SUBM` (Assault Squad 2)

Submesh description format used by map meshes from *Assault Squad 2*. This format is used when the starting chunk is not `PM01`.

```
SUBM
   vertex_elements[]
       type_usage

   face_start
   face_count
   unknown[2]
   mesh_flags
   material_name
```

| Name             | Type       | Size | Description                                |
| ---------------- | ---------- | ---- | ------------------------------------------ |
| FourCC           | uint8\[4]  | 4    | SUBM                                       |
| vertex\_elements | struct\[]  |      | List of vertex format elements             |
| face\_start      | uint32     | 4    | Index of the first triangle in the submesh |
| face\_count      | uint32     | 4    | Number of triangles in the submesh         |
| unknown\[2]      | uint32\[2] | 8    | Unknown data                               |
| mesh\_flags      | uint32     | 4    | Mesh bit flags                             |
| material\_name   | string8    | 1+   | Material name                              |

#### Vertex elements info

The `vertex_elements[]` list describes the vertex layout.

The list does not contain an element count and is read sequentially until a terminator element is encountered.

The `type_usage` field stores both the element type and its semantic.

* `(type_usage & 0x0F)` determines the element type.
* `(type_usage & 0xF0) >> 4` determines the element usage.

The value `0xFF` is used as the list terminator and ends vertex format parsing.

| Name        | Type  | Size | Description               |
| ----------- | ----- | ---- | ------------------------- |
| type\_usage | uint8 | 1    | Element type and semantic |

#### Element type

Determined by the lower four bits of the `type_usage` field.

<table><thead><tr><th width="75.28515625">Value</th><th width="104.07421875">Name</th><th width="105.12109375">Type</th><th>Comment</th></tr></thead><tbody><tr><td>0</td><td>FLOAT1</td><td>float</td><td></td></tr><tr><td>1</td><td>FLOAT2</td><td>float[2]</td><td></td></tr><tr><td>2</td><td>FLOAT3</td><td>float[3]</td><td></td></tr><tr><td>3</td><td>FLOAT4</td><td>float[4]</td><td></td></tr><tr><td>4</td><td>SHORT2</td><td>int16[2]</td><td></td></tr><tr><td>5</td><td>BYTE4</td><td>uint8[4]</td><td></td></tr><tr><td>6</td><td>COLOR</td><td>uint8[4]</td><td>RGBA</td></tr><tr><td>7</td><td>HALF4</td><td>float[4]</td><td>Half-precision</td></tr><tr><td>8</td><td>BYTE4N</td><td>uint8[4]</td><td>UNORM8</td></tr></tbody></table>

#### Element usage

Determined by the upper four bits of the `type_usage` field.

<table><thead><tr><th width="102.59765625">Value</th><th>Description</th></tr></thead><tbody><tr><td>0</td><td>POSITION</td></tr><tr><td>1</td><td>NORMAL</td></tr><tr><td>2</td><td>COLOR</td></tr><tr><td>3</td><td>TEXCOORD</td></tr><tr><td>4</td><td>BLEND WEIGHT</td></tr><tr><td>5</td><td>BLEND INDICES</td></tr><tr><td>6</td><td>TANGENT</td></tr></tbody></table>

#### Bit mask for `mesh_flags`&#x20;

<table><thead><tr><th width="133.25390625">Value</th><th>Description</th></tr></thead><tbody><tr><td><code>0x0001</code></td><td>Two-sided mesh (render this mesh without culling)</td></tr><tr><td><code>0x0002</code></td><td>Use alpha (compatibility mode)</td></tr><tr><td><code>0x0004</code></td><td>Use realtime scene lighting</td></tr><tr><td><code>0x0008</code></td><td>Use player color lighting</td></tr><tr><td><code>0x0010</code></td><td>Skinned mesh</td></tr><tr><td><code>0x0020</code></td><td>Shadow volume mesh</td></tr><tr><td><code>0x0040</code></td><td>Mirrored (has negative scaling)</td></tr><tr><td><code>0x0080</code></td><td>Blend by second texture alpha</td></tr><tr><td><code>0x0100</code></td><td>Bump (compatibility mode)</td></tr><tr><td><code>0x0200</code></td><td>Specular color stored</td></tr><tr><td><code>0x0400</code></td><td>Format with material instead of textures</td></tr><tr><td><code>0x0800</code></td><td>Sub-skin feature</td></tr><tr><td><code>0x1000</code></td><td>Two textures with one texcoord</td></tr><tr><td><code>0x2000</code></td><td>Using VD (compatibility mode)</td></tr><tr><td><code>0x4000</code></td><td>Has lightmap</td></tr></tbody></table>


# ANM format (.anm)

## Overview

Format `.anm` is used to store animations of skeletal models in engines of the GEM family.\
GEM RTS supports all previous versions of the animation format.\
Each file may contain:

* frame range parameters;
* bone map;
* animation keys;
* visibility data;
* mesh animation;
* optional comments.

**File structure**

```
EANM
version
FRMS
    frame_max + 1
CMNT
    size
    comment[size]
BMAP
    bone_count
    bones [bone_count]
        bone_name
frame cycle
    FRMN | FRM2 | FRM3
```

## Chunks

### File Header

Content verifier. Confirms that the file contains animation.

<table><thead><tr><th width="117.13671875">Name</th><th width="93.76171875">Type</th><th width="78.03515625">Size</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td>4</td><td><code>EANM</code></td></tr><tr><td>version</td><td>int16[2]</td><td>4</td><td>Format version. The first 2 bytes contain <code>major</code>, the second 2 bytes contain <code>minor</code>:<br><code>0x00040000</code> version 4.0 (GEM1, Soldiers Heroes of World War II)<br><code>0x00060000</code> version 6.0 (GEM2, Men of War)<br><code>0x00060001</code> version 6.1 (GEM2.5, Majesty2; GEM RTS, Men of War II)<br>GEM RTS supports all versions</td></tr></tbody></table>

### Chunk `FRMS`

Specifies the maximum frame number in the animation.

**Data structure**

```
FRMS
    frame_max + 1
```

<table><thead><tr><th width="145.92578125">Name</th><th width="102.61328125">Type</th><th width="82.23046875">Size</th><th>Description</th></tr></thead><tbody><tr><td><code>FourCC</code></td><td>uint8[4]</td><td>4</td><td><code>FRMS</code></td></tr><tr><td><code>frame_max + 1</code></td><td>int32</td><td>4</td><td>The value is 1 greater than the maximum frame number.</td></tr></tbody></table>

### Chunk `CMNT`

An optional comment chunk. Also used as a GEM3 format flag.

**Data structure**

```
CMNT
    size
    comment[size]
```

<table><thead><tr><th width="112.7578125">Name</th><th width="108.5">Type</th><th width="79.3515625">Size</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td>4</td><td><code>CMNT</code></td></tr><tr><td>size</td><td>uint16</td><td>2</td><td>Comment size in bytes</td></tr><tr><td>comment</td><td>char[size]</td><td>1+</td><td>Comment text</td></tr></tbody></table>

### Chunk `BMAP`

Animation bones map. Supports LOD via suffix `._lod<lod_number>` in the name of a bone.

**Data structure**

```
BMAP
    bone_count
    bones[bone_count]
         bone_name
```

<table><thead><tr><th width="122.77734375">Name</th><th width="168.609375">Type</th><th width="80.10546875">Size</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td>4</td><td><code>BMAP</code></td></tr><tr><td>bone_count</td><td>int32</td><td>4</td><td>The number of bones in the map. Regardless of type <code>int32</code>, version 6.1 supports no more than 255 bones</td></tr><tr><td>bones</td><td>struct[bone_count]</td><td></td><td>Bone data array</td></tr></tbody></table>

**Description of the bone array**

<table><thead><tr><th width="124.0703125">Name</th><th width="132.71875">Type</th><th width="77.1796875">Size</th><th>Description</th></tr></thead><tbody><tr><td>bone_name</td><td>string8/24 or string32</td><td>1+</td><td>Name of the bone. If the GEM3 format is used, the following applies <code>string8/24</code>. For older formats, use <code>string32</code></td></tr></tbody></table>

## Frame cycles

After the bone map, a sequence of animation frames begins.

**Data structure**

```
frame cycle
    FRMN | FRM2 | FRM3
```

The chunk type depends on the animation format version.

<table><thead><tr><th width="170.27734375">Frame format identifier</th><th width="100.73828125">Version</th><th>Comment</th></tr></thead><tbody><tr><td>FRMN</td><td>V1</td><td>Supported since GEM1</td></tr><tr><td>FRM2</td><td>V2</td><td>Supported since GEM2</td></tr><tr><td>FRM3</td><td>V3</td><td>Supported since GEM2.5 / GEM RTS</td></tr></tbody></table>

\*) GEM RTS supports all format versions.

### Frame format V1 (`FRMN`)

Used in GEM1.

**Data structure**

```
FRMN
frame_no
cycle
     BONE
     index
     cycle
          MATR
               matrix
          VISI
               visibility
          MESH
               size
               mesh_data[size]
```

#### **Frame Verifier V1**

<table><thead><tr><th width="117.1484375">Name</th><th width="101.46484375">Type</th><th width="79.80078125">Size</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td>4</td><td><code>FRMN</code></td></tr><tr><td>frame_no</td><td>int32</td><td>4</td><td>Frame number</td></tr></tbody></table>

#### **Chunk `BONE`**

Contains animation of a single bone.

<table><thead><tr><th width="92.73828125">Name</th><th width="102.953125">Type</th><th width="83.484375">Size</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td>4</td><td><code>BONE</code></td></tr><tr><td>index</td><td>int32</td><td>4</td><td>Bone index from the <code>BMAP</code> table</td></tr></tbody></table>

#### **Chunk `MATR`**

Bone transformation matrix.

<table><thead><tr><th width="99.89453125">Name</th><th width="115.23828125">Type</th><th width="79.578125">Size</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td>4</td><td><code>MATR</code></td></tr><tr><td>matrix</td><td>float[3][4]</td><td>48</td><td>3x4 matrix. Contains: position, orientation, scale</td></tr></tbody></table>

#### **Chunk `VISI`**

Visibility of a bone.

<table><thead><tr><th width="99.48828125">Name</th><th width="93.73046875">Type</th><th width="88.2109375">Size</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td>4</td><td><code>VISI</code></td></tr><tr><td>visibility</td><td>int32</td><td>4</td><td>Visibility flag. Values: <code>0</code> - invisible <code>1</code> - visible</td></tr></tbody></table>

#### **Chunk `MESH`**

Mesh animation.

<table><thead><tr><th width="109.58984375">Name</th><th width="110.62890625">Type</th><th width="79.3125">Size</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td>4</td><td><code>MESH</code></td></tr><tr><td>size</td><td>int32</td><td>4</td><td>Mesh animation data size</td></tr><tr><td>mesh_data</td><td>uint8[size]</td><td></td><td>Mesh animation data</td></tr></tbody></table>

### Frame Format V2 (`FRM2`)

Used in GEM2.

**Data structure**

```
FRM2
frame_no
key_count

keys[key_count]
bone_map_index
key_flags

[if key_flags & 0x0001]
            position

[if key_flags & 0x0002]
            orientation

[if key_flags & 0x0040]
            scale

[if key_flags & 0x0020]
            mesh
                size
                data[size]
```

#### **Frame Verifier V2**

<table><thead><tr><th width="113.47265625">Name</th><th width="179.22265625">Type</th><th width="80.35546875">Size</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td>4</td><td><code>FRM2</code></td></tr><tr><td>frame_no</td><td>uint16</td><td>2</td><td>Frame number</td></tr><tr><td>key_count</td><td>uint8</td><td>1</td><td>Number of animated keys per frame</td></tr><tr><td>keys</td><td>struct[key_count]</td><td></td><td>Key description structure</td></tr></tbody></table>

#### **Key structure (`struct[key_count]`)**

<table><thead><tr><th width="155.45703125">Name</th><th width="83.9453125">Type</th><th width="85.8203125">Size</th><th>Description</th></tr></thead><tbody><tr><td>bone_map_index</td><td>uint8</td><td>1</td><td>Bone index from the <code>BMAP</code> table</td></tr><tr><td>key_flags</td><td>uint16</td><td>2</td><td>Bitmask of animated parameters</td></tr></tbody></table>

#### **Bit mask for `key_flags`**

<table><thead><tr><th width="124.5">Bit</th><th>Description</th></tr></thead><tbody><tr><td><code>0x0001</code></td><td>Position</td></tr><tr><td><code>0x0002</code></td><td>Orientation</td></tr><tr><td><code>0x0004</code></td><td>Sign of a mirrored matrix</td></tr><tr><td><code>0x0008</code></td><td>Turning on visibility</td></tr><tr><td><code>0x0010</code></td><td>Turning off visibility</td></tr><tr><td><code>0x0020</code></td><td>Mesh animation</td></tr><tr><td><code>0x0040</code></td><td>Scale</td></tr></tbody></table>

#### **Key data**

Fields are present only if the corresponding bit is set in `key_flags`.

<table><thead><tr><th width="136.82421875">Name</th><th width="115.67578125">Type</th><th width="80.20703125">Size</th><th>Description</th></tr></thead><tbody><tr><td>position</td><td>float[3]</td><td>12</td><td>Position</td></tr><tr><td>orientation</td><td>float[3]</td><td>12</td><td>Normalized form of a quaternion</td></tr><tr><td>scale</td><td>float[3]</td><td>12</td><td>XYZ scale</td></tr><tr><td>mesh</td><td>struct</td><td></td><td>Mesh animation</td></tr><tr><td>mesh.size</td><td>int32</td><td>4</td><td>Data size</td></tr><tr><td>mesh.data</td><td>uint8[size]</td><td></td><td>Binary data of mesh animation</td></tr></tbody></table>

### Frame format V3 (`FRM3`)

Used in GEM2.5 and GEM RTS.

**Data structure**

```
FRM3
    frame_no

    keys[key_count]
        bone_map_index
        key_flags

[if key_flags & 0x0001]
            position

[if key_flags & 0x0002]
            orientation

[if key_flags & 0x0040]
            scale

[if key_flags & 0x0020]
            mesh
                size
                mesh_data[size]
```

#### **Frame Verifier V3**

<table><thead><tr><th width="113.6796875">Name</th><th width="170.09375">Type</th><th width="78.12890625">Size</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td>4</td><td><code>FRM3</code></td></tr><tr><td>frame_no</td><td>uint8 <br>uint16 <br>uint32</td><td>1<br>2 <br>4</td><td><p>The field size depends on <code>frame_max</code>. <br>Used by: </p><ul><li><code>uint8</code>, if <code>frame_max &#x3C;= 255</code> </li><li><code>uint16</code>, if <code>frame_max &#x3C;= 65535</code> </li><li><code>uint32</code>, if <code>frame_max >= 65536</code></li></ul></td></tr><tr><td>key_count</td><td>uint8</td><td>1</td><td>Number of animated keys per frame</td></tr><tr><td>keys</td><td>struct[key_count]</td><td></td><td>Key description structure</td></tr></tbody></table>

#### **Key structure (`struct[key_count]`)**

<table><thead><tr><th width="161.80078125">Name</th><th width="87.83984375">Type</th><th width="91.9296875">Size</th><th>Description</th></tr></thead><tbody><tr><td>bone_map_index</td><td>uint8</td><td>1</td><td>Bone index from the map <code>BMAP</code> table</td></tr><tr><td>key_flags</td><td>uint16</td><td>2</td><td>Bitmask of animated parameters</td></tr></tbody></table>

#### **Bit mask (`key_flags`)**

<table><thead><tr><th width="110.921875">Meaning</th><th>Description</th></tr></thead><tbody><tr><td><code>0x0001</code></td><td>Position</td></tr><tr><td><code>0x0002</code></td><td>Orientation</td></tr><tr><td><code>0x0004</code></td><td>Sign of a mirrored matrix</td></tr><tr><td><code>0x0008</code></td><td>Turning on visibility</td></tr><tr><td><code>0x0010</code></td><td>Turning off visibility</td></tr><tr><td><code>0x0020</code></td><td>Mesh animation</td></tr><tr><td><code>0x0040</code></td><td>Scale</td></tr></tbody></table>

#### **Key data**

Fields are present only if the corresponding bit is set in `key_flags`.

<table><thead><tr><th>Name</th><th width="121.40625">Type</th><th width="88.25390625">Size</th><th>Description</th></tr></thead><tbody><tr><td>position</td><td>float[3]</td><td>12</td><td>Position</td></tr><tr><td>orientation</td><td>float[3]</td><td>12</td><td>Normalized form of a quaternion</td></tr><tr><td>scale</td><td>float[3]</td><td>12</td><td>XYZ scale</td></tr><tr><td>mesh</td><td>struct</td><td></td><td>Mesh animation</td></tr><tr><td>mesh.size</td><td>int32</td><td>4</td><td>Data size</td></tr><tr><td>mesh.data</td><td>uint8[size]</td><td></td><td>Binary data of mesh animation</td></tr></tbody></table>


# Convex Polyhedron format .vol

## Overview

Chunk-based binary format for storing convex volume data.

**File structure**

```
EVLM

VERT
    vertices_count
    vertices[vertices_count]

INDX
    indices_count
    indices[indices_count]

SIDE
    sides_count
    sides[sides_count]

MARK
    marks_count
    marks[marks_count]
```

## File header

Format identifier

<table><thead><tr><th width="79.46484375">File</th><th width="102.13671875">FourCC</th><th>Description</th></tr></thead><tbody><tr><td>.vol</td><td><code>EVLM</code></td><td>Chunk-based binary file containing a convex polyhedron</td></tr></tbody></table>

## Chunk `VERT`

<table><thead><tr><th width="137.37109375">Name</th><th width="212.26953125">Type</th><th width="78.64453125">Size</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td>4</td><td><code>VERT</code></td></tr><tr><td>vertices_count</td><td>int32</td><td>4</td><td>Number of vertices</td></tr><tr><td>vertices</td><td>float[3][vertices_count]</td><td></td><td>Vertex data</td></tr></tbody></table>

## Chunk `INDX`

Indices

<table><thead><tr><th width="137.75390625">Name</th><th width="184.5625">Type</th><th width="76.12890625">Size</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td>4</td><td><code>INDX</code></td></tr><tr><td>indices_count</td><td>int32</td><td>4</td><td>Number of indices</td></tr><tr><td>indices</td><td>uint16[indices_count]</td><td></td><td>Index data</td></tr></tbody></table>

## Chunk `SIDE`

Face classification for armor

<table><thead><tr><th width="122.55078125">Name</th><th width="169.8828125">Type</th><th width="84.8984375">Size</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td>4</td><td><code>SIDE</code></td></tr><tr><td>sides_count</td><td>int32</td><td>4</td><td>Number of faces</td></tr><tr><td>sides</td><td>uint8[sides_count]</td><td></td><td><p>Side code:</p><p>1: front</p><p>2: top</p><p>3: left</p><p>4: right</p><p>5: rear</p><p>6: bottom</p></td></tr></tbody></table>

## Chunk MARK

Face marking

\*) Not used in GEM RTS

<table><thead><tr><th>Name</th><th width="172.9140625">Type</th><th width="78.29296875">Size</th><th>Description</th></tr></thead><tbody><tr><td>FourCC</td><td>uint8[4]</td><td>4</td><td><code>MARK</code></td></tr><tr><td>marks_count</td><td>int32</td><td>4</td><td>Number of faces</td></tr><tr><td>marks</td><td>uint8[marks_count]</td><td></td><td>Data for each face</td></tr></tbody></table>


# GEM RTS Tools


# 3ds Max Plugin

## Installation and Configuration of the 3ds Max Plugin

### Prerequisites

Before installing the plugin, ensure that the correct version of 3ds Max is installed on your computer. You need 3ds Max version 2017 or later to work with the plugin.

The plugins for exporting models to the game, along with sample models and necessary resources, are located in the `modeling` folder in the game's root directory.

{% hint style="info" %}
For information on how to locate the game's root folder, refer to the article [Game Local Files and Player Profile Locations](/foundational-knowledge/game-local-files-and-player-profile-locations)
{% endhint %}

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FcluT9KzvvIgTh4m29jlD%2Fimage.png?alt=media&amp;token=5707f25a-b762-4408-8830-137d79fd17fe" alt=""><figcaption><p>Contents of the <code>modeling</code> folder</p></figcaption></figure>

### Selecting Plugin version

Plugin versions for different versions of 3ds Max are located in the `modeling\plugins` folder.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FRtF3EDVL3bK0FNk0O8Mx%2F%D1%81%D0%BE%D0%B4%D0%B5%D1%80%D0%B6%D0%B8%D0%BC%D0%BE%D0%B5%20%D0%BF%D0%B0%D0%BF%D0%BA%D0%B8%20plagins.png?alt=media&amp;token=f41f46b2-c31f-4ca6-81e9-19fe9f85add7" alt="" width="563"><figcaption><p>Contents of the <code>plugins</code> folder</p></figcaption></figure>

Identify and select the folder that matches your installed version of 3ds Max (for example, if you have **3ds Max 2025**, select the plugin version from the **3dsmax\_2025\_x64** folder).

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FBstrIko9JefZt8GXp7wr%2F%D1%84%D0%B0%D0%B8%CC%86%D0%BB-%D1%83%D1%81%D1%82%D0%B0%D0%BD%D0%BE%D0%B2%D1%89%D0%B8%D0%BA%203ds%20max%20plagin.png?alt=media&amp;token=7eac7f2e-1a92-4227-b8b3-67f5ada61853" alt="" width="563"><figcaption></figcaption></figure>

### Installing the 3ds Max Plugin

{% hint style="info" %}
This guide covers the installation of the 3ds Max plugin, specifically demonstrating the process using 3ds Max 2025. The installation and configuration steps described here are applicable to other versions of 3ds Max, following the same procedures.
{% endhint %}

1. Launch 3ds Max with an empty scene
2. Drag and drop the `gem3export.mzp` file into the 3ds Max window.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F1TbUgp2M82dKxZ0EISJS%2Fimage.png?alt=media&amp;token=80402ab5-c89a-4545-9e3a-7c212be42308" alt=""><figcaption><p>Drag and drop the <code>gem3export.mzp</code> file into the 3ds Max window</p></figcaption></figure>

3. Close 3ds Max
4. Open `gem3export.mzp` as you would a zip archive and open the `max_root` folder:
   1. Copy the file `Gem3Export.dle` to the plugins folder: `%path%\Autodesk\3dsMax\2025-64bit\ENU\Plugins`;
   2. Copy the file `nvtt.dll` to the root folder of 3ds Max: `%path%\Autodesk\3dsMax\2025-64bit\ENU`,\
      where `%path%` is the path to the 3ds Max folder.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FM9HVy12ac2yzLA3Jy9t6%2Fimage.png?alt=media&amp;token=1e8b945e-5254-4d5e-b670-f0ea353791ac" alt=""><figcaption></figcaption></figure>

### **Enabling GEM Materials in 3ds Max**

1. Launch 3ds Max
2. Go to the `Customize` menu
3. In the `Custom Defaults Switcher` menu, switch to `MAX Legacy`.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2Fa8EMqUnytz53O9k4UENJ%2Fimage.png?alt=media&amp;token=dcb546c7-17e3-497b-aff3-b56b753a3501" alt=""><figcaption><p>Switching to MAX Legacy in 3ds Max</p></figcaption></figure>

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FQurX3sFOIQazMPcQhBAw%2Fimage.png?alt=media&amp;token=81961945-c8d7-41d2-9548-329317588797" alt="" width="528"><figcaption></figcaption></figure>

4. Close 3ds Max.

### **Add the Plugin to the 3ds Max Utilities**

1. Open 3ds Max.
2. Go to the Utilities settings and click the `More…` button.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FkUc9B27kC3tkEFZQqAzC%2Fimage.png?alt=media&amp;token=9c9c4696-1dfe-4064-8c60-64084a4dbf13" alt="" width="359"><figcaption></figcaption></figure>

3. In the list that appears, select `GEMPlugin` and click `OK` to confirm.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F6K2tGnDBG1dqsbxAc08l%2Fimage.png?alt=media&amp;token=8c784eb4-d59e-4e67-a88d-be08ef428ef9" alt="" width="422"><figcaption></figcaption></figure>

The GEMPlugin panel is now added to your Utilities.

### Configuring Plugin Settings

1. **Open GEMPlugin options**\
   On the plugin panel, click the `Options` button to open the `Gem3 export options` window.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FFfQDXO6x0TiRqDxDt8n6%2FGEMPlugin%20Options.png?alt=media&amp;token=83628789-9065-4108-8b75-b3b121038550" alt=""><figcaption><p>GEMPlugin panel</p></figcaption></figure>

2. **Set Up the game folder**\
   In the `Gem3 export options` window, specify the path to the game's root folder under the `Game folder` field. This should automatically fill other fields in the settings window.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FCTjSGYA848APGmDsvSi2%2FGEMPlugin%20Options%20window.png?alt=media&amp;token=17fb89b1-5796-456d-abce-c677d7f9edbd" alt=""><figcaption></figcaption></figure>

3. **Configure paths to export resources**

* Change the path in the `Additional Resources` line to point to the mod's folder (ensure a mod package is created beforehand).
* Add a path to the texture folder in the `External folders: Textures` section. For example, point it to `modeling/models_samples/texture/common`.

3. **Environment Settings**

* In the `Environment` section, set the path to the environment settings files folder and select the appropriate file from `set/environment/common`.

{% hint style="warning" %}
All paths should be written in lowercase to ensure they are recognized correctly
{% endhint %}

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FgrBaxiYE15RKfL2XbSVK%2F%D0%9D%D0%B0%D1%81%D1%82%D1%80%D0%BE%D0%B8%CC%86%D0%BA%D0%B0%20Gem3%20export%20options.png?alt=media&amp;token=1bcaa89a-7b61-4fad-b8fa-a9cf0dbc2d02" alt="Configuring Gem3 export options in the export dialog"><figcaption></figcaption></figure>

### Adding the Export Button to the Toolbar

1. Right-click on the toolbar and select `Customize`

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FNgPpUriSPPmw9qRR95kJ%2FAdding%20the%20Export%20Button1.png?alt=media&amp;token=312a7032-6801-4c0b-91ff-c9eae1558d4b" alt=""><figcaption></figcaption></figure>

2. Go to the `Toolbars` tab.
3. In the `Actions` list, find `Gem3 Export…`

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FTLfvDz9j9CfpoxRWyrEJ%2FAdding%20the%20Export%20Button2.png?alt=media&amp;token=101f817c-cd46-407b-9013-89fc60aeb729" alt=""><figcaption></figcaption></figure>

4. Drag `Gem3 Export…` to the desired location on your toolbar.

## Getting Started

### **Material Conversion**

After installing the plugin, when you first open a `.max` file, any existing materials (such as EclipseMtl and Gem2) will be automatically converted to Gem3 materials. If the plugin cannot find the necessary textures or schemes:

* A dialog box will appear, allowing you to select a folder containing the textures and schemes.
* Alternatively, use the `Auto repair` feature, which will find the texture folder based on paths specified in the `mdl common` files located alongside the `.max` file.

### **Configuring the Viewport**

To ensure that materials appear in the Viewport as they do in the game, it’s important to adjust the gamma settings in 3ds Max.

1. **Disable Gamma Correction**
   1. Open the `Rendering` menu and select `Gamma/Lut setup`.
   2. In the `Preference Settings` window, go to the `Gamma and LUT` tab.
   3. Uncheck the `Enable Gamma/LUT Correction` checkbox.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FRMhDu0pP7iiDQEOq6JPT%2FDisable%20Gamma%20Correction1.png?alt=media&amp;token=3050c3e7-70e9-44c4-8159-763c6587796f" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FqILZUnPfd4aHQTr3KPZA%2FDisable%20Gamma%20Correction2.png?alt=media&amp;token=a3d61027-70b5-495f-9b04-782088c1553b" alt=""><figcaption></figcaption></figure>

2. **Set Environment Background**

In the Viewport Menu, check the `Environment Background` option under `Viewport Background`.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FKdg7ckoE9cqlmjSm2WK3%2FSet%20Viewport%20Background.png?alt=media&amp;token=eabc07e8-3948-4cf6-95cd-9e60e011417e" alt=""><figcaption></figcaption></figure>

3. **Texture Quality Settings in Viewport**
   1. Open the Viewport Menu and select `Viewport Configuration`.
   2. In the window that appears, go to the `Display Performance` tab.
   3. Adjust the `Texture Maps` setting to control the display quality of textures.

{% hint style="warning" %}
A higher `Texture Maps` setting increases the load on the system’s RAM.\
A recommended setting is 2048 for optimal performance and quality.
{% endhint %}

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FnW31lr0XQfp2qKZ0Cs2C%2FTexture%20Quality%20Settings%20in%20Viewport.png?alt=media&amp;token=e9a6071d-88d8-4a62-a521-529b00170485" alt=""><figcaption></figcaption></figure>

## Export Process

### **Export Settings**

When you click the export button, set the following options:

* **Gem RTS compatible**
* **Don’t rename bones**

Other options can be toggled based on the specific components of the scene you need to export, such as geometry, textures, lights, cameras, and animations. These can be exported as a whole or separately.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FvJ3hc9mjsBFGh7R2bLIB%2FExport%20settings.png?alt=media&amp;token=5ec33aee-244a-413c-95f7-fd1cc4bbf6a4" alt=""><figcaption></figcaption></figure>

### **Default export path**

By default, the model is exported to the `modeling\scene\entity\` directory.\
You can directly set an export path to the mod folder by entering it in the `Additional Resources` field in the [GEMPlugin options](#configuring-plugin-settings)

## Resources Required for Plugin Operation

Below is a summary of the resources needed for the plugin to function correctly and their locations:

| Resource Description            | Location                 |
| ------------------------------- | ------------------------ |
| Resources needed for the Plugin | `modeling/resource`      |
| Model samples                   | `modeling/models_sample` |
| Textures and schemes            | `texture/common`         |


# GEM Importer

Quick Guide

**GEM Importer** converts input **FBX**, **OBJ**, **glTF**/**GLB**, and **MDL** files into a set of **GEM/MDL** output files.

**The program can be launched in two ways:**

1. Double-click `gem_import.exe`.\
   The program runs according to the settings in the `gem_import.json` configuration file.
2. [From the command line](#user-content-fn-1)[^1].\
   This method allows you to pass parameters for a specific run without modifying the `gem_import.json` configuration file.

## First run

{% hint style="info" %}
The **first run** means that the `gem_import.json` configuration file is **not present** in the folder containing `gem_import.exe`.
{% endhint %}

On the first run, **GEM Importer** creates a basic `gem_import.json` configuration file in the folder containing `gem_import.exe` and then exits.

To perform the first run, either double-click `gem_import.exe` or run the program from the **command line** without any parameters \[`gem_import`].

{% hint style="warning" %}
No files are imported during the first run.
{% endhint %}

## Configuration source precedence

The final import parameter values are determined from three sources. Each subsequent source has higher priority and overrides the corresponding values from the previous source:

1. Built-in default values;
2. Sections in `gem_import.json`;
3. Explicit CLI overrides.

{% hint style="info" %}
Command-line parameters apply only to the current run and do not modify the contents of `gem_import.json`.
{% endhint %}

## Configuring `gem_import.json`

The `gem_import.json` file is the primary way to configure GEM Importer. After the first run, open the generated file in a text editor and specify the import parameters. On subsequent launches by double-clicking, the program uses the settings from this file.

<details>

<summary>Example <code>gem_import.json</code></summary>

```json
{
  "app": {
    "version": 2,
    "importer": "gem_import 1.0.0.110",
    "description": "Configuration for importing and exporting GEM/MDL assets",
    "author": "gem_import",
    "debug": {
      "outLog": "./out_log",
      "verbose": 1,
      "htmlFormat": false,
      "dryRun": false
    }
  },
  "import": {
    "general": {
      "inputDir": "./in",
      "outDir": "./out",
      "format": "MDL3",
      "importUniformScale": 1.0
    },
    "content": {
      "volumes": true
    },
    "overwriteExisting": {
      "mesh": true,
      "texture": true,
      "animation": true,
      "material": true,
      "cmesh": true,
      "def": true,
      "mdl": true
    },
    "textures": {
      "searchPaths": [],
      "textureOutputSubdir": "",
      "useTexturesFromModel": true,
      "fileNameConvention": {
        "diffuse": ["basecolor", "base_color", "albedo", "diffuse"],
        "bump": ["normal", "normalmap", "normal_pbr", "bump", "nm"],
        "ao": ["ao", "ambientocclusion", "cavity"],
        "lightmap": ["lm", "lightmap", "lightingmap"],
        "roughness": ["roughness", "rough", "rg"],
        "metallic": ["metallic", "metalness", "metal", "met", "mt"],
        "specular": ["specular", "spec", "sp"],
        "glossiness": ["gloss", "glossiness"],
        "emissive": ["emissive", "emission", "emit"],
        "fuzz": ["fuzz"]
      }
    },
    "materials": {
      "classSimple": "pbr/simple",
      "classStandard": "pbr/standard",
      "classStandardLightmap": "pbr/standard_lightmap",
      "classStandardEmissive": "pbr/standard_emissive",
      "defaultNormal": "$/pbr/0_nm",
      "defaultAo": "$/pbr/0_ao",
      "defaultRoughness": "$/pbr/0_rg",
      "defaultMetallic": "$/pbr/0_met"
    }
  }
}
```

</details>

### `gem_import.json` key reference

<table><thead><tr><th width="236.0703125">Section</th><th width="208.8046875">Key</th><th>Description</th></tr></thead><tbody><tr><td><code>app.debug</code></td><td><code>outLog</code></td><td>Path to the log folder</td></tr><tr><td><code>app.debug</code></td><td><code>verbose</code></td><td>File log verbosity level [0..2]</td></tr><tr><td><code>app.debug</code></td><td><code>htmlFormat</code></td><td>Write the import log in HTML format instead of TXT</td></tr><tr><td><code>app.debug</code></td><td><code>dryRun</code></td><td>Enables read and validation mode without writing the regular output</td></tr><tr><td><code>import.general</code></td><td><code>inputDir</code></td><td>Path to the source folder containing files to import.<br>Input folders used by <code>--run-config</code></td></tr><tr><td><code>import.general</code></td><td><code>outDir</code></td><td>Path to the root import output folder</td></tr><tr><td><code>import.general</code></td><td><code>format</code></td><td>Specifies the target MDL format for the imported model.<br>Available values:<br>• <code>MDL1</code> — for <strong>GEM1</strong>.<br>• <code>MDL2</code> — for <strong>GEM2</strong>.<br>• <code>MDL3</code> — for <strong>GEM RTS</strong>.</td></tr><tr><td><code>import.general</code></td><td><code>importUniformScale</code></td><td>Scale applied to imported models</td></tr><tr><td><code>import.content</code></td><td><code>volumes</code></td><td>When enabled, the importer preserves and exports detected volume/collision content to MDL and <code>.cmesh</code></td></tr><tr><td><code>import.overwriteExisting</code></td><td><p><code>mesh</code>,</p><p><code>texture</code>,</p><p><code>animation</code>,</p><p><code>material</code>,</p><p><code>cmesh</code>,</p><p><code>def</code>,</p><p><code>mdl</code></p></td><td>Allows existing output files of the specified types to be overwritten</td></tr><tr><td><code>import.textures</code></td><td><code>searchPaths</code></td><td>Additional folders in which to search for source textures</td></tr><tr><td><code>import.textures</code></td><td><code>textureOutputSubdir</code></td><td>Relative subfolder inside <code>outDir</code> for exported textures. If the value is empty, textures are written next to the model</td></tr><tr><td><code>import.textures</code></td><td><code>useTexturesFromModel</code></td><td><ul><li><code>true</code> — use texture references from the source material;</li><li><code>false</code> — collect material textures from folders named after the materials</li></ul></td></tr><tr><td><code>import.textures</code></td><td><code>fileNameConvention</code></td><td>Maps filename suffixes to <code>.material</code> fields when <code>useTexturesFromModel=false</code></td></tr><tr><td><code>import.materials</code></td><td><code>classSimple</code>, <code>classStandard</code>, <br><code>classStandardLightmap</code><br><code>classStandardEmissive</code></td><td>Classes of the generated MDL materials</td></tr><tr><td><code>import.materials</code></td><td><code>defaultNormal</code>, <code>defaultAo</code>, <code>defaultRoughness</code>, <code>defaultMetallic</code></td><td>Fallback textures for generated materials</td></tr></tbody></table>

### Geometry processing

The importer automatically accounts for the coordinate systems used by the input formats and performs the transformations required for GEM/MDL output. For FBX and OBJ files, normals are generated only if they are missing from the source model.

Polygon sidedness cannot be configured through JSON.

* For GLB/GLTF, the source material's `doubleSided` value is preserved.
* For FBX, the importer uses the material's two-sided setting and any `CullingOff/CullingOn` value explicitly assigned to the node.
* A submesh with no assigned material is forced to use `twoSided=true`.

Setting `content.volumes=true` does not generate **volumes** when none are present. This flag allows the importer to preserve and write volumes detected in the source model.

* When set to `false`, volume resources and `.cmesh` elements are removed before the output is written.
* Overwriting an existing `.cmesh` is controlled independently by `overwriteExisting.cmesh`.

### The `overwriteExisting` flag

The `overwriteExisting` flags do not disable the export of new files. They protect only files that already exist. The following rules apply:

* if the file does not exist, it is written;
* if the file already exists, it is written only when\
  &#x20;`overwriteExisting.<type> = true`.

This parameter prevents existing, configured `.def` and `.mdl` files from being overwritten when the model is imported again.

<details>

<summary>Example settings for the <code>overwriteExisting</code> section</summary>

```json
"overwriteExisting": 
    { 
    "mesh": true, 
    "texture": true, 
    "animation": true, 
    "material": true, 
    "cmesh": true, 
    "def": false, 
    "mdl": false
    }
```

</details>

### Texture processing

The `searchPaths` parameter specifies where the importer searches for source textures. It is also used to locate external images referenced by `.gltf` files.

The `textureOutputSubdir` parameter specifies the output subfolder for exported textures inside `outDir`.

The model is then written to `<outDir>/<model_stem>/`,\
and its textures are written to `<outDir>/textures/<model_stem>/`.

If `textureOutputSubdir` is empty, the textures are written next to the model.

<details>

<summary>Example settings for the <code>textures</code> section</summary>

```json
"textures": 
    { 
    "searchPaths": ["D:/SourceTextures/Rock"], 
    "textureOutputSubdir": "textures", 
    "useTexturesFromModel": true, 
    "fileNameConvention": 
        { 
        "diffuse": ["basecolor", "base_color", "albedo", "diffuse"], 
        "lightmap": ["lm", "lightmap", "lightingmap"],
        "bump": ["normal", "normalmap", "normal_pbr", "bump", "nm"], 
        "ao": ["ao", "ambientocclusion", "cavity"], 
        "roughness": ["roughness", "rough", "rg"], 
        "metallic": ["metallic", "metalness", "metal", "met", "mt"], 
        "specular": ["specular", "spec", "sp"], 
        "glossiness": ["gloss", "glossiness"], 
        "emissive": ["emissive", "emission", "emit"], 
        "fuzz": ["fuzz"] 
        }
    }
```

</details>

### The `useTexturesFromModel` parameter

1. Standard mode (default setting):

```json
"useTexturesFromModel": true
```

The importer uses texture references from the source material: FBX material slots, OBJ `.mtl`, or glTF/GLB materials.

2. Alternative mode:

```json
"useTexturesFromModel": false
```

The importer ignores texture references embedded in the model and searches for material folders next to the source model and directly inside each folder listed in `searchPaths`.

Without `searchPaths`:

```
model_folder/
    model.fbx
    <materialName>/
        <anything>_<textureType>.<ext>
```

To add an extra `textures` level, specify it explicitly relative to the model folder:

```json
"searchPaths": ["textures"]
```

```
model_folder/
    model.fbx
    textures/
        <materialName>/
            <anything>_<textureType>.<ext>
```

The same structure is used for an absolute `searchPaths` value:

```
<materialName>/
    <anything>_<textureType>.<ext>
```

Example for the `matid_1` material:

```
matid_1/
    rock_basecolor.jpg
    rock_normal.jpg
    rock_ao.jpg
    rock_roughness.jpg
```

Texture type suffixes are configured in `import.textures.fileNameConvention`:

```json
"fileNameConvention": 
    { 
    "diffuse": ["basecolor", "base_color", "albedo", "diffuse"],
    "lightmap": ["lm", "lightmap", "lightingmap"], 
    "bump": ["normal", "normalmap", "normal_pbr", "bump", "nm"],
    "ao": ["ao", "ambientocclusion", "cavity"],
    "roughness": ["roughness", "rough", "rg"],
    "metallic": ["metallic", "metalness", "metal", "met", "mt"],
    "specular": ["specular", "spec", "sp"],
    "glossiness": ["gloss", "glossiness"], 
    "emissive": ["emissive", "emission", "emit"],
    "fuzz": ["fuzz"]
    }
```

The key is a field or slot in the generated `.material`.\
The key value is a list of accepted suffixes that follow the final underscore \[ `_` ] in the filename.\
The name of the immediate parent folder must match the material name. Files in folders belonging to other materials are ignored.

{% hint style="info" %}
The importer compares only the part of the filename after the final underscore \[ `_` ]. Therefore, compound values containing underscores, such as `base_color` and `normal_pbr`, are not recognized. Use single-part values such as `basecolor`, `normal`, or `normalmap`.
{% endhint %}

{% hint style="info" %}
When `useTexturesFromModel=false`, the names of exported `.dds` files and their references in `.material` are written in lowercase. This ensures exact path matching on case-sensitive file systems, including Linux.
{% endhint %}

<details>

<summary>Example of an incorrect parameter configuration</summary>

If the configuration file contains\
`"bump": ["normal","normalmap","normal_pbr","bump","nm"]`,

the following files

`matid_1/rock_normal.png`

and

`matid_1/rock_normalmap.png`

will both be assigned to the `bump` field during import.

</details>

## Command-line parameters

Command-line parameters allow you to change settings for a specific GEM Importer run. The supplied values take precedence over the corresponding values in **gem\_import.json** but do not modify the configuration file.

<table><thead><tr><th width="233.48046875">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>No parameters</td><td>Create the <code>gem_import.json</code> configuration file with the basic import settings and exit on the first run.<br>If <code>gem_import.json</code> already exists, import files according to the settings in the configuration file</td></tr><tr><td><code>-i, --input &#x3C;file></code></td><td>One input file.<br>Supported formats: <code>.fbx</code>, <code>.obj</code>, <code>.gltf</code>, <code>.glb</code>, <code>.mdl</code></td></tr><tr><td><code>--input-dir &#x3C;dirs></code></td><td>One or more input folders. Separate paths with a semicolon [ <code>;</code> ]</td></tr><tr><td><code>--run-config</code></td><td>Import from <code>import.general.inputDir</code></td></tr><tr><td><code>-s, --settings &#x3C;file></code></td><td>Use the specified <code>gem_import.json</code></td></tr><tr><td><code>-o, --out-dir &#x3C;dir></code></td><td>Root output folder. Overrides <code>import.general.outDir</code></td></tr><tr><td><code>--verbose [0 | 1 | 2 ]</code></td><td>Set the log file verbosity level</td></tr><tr><td><code>--html</code><br><code>--no-html</code></td><td>Write an HTML log<br>Write a TXT log</td></tr><tr><td><code>--dry-run</code></td><td>Read and validate only, without writing the regular output</td></tr><tr><td><code>--write-help</code></td><td>Write <code>gem_import.md</code> next to the executable</td></tr><tr><td><code>--version</code></td><td>Display the <code>gem_import</code> version and exit</td></tr><tr><td><code>-h, --help</code></td><td>Display command-line help</td></tr></tbody></table>

### Running with a BAT file

For regular **GEM Importer** runs with the same parameters, you can create a BAT file. This eliminates the need to enter the command manually each time.

Create a text file in the folder containing `gem_import.exe`, add the launch command, and save the file with the `.bat` extension, for example, `import_models.bat`:

```bat
@echo off
gem_import --input-dir "D:\Models\fbx;D:\Models\gltf" --out-dir "D:\Out" --verbose 1
pause
```

Double-click the BAT file to run the command. The `pause` command keeps the Command Prompt window open after the import is complete so that you can review the program messages.

<details>

<summary>Command-line examples</summary>

{% hint style="info" %}
Enter all commands shown below in Windows Command Prompt.
{% endhint %}

1. Importing a single file:

```bash
gem_import --input "D:\Models\vehicle.fbx" --out-dir "D:\Out" --verbose 2 --html
```

The command imports `vehicle.fbx`, writes the output to `D:\Out`, and generates a detailed HTML log.

2. Importing files from multiple folders:

```bash
gem_import --input-dir "D:\Models\fbx;D:\Models\gltf" --out-dir "D:\Out" --verbose 1
```

The command imports supported files from `D:\Models\fbx` and `D:\Models\gltf`. Folder paths are separated with a semicolon. The output is written to `D:\Out`, and the file log uses verbosity level 1.

3. Importing with a specified configuration file:

```bash
gem_import --run-config --settings "D:\Work\gem_import.json"
```

The command uses `D:\Work\gem_import.json` and imports files from the folders specified in `import.general.inputDir`.

</details>

## Import output files

A typical import produces the following set of files:

```
<outDir>/
    <model_name>/
        <model_name>.def
        <model_name>.mdl
        .mesh
        .cmesh
        .material
        .animation
        *.dds
```

{% hint style="info" %}
The output file set depends on the source model and the data it contains.
{% endhint %}

[^1]: To open Command Prompt in Windows:

    1. Open File Explorer.
    2. Place the cursor in the File Explorer address bar.
    3. Enter `cmd` and press Enter.


# Mod Development

The section encompasses the basic principles and advanced features of modding, providing a comprehensive understanding of the mod creation process.

## Introduction

Creating game modifications is an exciting and multifaceted process that offers developers extensive opportunities for creativity and innovation. Gem RTS provides all the necessary tools and resources to bring the boldest ideas to life, allowing you to add unique elements to the game through mods. In this section, we will cover all aspects of mod development, from the first steps to advanced techniques.

To get started creating mods, you need to find and set up the Editor's working folder and learn how to connect mods to the game.

{% hint style="info" %}
Mods (either Raw or Workshop Item packages) must be placed in “Working Packages” folder. Set it in the Game Options.
{% endhint %}

{% hint style="info" %}
The content of the [game folder](/foundational-knowledge/game-local-files-and-player-profile-locations) updates only through the launcher.\
Do not add any files directly to the game folder
{% endhint %}

## Working Packages

"Working Packages" is the editor's working folder that mods, raw packages and the “[Editor local changes](#user-content-fn-1)[^1]” package are stored .\
By default, the editor's working folder is the /packages folder in the game profile.

<table><thead><tr><th width="380">Platform</th><th>Working folder location in the game profile</th></tr></thead><tbody><tr><td>Windows</td><td>Users\[UserName]\AppData\Local\Men of War II\packages\</td></tr><tr><td>Ubuntu</td><td>~/Men of War II/packages/</td></tr></tbody></table>

You can change the location of the editor's working folder if necessary.

### How to change editor's working folder

1. Open the game options
2. Select the "Game" tab
3. Switch "My profile" to "Selected Folder" inside the "Working Packages" field
4. Enter the path in the "Folder Location" field to the desired folder
5. Click the "Apply" button

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FX3Z4IzY7ikA8k4b9YNWa%2FGame%20Tab.jpg?alt=media&amp;token=aecacf17-af60-43ae-b83e-a907583835d5" alt=""><figcaption><p>Game tab in the Options</p></figcaption></figure>

### Package Activation

The content of a package becomes available in the game and in the editor after its activation.

The list of all available packages is in the "Packages" tab.\
Activated packages are marked in checkboxes.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FB1f2O3RihXgwPMzAbI9Y%2FPackages%20window.jpg?alt=media&amp;token=a46dc7e7-95e0-4530-ba59-7bbd30bf0ff6" alt=""><figcaption><p>Packages tab in the Options</p></figcaption></figure>

{% hint style="info" %}
The content of the [game folder](/foundational-knowledge/game-local-files-and-player-profile-locations) updates only through the launcher.\
Changing files in the main game folder can lead to conflicts and errors when launching the game.
{% endhint %}

{% hint style="info" %}
The contents of encrypted packets are not available in the editor
{% endhint %}

***

Before starting with mod development, it is essential to study sections:

* [Game Resource Architecture](/foundational-knowledge/game-resource-architecture)
* [Basic Knowledge about Configuration Files](/foundational-knowledge/basic-knowledge-about-configuration-files)

These sections provide the foundational knowledge required to effectively create mods for the game.

### Learn more about

<table data-card-size="large" data-column-title-hidden data-view="cards"><thead><tr><th data-type="content-ref"></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden align="center"></th><th data-hidden align="center"></th><th data-hidden></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td><a href="/mod-development/creating-mod">Creating mod</a></td><td></td><td align="center">Добавление новых карт и миссий в игру</td><td align="center"></td><td></td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FXqe0ZKqSICsAK0XgCyMC%2Fsplash_editor_3.jpg?alt=media&amp;token=ecb5bb0d-d794-4925-a780-f7d98f315d42">default_cover.jpg</a></td></tr><tr><td><a href="/mod-development/advanced-package-configuration">Advanced package configuration</a></td><td><a href="/mod-development/advanced-package-configuration">Advanced package configuration</a></td><td align="center">Создание балансного мода</td><td align="center"></td><td></td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FXqe0ZKqSICsAK0XgCyMC%2Fsplash_editor_3.jpg?alt=media&amp;token=ecb5bb0d-d794-4925-a780-f7d98f315d42">default_cover.jpg</a></td></tr></tbody></table>

[^1]: This folder will be automatically created as soon as the editor is launched. All changes in the editor are saved here.


# Getting started with modding

## Tools and Preparations

To perform map porting, configuration editing, and asset validation, several supporting tools are commonly used. The list below outlines recommended software solutions for working with game resources packed in `.pak` archives, editing configuration files, and viewing texture data.

***

### Archive management tools

An archive tool is necessary for interacting with `.pak` files. It enables browsing, extraction, and repackaging of game assets.

**Recommendations:**

* [**7-Zip**](https://www.7-zip.org/) – lightweight and open-source; supports command-line and GUI modes.
* WinRAR, PeaZip, or Total Commander – suitable alternatives with advanced search or integration capabilities.

{% hint style="info" %}
In documentation and examples, **7-Zip** is used as the reference tool.
{% endhint %}

***

### Text editors and comparison tools

Configuration files such as `.def`, `.set`, `.inc`, and `.txt` require a reliable text editor for inspection and modification.

**Recommendations:**

* [**Notepad++**](https://notepad-plus-plus.org/) – supports syntax highlighting, encoding control, and plug-in extensions.
* Visual Studio Code – an alternative with integrated file navigation and version control.
* WinMerge – useful for comparing file revisions in parallel.

**Suggested extension for Notepad++:**\
\&#xNAN;*Compare Plugin* — enables side-by-side comparison of two files.

**Install Compare Plugin:**

1. Launch Notepad++
2. Go to `Plugins → Plugins Admin`
3. Search for `Compare`
4. Check the box and press **Install**
5. Accept any UAC prompts
6. Notepad++ will restart automatically

***

### DDS viewing tools

For previewing `.dds` texture files outside of the game editor, third-party viewers can be helpful — particularly when identifying texture variants or working with PBR replacements.

**Recommendations:**

* [**DDS Viewer**](https://ddsviewer.com/) – provides standalone viewing of `.dds` files.
* [**SageThumbs**](https://sourceforge.net/projects/sagethumbs/) – adds thumbnail preview support for `.dds` in Windows Explorer.

{% hint style="info" %}
These tools are optional but may significantly improve workflow when analyzing legacy texture usage.
{% endhint %}

***

## Working with `.pak` archives

All game resources are organized into folders and archived using the `.pak` format.\
Archives that contain configuration files essential for gameplay modifications are **not encrypted**, making it possible to extract or browse files directly.

To explore the contents of `.pak` archives, you can use standard archive management tools that recognize `.pak` files as ZIP-compatible containers. These tools allow you to browse, search, and extract files using a graphical interface.

<table><thead><tr><th>Tool</th><th width="120.03515625">License</th><th>Associate .pak extension</th><th>How to Search Inside Archives</th></tr></thead><tbody><tr><td><strong>7-Zip File Manager</strong></td><td>Free / Open Source</td><td><strong>Tools → Options → System</strong> → Add <code>.pak</code> (requires Admin rights)</td><td>Press <code>F4</code> or go to <strong>Tools → Find</strong>, enable “Search in archives”, enter a mask or regex, and start the search.</td></tr><tr><td><strong>WinRAR</strong></td><td>Commercial (non-expiring trial)</td><td><strong>Settings → Integration</strong> → Add <code>.pak</code></td><td>Press <code>Alt + F7</code>, check “Search in archives”, set a filename mask, and WinRAR will return a list of matching files with archive context.</td></tr><tr><td><strong>PeaZip</strong></td><td>Free / Open Source</td><td><strong>Options → File associations</strong> → Add <code>.pak</code></td><td>Click the search icon or press <code>F3</code> to open in-archive search. PeaZip supports recursive search through nested folders and archives.</td></tr><tr><td><strong>Total Commander</strong></td><td>Shareware (€42, trial supported)</td><td><strong>Configuration → Packer</strong> → Associate <code>.pak</code> with <code>7z.dll</code></td><td>Use <code>Alt + F7</code>, enable “Search in archives”. Advanced search supports multi-archive and nested archive scanning.</td></tr><tr><td><strong>Windows File Explorer</strong></td><td>Free</td><td>Rename <code>.pak</code> to <code>.zip</code></td><td>Use the <strong>Search Tools</strong> ribbon → enable “Search inside compressed folders”. Explorer will index ZIPs and return hits like regular files.</td></tr><tr><td><strong>FAR</strong></td><td>Free / Open Source</td><td>Install 7-Zip or MultiArc plugin; associate <code>.pak</code> with ZIP-compatible unpacker</td><td>Open <code>.pak</code> archive as a directory. Press <code>Alt + F7</code> to search by filename inside archives and subfolders. Plugin must support ZIP format (e.g., 7z).</td></tr></tbody></table>


# Creating mod

{% hint style="info" %}
Before starting to work on a mod, we recommend familiarizing yourself with the basic principles of mod creation and [the resource architecture](/foundational-knowledge/game-resource-architecture) in Men of War II.
{% endhint %}

Created and modified game resources in the editor are automatically saved to the "Editor local changes" folder, located in the editor's "Working Packages" folder.

## Steps to connect new and modified resources to the game via mods

1. Create a package for the mod and [connect it to the game](/mod-development#package-activation).
2. Transfer both the new and modified resources from "Editor local changes" to the mod package.
3. Configure the package properties.
4. Test the mod.
5. Publish in the Workshop.

## Creating a mod package

1. Srart the Game
2. Open the Options and select the PACKAGES tab
3. Click the "Create" button (located below the list of packages).

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FB1f2O3RihXgwPMzAbI9Y%2FPackages%20window.jpg?alt=media&amp;token=a46dc7e7-95e0-4530-ba59-7bbd30bf0ff6" alt=""><figcaption><p>The Packages tab in the Game Options</p></figcaption></figure>

4. Enter a name for your new mod package in the dialog box that appears and click "OK".

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FtCVLGpIykrI4DxEB3EwK%2FCreating%20a%20mod%20package.png?alt=media&amp;token=b9d38e50-2e79-44f1-9814-b595de7207d3" alt=""><figcaption><p>Confirm your intention to create a package for the mod</p></figcaption></figure>

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FWdfQG2SSaa32ZwFIU3Eu%2FEnter%20a%20name%20.png?alt=media&amp;token=5a492c12-86ef-4018-ab30-fff54219fdf9" alt=""><figcaption><p>Enter the package name</p></figcaption></figure>

The package name will appear in the general list of packages.

6. Enable the mod package to the game and editor.\
   Check the box in the line with name of the created package and click the "Apply" button.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FFuplAb7jgPfs2nU0znj4%2F%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%202024-05-02%20%D0%B2%2016.24.12.png?alt=media&amp;token=a28644b8-c74b-4389-a95c-19a6e3f45c0a" alt=""><figcaption><p><strong>Illustration of enabling the package to the game</strong></p></figcaption></figure>

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F7qvQfyQEJiGUaQHvJXtb%2F%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%202024-05-02%20%D0%B2%2016.23.23.png?alt=media&amp;token=fe375498-2f4a-4bb8-acb3-6c57f7563e88" alt=""><figcaption><p>Window with information about a mod package</p></figcaption></figure>

{% hint style="info" %}
Hovering over the package displays a popup window with basic information about the package:

* Package type
* ID
* Path to the package folder
* Creation date and author
  {% endhint %}

At this step, the mod package is created and enabled. The package's resources are available for loading in the game and the editor.

## Transferring new and modified resources to the mod package

1. Open the "Working Packages" folder in File Explorer and find the folder of the created raw package.
2. Transfer resources from the "Editor local changes" folder to the created package's folder, maintaining the file placement structure.

{% hint style="info" %}
After moving the mod resources to the package, the editor will automatically save changes to the mod's resources in its package.
{% endhint %}

{% hint style="info" %}
The "Editor local changes" folder only keeps new resources and original game resources modified by the editor.\
If necessary, transfer resources from the "Editor local changes" package to the mod package, maintaining the file placement structure.
{% endhint %}

At this step, both the new and modified resources are in the mod package.\
The next step is to configure the mod package.

## Configuring the mod package

### Adding a preview image

Place an image of the mod cover at the root folder of the mod package.\
A file must be named preview, saved in jpg format and sized 512x512.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FKEBdcVHrikimoA6HscNW%2F%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%202024-05-02%20%D0%B2%2017.15.54.png?alt=media&amp;token=e0972c78-d1a8-4562-acfd-780170fee109" alt=""><figcaption><p><strong>Example of a mod package folder layout and its root folder contents</strong></p></figcaption></figure>

### Package properties

At the root of the mod folder is an .info file where you need to configure the mod package parameters.

<table><thead><tr><th width="198">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>Unique package identifier, automatically generated when you click "Create" on the "Packages" tab in "Game Settings"</td></tr><tr><td>legacy_id</td><td>After publishing the raw package in the Steam Workshop, the id parameter is replaced by the legacy_id parameter, and the Package changes its type from Raw to Workshop Item</td></tr><tr><td>name</td><td>Package name</td></tr><tr><td>author</td><td>Package author</td></tr><tr><td>order</td><td>Order in the package list.<br>By default, it is 0 and displayed at the top of the package list</td></tr><tr><td>default_disabled</td><td><p>The package is disabled by default until the player applies it in the Game Options.</p><p>It is recommended to set this parameter for all mods.</p></td></tr><tr><td>dependency</td><td>Sets dependencies on already existing packages.<br>For the mod to use the resources and parameters of the original game as a base, you need to specify a dependency on the original game package by stating its id in the dependency block.<br>The block can be used repeatedly to set the sequence of connecting packages for the correct operation of the mod.</td></tr></tbody></table>

## Testing mod

1. Start the game.
2. Open the Options, select the PACKAGES tab and make sure the mod package is enabled.
3. Exit the game Options to the "Main Menu".
4. Create a session on a map from the mod and test the map and mission.
5. Fix any found bugs and errors.

Once your mod is tested and ready, you can publish it to the Steam Workshop

## Steam Workshop

### **Publishing the mod:**

1. Open the game Options and select the Packages tab
2. Select the name of your mod package from the list and click the "Publish" button - the mod will be added to the Workshop in "invisible" mode

{% hint style="info" %}
Keep your mod "invisible" or private until you are ready to make it public, allowing for further testing or private sharing.
{% endhint %}

3. Go to the mod page in Workshop to do this select its name from the package list and click the "Workshop" button.

{% hint style="info" %}
You can find the link to the mod page in the description window that appears under the cursor when hovering over the mod name field in the package list.
{% endhint %}

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FzZTS5Dec86f675lAONCL%2FPublishing%20mod%20to%20the%20Workshop.png?alt=media&amp;token=f699ad6c-dc77-40f1-a08c-4e0ba2bfc504" alt=""><figcaption></figcaption></figure>

3. Configure the appearance of the mod page using the Workshop tools.

### **Updating the mod**

Once you have finished working on the mod update, you need to publish the update in the Workshop.

1. Start the game and go to the Packages tab in the Game Options.
2. Select the name of the package for which you need to publish updates from the list and click the "Update" button - any package updates will be published in the Workshop.

{% hint style="info" %}
You can add new files to the mod at any time, working with the mod folder located in the "Working Packages" folder.
{% endhint %}


# Advanced package configuration

Creating balanced mods often requires more complex settings of the mod package.\
Settings for the package are specified in the .info file.

## **Dependency configuration**

You can configure dependencies on existing packages using the `dependency` block.

The mod will use the original game's resources if the "Men of War II, main package" ID is specified in the `dependency` block. Otherwise, Men of War II game resources will not be included in the mod.

If a mod is dependent on another mod, a dependency block must be added specifying the ID of the required mod.\
Multiple dependency blocks can be included to determine the sequence of package connections. Should a mod require several other mods to function properly, a sequence of dependency blocks listing the necessary mod IDs in the order of their connection should be created.

{% hint style="info" %}
Resources are loaded and modified in the order specified by these blocks in the .info file. The content and functionality of the target files depend on the correct order of these dependency blocks
{% endhint %}

{% hint style="warning" %}
Any discrepancies in the order can result in errors or conflicts during resource loading
{% endhint %}

<details>

<summary><strong>Example of setting the sequence for connecting packages</strong></summary>

```
{id "cc507783-2143-4598-99de-237a5ea5e621"}
{name "Fun games"}
{order 0}
{dependency "02f8e8f9-91d9-45e0-8ee6-dc56adae4763"}; main package
{default_disabled}
{ dependency “Id[A]”}
{ dependency “Id[D]”}
{ dependency “Id[C]”}
{ dependency “Id[B]”}
{author "Created by username, at Mon Apr 17 16:39:49 2024"}
```

*The package "Fun games" uses the `main` package as its base resources and requires the activation of packages A, B, C, and D.*\
*The sequence of `dependency` blocks sets the order in which these packages must be loaded. This ensures that each package functions correctly.*

</details>

## **Resource exclusion**

| Parameter      | Description                                                                                                        |
| -------------- | ------------------------------------------------------------------------------------------------------------------ |
| delete\_global | Specifies a list of resources that should be ignored by the game when activating resources from the global folder. |
| delete\_scene  | Specifies a list of resources that should be ignored by the game when activating resources from the scene folder.  |

## **Enforced resource activation**

<table><thead><tr><th width="252">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>always_activate_scene</td><td>Always activates the 'scene' section of the package if the 'global' section of this package is active. By default, the 'scene' section is activated if a map located in the 'global' section of this package is loaded.</td></tr><tr><td>always_activate_global</td><td>Indicates that this package changes global game settings.<br>If a package with the always_activate_global parameter is enabled in the game, this fact is always noted in the list when creating a host, in saving the game, and similar instances.</td></tr></tbody></table>

## **Package compatibility checks**

| Parameter                     | Description                                                                                                                                                                                                                                             |
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| incompatible \<package id>    | Used to specify the IDs of packages that are incompatible with this package. The game will disable any package with the specified ID when this package is activated                                                                                     |
| min\_core\_version \<version> | The minimum game version with which the package is compatible. If this parameter is not specified, the corresponding check is absent                                                                                                                    |
| max\_core\_version \<version> | The maximum game version with which the package is compatible. If this parameter is not specified, the corresponding check is absent                                                                                                                    |
| hash                          | The hash parameter value allows for pre-determining that the package content is the same among different users and on the server when playing together. The hash parameter value is automatically updated when the package is published in the Workshop |
| client\_only                  | The package content is available only on the client, it is not loaded on the server and does not affect gameplay                                                                                                                                        |
| obsolete                      | Allows hiding package resources (entities and textures) in the lists of available resources in the editor                                                                                                                                               |

<details>

<summary><strong>Example .info content for a balanced mod</strong></summary>

```
{id "cc507783-2143-4598-99de-237a5ea5e621"}
{name "Fun games"}
{dependency "02f8e8f9-91d9-45e0-8ee6-dc56adae4763"} ; main package
{dependency "b86c6020-9b25-4659-bcdf-53b12715a0a1"} ; Good mod
{dependency "aa6c6408-9b43-4562-bcdf-53b12715a97d"} ; God mod
{delete_global "/map/single/2" "/video/menu.avi"}
{delete_scene "/entity/service/flag"}
{always_activate_scene}
{always_activate_global}
{author "Created by username, at Mon Apr 17 16:39:49 2024"}
```

*The mod operates on the base of the original game.*\
*The mod is compatible with the game version not lower than 1.302.*\
*Requires the sequential connection of the Good and God mods. Not compatible with the Realism mod.*\
*The game will ignore resources from the folder "/map/single/2" and the file "/video/menu.avi" in the global section.*\
*The game will ignore the service object "/entity/service/flag" from the scene section upon loading.*\
*Contains a hash for resource identity verification.*

</details>


# Creating Settings templates

## Switching Settings Templates

The Settings template selection window appears in two cases:

* On the first launch of the game.
* When selecting it in the **GAME** OPTIONS.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FTk0PUKx5XsUiGjaMDSVI%2FSelect%20the%20Settings%20Template.png?alt=media&amp;token=68fc7ec0-6f1f-48e3-aa6e-e604c12a713a" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F2ikJcw3LfNlIrNOSrBde%2FGame%20Settings%20Templates.png?alt=media&amp;token=4f69af0a-a3e6-4e9a-9c1e-8227f2fdf824" alt=""><figcaption></figcaption></figure>

## Location and structure of Settings Templates

Settings templates are located in the directory: `main\global\interface\profiles`.\
Each template contains a set of options that can partially or fully override the current settings stored in `.opt` files.

## Icons for Setting templates

For each settings template, you can set icons for two states:

* **normal** — the state when the user isn’t interacting with the icon;
* **selected** — the state when the template is chosen.

For example, for the **default** template, the icons are located in the following paths:

* `main\global\interface\profiles\default\icon.tga` — for the normal state
* `main\global\interface\profiles\default\icon_selected.tga` — for the selected state

## Connecting Additional Packages

Settings templates can also be used to connect additional packages.\
To ensure that specific packages are connected when selecting a template, they need to be specified in the configuration file: `main\global\interface\options_template_packages.set`.

<details>

<summary><strong>Example</strong></summary>

```plaintext
{
    mow_classic
    {
        "40e43b15-5df8-4623-9b87-dc4eb366961b"
    }
}
```

This links the **mow\_classic** template to the package with ID `"40e43b15-5df8-4623-9b87-dc4eb366961b"`.

</details>

## Localization

The texts related to the localization of the settings template selection window are located in files like:

`main\<language>\interface\text\profiles.lng`.

This file needs to be configured to ensure that the settings template selection window displays the texts in the desired language.


# Modding Guides

A complete beginner friendly guide covering the basics of map creation, mission scripting, and publishing mods through the Steam Workshop.

<table data-view="cards"><thead><tr><th data-type="content-ref"></th><th></th><th data-hidden data-card-cover data-type="image">Cover image</th></tr></thead><tbody><tr><td><a href="/mod-development/modding-guides/editor-basics-and-map-creation">Editor Basics and Map Creation</a></td><td>Learn the basics of modding in Men of War II using the built in Editor tools. This guide covers everything you need to start creating your own maps and get familiar with the core workflow.</td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FsaSCIgc8BeW5eIYSmp5V%2Fmap%20editor%20menu.jpg?alt=media&amp;token=3f9efd98-03bf-4632-a627-5c2b96fce643">map editor menu.jpg</a></td></tr><tr><td><a href="/mod-development/modding-guides/intro-to-mission-scripting">Intro to Mission Scripting</a></td><td>Continue your modding journey in Men of War II by learning how to create and script your own missions. This guide introduces the basics of mission setup, logic, and gameplay scripting.</td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FqW4cupb6AwhdqjOeRgBp%2FMission%20editor%20menu.png?alt=media&amp;token=3bd05a46-f305-4bd8-8a24-7a1f0ae4483d">Mission editor menu.png</a></td></tr><tr><td><a href="/mod-development/modding-guides/steam-workshop-and-publishing-your-mods">Steam Workshop and Publishing your Mods</a></td><td>Learn how to save, package, and publish your mods through the Steam Workshop. This guide covers the full process of uploading and sharing your creations with the community.</td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FzZTS5Dec86f675lAONCL%2FPublishing%20mod%20to%20the%20Workshop.png?alt=media&amp;token=f699ad6c-dc77-40f1-a08c-4e0ba2bfc504">Publishing mod to the Workshop.png</a></td></tr></tbody></table>


# Editor Basics and Map Creation

The first part of the Beginner’s Guide to Modding for games powered by GEM RTS

In the first part of our Beginner's Guide to Modding in Men of War II, you will learn how to use the basic tools found in the game's Editor, and all you need to start creating your own maps.

Learn the fundamentals of working with the GEM RTS Editor, demonstrated using Men of War II as an example. This episode covers the basic editor workflow, entity placement, terrain editing, water setup, and weather configuration used when creating maps for games built on the GEM RTS engine.

### Episode Breakdown

* Editor Basics — 0:00
* Entities — 1:41
* Land — 4:47
* Water — 8:28
* Weather — 9:02

{% embed url="<https://youtu.be/DphBQhPI7vg?si=V9uLeHI9VlEfiUvz>" %}


# Intro to Mission Scripting

The second part of the Beginner’s Guide to Modding for games powered by GEM RTS

Learn how mission creation and scripting works in the GEM RTS engine, including gameplay logic, triggers, tasks, and mission setup workflows, demonstrated using Men of War II as an example.

Episode Breakdown:

* Player - 0:25
* Spawning Units - 1:18
* Placing Infantry - 2:30
* Simulation Mode - 3:41
* Triggers - 5:33
* Text Browser - 6:59
* Tasks - 9:17
* Waypoints - 12:35
* Testing - 14:23

{% embed url="<https://youtu.be/IJHBn8Q5k3U?si=QV6T3VNu1kWksaxh>" %}


# Steam Workshop and Publishing your Mods

The third part of the Beginner’s Guide to Modding for games powered by GEM RTS

Learn how mod packaging and publishing works in the GEM RTS engine, including saving, uploading, and sharing your creations through the Steam Workshop, demonstrated using [Men of War II](https://bestway.com.ua/games/men-of-war-ii/) as an example.

Main stages of mod publishing:

* Package setup (0:12–0:25):\
  In the game settings, open the Packages section. If the publish button is inactive, this means that the package does not contain any mod files.
* Moving files (0:30–1:06):\
  New files created in the Editor are automatically saved in the editor local changes folder. These files must be manually moved into your custom package folder, such as tutorial, using Windows Explorer.

{% hint style="warning" %}
Do not move the **.info** file, as it is required for the package to function correctly inside the engine.
{% endhint %}

* Publishing (1:25–1:45):\
  After moving the files, the game must be restarted. Once restarted, the publish button becomes available and the mod can be uploaded to the Steam Workshop.
* Workshop visibility (1:47–1:53):\
  By default, newly uploaded mods are set to hidden status. This gives creators time to prepare descriptions and add screenshots before making the mod publicly available.

Although the workflow is demonstrated using Men of War II, the same publishing principles apply to other games built on the GEM RTS engine.

{% embed url="<https://youtu.be/NvIZU4z5Bzg?si=sGclnhKzzVQL5clW>" %}


# Editor

This page provides an overview of the key components of GEM RTS Editor and their functions. Additional information and detailed guides are available through links to other pages.

The GEM RTS Game Editor is a specialized application designed for modifying and creating game resources. The majority of the editor's functionality is focused on developing game levels.

A game level in the GEM RTS engine consists of two primary components:

**Map**: This is the landscaped terrain where the gameplay takes place. It is specifically designed to align with the objectives and requirements of the mission. The map includes geographical features, environmental settings, and can be customized for different gameplay experiences.\
Maps are created and modified using the [**Map Editor**](/editor/map-editor).

**Mission**: This component defines the gameplay objectives, rules, and player interactions. It includes scripted events for single-player scenarios or the setup for multiplayer battles. The mission dictates the flow of the game on the map, determining what players must do to succeed.\
Missions are created and modified in the [**Mission Editor**](/editor/mission-editor)**.**

**Additional types of Editors contained within GEM RTS**:

* [**Environment Editor**](/editor/environment-editor): Modify and create different environmental settings.
* [**FX Editor**](/editor/fx-editor): Manage and create special effects.
* [**Mission Properties Editor**](/editor/mission-editor/mission-properties-editor): Set and modify various mission properties.

**Debugging and Testing Tools:**

* [**Debug Processes Window**](/editor/debug-tools/debug-processes-window): Display debug information about game components.
* [**Console**](/editor/debug-tools/console): Access the system console for advanced commands and outputs.
* [**Render Layer List Window**](/editor/debug-tools/render-layer-list-window): Configure the display settings for map layers.
* [**Simulation Mode**](/editor/simulation-mode): Test and simulate different game scenarios.

## **Launching the Editor**

The editor can be launched either through the launcher or directly from the game's root directory using the executable file.


# Camera control in the Editor

## **Free camera mode**

The console command `g_cheatkeys [ 1 | 0 ]` controls the ability to activate or deactivate the free camera mode in Simulation Mode \[F1].

* **Enabling Free camera mode:** When you enter `g_cheatkeys 1` in the console, you enable the functionality to activate the free camera mode. With this setting enabled, pressing the key combination `Ctrl+Shift+T` turns on the free camera, allowing for unrestricted movement around the game environment.
* **Deactivating Free camera mode:** Pressing `Ctrl+Shift+T` again will deactivate the free camera and return control to the standard camera settings.

This command is useful for developers who need to navigate freely within the game's simulation environment for testing or demonstration purposes.

## **First-person view mode**

In Simulation Mode, you can switch the camera to a first-person view of a selected unit, provided the unit has an active visor, by using the `Shift+F` key combination. Pressing the combination again will exit the first-person view mode.

## **Mouse-based map navigation**

The camera moves based on a selected point on the map, ensuring that navigation is anchored and consistent, regardless of where you move the mouse.

This method allows the camera to moves freely across the map without being influenced by distance from objects or the tilt of the camera.

1. Fix a point on the map by holding down the `Space` key.
2. Move the mouse while holding down the LMB key without releasing the Space key.

## **Camera control panel in the Editor**

The **Clip Camera Position** checkbox in the Map Editor serves as a toggle for enabling or disabling camera movement restrictions.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FXNTzW1amGnBuGO3bFPM2%2Fimage.png?alt=media&amp;token=165f01d8-467b-45c4-9013-bb96576675b7" alt=""><figcaption><p><strong>Clip Camera Position</strong> checkbox</p></figcaption></figure>

The same function is performed by the console command \`cam\_clip \[ 1 | 0 ]\`. ## \*\*Camera settings panel\*\* The Camera settings panel is located in the Mission Editor menu into the Simulation Mode.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F6tMJREqOx4wktwIX4bkL%2Fimage.png?alt=media&amp;token=feb7a8cc-b3a4-485c-a7f6-1fc1b56cf1a5" alt=""><figcaption><p>Camera settings panel</p></figcaption></figure>

Description of the camera settings panel buttons

<table><thead><tr><th width="122">Button</th><th>Description</th></tr></thead><tbody><tr><td>Alt</td><td>Adjusts the camera's elevation above the ground</td></tr><tr><td>A</td><td>Pitch: Tilts the camera forward or backward</td></tr><tr><td>Y</td><td>Yaw: Rotates the camera horizontally</td></tr><tr><td>R</td><td>Roll: Rotates the camera around its viewing axis</td></tr><tr><td>F</td><td>FOV (Field of View): Adjusts the camera's viewing angle</td></tr></tbody></table>

{% hint style="info" %}
Holding down the Ctrl key while clicking a button will change the values ten times faster or slower.
{% endhint %}

{% hint style="warning" %}
High roll values (R) may cause shadows to display incorrectly
{% endhint %}

## Console Commands for Camera

The general working principle of console commands is described in the article titled [Console](/editor/debug-tools/console)

### **General Camera Parameters**

<table><thead><tr><th width="222">Command</th><th width="92">Value</th><th>Description</th></tr></thead><tbody><tr><td>cam_follow</td><td>[0 | 1]</td><td>Turns off/on camera follow for a selected unit under direct control. Does not work in the current version of the engine.</td></tr><tr><td>cam_followPosition</td><td>0,6</td><td>Camera offset when following a unit under direct control. The command does not work in the current version of the engine.</td></tr><tr><td>cam_allowMouseScroll</td><td>[0 | 1]</td><td>Turns off/on scrolling when the mouse approaches the edge of the screen.</td></tr><tr><td>cam_scaleBias</td><td>[0 | 1]</td><td>Turns off/on the Z-buffer offset for shadow calculations.</td></tr><tr><td>cam_zNear1</td><td>30</td><td>Sets the z_near plane in distance units when the camera has a near-horizontal tilt.</td></tr><tr><td>cam_zFar</td><td>5000</td><td>Sets the distance for the z_far plane in distance units.</td></tr></tbody></table>

### **Ground Contact Camera Settings**

Settings for preventing the camera from sinking into the ground.\
These settings are designed to prevent the camera from unintentionally sinking into the ground during navigation, ensuring a stable viewing experience in environments with varying terrain elevations.

<table><thead><tr><th>Command</th><th width="110">Value</th><th>Description</th></tr></thead><tbody><tr><td>cam_liftAuto</td><td>[0 | 1]</td><td>Off/On for automatically lifting the camera if it goes below the ground.</td></tr><tr><td>cam_liftRadius</td><td>1.5</td><td>Radius in meters for points assessing whether the camera has gone underground.</td></tr><tr><td>v_camAutoLiftingVolume</td><td>[0 | 1]</td><td>Off/On for displaying points that assess camera submersion into the ground.<br>To see the points, stop rendering by pressing <code>Alt+Pause</code> and move the camera aside.</td></tr><tr><td>cam_liftSteadyUpMin</td><td>-2.0</td><td>Lower limit of deviation from the calculated auto-lift value at maximum zoom in, in meters.</td></tr><tr><td>cam_liftSteadyUpMax</td><td>-2.0</td><td>Lower limit of deviation from the calculated auto-lift value at maximum zoom out, in meters.</td></tr><tr><td>cam_liftSteadyDownMin</td><td>2.0</td><td>Upper limit of deviation from the calculated auto-lift value at maximum zoom in, in meters.</td></tr><tr><td>cam_liftSteadyDownMax</td><td>2.0</td><td>Upper limit of deviation from the calculated auto-lift value at maximum zoom out, in meters.</td></tr><tr><td>cam_liftSteadyBlendStart</td><td>0.0</td><td>[0.0 .. 0.9] Start of operation of limits, relative to distance restrictions in the clip.</td></tr><tr><td>cam_liftSteadyBlendEnd</td><td>1</td><td>[0 .. 1] End of operation of limits, relative to distance restrictions in the clip.</td></tr></tbody></table>

### Camera Shake from Explosions

This configuration allows for the adjustment of camera responsiveness to explosive events, enhancing the immersion and realism in the game environment.

| Command         | Value     | Description                                |
| --------------- | --------- | ------------------------------------------ |
| cam\_shake      | \[0 \| 1] | Off/On for camera shake due to explosions. |
| cam\_shakeScale | 1.0       | \[0 .. 10] Scaling of shake intensity.     |

### Camera Limits

Settings for Camera limits and recommended values.\
These parameters allow for precise control over the camera's operational range, including its movement limits and viewing angles, to ensure optimal visibility and performance within the game environment.

<table><thead><tr><th width="248">Command</th><th width="118">Value</th><th>Description</th></tr></thead><tbody><tr><td>cam_clip</td><td>[0 | 1]</td><td>Off/On for camera clipping limits.</td></tr><tr><td>cam_viewAngleFree</td><td>true | false</td><td>If true, uses a wider range from clipper and set for distance or viewAngle (pitch).<br>If false, uses a narrower range.</td></tr><tr><td>cam_viewAngleMin</td><td>5</td><td>Minimum camera tilt angle (0 - horizontal, parallel to the ground).</td></tr><tr><td>cam_viewAngleMax</td><td>85</td><td>Maximum camera tilt angle (90 - vertical, top-down).</td></tr><tr><td>cam_viewAngleDistanceK</td><td>0.5</td><td>How to clamp the camera angle as it approaches the ground.</td></tr><tr><td>cam_distanceMin</td><td>100</td><td>Minimum distance from the ground to the camera.</td></tr><tr><td>cam_distanceMax</td><td>660</td><td>Maximum distance from the ground to the camera.</td></tr><tr><td>cam_viewFovMin</td><td>0.0</td><td>If greater than 0, changes the camera's FoV depending on the distance from the camera to the ground.</td></tr><tr><td>cam_viewFovMax</td><td>0.0</td><td>If greater than 0, changes the camera's FoV depending on the distance from the camera to the ground.</td></tr></tbody></table>

### Third-person view camera settings

Configuration parameters and recommended values for Third-person view camera.\
These settings allow for precise control of the camera in a third-person perspective, adjusting distances, angles, and field of view to optimize player visibility and interaction.

<table><thead><tr><th width="284">Parameter</th><th width="100">Value</th><th>Description</th></tr></thead><tbody><tr><td>cam_tpsFollowDistanceV</td><td>2</td><td>Vertical zoom follow distance (meters).</td></tr><tr><td>cam_tpsFollowDistanceH</td><td>2</td><td>Horizontal zoom follow distance (meters).</td></tr><tr><td>cam_tpsFollowOffsetUpV</td><td>2</td><td>Vertical offset of the camera during vertical zoom (meters).</td></tr><tr><td>cam_tpsFollowOffsetUpH</td><td>2</td><td>Vertical offset of the camera during horizontal zoom (meters).</td></tr><tr><td>cam_tpsFollowOffsetSideV</td><td>0</td><td>Lateral offset of the camera during vertical zoom (meters).</td></tr><tr><td>cam_tpsFollowOffsetSideH</td><td>0</td><td>Lateral offset of the camera during horizontal zoom (meters).</td></tr><tr><td>cam_tpsFollowOffsetForwardV</td><td>0</td><td>Forward offset of the camera during vertical zoom (meters).</td></tr><tr><td>cam_tpsFollowOffsetForwardH</td><td>0</td><td>Forward offset of the camera during horizontal zoom (meters).</td></tr><tr><td>cam_tpsFollowPitchMin</td><td>45</td><td>Minimum pitch of the moving camera (degrees).</td></tr><tr><td>cam_tpsFollowPitchMax</td><td>85</td><td>Maximum pitch of the moving camera (degrees).</td></tr><tr><td>cam_tpsFollowFOV</td><td>65</td><td>Field of view of the moving camera (degrees).</td></tr><tr><td>cam_tpsFollowSpeedH</td><td>2</td><td>Camera follow speed for mouse movements in horizontal zoom position (degrees).</td></tr><tr><td>cam_tpsFollowSpeedV</td><td>1</td><td>Camera follow speed for mouse movements in vertical zoom position (degrees).</td></tr><tr><td>cam_tpsDefaultFOV</td><td>60.0</td><td>Default field of view of the camera (degrees).</td></tr><tr><td>cam_tpsCameraBone</td><td>camera</td><td>Name of the bone the camera operates on.</td></tr></tbody></table>


# Useful Editor shortcuts and Console commands

## Editor shortcuts

This table presents the hotkeys for various functions within the Gem RTS game engine:

<table><thead><tr><th width="186">Key</th><th>Action</th></tr></thead><tbody><tr><td><strong>F1</strong></td><td>Game Mode</td></tr><tr><td><strong>F2</strong></td><td>Map Editor</td></tr><tr><td><strong>F3</strong></td><td>Mission Editor</td></tr><tr><td><strong>F4</strong></td><td>FX Editor</td></tr><tr><td><strong>F6</strong></td><td>Environment Editor</td></tr><tr><td><strong>F9</strong></td><td>Mission properties</td></tr><tr><td><strong>F10</strong></td><td>Debug processes list</td></tr><tr><td><strong>F11</strong></td><td>Render layer list for debugging</td></tr><tr><td><strong>T</strong></td><td>Auxiliary console for search and replace in missions</td></tr><tr><td><strong>G</strong></td><td>Drop an aerial bomb at the cursor position</td></tr><tr><td><strong>Y</strong></td><td>Drop a Molotov cocktail at the cursor position</td></tr><tr><td><strong>B</strong></td><td>High-explosive blast at the cursor position</td></tr><tr><td><strong>Tilde (~)</strong></td><td>Show console</td></tr><tr><td><strong>Numpad 0-9</strong></td><td>Select a player under the specified number (0-9)</td></tr><tr><td><strong>Numpad -</strong></td><td>Decrease brush size</td></tr><tr><td><strong>Numpad +</strong></td><td>Increase brush size</td></tr><tr><td><strong>CTRL + 0</strong></td><td>Center the camera at coordinate (0,0)</td></tr><tr><td><strong>CTRL + T</strong></td><td>Assign or remove a tag from the selected object</td></tr><tr><td><strong>CTRL + F</strong></td><td>Find an object and focus the camera on it</td></tr><tr><td><strong>CTRL + X</strong></td><td>Quickly end a mission (win/lose)</td></tr><tr><td><strong>CTRL + I</strong></td><td>Inventory (works in F1 mode)</td></tr><tr><td><strong>CTRL + M</strong></td><td>Minimap settings (works in F1 mode)</td></tr><tr><td><strong>CTRL + S</strong></td><td>Save map/mission (works in F2/F3 mode)</td></tr><tr><td><strong>CTRL + O</strong></td><td>Open map/mission (works in F2/F3 mode)</td></tr><tr><td><strong>CTRL + C</strong></td><td>Copy</td></tr><tr><td><strong>CTRL + V</strong></td><td>Paste</td></tr><tr><td><strong>CTRL + Y/Z</strong></td><td>Undo/Redo action</td></tr><tr><td><strong>ALT + V</strong></td><td>Display object volumes (SHIFT + V toggles display mode)</td></tr><tr><td><strong>ALT + C</strong></td><td>Display components (Object hit boxes)</td></tr><tr><td><strong>ALT + S</strong></td><td>Display axes for all skeleton bones</td></tr><tr><td><strong>ALT + R</strong></td><td>Invoke various functions, start animations</td></tr><tr><td><strong>ALT + T</strong></td><td>Display tags above game objects</td></tr><tr><td><strong>ALT + P</strong></td><td>Display path (shows selected waypoints)</td></tr><tr><td><strong>ALT + W</strong></td><td>Display wireframe mesh</td></tr><tr><td><strong>ALT + I</strong></td><td>Show MID (object identifier in the mission)</td></tr><tr><td><strong>ALT + F</strong></td><td>Toggle fog of war on and off</td></tr><tr><td><strong>ALT + H</strong></td><td>Display a certain map of the ground surface</td></tr><tr><td><strong>ALT + A</strong></td><td>Display object obstacles (boundary objects for pathfinding)</td></tr><tr><td><strong>ALT + B</strong></td><td>Display general object boundaries</td></tr><tr><td><strong>ALT + Y/Z</strong></td><td>Navigate through undo/redo history in editor/mission</td></tr><tr><td><strong>SHIFT + V</strong></td><td>Change display modes for volumes when enabled by ALT + V</td></tr><tr><td><strong>SHIFT + T</strong></td><td>Select textures for the scene</td></tr><tr><td><strong>CTRL + ALT + D</strong></td><td>Control display elements of the interface (works in F1)</td></tr><tr><td><strong>SHIFT + W</strong></td><td>Context menu for the selected object in mission mode (F3)</td></tr><tr><td>[<strong>SHIFT + W]: 1</strong></td><td><strong>IK Params:</strong> Edit limits in bones with inverse kinematics enabled</td></tr><tr><td>[<strong>SHIFT + W]: 2</strong></td><td><strong>Bone colors:</strong> Edit the color of model bones</td></tr><tr><td>[<strong>SHIFT + W]: 5</strong></td><td><strong>Call function:</strong> Invoke various functions, start animations</td></tr><tr><td>[<strong>SHIFT + W]: 6</strong></td><td><strong>Tags:</strong> Assign or remove a tag from the selected object</td></tr><tr><td>[<strong>SHIFT + W]: 7</strong></td><td><strong>Inventory:</strong> Edit inventory</td></tr></tbody></table>

## Console commands

{% hint style="info" %}
Below is a selection of commands and variables that are frequently used and highly useful.\
If you need to view the complete list of available commands and variables, use the console command `help`, which will return the full list.
{% endhint %}

### Commands for scene configuration

<table><thead><tr><th width="174">Command name</th><th width="107">Value</th><th>Description</th></tr></thead><tbody><tr><td><code>v_boxWorld</code></td><td>[ 1 | 0 ]</td><td>Enables or disables world/map boundaries.</td></tr></tbody></table>

### Console messages

These commands enhance troubleshooting and monitoring within the game environment by providing real-time feedback on various actions and system states. This functionality is essential for developers and testers to efficiently identify and address issues.

| Command                      | Description                                                                                         |
| ---------------------------- | --------------------------------------------------------------------------------------------------- |
| `con_messages 1`             | Enables the display of messages about loading and setting various parameters.                       |
| `con_debugs 1`               | Enables the display of debug messages, such as script debugging, various types of damage debugging. |
| `con_warnings 1`             | Enables the display of warning messages about errors.                                               |
| `dbg_blastwave 1`            | Enables the display of debug information when dealing blast damage.                                 |
| `dbg_fragments 1`            | Enables the display of debug information when dealing fragmentation damage.                         |
| `dbg_InteractionEvent 1`     | Enables the display of debug information when object script events are triggered.                   |
| `dbg_InteractionEventInfo 1` | Expands the display of debug information when object script events are triggered.                   |
| `dbg_health 1`               | Enables the display of debug information when dealing damage to soldiers.                           |
| `dbg_piercing 1`             | Enables the display of debug information when armor is penetrated.                                  |

### Hot reload commands

The following commands allow for the immediate update of resources and scripts in the editor without needing a full restart, thereby reducing the time required for testing changes and speeding up the development process.

| Command                         | Description                                                                         |
| ------------------------------- | ----------------------------------------------------------------------------------- |
| `g_alwaysReloadSceneSettings 1` | Applies new set-file settings by reloading the scene without restarting the editor. |
| `ed_reloadBitmaps`              | Applies changes to textures.                                                        |
| `ed_reloadLandBitmaps`          | Applies changes to map textures.                                                    |
| `ed_reloadInteractions`         | Applies changes to scripts.                                                         |

### Commands for selected objects

These commands allow for detailed manipulation and debugging of selected objects, providing comprehensive control over various aspects of object properties and behaviors in the game environment.

<table><thead><tr><th width="355">Command</th><th width="141">Value</th><th>Description</th></tr></thead><tbody><tr><td><code>v_bones</code></td><td>[0 | 1]</td><td>Off/On for displaying bone axes (ALT + S).</td></tr><tr><td><code>v_bonesNames</code></td><td>[0 | 1]<br>"name1" "name2" ...</td><td>Off/On for displaying bones and their names based on parameters.<br>If set to 1, all bones and their names are displayed; otherwise, only specified ones.</td></tr><tr><td><code>v_volumes</code></td><td>[0 | 1]</td><td>Off/On for displaying volumes (ALT + V).</td></tr><tr><td><code>v_volumeNames</code></td><td>[0 | 1]</td><td>Off/On for displaying volume names.</td></tr><tr><td><code>v_volumeFilter</code></td><td>"name"</td><td>Off/On for displaying the volume with the specified name, ensuring data under the cursor (armor and volume side) is not obscured by other volumes.</td></tr><tr><td><code>v_volumeSides</code></td><td>[0 | 1]</td><td>Off/On for coloring each volume side accordingly.</td></tr><tr><td><code>v_showArmorPlaneMarker</code></td><td>[0 | 1]</td><td>Off/On for displaying the name of the volume side under the cursor (for armor debugging).</td></tr><tr><td><code>v_props</code></td><td>[0 | 1]</td><td>Off/On for displaying names in a list for each object in the scene as specified in the object's def-files under the props parameter.</td></tr><tr><td><code>v_colliderID</code></td><td>[0 | 1]</td><td>Off/On for displaying the collider's name of an object.</td></tr><tr><td><code>v_targetClass</code></td><td>[0 | 1]</td><td>Off/On for displaying the target class name of an object.</td></tr><tr><td><code>v_targetSelector</code></td><td>[0 | 1]</td><td>Off/On for displaying the target selection profile name of an object.</td></tr><tr><td><code>ed_select</code></td><td>"name"</td><td>Selects all objects in the scene by their name; repeating the command for another object does not deselect previously selected objects.</td></tr><tr><td><code>ed_selectNonVisible</code></td><td>[0 | 1]</td><td>Off/On for selecting invisible objects on the map.</td></tr><tr><td><code>ed_allowSelectLandPatchEntity</code></td><td>[0 | 1]</td><td>Off/On mode allowing selection of placed trenches while holding the CTRL key.</td></tr><tr><td><code>v_boarder</code></td><td>[0 | 1]</td><td>Off/On for displaying entry and seating places for soldiers in cover, showing transition lines between different covers.</td></tr><tr><td><code>v_places</code></td><td>[0 | 1]</td><td>Off/On for displaying placement information: name, type, and the bone to which the cover is attached.</td></tr><tr><td><code>v_visor</code></td><td>[0 | 1]</td><td>Off/On for displaying visors.</td></tr><tr><td><code>v_visorInfo</code></td><td>[0 | 1]</td><td>Off/On for displaying visor information: sensor name, visor, and bone.</td></tr><tr><td><code>v_supportPoints</code></td><td>[0 | 1]</td><td>Off/On for displaying ground contact support points (see support bones, suspension settings).</td></tr><tr><td><code>v_patherId</code></td><td>[0 | 1]</td><td>Off/On for displaying the object's circle used for pathfinding, showing the profile name used for pathfinding.</td></tr><tr><td><code>ui_armorDisplay</code></td><td>[0 | 1]</td><td>Off/On for displaying under the cursor information about volume, weapon penetration (if AP), damage, volume armor, effective armor, angles, etc.</td></tr><tr><td><code>v_bullet_pass</code></td><td>100</td><td>Off/On for displaying volumes with the bullet_pass threshold set in armor settings.</td></tr><tr><td><code>preprocess_sdl</code></td><td>"/path"</td><td>Processes the specified SDL file with all its instructions.</td></tr><tr><td><code>g_effect</code></td><td>"event_name"</td><td>Triggers a script event for the selected object.</td></tr><tr><td><code>v_observerSuspect</code></td><td>[0 | 1]</td><td>Off/On for displaying information about noise and unit detection when firing (requires a listener, not an ally).</td></tr><tr><td><code>v_observerSuspectNoiseZoneStep</code></td><td>5</td><td>Displays noise circles and levels around the object at a specified step in meters.</td></tr><tr><td><code>v_talks</code></td><td>[0 | 1]</td><td>Off/On for displaying debug information for dialogs (talk).</td></tr></tbody></table>

### Camera Settings

These settings control various aspects of the camera's behavior and positioning, allowing for precise adjustments to the view angle, distance, field of view, and other parameters to enhance the user experience.

<table><thead><tr><th>Parameter</th><th width="123">Value</th><th>Description</th></tr></thead><tbody><tr><td>cam_viewAngleFree</td><td>[0 | 1]</td><td>Enable/disable free camera view angle:<br>0 - disables,<br>1 - enables.</td></tr><tr><td>cam_distanceMin</td><td>200</td><td>Minimum distance of the camera from the object.</td></tr><tr><td>cam_distanceMax</td><td>900</td><td>Maximum distance of the camera from the object.</td></tr><tr><td>cam_viewAngleMax</td><td>90</td><td>Maximum camera view angle.</td></tr><tr><td>cam_viewAngleMin</td><td>0</td><td>Minimum camera view angle.</td></tr><tr><td>cam_viewAngleDistanceK</td><td>0.1</td><td>Coefficient determining the dependency of the view angle on the camera distance.</td></tr><tr><td>cam_liftSteadyUpMin</td><td>0.2</td><td>Minimum value for camera lift when moving up.</td></tr><tr><td>cam_liftSteadyDownMin</td><td>0.3</td><td>Minimum value for camera descent when moving down.</td></tr><tr><td>cam_liftSteadyBlendStart</td><td>0.02</td><td>Start of the blend interval for smooth lifting/descent.</td></tr><tr><td>cam_liftSteadyBlendEnd</td><td>0.9</td><td>End of the blend interval for smooth lifting/descent.</td></tr><tr><td>cam_liftSteadyUpMax</td><td>-5</td><td>Maximum value for camera lift when moving up.</td></tr><tr><td>cam_liftSteadyDownMax</td><td>5</td><td>Maximum value for camera descent when moving down.</td></tr><tr><td>cam_viewFovMin</td><td>40</td><td>Minimum camera field of view (FoV).</td></tr><tr><td>cam_viewFovMax</td><td>70</td><td>Maximum camera field of view (FoV).</td></tr><tr><td>cam_zFar</td><td>10000</td><td>Global draw distance, where 1 meter equals 20 length units.</td></tr><tr><td>cam_allowMouseScroll</td><td>[ 0 | 1]</td><td>Toggle camera movement using mouse scroll:</td></tr></tbody></table>

### Fog settings commands

These commands control various aspects of fog and object visibility settings, allowing for detailed customization of the visual environment.

<table><thead><tr><th>Command</th><th width="118">Value</th><th>Description</th></tr></thead><tbody><tr><td><code>r_fogSaturation</code></td><td>0.5</td><td>Fog saturation.</td></tr><tr><td><code>r_fogBrightness</code></td><td>0.6</td><td>Fog brightness.</td></tr><tr><td><code>r_fogFullRangeOpacity</code></td><td>0</td><td>Fog opacity at full range.</td></tr><tr><td><code>r_foggedByHumanRadius</code></td><td>1</td><td>Radius of fog created by a human.</td></tr><tr><td><code>r_zNearClipOpacity</code></td><td>0.2</td><td>Opacity of objects close to the camera.</td></tr><tr><td><code>r_zNearClipHideMs</code></td><td>300</td><td>Time (ms) for objects close to the camera to become invisible.</td></tr><tr><td><code>r_zNearClipDistance</code></td><td>6.5</td><td>Distance at which near clipping starts to take effect.</td></tr><tr><td><code>v_pathVisualizerOpacity</code></td><td>255</td><td>Path visualizer opacity.</td></tr></tbody></table>

### Building settings commands

This table helps developers understand and configure parameters that affect the behavior and interactions of soldiers in buildings during gameplay.

<table><thead><tr><th width="363">Command</th><th width="81">Value</th><th>Description</th></tr></thead><tbody><tr><td><code>g_stateIconCellsForAssaultHouse</code></td><td>5</td><td>Number of icon cells in a house during an assault.</td></tr><tr><td><code>g_humanInHouseAttackDelayMin</code></td><td>0.15</td><td>Minimum attack delay (shooting/burst) for infantry in a house.</td></tr><tr><td><code>g_humanInHouseAttackDelayMax</code></td><td>0.5</td><td>Maximum attack delay (shooting/burst) for infantry in a house.</td></tr><tr><td><code>g_aimingSectorInHouseAngle</code></td><td>80</td><td>Aiming sector angle limit for shooting from a position in a house. A value of 80 could lead to shooting through walls.</td></tr><tr><td><code>g_houseBoardTimeMin</code></td><td>2.5</td><td>Minimum time to enter a house.</td></tr><tr><td><code>g_houseBoardTimeMax</code></td><td>2.5</td><td>Maximum time to enter a house.</td></tr><tr><td><code>g_houseEmitTimeMin</code></td><td>1.5</td><td>Minimum time for effects (e.g., smoke) to start emitting from a house.</td></tr><tr><td><code>g_houseEmitTimeMax</code></td><td>1.5</td><td>Maximum time for effects (e.g., smoke) to start emitting from a house.</td></tr></tbody></table>

### Unit damage settings

This table helps developers understand and configure various aspects of damage, its visualization, and mechanics in the gameplay.

<table><thead><tr><th width="379">Command</th><th width="107">Value</th><th>Description</th></tr></thead><tbody><tr><td><code>v_damage 1</code></td><td>1</td><td>Enables the display of various debug zones related to damage (fire zone, explosions, etc.).</td></tr><tr><td><code>g_humanStunTimeMin</code></td><td>2</td><td>Minimum stun time for a soldier from wave damage.</td></tr><tr><td><code>g_humanStunTimeMax</code></td><td>7</td><td>Maximum stun time for a soldier from wave damage.</td></tr><tr><td><code>g_humanStunDamageMin</code></td><td>1</td><td>Minimum damage value for calculating stun time.</td></tr><tr><td><code>g_humanStunDamageMax</code></td><td>5</td><td>Maximum damage value for calculating stun time.</td></tr><tr><td><code>v_ArmorHealthBarDisabledForEnemy</code></td><td>0</td><td>Enables the health bar (HP bar) display for enemies.</td></tr><tr><td><code>g_disableSignalForDamage</code></td><td>0</td><td>Enables signal transmission when damage is dealt.</td></tr><tr><td><code>g_shellAPMissCannon</code></td><td>0</td><td>Chance that an armor-piercing shell will pass through the cannon without registering a hit.</td></tr><tr><td><code>g_shellAPZeniteMissCannon</code></td><td>0</td><td>Chance that an anti-aircraft shell will pass through the cannon without registering a hit.</td></tr><tr><td><code>g_shellAPMissHuman</code></td><td>0</td><td>Chance that an armor-piercing shell will pass through a human without registering a hit.</td></tr><tr><td><code>g_bulletOvermatchMin</code></td><td>0.0001</td><td>Minimum OvermatchDamping value for HEAT rounds, allowing configuration of penetration thresholds by shell type.</td></tr></tbody></table>

### Targeting settings

This table helps developers understand and configure various aspects of targeting and damage mechanics in the gameplay.\
These settings allow for detailed customization of targeting mechanics, including how units interact with obstacles, the precision of artillery fire, and the handling of armor penetration.

<table><thead><tr><th width="511">Command</th><th width="74">Value</th><th>Description</th></tr></thead><tbody><tr><td><code>g_weaponTargetingSmokeObstacleSpreadMultiplier</code></td><td>3</td><td>Multiplier for increasing the spread circle when targeting through smoke.</td></tr><tr><td><code>g_spreadMinByActorRadiusScale</code></td><td>1</td><td>Maximum convergence relative to the radius of buildings for howitzers.</td></tr><tr><td><code>g_spreadMinByActorRadiusOffset</code></td><td>0</td><td>Additional value to the convergence radius on buildings.</td></tr><tr><td><code>g_zeroingForHouseCount</code></td><td>3</td><td>Number of shots at a building until maximum convergence for howitzer fire.</td></tr><tr><td><code>g_armorHealthDamageRangeMin</code></td><td>1</td><td>Minimum armor damage multiplier.</td></tr><tr><td><code>g_armorHealthDamageRangeMax</code></td><td>1</td><td>Maximum armor damage multiplier.</td></tr><tr><td><code>g_armorPierceNormalizationAngle</code></td><td>0</td><td>Disables normalization during penetration.</td></tr><tr><td><code>g_armorPierceNormalizationAngle_TwoCalibresRule</code></td><td>0</td><td>Disables normalization and the two calibers rule.</td></tr><tr><td><code>g_actorAttackGroundLostRadius</code></td><td>1</td><td>Radius after which targeting shifts from attacking a unit to attacking the ground (for cannons).</td></tr><tr><td><code>g_howitzerAttackGroundLostRadius</code></td><td>1</td><td>Radius after which targeting shifts from attacking a unit to attacking the ground (for howitzers).</td></tr><tr><td><code>g_maxAltitude</code></td><td>1800</td><td>Altitude limit for targeting in units (20 units = 1 meter).</td></tr></tbody></table>

### Movement settings

This table describes the parameters for movement mechanics in the game engine.

<table><thead><tr><th width="385">Command</th><th width="134">Value</th><th>Description</th></tr></thead><tbody><tr><td><code>g_moveForceForwardSectorAngle</code></td><td>90</td><td>Angle within which reverse movement will be applied.</td></tr><tr><td><code>g_moveForceForwardSectorLength</code></td><td>40</td><td>Distance within which reverse movement will be applied.</td></tr><tr><td><code>g_pathMinSearchRadius</code></td><td>40</td><td>Minimum search radius for pathfinding detours.</td></tr><tr><td><code>g_fogSimpleXRayVision</code></td><td>1</td><td>Enables the simple fog rule for AI units.</td></tr><tr><td><code>g_trailerMassRatioToSpeedDamping</code></td><td>"(0, 0.2) (1, 1)"</td><td>Trailer speed penalty table, showing the speed damping based on mass.</td></tr></tbody></table>

### Other useful commands

<table><thead><tr><th width="423">Parameter</th><th width="101">Value</th><th>Description</th></tr></thead><tbody><tr><td><code>mp_spawnPrepareDelay</code></td><td>100.0</td><td>Cooldown time for "reinforcement routes".</td></tr><tr><td><code>mp_spawnPrepareSlotCount</code></td><td>2</td><td>Number of "reinforcement routes".</td></tr><tr><td><code>g_autoTargetingRange</code></td><td>7</td><td>Cursor radius for unit auto-targeting.</td></tr><tr><td><code>g_quickMenuActionsDelay</code></td><td>0.2</td><td>Delay before the action radial menu progress bar appears.</td></tr><tr><td><code>g_quickMenuActionsTime</code></td><td>0.3</td><td>Duration of the action radial menu progress bar.</td></tr><tr><td><code>g_mineOnEnemyTerritoryDiscoverTime</code></td><td>90</td><td>Time in seconds to discover mines in enemy territory.</td></tr><tr><td><code>g_mineDeleteDefusedTime</code></td><td>120</td><td>Time in seconds to delete defused mines.</td></tr><tr><td><code>ed_missionEditorWindowWidth</code></td><td>500</td><td>Sets the width of the mission editor interface in pixels.</td></tr><tr><td><code>dbg_canSelectEmptyVehicles</code></td><td>1</td><td>Enables selection of empty units.</td></tr><tr><td><code>ui_possiblePierceChance</code></td><td>0.4</td><td>Pierce chance above which the indicator turns yellow.</td></tr><tr><td><code>ui_successPierceChance</code></td><td>0.75</td><td>Pierce chance above which the indicator turns green.</td></tr><tr><td><code>g_energyByPierceChanceUpscale</code></td><td>0.2</td><td>Additional shell energy for greater penetration based on chance.</td></tr><tr><td><code>ui_showScoreReport</code></td><td>0</td><td>Disables score display for territory in ground control.</td></tr><tr><td><code>ui_hideHealthBar</code></td><td>1</td><td>Disables health bar display in the UI.</td></tr><tr><td><code>g_effectiveStrengthMaxK</code></td><td>2.0</td><td>Maximum effective armor relative to thickness.</td></tr><tr><td><code>mp_unfogEnemyTerritoryDistanceToBorder</code></td><td>3</td><td>Depth of illuminated enemy territory beyond the front line.</td></tr><tr><td><code>g_chassisIntegratorDepth</code></td><td>6</td><td>Smoothing coefficient to reduce shaking over rough terrain.</td></tr><tr><td><code>g_delayUseUserMessage</code></td><td>0</td><td>Delay before re-sending a message from the player list (radial menu).</td></tr><tr><td><code>g_delayUseUserGuide</code></td><td>0</td><td>Delay before re-setting a command pointer.</td></tr><tr><td><code>ui_loadingTips</code></td><td>1</td><td>Enables loading tips.</td></tr><tr><td><code>g_orderWithdrawTime</code></td><td>8</td><td>Retreat time.</td></tr><tr><td><code>mp_afkTimeConnect</code></td><td>180</td><td>Time for a player to connect and start loading before being kicked from the session (PVP).</td></tr><tr><td><code>mp_afkTimeConnectSingle</code></td><td>180</td><td>Time for a player to connect and start loading before being kicked from the session (PVE).</td></tr><tr><td><code>mp_afkTimeCommand</code></td><td>150</td><td>AFK timer for PVP.</td></tr><tr><td><code>mp_afkTimeCommandSingle</code></td><td>7200</td><td>AFK timer for PVE.</td></tr><tr><td><code>g_formationIntervalMin</code></td><td>1.5</td><td>Minimum distance between units in formation when dragging with RMB, accounting for unit radius.</td></tr><tr><td><code>g_formationIntervalMax</code></td><td>40</td><td>Maximum distance between units in formation when dragging with RMB, accounting for unit radius.</td></tr><tr><td><code>g_coverSelectBush</code></td><td>1</td><td>Includes bushes in the cover selector.</td></tr><tr><td><code>g_talksPriorityDelay</code></td><td>0.5</td><td>Delay coefficient between playing dialogs (talk).</td></tr></tbody></table>


# Map Editor

The **Map Editor** is a comprehensive suite of tools for map creation.

**Functionalities of the Map Editor include:**

* **Creating and modifying the mesh of the ground surface**\
  Adjust the size and geometric shape of the terrain to suit the map’s design.
* **Painting the mesh of the ground surface**\
  Apply materials, colors, and grass to enhance the visual appeal of the terrain.
* **Placing entities**\
  Add various elements such as buildings, flora, decor, special effects, sound effects, and interactive game entities to the map.
* **Creating and customizing water surfaces**\
  Use special water materials to create and brush rivers, lakes, and seas.
* **Configuring properties**\
  Set properties of the ground surface and objects to dictate their behavior and interaction within the game environment.

Upon launching, users default to the **Map Editor** and can return to it from other editors by pressing the `F2` key.

## **Map Editor interface**

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F01J2s2lu44kYGqmmoEhg%2FMap%20Editor%20Inferface%20elements.png?alt=media&amp;token=5a951058-f541-4932-9a8f-6b32f61f6149" alt=""><figcaption><p><strong>The Map Editor's Tool Window</strong></p></figcaption></figure>

<table><thead><tr><th width="75">№</th><th width="164">Name</th><th>Description</th></tr></thead><tbody><tr><td>1</td><td><a href="#main-menu">MAP button</a></td><td>Opens the <strong>Main menu</strong> of the <strong>Map Editor</strong></td></tr><tr><td>2</td><td><a href="#side-menu">Side menu</a></td><td>Tabs for the <strong>Map Editor</strong>'s tool groups</td></tr><tr><td>3</td><td>Editor panel</td><td>Settings and properties of the selected tool</td></tr><tr><td>4</td><td>Hints window</td><td>The window displays hints for the selected element in the <strong>Editor</strong> panel.</td></tr><tr><td>5</td><td>Vewport</td><td>A real-time editable canvas for map interaction</td></tr><tr><td>6</td><td>Player indicator</td><td>Displays color-coded group numbers of units controlled by the player in the editor</td></tr></tbody></table>

## Main menu

The **Main menu** of the **Map Editor** (**Map editor menu**) contains basic functions.

The **Main menu** can be called in two ways:

1. **By clicking the MAP button**\
   This button is located at the top of the Editor panel.
2. **By pressing the `Esc` key on the keyboard**\
   By pressing the `Esc` key on the keyboard, users can quickly access the **Map editor menu** window from anywhere within the **Map Editor**.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FsaSCIgc8BeW5eIYSmp5V%2Fmap%20editor%20menu.jpg?alt=media&amp;token=3f9efd98-03bf-4632-a627-5c2b96fce643" alt="" width="563"><figcaption><p>The main menu window</p></figcaption></figure>

<table><thead><tr><th width="182">Menu item</th><th width="292">Description</th><th>Keyboard shortcut</th></tr></thead><tbody><tr><td><code>New</code></td><td>Initiates the process to create a new map</td><td></td></tr><tr><td><code>Save</code></td><td>Allows users to save the current map</td><td><code>Ctrl + S</code></td></tr><tr><td><code>Save As...</code></td><td>Enables saving the current map under a new name or location</td><td><code>Ctrl + Shift + S</code></td></tr><tr><td><code>Reload</code></td><td>Refreshes the current map.<br>Map reverts to the last saved state</td><td></td></tr><tr><td><code>Load</code></td><td>Provides options to open a previously saved map</td><td><code>Ctrl + O</code></td></tr><tr><td><code>Load recent</code></td><td>Allows users to quickly access and load maps that were recently edited or opened</td><td></td></tr><tr><td><code>Exit</code></td><td>Closes the Map Editor and exits the application</td><td><code>Alt + X</code></td></tr></tbody></table>

## **Side menu**

The **Side menu** contains groups of tools for map editing, displayed as tabs on the left side of the editor panel.\
The active tab, which shows the currently selected group of tools, is highlighted for easy identification

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2Fie4fdvZceCgPmaQUjZDP%2FMap%20Editor%20Side%20Menu.png?alt=media&amp;token=6b0370e2-2773-4700-af37-ec578963b7ae" alt=""><figcaption><p><strong>Side menu of the Map Editor</strong></p></figcaption></figure>

<table><thead><tr><th width="199">Tab name</th><th width="194">Editor name</th><th>Description</th></tr></thead><tbody><tr><td><code>scene [1]</code></td><td><a href="/editor/map-editor/1-scene-editor">Scene Editor</a></td><td>Tools for managing entities placed on the map and their structuring, which speeds up access to entities and simplifies the map editing process</td></tr><tr><td><code>entity [2]</code></td><td><a href="/editor/map-editor/2-entity-editor">Entity Editor</a></td><td>This tool is used for placing and adjusting the placement of various elements on the map, including decor, flora, visual and sound effects, and other entities.<br>It provides tools and options necessary for precisely positioning and configuring these elements within the game environment.</td></tr><tr><td><code>land [3]</code></td><td><a href="/editor/map-editor/3-landscape-editor">Landscape Editor</a></td><td>A comprehensive tool within the <strong>Map Editor</strong> designed for terrain customization. It offers brushes and settings for modifying terrain elevation, applying materials, adjusting colors, resizing mesh, and defining landscape properties, enabling detailed and precise landscape design.</td></tr><tr><td><code>water [4]</code></td><td><a href="/editor/map-editor/5-water-editor">Water Editor</a></td><td>This tab features the <strong>Water Editor</strong>, which allows for the creation and editing of water bodies such as rivers, lakes, and seas.</td></tr><tr><td><code>edifice [5]</code></td><td>Edifice Editor</td><td></td></tr></tbody></table>

**The Side menu tabs can be switched in two ways**:

* by clicking on the respective tab icon;
* using the keyboard keys 1, 2, 3, 4, 5, 6

## **Simulation mode**

* **`Start` button**\
  Initiates a safe simulation mode for testing the map.\
  Upon activation, this button changes to the `Finish` button.
* **`Finish` button**\
  Used to exit simulation mode.\
  Exiting simulation mode triggers a map reload process, restoring the map to its original state. Any changes made during the test, such as destruction or other consequences, are not saved.


# Creating a new map

## General information about a map

A map is a game level that typically does not contain scenario logic (scripts).\
It includes a ground surface and map entities such as trees, fences, houses, sound effects, and visual effects.

{% hint style="info" %}
The ground surface is a mesh composed of triangles (a type of polygon).\
The shape and size of these polygons significantly influence texture mapping, which directly impacts the quality of visual detail on the ground surface.
{% endhint %}

{% hint style="info" %}
Smaller polygons allow for smoother and higher-quality texture transitions but can significantly increase the overall number of polygons, negatively affecting game performance (fps).
{% endhint %}

The [Map Editor](/editor/map-editor) is the primary tool for both creating new maps and making changes to existing ones.

## **Creating a new map**

1. Open the [Map Editor menu](/editor/map-editor#main-menu).
2. Click the **New** button.
3. Confirm the intention by clicking the **Yes** button.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FY4gGz2nJgMYhn3SUYgau%2Fimage.png?alt=media&amp;token=68435c71-c81c-470c-b605-c4d6fbfe179d" alt=""><figcaption><p><strong>Warning when pressing the 'New' button</strong></p></figcaption></figure>

4. Fill up parameters in the **Setup landscape** window and click the **Ok** button.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FlnOFvdoXpVgjDEWMO0kd%2Fimage.png?alt=media&amp;token=8f43fc55-cd98-40eb-949c-07b43d3c260d" alt=""><figcaption><p>Initial map parameters window</p></figcaption></figure>

### **Setup landscape parameters**

<table><thead><tr><th width="186">Parameter</th><th width="237">Description</th><th>Note</th></tr></thead><tbody><tr><td>polygon</td><td>Initial polygon settings of the ground surface mesh</td><td></td></tr><tr><td>polygon/triangle</td><td><p><strong>Type of polygon:</strong></p><p>90 - rectangular,</p><p>60 - equilateral.</p></td><td>Recommended type is rectangular.<br>The shape affects the quality of texture blending along transition lines</td></tr><tr><td>polygon/side</td><td>Side size of the polygon</td><td>Recommended side parameter is 2,2 m.<br>This parameter influences the detail of the ground surface rendered with materials</td></tr><tr><td>texture</td><td>Settings of initial material</td><td></td></tr><tr><td>texture/size</td><td>Size of the initial texture tile</td><td>Affects the average texture density</td></tr><tr><td>texture/bitmap</td><td>Name of the base material</td><td>Selected from the list.<br>For a new map, 'grid001' can be used as the initial texture</td></tr><tr><td>terrain</td><td>Initial terrain type</td><td>Default is 'ground', not recommended to change.</td></tr><tr><td>mapSize</td><td>Map size in game units of length.</td><td>Recommended size is 600x600.</td></tr></tbody></table>

After setting up the initial landscape parameters of the map, click the 'OK' button to create the mesh with the specified parameters.\
At this stage, the map template is created.

**The next step is to save the new map to specify its name.**

### **Naming rules for maps**

Map names can include:

* latin alphabet letters (both uppercase and lowercase A to Z),
* arabic numerals (0-9),
* and symbols such as hyphen (-) and underscore (\_) to enhance readability or separate elements within the map name.

{% hint style="info" %}
Using a slash "/" in the map name automatically creates an additional intermediate folder (if it doesn't exist) and sets the path for saving the map files.\
For example, entering "multi/first\_map" as the name will save the map in the folder `map\multi\first_map`.
{% endhint %}

{% hint style="warning" %}
The GEM RTS engine is case-insensitive to map names It treats names such as "MapName", "mapname", and "MAPNAME" as equivalent.
{% endhint %}

{% hint style="warning" %}
It is possible to save the map under an existing name by selecting the desired name from the list. Before saving, the editor will issue a warning about overwriting the map. After saving, it will be impossible to restore the original map.
{% endhint %}

### **Saving the map**

1. Open the **Map editor menu**
2. Click the **Save as** button

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2Ff0SlPDQQIe2bDBZxcUDu%2Fimage.png?alt=media&amp;token=c5b93712-a29f-4758-b4c9-7ae36c15bea8" alt=""><figcaption><p><strong>Map editor's main menu window</strong></p></figcaption></figure>

3. In the **Save As** dialog box that appears, enter the desired name for your map in the **File** field and press the **Ok** button.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FrnsVKKx6fHP6viChrhvT%2Fimage.png?alt=media&amp;token=b475fc20-11d1-4e9c-83ff-214002efb8af" alt=""><figcaption><p><strong>Naming a new map in the 'File' field of the 'Save as' window</strong></p></figcaption></figure>

**At this stage, the template of the new map is ready for creating game level and missions.**

## **Map files**

After the first save, the editor creates a named folder containing three main map files essential for game functionality.

<table><thead><tr><th width="199">File name</th><th>Description</th></tr></thead><tbody><tr><td>map</td><td>Entity layer</td></tr><tr><td>map.ply</td><td>3D model of the ground surface</td></tr><tr><td>map.net</td><td>Heightmap</td></tr></tbody></table>

### Entity layer

This layer includes both static and dynamic entities, such as buildings, entities of flora, entourage and other non-terrain elements that players can interact with.\
The Entity Layer is created and modified using the [Entity Editor.](/editor/map-editor/2-entity-editor)

### 3D landscape model

The map.ply file contains the 3D model for the ground surface, which includes all the topographical details defining the terrain's appearance and behavior in the game. Key aspects include:

* **Geometry**\
  Defines the 3D shape of the terrain, including elevations, depressions, and the overall form such as mountains, valleys, and flat areas.
* **Textures and materials**\
  Textures are applied to the geometry to provide a realistic look, incorporating materials like grass, rocks, sand, etc.
* **Terrain PP and FX data**\
  These data ensure proper interaction between units and the terrain.\
  Terrain PP (Physical Properties) data ensures units like humans or vehicles respond correctly to the terrain.\
  Terrain FX data adds the correct visual effects when units interact with the terrain.

This file is created and modified using the [Land Editor](/editor/map-editor/3-landscape-editor).

### Heightmap

This file is used by the game engine for calculating various game components and parameters. It is crucial for AI pathfinding, as it delineates where units can and cannot move, defining blocked areas and regions with special movement rules.\
The heightmap file is edited using the Heights brush of the Land Editor


# \[1] Scene Editor

## General Information about the Scene Editor

The Scene Editor is part of the Map Editor and provides tools for structuring and managing entities placed on the map. This accelerates access to entities and simplifies the map editing process. The Scene Editor is located under the **`scene`**`[1]` tab in the side menu of the Map Editor.\
The editor window contains two tabs:

* Explorer
* Layers

## Explorer

Explorer is designed to display all entities in the scene in a hierarchical tree structure.\
The tree reflects the structure of entities according to the folder location of the entity in the game resources relative to the `...\scene\entity` folders.

### Interface elements

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2Fda3YuNA0pw7iSsAGqDT7%2FExplorer%20interface.png?alt=media&amp;token=d42e8eb0-81fb-444c-950b-9a19ee0bfa8a" alt=""><figcaption></figcaption></figure>

* \[1] Folder tree of entities placed on the map
* \[2] Properties window for the selected entity instance, **Properties for 'actor'**
* \[3] Hints window for the selected parameter from the Properties window

### Functionality

* **Selecting an entity instance on the map**\
  Navigating through the tree automatically highlights the corresponding entity instance in the scene.
* **Finding an entity instance on the map**\
  Double-clicking the name of an entity instance in the list centers the camera on it in the map.
* **Finding an entity instance in the tree list**\
  Selecting an entity on the map highlights it in the Explorer tree. If multiple entities are selected on the map, only the first one will be highlighted in the tree.
* **Quick access to entity instance properties**\
  The properties of the selected entity are displayed in the Properties window.
* **Synchronization**
  * Deleting an entity instance from the map also removes it from the Explorer list.
  * Adding an entity instance via the Entity or Foliage tools adds it to the Explorer list.

### Context Menu

Right-clicking on a folder in the tree opens a context menu with options for managing entity states:

|         |                                                                  |
| ------- | ---------------------------------------------------------------- |
| Visible | Toggles the visibility of entities based on their current state. |
| Lock    | Locks or unlocks entities for selection.                         |

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td>For a visible entity, the context menu will offer the option to make it <strong>Invisible</strong></td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F8neCCCaGSYj2fIY3yoYS%2Fexplorer%20invisible.png?alt=media&amp;token=87393633-0f37-4ec1-9b51-e2a161525f1a">explorer invisible.png</a></td></tr><tr><td>For an invisible entity, the context menu will offer the option to make it <strong>Visible</strong></td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FghvuqwlyDuOwfPiWTQBt%2Fexplorer%20visible.png?alt=media&amp;token=61e96242-36fa-4210-9f4e-35d007ca22b5">explorer visible.png</a></td></tr><tr><td>For an unlocked entity, the context menu will offer the option to <strong>Lock</strong> it for selection</td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FxUhBhXbRkOWEahP6K9zG%2Fexplorer%20lock.png?alt=media&amp;token=c4b723a9-57c3-4ae8-8889-43dc21a3688c">explorer lock.png</a></td></tr><tr><td>For a locked entity, the context menu will offer the option to <strong>Unlock</strong> it for selection</td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FlVj1nGDg7W2urUKOS6tM%2Fexplorer%20unlock.png?alt=media&amp;token=9bcc5b61-62e9-418e-852e-94d670468b15">explorer unlock.png</a></td></tr></tbody></table>

{% hint style="info" %}
The context menu is available for individual items in the list as well as for entire folders or branches of folders.
{% endhint %}

{% hint style="info" %}
Switching the **Visible** and **Lock** states on folders with a large number of entities may take some time to process.
{% endhint %}

## Layers

The **Layers** tool is designed to organize map entities into thematic layers, allowing control over their visibility and editability.

### Context Menu

To work with layers, use the context menu, which is accessed by right-clicking on an empty space in the Layers tab window or on the name of the desired layer.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FvSDgiX1yNpG6TUOBh1TZ%2Fscene%20Layers%20menu.png?alt=media&amp;token=088c7eeb-2bdc-4d3c-a020-d4462b7015e4" alt=""><figcaption><p><strong>Context Menu Options in the Layers Tab</strong></p></figcaption></figure>

<table><thead><tr><th width="187">Menu Item</th><th width="216">Action</th><th>Description</th></tr></thead><tbody><tr><td>Create Empty Layer</td><td>Create an empty layer</td><td>Available when the context menu is accessed on an empty space in the Layers tab or on any layer.</td></tr><tr><td>Add Selected Entities to New Layer</td><td>Add selected entities to a new layer</td><td>Available when the context menu is accessed on an empty space in the Layers tab or on any layer. Before this, select the desired entity instances on the map or using Explorer.</td></tr><tr><td>Add Selected Entities to Selected Layer</td><td>Add selected entities to the selected layer</td><td>Select the desired entity instances on the map or using Explorer, then open the context menu on the desired layer.</td></tr><tr><td>Delete Layer</td><td>Delete the selected layer</td><td>Open the context menu on the layer you want to delete.</td></tr><tr><td>Rename</td><td>Rename the selected layer</td><td>Open the context menu on the layer you want to rename.</td></tr><tr><td>Invisible/Visible</td><td>Hide or show the layer</td><td>Open the context menu on the desired layer.</td></tr><tr><td>Lock/Unlock</td><td>Lock or unlock the layer's entities for selection on the map</td><td>Open the context menu on the desired layer.</td></tr><tr><td>Remove Selected Entities from Layer</td><td>Remove the selected entity from the current layer</td><td>Open the context menu on the name of the Entity instance that you want to remove from the layer.</td></tr></tbody></table>


# \[2] Entity Editor

Mastering Entity manipulation on a Map

The Entity Editor is a robust toolset located within the Map Editor of the GEM RTS engine, specifically designed for effective management of entities on game maps.\
It integrates into the first tab of the Map Editor's side menu.

**Primary functions of the Entity Editor**:

* efficiently place and arrange various game entities such as buildings, objects of flora and environmental elements across the map;
* modify the placement and orientation of existing entities to fine-tune the map layout;
* configuring the properties of entities on the map.

**Switching to the Entity Editor can be done in two ways**

* Click on the tab icon in the side menu of the Map Editor.
* Press the '1' key on the keyboard.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FkgoNnEbz6LHb6dv3jFNq%2Fimage.png?alt=media&amp;token=f6f00766-422a-49d5-a75b-3c94319ffcb3" alt=""><figcaption><p>Entity Editor window</p></figcaption></figure>

## **Components of the Entity Editor window**

### **List of object assets**

The main component of the Entity Editor window is the list of assets for placing entities on the map.

Assets are categorized into thematic folders to streamline the selection process and enhance workflow efficiency.

<table><thead><tr><th width="177">Name</th><th>Description</th></tr></thead><tbody><tr><td>-fauna</td><td>Animal unit assets</td></tr><tr><td>-human</td><td>Infantry unit assets.<br>Sorted by unit nationality and named according to the unit's role in the game.</td></tr><tr><td>-vehicle</td><td>Vehicle unit assets.<br>Sorted by types of military and civilian vehicles and named after real vehicles.</td></tr><tr><td>construction</td><td>Buildings and decor objects.<br>Assets are sorted into thematic categories.</td></tr><tr><td>flora</td><td>Flora objects: trees, bushes and grass.</td></tr><tr><td>fx</td><td>FX special effects assets.<br>Sorted into thematic folders.<br>Most are designed for in-game effects spawning and are not saved when placed on the map except for some effects from the common, smoke, and water folders.</td></tr><tr><td>humanskin</td><td>A technical folder with infantry unit skin models, which are the basis for assets in the -human folder.</td></tr><tr><td>inventory</td><td>A technical folder with inventory models.<br>Used for setting up unit inventory.</td></tr><tr><td>landscape</td><td>Assets for ground surface elements: stamps, stones, and slopes. Sorted into thematic folders.</td></tr><tr><td>particle</td><td>A technical folder with unit part assets used by the engine during gameplay.</td></tr><tr><td>service</td><td>A technical folder with service object assets used by the engine during gameplay.</td></tr></tbody></table>

The 'Search entity' field can be used to search for an asset in the list by its name or a specified mask.

{% hint style="warning" %}
Asset folders for units (-fauna, -human, -vehicle) are intended for placement on the map exclusively in the Mission Editor. An exception is the placement of units for the purpose of creating ambient elements of the map - corpses of infantry and destroyed vehicles.
{% endhint %}

{% hint style="info" %}
Assets from technical folders are necessary for the engine's operation and are not intended for placing entities on maps. An exception exists only for certain special effects and service object assets
{% endhint %}

### **Additional options in the Entity Editor**

* The **Clip camera position** ensures the camera behavior in the editor is the same as in the game
* The **Rotation lock angle** option locks the rotation of a selected entity on the map to the angle specified in the parameter field.

## **Placing entities on the map**

To place an entity:

* Select the desired asset from the Entity list.
* Click on the map where you want the entity to be placed, using the LMB.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FtUgs9P9oEqaP6bMX55r0%2Fimage.png?alt=media&amp;token=e48bc148-3371-4fb1-80e4-8e3603eebac0" alt=""><figcaption><p>Preview functionality</p></figcaption></figure>

### **Previewing entities**

A preview of the entity from the asset is available.\
To preview an entity , select its name in the list and hover the mouse cursor over the map area.

{% hint style="info" %}
Preview functionality is unavailable for entities containing structure
{% endhint %}

## **Selecting entities**

An entity can be selected on the map in three ways.

1. Click the LMB on the visual center of the entity
2. Drag the selection frame using LMB
3. Use the console command "ed\_select name" to mass select based on names

## **Operations with selected entities**

* Moved across the map by holding the right mouse button (RMB).
* Rotated around the object's center by holding the 'C' key and moving the mouse up/down.
* Tilted relative to the vertical axis by holding the 'X' key and rotating the mouse.
* Resized using the 'scale' modifier by holding the 'S' key and moving the mouse up/down.
* Moved along the vertical axis by holding the 'A' key and moving the mouse up/down.

| Action                             | Shortcut                      |
| ---------------------------------- | ----------------------------- |
| Move across the map                | Hold RMB                      |
| Rotate around the object's center  | Hold 'C' + Move Mouse Up/Down |
| Tilt relative to the vertical axis | Hold 'X' + Rotate Mouse       |
| Resize using the 'scale' modifier  | Hold 'S' + Move Mouse Up/Down |
| Move along the vertical axis       | Hold 'A' + Move Mouse Up/Down |

## **Entity properties window**

The game entity properties window opens below the asset list window when an entity is selected on the map.


# \[3] Landscape Editor

The \[Land] tool group in the Map Editor is designed for creating, editing, and setting properties of the landscape surface.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F3trBaKce5nRMnPsJTUFI%2Fimage.png?alt=media&amp;token=306d7bc7-0e2a-4674-a9c3-99f49c8c9c5f" alt=""><figcaption></figcaption></figure>

## **Landscape Editor tools**

<table><thead><tr><th width="205">Editor Name</th><th width="116">Tab</th><th>Description</th></tr></thead><tbody><tr><td><a href="/editor/map-editor/3-landscape-editor/heights-editor"><strong>Heights Editor</strong></a></td><td>Heights</td><td>Brush for creating and editing the terrain's relief.</td></tr><tr><td><a href="/editor/map-editor/3-landscape-editor/polygons-editor"><strong>Polygons Editor</strong></a></td><td>Polygons</td><td>Brush for editing the size of the ground surface mesh and its polygonal grid detail.</td></tr><tr><td><a href="/editor/map-editor/3-landscape-editor/terrains-editor"><strong>Terrain Types Editor</strong></a></td><td>Terrains</td><td>Brush for marking the properties of the ground surface.</td></tr><tr><td><a href="/editor/map-editor/3-landscape-editor/flags-editor"><strong>Flags Editor</strong></a></td><td>Flag</td><td>Brush for marking the ground surface for potential game events.</td></tr><tr><td><a href="/editor/map-editor/3-landscape-editor/color-editor"><strong>Colors Editor</strong></a></td><td>Colors</td><td>Brush for coloring the vertices of the ground surface's polygonal grid.</td></tr><tr><td><a href="/editor/map-editor/3-landscape-editor/material-editor"><strong>Materials Editor</strong></a></td><td>Textures</td><td>Tool group for painting the ground surface and setting material properties.</td></tr><tr><td><a href="/editor/map-editor/3-landscape-editor/grass-editor"><strong>Grass Editor</strong></a></td><td>Grass</td><td>Brush for applying grass cover.</td></tr><tr><td><a href="/editor/map-editor/3-landscape-editor/foliage-editor"><strong>Foliage Editor</strong></a></td><td>Foliage</td><td>Brush for automating the process of populating the map with objects</td></tr></tbody></table>


# Heights Editor

The **Heights Editor** \[`Heights`] toolset allows you to modify the **ground surface** mes&#x68;**:** creating hills, mountains, valleys, ravines, and lowlands on the map.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FM0ulwiaEA18GUuuFzy6c%2FLand%20Editor.png?alt=media&amp;token=80a8de22-5eaf-418c-9eaf-ae5062758a9d" alt=""><figcaption><p>Heights Editor Tab</p></figcaption></figure>

The `Alt+W` key combination toggles the display of the **ground surface** mesh polygonal grid and switches between polygonal grid display modes.

## **Heights Brush operation**

* **Raising vertices**\
  Moving the brush with the Left Mouse Button (`LMB`) held down raises the vertices of the ground surface mesh.
* **Lowering vertices**\
  Moving the brush with the Right Mouse Button (`RMB`) held down lowers the vertices.
* **Smoothing** **vertices**\
  Moving the mouse while holding the `Shift` key smooths out the height differences for the vertices of the ground surface mesh that fall within the brush area. This helps create smoother transitions between areas of varying heights.
* **Fixing alignment**\
  Moving the mouse while holding the left `Alt` key fixes the alignment of the vertices to the level of the vertices under the brush area at the moment the Alt key is pressed.
* **Brush size**\
  The brush size can be increased and decreased using the Numpad Plus (`+`) and Numpad Minus (`-`) keys.

## Configuring the Heights brush

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FuAZJYr8f4DUDHQQToqQK%2FHeights%20Editor%201.png?alt=media&amp;token=5577655c-c691-4ee6-b975-8de8d1d04665" alt="" width="563"><figcaption><p>Tools for adjusting <strong>Heights brush</strong> properties</p></figcaption></figure>

* **Soft-Sharp slider** \[2.1]\
  Adjusting the slider position achieves the desired degree of softness for the **Heights brush**:
  * the `Sharp` position makes the brush hard: all vertices of the ground surface mesh under the brush change height with the same intensity.
  * the `Soft` position makes the brush soft: the intensity of height change is greater at the center of the brush and gradually decreases towards the edges.
* **Slow-Fast slider** \[2.2] affects the speed of height change for the vertices.
* **Fixed Height parameters**
  * The `fixed height` \[2.3] checkbox locks the alignment level of the ground surface mesh vertices at the specified height, which is set in the field next to it.
  * The `fix relative` checkbox enables discrete operations for the Heights brush, allowing vertices to be raised by a set height with each `LMB` click and lowered with each `RMB` click.\
    The ability to set the brush's discreteness becomes available when the fixed height parameter is enabled and set.

## **Additional functions of the Heights Editor**

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FmrQDQDVoAVvbbGjjReYk%2FHeights%20Editor%202.png?alt=media&amp;token=9d500939-f94b-4f8a-9cf4-2325646c6a71" alt="" width="563"><figcaption><p>Functions for debugging and configuring ground surface mesh</p></figcaption></figure>

<table><thead><tr><th width="285">Function name</th><th>Purpose</th></tr></thead><tbody><tr><td>[3.1] <code>heightmap</code></td><td>Debugging tool.<br>Checking this box enables visualization of the <strong>Path Planner heightmap</strong> with slope angle parameters for each grid cell.</td></tr><tr><td>[3.2] <code>Heightmap level</code></td><td>Debugging tool for slope steepness to check terrain passability based on <strong>ground surface</strong> slope angles.</td></tr><tr><td>[3.3] <code>Water altitude</code></td><td>Sea level parameter.<br>Used in the <strong>Entity Editor</strong> to align entities to the water level.</td></tr><tr><td>[3.4] <code>Clip heightmap</code></td><td>"Clip" function.<br>Allows clipping the <strong>Heightmap</strong> grid to the boundaries of the visible <strong>ground surface</strong> mesh.<br>Useful after reducing map size using the <strong>Polygon Editor</strong>.</td></tr><tr><td>[3.5] <code>Heightmap by mesh</code></td><td>Synchronize the heightmap grid with the visible <strong>ground surface</strong> mesh.</td></tr></tbody></table>

## **Heightmap transfer tools**

The **Heights Editor** tab contains tools for creating map terrain using a topographic map image or **Land decal** image, as well as transferring the heightmap for the **ground surface** mesh from one map to another.

### Import heightmap

The `Import heightmap` tool is used to create terrain based on a topographic map. Supported import formats: `tga`, `ebm`, `bmp`, `dds`, `jpg`, `png`.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FmJqoJvTV3KWsczGdkF4G%2FImport%20Heightmap.png?alt=media&amp;token=1b3fbc13-1236-4912-be01-eff24e5729a2" alt="" width="563"><figcaption><p>Heightmap Import tools</p></figcaption></figure>

**Heightmap import instruction**

1. **Prepare a heightmap image**\
   The heightmap uses a grayscale color scheme:

   * `black` represents the lowest elevation;
   * `white` represents the highest;
   * `shades of gray` indicate intermediate heights.

   The maximum supported image size is 8K, in 8-bit grayscale format, and the image aspect ratio must match the map’s aspect ratio (e.g., 1:1 for square maps).
2. **Set the Import parameters**
   * `Max height` \[4.1] - specifies the maximum terrain height in meters. This corresponds to the highest vertex of the ground surface mesh, reflecting the map’s intended design.\
     To convert game height units to meters, use the ratio `1 meter = 20 height units`.
   * `Zero height` \[4.2] - defines the gray shade that represents the **zero level** of the ground surface mesh.\
     By default, black color corresponds to the map’s zero ground surface level. Adjust this parameter for maps with depressions below the **zero level**, such as lakebeds or other low areas.
3. **Import the heightmap**\
   Click `Import heightmap`button \[4.4], then select the image file to import.

### Export heightmap

The `Export heightmap` tool allows creating a topographic map based on the terrain of the current map.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F0mKy0JcJwFRDbErzIEB2%2FExport%20Heightmap.png?alt=media&amp;token=76d5743c-a08f-4257-afee-18ba7552d495" alt="" width="563"><figcaption><p>Heightmap export tools</p></figcaption></figure>

**Heightmap export instructions**

1. Set the image size by filling in the `Image width` and `Image height` \[5.1] parameters.
2. Click `Export heightmap` \[5.2], choose the folder to save the file, and specify the file name.

### Land decal

The `Land decal` \[6] tool is used to apply a texture across the entire map, which simplifies the creation of maps based on real-world locations.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FjcqbQYWBLe13211AJhnG%2FLand%20decal.png?alt=media&amp;token=637bc65c-96a4-4169-be7a-e82ddfa384b8" alt="" width="563"><figcaption><p>Land decal</p></figcaption></figure>

#### Working with the Land decal

1. **Preparing the texture**
   * Prepare the decal image in one of the supported formats: `tga`, `ebm`, `bmp`, `dds`, `jpg`, `png`.
   * It is recommended to set the image size proportional to the map size.\
     For a 650x650 meter map, use an image size of 650x650 pixels (scale 1:100 m) or 1300x1300 pixels (scale 1:50 m), or according to the site plan.
2. **Saving the texture**
   * Save the image in the `scene/texture` directory.\
     For convenience, you can create a separate folder for decals.
3. **Adding a decal to the map**
   * Open the **Heights Editor** tab.
   * In the `Land Decal` block, click the `Create` button to apply the decal to the map.
   * Select the prepared image from the `scene/texture` directory.
4. **Adjusting the decal**
   * Adjust the decal transparency using the `Transparency` slider to make working with the map easier.
5. **Removing the decal**
   * Click the `Remove` button in the `Land Decal` block to remove the decal.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXd1Kb5JaW89WWI-wTYyOsRFIZUIgmBKmSzujEBXedF85ld6LRBWfSjIUFGtnX3FpzQS-_hhq1Pon-d5gT4yfCZIcbe15dhpfPl2OhAPiDd0Xve9tr1LwB8JB8TpGAUjjSd-eyaiz3MOjzLfghGJeqgSiXjx?key=F5ZZ1NbgL9AIkbClRQiLwQ" alt=""><figcaption><p>Result of applying the Land decal to the map's surface</p></figcaption></figure>

## Derived Heightmaps

The game engine generates several invisible derived heightmaps based on the polygons of the visible **ground surface**, which are used for calculating various game parameters.

To visualize and toggle through the auxiliary heightmaps, use the `Alt+H` key combination. Each press cycles through the different heightmaps, and the last press disables the visualization mode.

<table><thead><tr><th width="315">Map name</th><th>Purpose</th></tr></thead><tbody><tr><td><code>Visibility heightmap</code></td><td>A colorful grid that follows the contours of the <code>ground surface</code> and the objects located on it. The colors correspond to the visibility blockage height relative to the ground:<br>- <code>blue</code> - up to 0.25m;<br>- <code>purple</code> - 0.25 to 1.25m;<br>- <code>yellow</code> - 1.25 to 2m;<br>- <code>green</code> - 2 to 3m;<br>- <code>red</code> - 3m and above.</td></tr><tr><td><code>Land heightmap</code></td><td>Visualizes the height of the ground surface’s polygonal grid cells.<br>The color of the grid changes based on the minimum and maximum heights. This map is used by the engine for calculations related to ground contact and intersections.</td></tr><tr><td><code>Terrain heightmap</code></td><td>A colorful grid following the terrain's contours, marking the different <code>terrain types</code>.<br>The contour colors are defined by the <code>РР color</code> parameter, while the cell fill colors are determined by the <code>FX color</code> parameter.</td></tr><tr><td><code>Path planner heightmap</code></td><td>Visualizes the heightmap with a focus on the slope angles of each cell relative to the horizon.<br>This same map is displayed when the <code>heightmap</code> checkbox is enabled in the <code>Heights</code> tab of the Height Editor.<br>Colors indicate the slope angle compliance to the chosen level:<br>- <code>blue</code> - equal to or above the specified level;<br>- <code>gray</code> - below the specified level.<br>Used as a terrain passability check tool based on the surface slope angle for Pathfinding calculations.</td></tr><tr><td><code>Flags heightmap</code></td><td>Marks the ground surface with <code>flags</code>, which prohibit certain in-game actions on the marked areas.</td></tr></tbody></table>


# Polygons Editor

The Polygon Editor is part of the Land Editor group.\
It provides a simple tool for modifying the polygonal mesh of the terrain surface.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FUI9vLEWTYoETtsEyipZo%2F%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%202024-06-13%20%D0%B2%2017.08.59.png?alt=media&amp;token=9e074700-94ff-4245-a6d7-d93008f2bb28" alt=""><figcaption></figcaption></figure>

## Interface elements description

<table><thead><tr><th width="216">Element</th><th>Description</th></tr></thead><tbody><tr><td>Brush</td><td>The main tool for creating and editing polygons on the terrain surface</td></tr><tr><td>Level</td><td>Determines the fineness of the polygonal mesh. Select a value from 0 to 5 in the dropdown menu</td></tr><tr><td>Level Up</td><td>Doubles the base size of the terrain surface polygon with each click</td></tr><tr><td>Wireframe Checkbox</td><td>Enables the display of the polygonal mesh, making it easier to control the polygon editing process</td></tr></tbody></table>

{% hint style="warning" %}
Use the Level Up function only when absolutely necessary, as it changes the base size of the polygon. Each click doubles the base size of the polygon. This operation is irreversible.
{% endhint %}

## Brush functionality

* Adding/removing polygons
* Splitting/merging the polygonal mesh

{% hint style="warning" %}
Splitting polygons increases their number, which affects game performance.
{% endhint %}

{% hint style="danger" %}
When splitting polygons, ensure the mesh remains intact.\
Avoid splitting where a polygon vertex lands on the edge of a neighboring polygon, as this can cause holes in the mesh when editing vertex heights.
{% endhint %}

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F7dfl8900EomKVDVZKJz6%2F%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%202024-06-13%20%D0%B2%2017.48.45.png?alt=media&amp;token=6ee2fade-975a-4be8-8b5d-52d78494bcad" alt=""><figcaption></figcaption></figure>

## **Polygons brush operation**

### Setting brush parameters

* Brush size is adjusted using Numpad Plus (+) and Numpad Minus (-) keys.
* Set the polygon fineness using the Level parameter.

### Editing Polygons

* Adding polygons and adjusting polygonal mesh fineness - move the mouse while holding the left mouse button (LMB).
* Removing polygons - move the mouse while holding the right mouse button (RMB).

### Fixing the width of the polygon strip

The editor allows you to fix the width of the growing or deleting polygon strip to the brush diameter by adding key combinations

* Shift+X: fixes the strip width relative to the X-axis
* Shift+Y: fixes the strip width relative to the Y-axis

#### Algorithm for growing/deleting a polygon strip of fixed width

1. Adjust the brush size based on the width of the polygon strip to be deleted or grown
2. Hold down LMB/RMB to grow/delete
3. Without releasing the mouse button, consecutively hold down the Shift and X/Y keys to fix the polygon strip width
4. Move the mouse to draw the desired length of the strip

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FCUAmwIE8DvLIiQnajJHN%2F%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%202024-06-13%20%D0%B2%2018.43.48.png?alt=media&amp;token=91a62c24-d08f-4301-8953-82cf63b4111d" alt=""><figcaption><p>Example of drawing a polygon strip of fixed width</p></figcaption></figure>

## Usage example

The image illustrates how the editor can be utilized to modify the terrain surface by adjusting the mesh splitting level to achieve optimal results.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F1fOgxiRLDOuGQswV1yRc%2F%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%202024-06-13%20%D0%B2%2018.49.19.png?alt=media&amp;token=1b7d7c9e-78ba-4cbd-972a-286f452eeb13" alt=""><figcaption></figcaption></figure>

It is recommended to use polygon splitting for detailing the terrain and creating transitions between materials.


# Terrains Editor

### Introduction to the Terrains Editor

The Terrains Editor within the Gem RTS Land Editor provides developers with the capability to specify a variety of ground surface types on a map.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FIGyWQbdxRjdANVvSe8Af%2FTerrain%20Type%20Editor.png?alt=media&amp;token=e7ddb9f7-bd59-4771-9b16-b7356b1bee1b" alt=""><figcaption><p>The Terrain Types Editor</p></figcaption></figure>

### Accessing the Terrains Editor

For terrain type marking initiation, developers are required to open the Terrains tab located within the Land Editor.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FQ67WUZ4sUNNe4Px2cmte%2FTerrain%20Type%20Editor%20tab.png?alt=media&amp;token=ed1a1150-9fcd-4378-991f-b1bff6f2f461" alt=""><figcaption></figcaption></figure>

### Terrains Brush

To mark different terrain types, use the Brush tool, which has two components:

* **Terrain PP** (`PP color` parameter)
* **Terrain FX (**`FX Color` parameter)

The brush allows the customization of different map areas by specifying terrain properties and VFX

### Terrains Map

Applying the Terrains brush creates a Terrains Map that displays a colorful grid conforming to the shape of the landscape mesh

* The color of the grid lines is determined by the `PP Color` parameter, which specifies the physical properties of the ground surface;
* The color of cell fills is determined by the `FX Color` parameter, which defines the visual effects and texture modes of craters during ground interactions

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FAqmPKZ1dxihTHSUblKjP%2FTerrain%20colors.jpg?alt=media&amp;token=d5613059-4059-42b6-b971-d91581291bb8" alt=""><figcaption><p>The components of Terrain Types map</p></figcaption></figure>

## Terrain PP

The list of terrain types is predefined in the engine and can be viewed and selected in the Terrain PP panel.\
Each type has properties affecting unit interactions with the terrain:

* movement capability;
* maximum movement speed;
* changes in unit state (e.g., walking, swimming, sinking).

<table><thead><tr><th width="155">Terrain Type</th><th>Description</th></tr></thead><tbody><tr><td>ground</td><td>The default terrain type sets the standard movement speed for units.</td></tr><tr><td>no_pass</td><td>Movement is not allowed.<br>Refrain from this type; instead, use the no_pass flag.</td></tr><tr><td>swamp</td><td>Units sink in marshy areas</td></tr><tr><td>road</td><td>Roads allow units to move at their highest speed.</td></tr><tr><td>no_dig</td><td>No digging allowed.<br>Avoid using this type since it does not function properly.<br>Instead, use the no_dig flag.</td></tr><tr><td>deep_snow</td><td>Movement speed is decreased in deep snow.</td></tr><tr><td>water</td><td>Water areas allow units to swim or sink, depending on the unit type and water depth, calculated automatically from the water altitude parameter.</td></tr></tbody></table>

## Terrain FX

The Color FX parameter determines the VFX and craters' texmods suitable for the terrain type.

<table><thead><tr><th width="190">Terrain FX</th><th>Description</th></tr></thead><tbody><tr><td><strong>ground</strong></td><td>Dust effects and dirt texture craters are spawned.</td></tr><tr><td><strong>shallow_water</strong></td><td>Water splash effects are spawned in shallow water; no craters are spawned.</td></tr><tr><td><strong>bridge</strong></td><td>Dust effects from stone bridge destruction are spawned; no craters are spawned.</td></tr><tr><td><strong>bridge_wood</strong></td><td>Wood debris effects from wooden bridge destruction are spawned; no craters are spawned.</td></tr><tr><td><strong>road</strong></td><td>No dust effects are spawned when units move; asphalt texture craters are spawned.</td></tr><tr><td><strong>country_road</strong></td><td>Dust and soil effects typical of dirt roads are spawned, along with dirt texture craters.</td></tr><tr><td><strong>rock</strong></td><td>Effects and craters matching rocky surfaces are spawned.</td></tr><tr><td><strong>ice</strong></td><td>Visual effects and ice texture craters are spawned indicating movement or explosions on ice.</td></tr><tr><td><strong>sand</strong></td><td>Thick dust effects and sand texture craters are spawned during movement.</td></tr><tr><td><strong>puddle</strong></td><td>Splash effects and mud texture craters are spawned when moving through wet mud and puddles.</td></tr><tr><td><strong>mud</strong></td><td>Splash effects and mud texture craters are spawned when moving through marshy areas and deep puddles.</td></tr><tr><td><strong>snow</strong></td><td>Snow effects and snow-edged craters are spawned.</td></tr><tr><td><strong>grass</strong></td><td>Earth and grass chunk effects, dust during movement, and earth-textured craters are spawned.</td></tr><tr><td><strong>water</strong></td><td>Water effects, varying with depth, are spawned; depth is automatically set relative to the water altitude parameter.</td></tr></tbody></table>

### Steps to use the Terrains brush

1. Select the Land tab
2. Click the Terrains button
3. Select a terrain type from the Terrain PP options, determining the terrain's physical properties.
4. Select a VFX type from the Terrain FX options to define the visual effects and texture modes of craters during ground interactions.
5. Adjust the brush size with the Numpad Plus (+) and Numpad Minus (-) to accommodate different area sizes.
6. Apply the Terrain Type\
   Hold the Left Mouse Button and drag over the desired map area to apply the chosen terrain type and effects.


# Color Editor

The Color Editor \[Colors] is an integrated tool within the Map Editor that allows you to change the vertex colors on the polygonal mesh of the map surface.

## Opening the Color Editor

To open the Color Editor tools window, select the `Colors` tab on the Land Editor panel.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FE8Nh2WaD0845FUI6eERC%2FLand%20Colors.png?alt=media&amp;token=520947e0-4b12-45df-ad87-73e822105f07" alt=""><figcaption><p>Color Editor window</p></figcaption></figure>

## Color Editor interface

The right panel of the Color Editor contains the following controls:

### Brush settings panel

* `Soft-Sharp` **-** the slider to adjust the softness or hardness of the brush.
* `Slow-Fast` **-** the slider to adjust the speed of the brush action.

### Color selection panel

* `R, G, B` - sliders to adjust the red, green, and blue color components.
* `Palette` - a color palette for selecting colors.

## Using the Color Editor

### Selecting a color

Use the color palette or the `R, G, B` sliders to precisely adjust the shade.\
The currently selected color is displayed in the square below the palette.

**Eyedropper Tool**

To select a color from a specific location on the map:

1. Hover the cursor over the color palette.
2. Press and hold the `Ctrl` key to activate the eyedropper.
3. While holding `Ctrl`, move the eyedropper to the desired location on the map and select the color with a left mouse click (LMB).

### Brush settings

#### **Adjusting brush parameters**

Use the `Soft-Sharp` and `Slow-Fast` sliders to adjust the brush parameters.

The soft brush creates smooth color transitions, while the hard brush allows for sharp color changes.

The brush speed determines how quickly the color is applied to the surface as you move the mouse.

#### **Adjusting brush size**

To change the brush diameter, use the Plus (`+`) and Minus (`-`) keys on the Numpad.

### Applying color

To apply the selected color to the map surface, move the mouse while holding down the left mouse button (LMB) over the area you want to paint. The brush will change the vertex colors of the surface according to the chosen settings.

The Color Editor allows you to easily and accurately adjust the color parameters of the map surface, creating realistic and visually appealing landscapes.

{% hint style="warning" %}
When changing vertex colors, it is important to consider lighting and surface material to achieve the most natural look.
{% endhint %}

### Usage examples

The Color Editor can be used to create various visual effects, such as:

* coloring grass and foliage to create variety in the landscape's color palette;
* creating shadows and highlights to enhance scene realism;
* changing the color of the bottom of water bodies to simulate different lighting conditions and depths.

The Color Editor is a helpful tool for fine-tuning the visual aspects of the map.


# Flags Editor

The Flags brush is designed for marking the ground surface to restrict various game events:

* Unit spawning;
* Construction of defensive structures;
* Unit movement;
* Digging trenches.

A flag indicates a prohibition.

The Flags brush \[Flag] is located in the Land Editor tab \[2] within the Map Editor \[F2]

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F183kln9yIyQmpRxUNtL4%2Fflags.png?alt=media&amp;token=77a5fd5e-2d8b-4d3b-a447-1515de4b94dd" alt=""><figcaption></figcaption></figure>

## Using the Flags brush

* To configure the brush properties: mark the necessary prohibitions in the properties of the Flag brush
* Moving the Brush with the left mouse button (LMB) held down applies the selected set of flags.
* Moving the Brush with the right mouse button (RMB) held down removes the selected set of flags.

## **Types of Flags and their purpose**

### **Unit spawn prohibition**

* Editor Name: `no_spawn`.
* Marked and displayed with blue hatching.
* Mark areas where units are not allowed to spawn, e.g., at the edges of cliffs or steep slopes without exits.

### **Construction prohibition**

* Flag Name in the Editor: `no_install`.
* Marked and displayed with green hatching.
* Mark areas on the map where it is illogical or impossible to build defensive structures like sandbag cover, barbed wire, and tank traps. For example, on steep cliff slopes or rocks without exits.

### **Movement prohibition**

* Flag Name in the Editor: `no_pass`.\
  Equivalent to the `no_pass` terrain in the original Men of War.
* Marked and displayed with red hatching.
* Use sparingly in areas where player movement should be restricted by map design (high cliffs, steep rocks) or dictated by mission design requirements. For example, in the DDay map from Normandy DLC, the `no_pass` flag is used to prevent player movement on slopes, guiding the mission's progression.

### **Trench digging prohibition**

* Flag Name in the Editor: `no_dig`.
* Marked and displayed with yellow hatching.
* Mark areas on the map where it is illogical or impossible to dig trenches. In Men of War II, digging trenches is prohibited on steep slopes, rocky surfaces, in bodies of water, swamps, coastal areas and along asphalt roads. It is also recommended to mark areas under indestructible cover (for example, entourage rocks), under entourage entities without obstacles, and over entities of slope to avoid visual buges.\
  Entities with obstacles include an automatic prohibition on trench digging. Adding the no\_dig flag under houses or any other objects with obstacles is not necessary.

### **Examples**

#### The no\_dig Flag Over Slope Objects

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FJdGdAsEsd4JAGQbdaN23%2Fimage.png?alt=media&amp;token=58398086-e94e-4c63-b5ae-d40669d0c4ef" alt=""><figcaption></figcaption></figure>

The `no_dig` flag is applied with a large brush over cliffs to completely cover the slope model located under the ground surface polygons.

#### Visual bug example at the intersection of land and water when digging trenches

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FRIVX5Rc49XhciK4V6Q5d%2Fimage.png?alt=media&amp;token=e143dca4-6ddf-4713-b7f5-efb2ba268f34" alt=""><figcaption></figcaption></figure>

It is recommended to mark transitions between water and land surfaces with the `no_dig` flag to completely cover the water polygons along the shoreline under the ground surface polygons.

#### The no\_dig flag under entourage stones

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FzYSyGQh1wy9Rb8IwqgXl%2Fimage.png?alt=media&amp;token=1781abac-a5dd-4230-b2fc-375869b1c67c" alt=""><figcaption></figcaption></figure>

**The no\_dig flag on no steep slopes**

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2Fi9T9ny95m27XeUS77aU6%2Fimage.png?alt=media&amp;token=3912810a-283e-4a9c-90cd-16d64adb712c" alt=""><figcaption></figcaption></figure>

## Combined Flags brush

A combined brush with multiple flags enabled can be used to mark areas on the map where corresponding player actions need to be prohibited.\
For example, on cliff edges where spawning, digging, and placing sandbags are all restricted.


# Material Editor

**Material Editor** \[Textures] is part of the **Land Editor** (Land).\
This tool is designed for editing and configuring materials applied to the ground surface in the game world.

## Key elements of the Material Editor

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FzfhYeG6Zu0NAt5l69sUB%2Fimage.png?alt=media&amp;token=c5606b82-61db-45ea-839f-74bf81dc1963" alt=""><figcaption><p>Interface elements of the Material Editor</p></figcaption></figure>

1. Textures brush
2. Sliders for brush parameter adjustment
3. List of all ground materials on the map
4. Texture preview window for selected material
5. Properties window of the selected material

## Quick guide to using the Material Editor

1. **Selecting a material**
   1. Select the desired material from the material list \[3] or use the eyedropper to select a material from the map.
   2. If the desired material is not on the map, add it using the `Add` button \[3.1] or import materials from another map using the `Import` button \[3.2].

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FZlEhmWJukgQKrEvv2klL%2F%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%202024-07-18%20%D0%B2%2013.32.19.png?alt=media&amp;token=2acd9eec-4d45-4468-adf3-40b35296686e" alt="" width="518"><figcaption></figcaption></figure>

2. **Configuring texture parameters in a material**

   1. In the properties window of the selected material \[5], choose the material scheme for each layer:
      * \[5.3] - layer1;
      * \[5.4] - layer2.

   <figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FSx4oxbBy1X8zqhcUxlGT%2Fimage.png?alt=media&amp;token=dfd95ff6-e3c7-41db-b474-eb1ae684ccd0" alt="" width="446"><figcaption></figcaption></figure>

   2\. Configure the material parameters for each layer:

   * select the diffuse texture \[4];
   * adjust the density and tile size \[5.1];
   * set the parameter values for each layer of the material \[5].

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FClpKxpEn83LMYOFzPNZu%2F%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%202024-07-18%20%D0%B2%2017.28.28.png?alt=media&amp;token=97d522fa-2763-47f1-8a0c-15fce5059f66" alt="" width="416"><figcaption></figcaption></figure>

2. **Brush Settings**
   1. Adjust the brush size using the `+` and `-` keys on the Numpad.
   2. Use the `Soft-Sharp` and `Slow-Fast` sliders to adjust the brush edge softness and texture application speed.
   3. Adjust the texture blending in the material if necessary.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FqiqZ7Hgt1CsHCFNnXh7Z%2FBrush%20Settings.png?alt=media&amp;token=91eb4f44-bb96-43c9-aa45-95ef88af0558" alt="" width="458"><figcaption></figcaption></figure>

3. **Applying Material Textures**
   1. Use the brush to apply the selected material to the desired areas of the map.
   2. Create smooth transitions between materials by using the same texture in both materials..

## Detailed information for each Quick guide point

### **Material List**

Material List displays available materials for painting.\
All available materials on the map are displayed in a separate window as a list, with each entry showing the names of two textures.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FZlEhmWJukgQKrEvv2klL%2F%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%202024-07-18%20%D0%B2%2013.32.19.png?alt=media&amp;token=2acd9eec-4d45-4468-adf3-40b35296686e" alt="" width="518"><figcaption></figcaption></figure>

<table><thead><tr><th width="222">Element</th><th width="250">Description</th><th>Note</th></tr></thead><tbody><tr><td><code>[Name1]...[Name2]</code></td><td><p>A ground material consists of a pair of textures:</p><ul><li><strong>primary</strong> <strong>texture</strong> - left;</li><li><strong>secondary texture</strong> - right.</li></ul></td><td>By default, when creating a new map, the entire surface is filled with the primary texture of <a href="#base-material">the base material</a></td></tr><tr><td><code>Add</code></td><td>Button to add material to the list.</td><td>When you click the <code>Add</code> button, the editor adds a copy of the currently selected material from the list.<br>Then, in the newly added material row, you need to change one of the textures: left or right, to save the added material in the list.</td></tr><tr><td><code>Import...</code></td><td>Button to import a material list from another map.</td><td>The editor allows you to choose a map from the list available for loading in the editor.</td></tr></tbody></table>

### **Base Material**

When creating a new map, the entire surface is filled with the default material, where the left and right textures are the same.

It is recommended to immediately replace the right texture in the default material, creating a base material for the ground surface so that it is convenient to make transitions with other materials.

## **Material Selection**

There are two ways to select a material from those available on the map:

1. Left-click (LMB) on the material row in the material list \[3].

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FZlEhmWJukgQKrEvv2klL%2F%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%202024-07-18%20%D0%B2%2013.32.19.png?alt=media&amp;token=2acd9eec-4d45-4468-adf3-40b35296686e" alt="" width="518"><figcaption></figcaption></figure>

2. Use the eyedropper to select a material. To activate the eyedropper, hold down the `Ctrl` key and click LMB on the visually suitable point on the map surface.

## **Material configuration**

Selecting a material will highlight the corresponding row in the material list \[3].\
The preview \[4] and settings \[5] windows will display information about the textures in the selected material.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FH021rejznlr47OzrlRDF%2FPreview%20textures%20window.png?alt=media&amp;token=333ced4e-78bf-4712-bbcf-4e6ea39671a7" alt="" width="508"><figcaption><p>The Preview textures window</p></figcaption></figure>

### **Managing textures in a material**

<table><thead><tr><th width="123">Action</th><th width="180">Description</th><th>Note</th></tr></thead><tbody><tr><td><strong>Replace texture in material</strong></td><td>LMB on the texture visualization tile [4] opens the texture selection window.</td><td><p>When replacing a texture in a material, it will be replaced not only in the material but also in all places on the map where the selected material is applied.</p><p>This can spoil the visualization of transitions between materials. It is recommended to replace textures in a material only when absolutely necessary</p></td></tr><tr><td><strong>Swap</strong></td><td>Swap textures in a material.</td><td>This action will change textures not only in the material but also in all areas where the material is applied on the map, which can spoil the transitions between materials. It is recommended to do this only when absolutely necessary</td></tr><tr><td><strong>Fill</strong></td><td>Paint the entire map with the primary texture of the selected material.</td><td>Useful if you need to completely change the map's texture painting (e.g., change the season on the map)</td></tr></tbody></table>

### Main material parameters

<table><thead><tr><th width="78">№</th><th width="145">Parameter</th><th width="251">Description</th><th>Recommended Value</th></tr></thead><tbody><tr><td>4.1</td><td>Texture size</td><td>Side length of the texture square in pixels</td><td>1024</td></tr><tr><td>4.2</td><td>Texture density</td><td>Number of texture pixels per 1 meter of terrain surface in the game space</td><td>128 pix/m</td></tr><tr><td>4.3</td><td>Tile size</td><td>Step with which the texture will repeat when evenly covering the terrain surface</td><td>Should be chosen so that the texture density on the terrain surface varies within 120-130 pix/m</td></tr><tr><td>5.1</td><td>Lend texture basis</td><td>Base value of the material tile</td><td>15</td></tr><tr><td>5.2</td><td>MTL№</td><td>Field for setting the material type (one-layer or two-layer)</td><td>Only two-layer materials are used for applying to the terrain surface. Single-layer materials are used in the Water Editor</td></tr><tr><td>5.3</td><td>Layer 1</td><td>Field for choosing the scheme type for the first layer texture</td><td>The scheme type affects the composition of texture maps in the layer and the set of parameters in the texture settings</td></tr><tr><td>5.4</td><td>Layer 2</td><td>Field for choosing the scheme type for the second layer texture</td><td>-</td></tr></tbody></table>

## Brush

The textures brush allows you to apply materials to the ground surface in the game world. Texture application occurs on the vertices of the terrain mesh that fall within the brush circle.

### **Brush settings management**

<table><thead><tr><th width="288">Action</th><th width="260">Tool</th><th>Note</th></tr></thead><tbody><tr><td>Changing sizes of a brush</td><td><code>+</code> and <code>-</code> keys on the Numpad</td><td></td></tr><tr><td>Adjusting brush edge softness</td><td><code>Soft-Sharp</code> slider</td><td>Soft - soft edges;<br>Sharp - sharp edges</td></tr><tr><td>Adjusting texture application speed</td><td><code>Slow-Fast</code> slider</td><td></td></tr><tr><td>Selecting material from the list</td><td>LMB on the desired row in the material list window [3]</td><td>-</td></tr><tr><td>Pick a material from the map</td><td>The eyedropper tool</td><td>Hold down the <code>Ctrl</code> key and click LMB on the desired point on the map</td></tr></tbody></table>

## Ways to apply material textures

### **Pure Application**

* To apply a texture to the surface, move the mouse while holding down the LMB or RMB (for applying primary or secondary textures respectively).

### **Blending**

* Apply one texture over another by clicking LMB or RMB.
* Fix the degree of texture blending using the slider position in the texture visualization window.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2Fe1GlL9hgtJm3bkN5WWm0%2Fimage.png?alt=media&amp;token=758e323d-9b06-4662-bacf-8dd3beb2a134" alt="" width="464"><figcaption><p>Texture b<strong>lending slider</strong></p></figcaption></figure>

## Transitions between materials

To create smooth transitions between materials, use the same texture in both materials at their borders. This ensures a seamless gradient from one material to another.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2Fb3LLvlqqZ97CGxEJLLHC%2Fimage.png?alt=media&amp;token=0ca2a6d8-18b5-4398-b486-17031c209d6a" alt=""><figcaption><p><strong>Illustration of transitions between materials 1 and 2</strong></p></figcaption></figure>

<details>

<summary>Illustration Description</summary>

In the example shown, materials 1 and 2 share the same secondary texture – `forest_ground01_pbr`.

Smooth and visually seamless transitions between materials are achieved by applying their common texture, `forest_ground01_pbr`, along the entire perimeter of the transition.

In the illustration, the transition contour between materials 1 and 2 is shown with an orange arc, where the secondary texture of both materials is used to create a smooth transition.

Attempts to join materials using different textures result in sharp seams, as shown in the area marked by the red square.

It doesn't matter which texture (primary or secondary) is shared. The key is that the transition between materials is made through a common texture.

</details>


# Grass Editor

The **Grass Editor** in the GEM RTS Engine is used for adding and editing **grass cover** on a map's surface. The **grass cover** consists of **grass pools**.

A **grass pool** is a surface layer containing grass objects derived from one or more **grass patterns**.\
Grass Editor enables the creation of unique settings for each grass pool. Overlapping grass pools increase the density and diversity of grass cover in overlapping areas.

To access the Grass Editor, open the `Grass` tab in the **Landscape Editor**.

## **Grass Editor interface elements**

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F5qL7CGW5KO8BsGdiTpQv%2Fgrass%20editor.webp?alt=media&amp;token=434cc65c-0db0-46d6-a986-0fdd34cbf49e" alt=""><figcaption><p>The <code>Grass</code> tab in the <strong>Landscape Editor</strong>.</p></figcaption></figure>

1. Sliders for adjusting the `Grass` brush.
2. The **grass pool list**.
3. Buttons for managing the **grass pool list**.
4. Modifier settings window for the selected **grass pool**.
5. The **grass patterns list**.
6. Scene editor.

Grass cover creation, editing, and deletion occur in real-time using the `Grass` brush on the scene.

## The Grass brush settings

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FqJLSV3341xXgCNh2K1Dr%2FGrass%20Brush.png?alt=media&amp;token=96515cae-478b-4346-9304-da9a920af405" alt=""><figcaption></figcaption></figure>

* The slider `Sharp`/`Soft`: adjusts the blur level of the drawing area’s boundaries.
* The slider `Slow`/`Fast`: controls the rate of grass object addition during drawing.
* `Grass` brush size is adjusted using the `+` (Plus) and `-` (Minus) keys.

## **The Grass pool list**

The list displays the names of all grass pools used in the current map. The name of the selected grass pool is highlighted and comprises:

* pool type name;
* short description.

Example: `grid ‘grass green’`

* `grid`: pool type name.
* `grass green`: description.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FJNp2KP58f1UToyULwMwQ%2FGrass%20Pool%20list.png?alt=media&amp;token=53bb3088-a53f-4383-8b3e-f1daf6911bb7" alt=""><figcaption><p>The Grass Pool list</p></figcaption></figure>

To highlight the grass objects' locations on the map for the selected pool, hold the `Shift` key.

### **The Grass Pool list management buttons**

* `Add`: adds a new pool.
* `Delete`: removes the selected pool.

{% hint style="info" %}
Currently, only the `grid` pool type is supported.\
Procedurally generated pools may be added in future updates.
{% endhint %}

### Grass Pool modifier settings

Each grass pool has a set of modifiers that influence the grass cover's appearance.\
These modifiers adjust pool parameters and grass object spawning during brush use.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FjeyAW2fwQY43mMFSu0PN%2FSetting%20up%20Grass%20pool%20parameters.png?alt=media&amp;token=fd24c81f-410c-413e-9155-5b758b4bc06f" alt=""><figcaption><p><strong>Modifiers configuration window</strong></p></figcaption></figure>

The modifier window opens when a pool is selected or newly created.

<table data-header-hidden><thead><tr><th width="190">Modifier</th><th>Description</th></tr></thead><tbody><tr><td><code>name</code></td><td>Contains the pool's code name or brief description.<br>Example: <code>'grass fields'</code>.</td></tr><tr><td><code>cell size</code></td><td>Sets the grid cell size for grass placement density.<br><strong>Editable only for empty pools.</strong></td></tr><tr><td><code>rotation</code></td><td><p>Adjusts the grid angle, enabling placement on arbitrary angles relative to the ground surface layout.</p><p><strong>Editable only for empty pools.</strong></p></td></tr><tr><td><code>scale_range</code></td><td>Specifies the range for scaling grass objects during brush use, applied randomly within the range.</td></tr><tr><td><code>spreading</code></td><td>Defines grass object offset from grid nodes. A value of <code>0</code> places objects strictly at nodes, useful for creating aligned patterns like "furrows."</td></tr><tr><td><code>strict_angle</code></td><td>Regulates object placement on slopes. <em>(Disabled in the current version.)</em></td></tr></tbody></table>

## The Grass Patterns list

The `Patterns` window displays available templates for the `Grass` brush. The name of the selected pattern is highlighted.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FudsLCxAxmoHVHMUzvyXz%2FGrass%20Patterns.png?alt=media&amp;token=2840728e-52b6-425a-82fa-c9b33a3a277e" alt=""><figcaption><p>The pattern <code>plant_3</code> highlighted as the selected option for drawing grass cover</p></figcaption></figure>

{% hint style="info" %}
The description of the Grass Patterns list is in the file `scene/set/grass.set`
{% endhint %}

{% hint style="success" %}
Grass models in templates feature:

* Support for various materials.
* Shadow casting and self-shadowing.
* Interaction with "wind."
* "Burning" functionality.
  {% endhint %}

## Grass brush operation

* **LMB**: adds grass per the selected pool and template parameters.
* **RMB**: removes grass cover from the selected pool.

The grass pool's modifiers are applied when spawning grass objects during brush usage.

### **Recommendations:**

1. Use different templates to create a natural and diverse landscape.
2. Customize pool modifiers for specific tasks, e.g., dense forests, sparse meadows, or neatly aligned crop rows.
3. Combine grass cover with other elements like trees and shrubs for optimized and realistic scenes.

### Working algorithm with the Grass brush

**Adding grass:**

1. Add a new pool or select an existing one.
2. Configure grid parameters (`cell size`, `rotation`) for empty pools.
3. Set modifiers for grass models (`scale_range`, `spreading`).
4. Choose a grass template from the `Patterns` list.
5. Use `LMB` to draw or click on desired areas.

{% hint style="info" %}
Repeat steps 3–5 for different templates and adjust parameters as needed.
{% endhint %}

**Removing grass:**

1. Select the required grass pool.
2. Use `RMB` to erase grass from specific areas.

{% hint style="danger" %}
Deleting a grass pool removes all associated models from the map.
{% endhint %}

{% hint style="warning" %}
When designing maps, it is important to consider that the presence of grass cover impacts performance and to use various optimization methods to prevent FPS drops.
{% endhint %}

## Best practices for realistic landscapes

To achieve the most realistic perception of the map's landscape, it is important to apply a comprehensive approach, using several tools from the Map Editor:

* [**Materials Editor**](/editor/map-editor/3-landscape-editor/material-editor)
* [**Color Editor**](/editor/map-editor/3-landscape-editor/color-editor)
* **Grass Editor**
* [**Entity Editor**](/editor/map-editor/2-entity-editor) to complement the surface texture patterns with map entities like stones, flora, and other ambient objects.

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXfgGCiABrBVtujl8YSH9TI69dQLQYXP5SPpfMRhPV45svuzwQYmzSG40FRKuAfLZ5HYvqRxE11l-f8tKna13ZhFeQEKTl6epbF3QSXd4UM2YGdr4Zk7XAO7K3tGZEh_iLH7tHLLjbqeoAxmOqbUNOYLoGQ3?key=mT02MhWvds0bP5JA9s1VjA" alt=""><figcaption><p>Example <strong>of successful grass used on the arena_polesie map</strong></p></figcaption></figure>

**Natural grass cover:**

* Use overlapping pools with varied densities for realism.
* Combine short, tall, or dry grass patterns for natural effects.
* Avoid grass in areas dictated by narrative or map design.

**Maintaining visual integrity:**

* Use the `Color` brush for distant areas where grass rendering is disabled for optimization.
* Adjust terrain and grass cover hues to blend transitions and maintain consistency.

**Combining elements: textures, map entities, Grass brush, Color brush**

* Adjust terrain textures or vertex colors for seamless integration.
* Add objects like tall grass, stones, or shrubs for a lively environment, aligning with the map’s style and logic.

Using the Grass Editor in combination with other tools allows for creating detailed and visually appealing game maps, significantly simplifying the process of adding and configuring vegetation.


# Foliage Editor

This article covers the main aspects of using the Foliage Tools

**Foliage Tools** is a Land Editor tool designed for automated placement of game entities.\
The Foliage brush allows for quick and easy creation of realistic and optimized landscape scenes.\
The brush parameters enable you to configure the brush composition as well as the density, scale, tilt angle, and other characteristics of the entities included in the brush, giving you full control over entity placement when filling a scene.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F1EgtcOuhcGcjIVET3jF4%2Ffoliage.png?alt=media&amp;token=60134748-bf05-490b-946e-27388db51049" alt=""><figcaption><p>Foliage editor Interface elements</p></figcaption></figure>

## Foliage editor interface elements

* [Main Menu](#main-menu) \[1]
* [Brush settings](#brush-settings) \[2]
* [Foliage List](#foliage-list) \[3]
* [Properties Window](#properties-window) for the selected entity \[4]

## Main Menu

The **Foliage Tools** main menu \[1] provides basic functions for working with brushes. You can load previously saved brushes, save current settings, or create new brushes based on existing ones.

<table data-header-hidden><thead><tr><th width="218">Control Button</th><th>Description</th></tr></thead><tbody><tr><td><code>Load</code></td><td>Load a previously saved brush.</td></tr><tr><td><code>Save</code></td><td>Save the current brush.</td></tr><tr><td><code>Save As</code></td><td>Save the current brush as a new file or create a new brush.</td></tr></tbody></table>

## Brush settings

The brush settings \[2] determine how the tool will operate when placing entities. You can adjust the brush size, entity placement density, and manage the checkboxes that control whether entities can be placed on various surfaces, providing flexibility and control over scene creation.

<table><thead><tr><th width="222">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>Brush File</code></td><td>The file name with a relative path to the brush.</td></tr><tr><td><code>Brush Size</code></td><td>Determines the brush size within the range [0.0-3000.0].</td></tr><tr><td><code>Paint Density</code></td><td>Entity placement density, a general multiplier for each active entity within the range [0.0-1.0].</td></tr><tr><td><code>Landscape</code></td><td>Checkbox controlling permission to place entities on the landscape.</td></tr><tr><td><code>Static Meshes</code></td><td>Checkbox controlling permission to place a foliage on static meshes (for example: grass on buildings)</td></tr><tr><td><code>Foliage</code></td><td>Checkbox controlling permission to place a foliage on other blocking foliage geometry.</td></tr></tbody></table>

{% hint style="info" %}
The **Landscape** checkbox is enabled by default. The ability to toggle the **Landscape**, **Static Meshes**, and **Foliage** checkboxes is temporarily disabled.
{% endhint %}

## Foliage List

The **Foliage List** window \[3] contains a list of entities that can be placed in the scene using the loaded brush. The control buttons allow you to add new entities to the list, delete unnecessary ones, and clear the entire list to create a new selection of entities.

<table><thead><tr><th width="213">Control Button</th><th>Description</th></tr></thead><tbody><tr><td><code>Add</code></td><td>Add a new entity to the list.</td></tr><tr><td><code>Delete</code></td><td>Remove an entity from the list.</td></tr><tr><td><code>Clear</code></td><td>Clear a foliage list.</td></tr><tr><td><code>Generate</code></td><td>Generate a foliage list from selected entities.</td></tr></tbody></table>

## Properties Window

The **Properties** window for the selected entity \[4] is designed to configure the parameters of the selected entity from the foliage list. These settings allow you to adjust the entity's activity and its behavior when placed in the scene.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FQgLqa7sLc5K3o8wYRY4z%2Feditor.png?alt=media&amp;token=62875c6d-4bd2-4a4f-b961-015234e4f6a0" alt=""><figcaption><p><strong>Properties</strong> window</p></figcaption></figure>

### **Base properties**

This group of parameters controls the entity's activity and specifies the path to the entity file that will be used for placement.

<table><thead><tr><th width="245">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>Activate</code></td><td>Checkbox that determines whether the selected entity is active for painting.</td></tr><tr><td><code>Entity</code></td><td>The relative path to the entity file that will be used for painting.</td></tr></tbody></table>

### **Painting**

The parameters in the **Painting** section define the density of entities, the minimum distance between them, and their scale. These parameters provide control over how entities will be placed in the scene.

<table><thead><tr><th width="245">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>Density</code></td><td>Determines the density of entity instances during painting.</td></tr><tr><td><code>Radius</code></td><td>The minimum distance between entity instances during painting.</td></tr><tr><td><code>Apply Radius to All</code></td><td>Enables applying the specified radius settings to all entities in the foliage list.</td></tr><tr><td><code>Scale</code></td><td>Determines the random scale of entities within a specified range.</td></tr></tbody></table>

### **Placement**

The parameters in the **Placement** section control the placement of entities in the scene space, including offset, orientation to the surface normal, random rotation and tilt, as well as allowable angles and heights for placement.

<table><thead><tr><th width="262">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>Z Offset</code></td><td>Sets random offset along the Z-axis for each entity instance.</td></tr><tr><td><code>Align to Normal</code></td><td>Enables alignment of entity instances to the surface normal.</td></tr><tr><td><code>Align Max Angle</code></td><td>Sets the maximum deviation angle of the entity instance from the normal.</td></tr><tr><td><code>Random Yaw</code></td><td>Determines the random rotation of the entity instance around the vertical axis.</td></tr><tr><td><code>Random Pitch Angle</code></td><td>Determines the random tilt of the entity instance along the X-axis.</td></tr><tr><td><code>Ground Slope Angle</code></td><td>Restricts entity placement to surfaces with a specified slope angle.</td></tr><tr><td><code>Height</code></td><td>Determines the height range within which entities can be placed.</td></tr></tbody></table>

### **View**

The **View** settings define the visual parameters of entity instances and are used for fine-tuning the appearance of entities in the scene.

<table><thead><tr><th width="250">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>Opacity</code></td><td>Controls the level of entity transparency.</td></tr><tr><td><code>Color</code></td><td>Sets the color of entities in the scene.</td></tr></tbody></table>


# \[4] Spline Editor

**Spline Editor** \[`Spline`] is a set of tools for creating and editing linear objects on the map: roads, fences, power lines, shorelines, as well as for applying terrain deformation.

**Spline** is a curve along which linear objects are constructed. When placed, the spline automatically adjusts to the terrain, ensuring precise conformity to the surface curvature and its variations.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FPej4qotWwJkC21WkFdZr%2FSpline%20editor.jpg?alt=media&amp;token=ca04fcb4-1db9-4c48-ba3a-0e844149af26" alt="Spline editor window"><figcaption></figcaption></figure>

{% hint style="info" %}
In Gem RTS only the `Road` tab is available, intended for creating roads.
{% endhint %}

## Road Editor

The road creation tool is part of the spline editor and is used to build the road network on the map. It allows creating roads of any shape, automatically adjusting to the terrain, and controlling their appearance through road surface material parameters.

The road editor is located on the `Road` tab in the spline editor window `spline [4]`.

**The tool is intended for:**

* building roads of various widths and shapes;
* flexible configuration of road materials and textures;
* managing the rendering priority of roads on the terrain when they intersect;
* integrating the road network into the overall scene structure.

### General Information

Work in the road editor is organized through **road containers**.\
A container stores data about a specific road and may be empty — in which case the road will not be displayed on the map. The road visually appears only after spline nodes are added to the container.

**Spline** — a curve constructed along defined nodes. It may include any number of nodes and precisely follows the terrain curvature, defining the shape of the road surface.

**Spline nodes** — control points that form the road. Each node is displayed as a wireframe sphere and has two handles for curvature adjustment.

**Curvature handles** — manipulators around the selected node that allow controlling the smoothness of the road bend. The handle length can be adjusted by dragging with LMB.

**Legend:**

* Yellow wireframe sphere — spline nodes.
* Blue wireframe sphere — **active node**: the last added or selected (current).
* Yellow lines with small red spheres at the ends — road curvature handles.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FdjvstE1J7f1o7GLSDmK7%2FSpline%20nodes.png?alt=media&amp;token=63f7b35d-e576-4dd9-8dbc-06c5dec8594a" alt=""><figcaption><p>Legend illustration for spline elements</p></figcaption></figure>

### Road Editor Interface

<figure><img src="https://bestway-1.gitbook.io/dokumentaciya/~gitbook/image?url=https%3A%2F%2F2052154247-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fx2fkAZ6oKGGdByFhKPpa%252Fuploads%252F6M3SyZgN910Ei2Czo20M%252F20250917132124_1.jpg%3Falt%3Dmedia%26token%3Dd6bcfd61-1f04-4a98-a8cf-9c8a265321cb&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=67c30ef7&#x26;sv=2" alt=""><figcaption><p>Road editor window</p></figcaption></figure>

The `Road` window in the `spline [4]` tab contains the following elements:

1. **Display settings** — a set of checkboxes for configuring the display of nodes and spline lines of roads.
2. **Spline list** — a list of all road containers on the map. Each container stores information about one road surface.
3. **Properties panel** — a list of parameters for configuring the appearance of the selected road container (width, texture density, material, etc.).
4. **Hint window** — located under the **Properties** panel, displays the description of the selected parameter in the **Properties** window.
5. **Workspace**

### Context Menu of the Road Container List

The list of all road containers is located in the `Spline list` window. The context menu is used for container management.\
The context menu is opened with **RMB** in two ways depending on the action context:

* on empty space in the list — to add a new container or clear the list of containers;
* on the name of an existing container — to open the management menu for the selected object.

<figure><img src="https://bestway-1.gitbook.io/dokumentaciya/~gitbook/image?url=https%3A%2F%2F2052154247-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fx2fkAZ6oKGGdByFhKPpa%252Fuploads%252F3fXj9c7tzEl1dS0w0xxn%252F%25D0%2592%25D1%258B%25D0%25B7%25D0%25BE%25D0%25B2%2520%25D0%25BA%25D0%25BE%25D0%25BD%25D1%2582%25D0%25B5%25D0%25BA%25D1%2581%25D1%2582%25D0%25BD%25D0%25BE%25D0%25B3%25D0%25BE%2520%25D0%25BC%25D0%25B5%25D0%25BD%25D1%258E%2520%25D1%2583%25D0%25BF%25D1%2580%25D0%25B0%25D0%25B2%25D0%25BB%25D0%25B5%25D0%25BD%25D0%25B8%25D1%258F%2520%25D0%25BA%25D0%25BE%25D0%25BD%25D1%2582%25D0%25B5%25D0%25B8%25CC%2586%25D0%25BD%25D0%25B5%25D1%2580%25D0%25B0%25D0%25BC%25D0%25B8%2520%25D0%25B4%25D0%25BE%25D1%2580%25D0%25BE%25D0%25B3.jpg%3Falt%3Dmedia%26token%3D1ae05629-2d39-4237-af39-a302dc2e6ed3&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=d65fa2aa&#x26;sv=2" alt="Calling the context menu for managing road containers"><figcaption><p>Illustration of invoking the context menu for managing road containers</p></figcaption></figure>

#### Description of the context menu commands:

<table data-header-hidden><thead><tr><th width="249.62890625" valign="top">Command</th><th>Description</th></tr></thead><tbody><tr><td valign="top"><code>Add..</code></td><td>Adds a <strong>new road container</strong> to the list.<br>To create a road, select the container and add spline nodes (control points of the selected container).</td></tr><tr><td valign="top"><code>Rename..</code></td><td>Renames the selected road container.</td></tr><tr><td valign="top"><code>Copy..</code></td><td>Creates a copy of the selected road container.</td></tr><tr><td valign="top"><code>Delete</code></td><td>Deletes the selected container along with all points.</td></tr><tr><td valign="top"><code>Up</code></td><td>Moves the selected container up in the list.</td></tr><tr><td valign="top"><code>Down</code></td><td>Moves the selected container down in the list.</td></tr><tr><td valign="top"><code>Select control points</code></td><td>Selects all spline nodes of the selected road, allowing simultaneous movement.</td></tr><tr><td valign="top"><code>Clean points</code></td><td>Deletes all nodes from the selected road container.<br>After deletion, the road can be rebuilt.</td></tr><tr><td valign="top"><code>Clean a road list</code></td><td>Deletes all created containers from the map and the list.</td></tr></tbody></table>

The selected node can be moved along the map surface.\
The entire road surface can also be moved by selecting all spline nodes using the `Select control points` command in the container context menu.

#### Hotkeys for working with spline nodes:

| Control        | Description                                                                                                                                                                                  |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **LMB**        | <p>Selects a node on the map.<br>Dragging while holding LMB on the selected node moves it along the map surface.</p>                                                                         |
| **Ctrl + LMB** | <p>Adds a new node.<br>If the edge node is selected — a new node is added at the specified map location.<br>If clicked on a line between nodes — a new node is inserted into the spline.</p> |
| **RMB**        | Opens the context menu.                                                                                                                                                                      |

#### Context menu commands for spline nodes

The context menu opens with RMB on a node sphere.

<figure><img src="https://bestway-1.gitbook.io/dokumentaciya/~gitbook/image?url=https%3A%2F%2F2052154247-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fx2fkAZ6oKGGdByFhKPpa%252Fuploads%252FzG3t6saJFa2GGdW4wDto%252F%25D0%259A%25D0%25BE%25D0%25BD%25D1%2582%25D0%25B5%25D0%25BA%25D1%2581%25D1%2582%25D0%25BD%25D0%25BE%25D0%25B5%2520%25D0%25BC%25D0%25B5%25D0%25BD%25D1%258E%2520%25D1%2583%25D0%25B7%25D0%25BB%25D0%25B0%2520%25D1%2581%25D0%25BF%25D0%25BB%25D0%25B0%25D0%25B8%25CC%2586%25D0%25BD%25D0%25B0.png%3Falt%3Dmedia%26token%3D0982faa3-e393-420b-b500-e288ae2e137e&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=c1c2791c&#x26;sv=2" alt=""><figcaption></figcaption></figure>

| `Join nodes` | Delete the selected node and connect the adjacent ones. |
| ------------ | ------------------------------------------------------- |
| `Split road` | Split the spline into two parts.                        |
| `Cancel`     | Cancel the action.                                      |

### Creating a Road

{% stepper %}
{% step %}
**Create a road container**

1. **RMB** on empty space in the `-Spline list-` window → call the context menu and select `Add..`.

<figure><img src="https://bestway-1.gitbook.io/dokumentaciya/~gitbook/image?url=https%3A%2F%2F2052154247-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fx2fkAZ6oKGGdByFhKPpa%252Fuploads%252FRIFfBpsdwXxrUcFLL3lv%252F%25D0%2594%25D0%25BE%25D0%25B1%25D0%25B0%25D0%25B2%25D0%25BB%25D0%25B5%25D0%25BD%25D0%25B8%25D0%25B5%2520%25D0%25BD%25D0%25BE%25D0%25B2%25D0%25BE%25D0%25B3%25D0%25BE%2520%25D0%25BA%25D0%25BE%25D0%25BD%25D1%2582%25D0%25B5%25D0%25B8%25CC%2586%25D0%25BD%25D0%25B5%25D1%2580%25D0%25B0%2520%25D0%25B4%25D0%25BB%25D1%258F%2520%25D1%2581%25D0%25BF%25D0%25BB%25D0%25B0%25D0%25B8%25CC%2586%25D0%25BD%25D0%25B0%2520%25D0%25B4%25D0%25BE%25D1%2580%25D0%25BE%25D0%25B3%25D0%25B8.png%3Falt%3Dmedia%26token%3D4bc5678d-f175-4016-b5a0-b3bbf3386a64&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=f792176c&#x26;sv=2" alt=""><figcaption></figcaption></figure>

2. In the `Input` dialog, enter the container name and confirm — the name will appear in the `-Spline list-` window.

<figure><img src="https://bestway-1.gitbook.io/dokumentaciya/~gitbook/image?url=https%3A%2F%2F2052154247-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fx2fkAZ6oKGGdByFhKPpa%252Fuploads%252FYvWLdGGL2M2vouff4hYT%252F%25D0%2592%25D0%25B2%25D0%25BE%25D0%25B4%2520%25D0%25B8%25D0%25BC%25D0%25B5%25D0%25BD%25D0%25B8%2520%25D0%25BA%25D0%25BE%25D0%25BD%25D1%2582%25D0%25B5%25D0%25B8%25CC%2586%25D0%25BD%25D0%25B5%25D1%2580%25D0%25B0%2520%25D1%2581%25D0%25BF%25D0%25BB%25D0%25B0%25D0%25B8%25CC%2586%25D0%25BD%25D0%25B0%2520%25D0%25B4%25D0%25BE%25D1%2580%25D0%25BE%25D0%25B3%25D0%25B8%2520%25D0%25B2%2520%25D0%25B4%25D0%25B8%25D0%25B0%25D0%25BB%25D0%25BE%25D0%25B3%25D0%25BE%25D0%25B2%25D0%25BE%25D0%25B5%2520%25D0%25BE%25D0%25BA%25D0%25BD%25D0%25BE%2520Imput.png%3Falt%3Dmedia%26token%3D6dd857cd-31de-436f-a91d-7a506fc725eb&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=5c757a3e&#x26;sv=2" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**Add road nodes to the container**

1. Select the name of the created container from the list.
2. In the editor workspace, use **Ctrl + LMB** to add the first control point on the terrain at the desired map location — a blue sphere of the first spline node will appear.

<figure><img src="https://bestway-1.gitbook.io/dokumentaciya/~gitbook/image?url=https%3A%2F%2F2052154247-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fx2fkAZ6oKGGdByFhKPpa%252Fuploads%252FziKnhFQaBgd3xWTs3zR9%252F%25D0%2594%25D0%25BE%25D0%25B1%25D0%25B0%25D0%25B2%25D0%25BB%25D0%25B5%25D0%25BD%25D0%25B8%25D0%25B5%2520%25D1%2583%25D0%25B7%25D0%25BB%25D0%25BE%25D0%25B2%2520%25D1%2581%25D0%25BF%25D0%25BB%25D0%25B0%25D0%25B8%25CC%2586%25D0%25BD%25D0%25B0%2520%25D0%25B2%2520%25D0%25BA%25D0%25BE%25D0%25BD%25D1%2582%25D0%25B5%25D0%25B8%25CC%2586%25D0%25BD%25D0%25B5%25D1%2580.png%3Falt%3Dmedia%26token%3D09ff63b1-8cb8-48f6-9f88-4a7db5758f60&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=ad9eadc3&#x26;sv=2" alt=""><figcaption></figcaption></figure>

3. Hold **Ctrl** and use LMB to add more nodes, shaping the road line as required. The selected node is displayed as a blue sphere, all others as yellow.

<figure><img src="https://bestway-1.gitbook.io/dokumentaciya/~gitbook/image?url=https%3A%2F%2F2052154247-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fx2fkAZ6oKGGdByFhKPpa%252Fuploads%252Fgd0RO6oUatTjfgxWARWv%252F%25D0%2594%25D0%25BE%25D0%25B1%25D0%25B0%25D0%25B2%25D0%25BB%25D0%25B5%25D0%25BD%25D0%25B8%25D0%25B5%2520%25D1%2583%25D0%25B7%25D0%25BB%25D0%25BE%25D0%25B2.png%3Falt%3Dmedia%26token%3Db87e6b26-1352-482c-91b4-203e87431a5f&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=6f6f8ac6&#x26;sv=2" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**Adjust road curvature and add detail at turns**

1. Add, delete, or move spline nodes to refine the road shape.
2. Use **handles** to adjust road curvature smoothness at turns.

<figure><img src="https://bestway-1.gitbook.io/dokumentaciya/~gitbook/image?url=https%3A%2F%2F2052154247-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fx2fkAZ6oKGGdByFhKPpa%252Fuploads%252FVfqJ6SeucEUmaI4SEzn8%252F%25D0%2598%25D0%25BB%25D0%25BB%25D1%258E%25D1%2581%25D1%2582%25D1%2580%25D0%25B0%25D1%2586%25D0%25B8%25D1%258F%2520%25D1%2583%25D0%25B7%25D0%25BB%25D0%25BE%25D0%25B2%2520%25D1%2581%25D0%25BF%25D0%25BB%25D0%25B0%25D0%25B8%25CC%2586%25D0%25BD%25D0%25B0%2520%25D0%25B4%25D0%25BE%25D1%2580%25D0%25BE%25D0%25B3%25D0%25B8.png%3Falt%3Dmedia%26token%3D8dcd10b6-0933-44cf-9836-fdf8acb539fc&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=59c602f8&#x26;sv=2" alt=""><figcaption></figcaption></figure>

3. To properly display the road on sharp turns, increase the terrain mesh density. Go to the `land [3]` tab and select the `Polygons` tool. Adjust the `Level` parameter and use the brush to add polygons at the road turn area, improving rendering accuracy.

<figure><img src="https://bestway-1.gitbook.io/dokumentaciya/~gitbook/image?url=https%3A%2F%2F2052154247-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fx2fkAZ6oKGGdByFhKPpa%252Fuploads%252F3HGbU7GxeBz2EBVlkkST%252F%25D0%2594%25D1%2580%25D0%25BE%25D0%25B1%25D0%25BB%25D0%25B5%25D0%25BD%25D0%25B8%25D0%25B5%2520%25D0%25BF%25D0%25BE%25D0%25BB%25D0%25B8%25D0%25B3%25D0%25BE%25D0%25BD%25D0%25BE%25D0%25B2%2520%25D0%25BD%25D0%25B0%2520%25D0%25BF%25D0%25BE%25D0%25B2%25D0%25BE%25D1%2580%25D0%25BE%25D1%2582%25D0%25B0%25D1%2585%2520%25D1%2581%25D0%25BF%25D0%25BB%25D0%25B0%25D0%25B8%25CC%2586%25D0%25BD%25D0%25B0.jpg%3Falt%3Dmedia%26token%3D08c72f31-ebc2-4a19-ad0e-4a6ced1861e1&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=715ae9ab&#x26;sv=2" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**Configure road surface appearance**

1. Select a material for road surface visualization.

<figure><img src="https://bestway-1.gitbook.io/dokumentaciya/~gitbook/image?url=https%3A%2F%2F2052154247-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fx2fkAZ6oKGGdByFhKPpa%252Fuploads%252FOfM5oIrROVDaO33t1Y9j%252F%25D0%2592%25D1%258B%25D0%25B1%25D0%25BE%25D1%2580%2520%25D0%25BC%25D0%25B0%25D1%2582%25D0%25B5%25D1%2580%25D0%25B8%25D0%25B0%25D0%25BB%25D0%25B0%2520%25D1%2581%25D0%25BF%25D0%25BB%25D0%25B0%25D0%25B8%25CC%2586%25D0%25BD%25D0%25B0%2520%25D0%25B4%25D0%25BE%25D1%2580%25D0%25BE%25D0%25B3%25D0%25B8.jpg%3Falt%3Dmedia%26token%3De00927e4-3b33-4aa0-9a40-b788e88585e3&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=9714c590&#x26;sv=2" alt=""><figcaption></figcaption></figure>

2. Adjust other spline parameters.
   {% endstep %}
   {% endstepper %}

### Road Surface Parameters

The `Properties` panel displays road surface parameters for the selected container.\
Below the panel is a hint window with a short description of the selected parameter.

{% hint style="warning" %}
Some parameters will become available in the road editor with the next update of **Men of War II**.
{% endhint %}

| Parameter                   | Description                                                                                                                                                                                |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `Road Width` (`Half Width`) | <p>Road width, displayed as solid lines. Depends on the selected texture size.<br>When the texture or Pixel Density changes, the width recalculates automatically. Measured in meters.</p> |
| `Pixel Density`             | Texture pixel density per meter. When the texture or Road Width changes, the value recalculates automatically.                                                                             |
| `Alpha Distance`            | <p>Distance from the road edge to the falloff point.<br>Measured in meters.<br>Not supported in ground materials (no alpha channel).</p>                                                   |
| `Order`                     | Defines the rendering priority of the road relative to other roads and decals on the terrain.                                                                                              |
| `Materials`                 | Road surface material. Supports PBR and legacy Phong (for backward compatibility). The list of fine-tuning parameters depends on the selected material.                                    |
| `Diffuse Texture`           | File name of the road surface diffuse texture.                                                                                                                                             |
| `Diffuse Color`             | Diffuse color of the texture, set manually.                                                                                                                                                |
| `Opacity`                   | Transparency coefficient from 0.0 to 1.0. 0.0 — fully transparent surface, 1.0 — fully opaque.                                                                                             |
| `AO Rate`                   | Influence of the Ambient Occlusion (shading) map.                                                                                                                                          |
| `Metallic`                  | Level of metallic reflection of the road material.                                                                                                                                         |
| `Roughness`                 | Surface roughness parameter.                                                                                                                                                               |
| `Name`                      | Road name displayed in the spline list.                                                                                                                                                    |
| `Falloff` (folder)          | <p>Additional falloff properties.<br>Currently under development and unavailable for editing in the current engine version.</p>                                                            |

{% hint style="warning" %}
The list of spline parameters depends on the selected material.
{% endhint %}

### Road Editor Features

{% embed url="<https://youtu.be/jxXq2UUWL9k?autoplay=1&_loop=1>" %}


# \[5] Water Editor

The **Water Editor** \[water] is an integrated tool within the [Map Editor](/editor/map-editor).\
It is used for creating water bodies such as lakes, rivers, and seas on maps.

There are two ways to switch to the Water Editor:

* Click on the water icon in the Sidebar menu of the Map Editor.
* Press the 3 key on the keyboard.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FOwQmcfBzxDcXdwZiKIE5%2F%D0%A0%D0%B5%D0%B4%D0%B0%D0%BA%D1%82%D0%BE%D1%80%20%D0%B2%D0%BE%D0%B4%D1%8B.png?alt=media&amp;token=94ea01ec-03ef-43cf-b76b-fac783be8a35" alt=""><figcaption><p>Water Editor window</p></figcaption></figure>

## Pools

A pool is a single water surface mesh.\
Examples of pools:

* river
* lake
* sea
* river flowing into a lake or sea

The list of all pools on the map can be found in the `Pools` window.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FtQocb2oKjYBrdNimTYhw%2F%D0%9E%D0%BA%D0%BD%D0%BE%20Pools.png?alt=media&amp;token=ebb79202-eaf0-4e75-ae1f-5df61b111ab2" alt=""><figcaption><p>Pool list window</p></figcaption></figure>

### Pool level

The `Altitude` parameter value sets the water surface level height for the selected pool in the list.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FSR0YzKSqJ2OBBAHz72iy%2F%D0%A3%D1%80%D0%BE%D0%B2%D0%B5%D0%BD%D1%8C%20%D0%B1%D0%B0%D1%81%D1%81%D0%B5%D0%B8%CC%86%D0%BD%D0%B0.png?alt=media&amp;token=46f016af-e42e-4085-9ac7-008237cab3b1" alt=""><figcaption><p>Pool level</p></figcaption></figure>

Pools with `Altitude` values within 10 game units (0.5m) will be rendered at the same level for optimization purposes.\
Gem RTS rendering supports up to 16 different water surface levels.

{% hint style="warning" %}
When creating multiple water levels, it is important to consider that rendering each level is equivalent to rendering an entire scene, which impacts fps.\
A good practice in map design is to justify the necessity of different water levels from a game design perspective.
{% endhint %}

### Rules for creating pools

* If the water surfaces are not connected to each other (e.g., 2 lakes), they should be made as separate pools.
* River branches with different flows are allowed to be made as separate pools (details are described below).
* Each water level should be justified by game design.

## Creating a Pool

### Preparation stage

Before creating a pool, it is recommended to use the [Land Editor](/editor/map-editor/3-landscape-editor) tools to prepare the land surface relief at the location of the intended water body.

### Naming the Pool

1. Right-click in an empty area of the Pools window to open the context menu.
2. Select the `Add...INSERT` option.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FRuTsFmQgaZLk2mGJAZbQ%2Fimage.png?alt=media&amp;token=d460cd21-aca5-4796-96d9-efba7bb32dee" alt=""><figcaption><p>Context Menu in the Pools Window</p></figcaption></figure>

3. Enter the name of the pool in the `Input` window that appears and click the Ok button.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FNyjUdZ9UsxDMtB2lgWpR%2Fimage.png?alt=media&amp;token=7d85ea09-b330-4b65-81b0-a133dbef1bd6" alt=""><figcaption><p>Pool Naming Process</p></figcaption></figure>

The name of the pool will appear in the list in the `Pools` window.

### Creating the water surface mesh

{% hint style="info" %}
The process of creating a water surface mesh is similar to creating and editing ground surface mesh polygons in the [Polygons Editor](/editor/map-editor/3-landscape-editor/polygons-editor).
{% endhint %}

1. From the pool list, select the pool name for which you need to create or edit the water surface mesh.
2. Set the `Altitude` parameter value
3. Use the Polygons brush to create and edit the water surface mesh

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FKHlgi7pQXVLdU5dz1BIg%2Fimage.png?alt=media&amp;token=2f22fede-2b24-4b56-9241-b6363f4268ff" alt=""><figcaption><p>Creating a water surface mesh using the Polygons brush</p></figcaption></figure>

When creating and editing the water surface mesh, ensure that the water mesh polygons intersect with the ground surface mesh at the expected shoreline locations to avoid gaps between the surfaces.

{% hint style="info" %}
Pools can be sounded using the `area`entity
{% endhint %}

## Water Editor Tools

### **Polygons**

The Polygons brush is used to create and edit the pool's water surface mesh.

* To add polygons to the water surface mesh, press and hold the left mouse button (LMB) and move the mouse in the desired direction.
* To delete polygons, press and hold the right mouse button (RMB) and move the mouse over the polygons you want to remove.

<table><thead><tr><th width="261">Polygons Brush Parameters</th><th>Description</th></tr></thead><tbody><tr><td><code>Wireframe</code> checkbox</td><td>Enable/disable the display of the water surface mesh polygonal grid.</td></tr><tr><td><code>Level</code></td><td>The segmentation level of the water surface mesh polygons. Higher values increase the number of polygons by subdividing each into smaller parts, making the mesh more detailed.</td></tr><tr><td><code>Level Up</code> button</td><td>This button increases the base size of the polygons in the mesh.</td></tr></tbody></table>

{% hint style="success" %}
It is recommended to increase the `Level` parameter at river bends to segment polygons into smaller pieces, ensuring smoother water material texturing on the mesh surface.
{% endhint %}

{% hint style="warning" %}
The `Level Up`operation is irreversible as it changes the base triangle size. This can disrupt the existing texture mapping on the surface.
{% endhint %}

### **Flow**

The Flow tool is used for creating currents in river pools.

#### **Action Algorithm**

1. Set guide points for the Flow curve; the engine will generate texture coordinates to create the appearance of flow.
2. Edit the curve points to form a smooth line corresponding to the riverbed and current.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FoD0B3IUGWhOjM6OeF8lC%2F%D0%98%D0%BD%D1%81%D1%82%D1%80%D1%83%D0%BC%D0%B5%D0%BD%D1%82%20Flow.png?alt=media&amp;token=5d3d413b-46e2-4cab-89dd-bc25ebe40eba" alt=""><figcaption><p>Example of a Flow curve for a river pool</p></figcaption></figure>

#### **Flow Editor modes**

<table><thead><tr><th width="205">Mode</th><th>Description</th></tr></thead><tbody><tr><td>Creation</td><td><p>Activated when there is no curve.</p><p>Each LMB click on the map adds a node point.</p><p>RMB click adds the last point and exits creation mode.</p></td></tr><tr><td>Editing</td><td><p>Activated when hovering over an existing line or point.</p><p>LMB on the curve (not on a point) creates a new point on the curve.</p><p>Holding LMB on a curve point allows you to move the selected curve point on the map.</p><p>RMB on a curve point deletes the point.</p></td></tr></tbody></table>

#### Guidelines for creating the flow curve

1. The start and end points should extend beyond the visible part of the river, "into" the banks or beyond the edge of the map.
2. At bends, it is recommended to place the Flow curve point closer to the inner corner of the riverbed for a more natural-looking flow animation.
3. In areas where the water current direction changes, it is recommended to make a more detailed mesh (use Polygons brush level 5) for smoother mixing of water movement animations.
4. There are no restrictions on the number of curve points and the length of the curve.

### Soft-Sharp and Slow-Fast Sliders

The position of the `Soft-Sharp` and `Slow-Fast` sliders determines the smoothness and speed of the Colors and Materials brushes in the Water Editor.

### **Colors**

The Colors brush is used to paint the vertices of the water mesh.

It works similarly to the Colors brush in the [Land Editor](/editor/map-editor/3-landscape-editor).

{% hint style="info" %}
When using the Colors brush, it is recommended to set the water material color parameter to white, as the colors of the water material and mesh vertices multiply during painting. Therefore, the default vertex color in the material scheme will neutralize the brush color.
{% endhint %}

### **Materials**

The Materials brush is used for painting the water surface.

Each pool contains its own list of materials.

You can add materials to the selected pool using the `Add` button.\
Materials can be imported from other pools or maps by clicking the `Import` button.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FeQxPLr6MoKuKCny2jo6h%2Fimage.png?alt=media&amp;token=2f19dd9c-eeb6-4e20-9957-711f021a5e6a" alt=""><figcaption><p>Materials window</p></figcaption></figure>

## Water Material Settings

The water material parameters configuration window opens when selecting a material from the list on the Materials tab.

{% hint style="info" %}
The `land_texture_basis` parameter is present in all map materials and sets the value of the base tile for the land material. By default, it is set to 15.
{% endhint %}

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F8FAwYmrHBko6iUA2y1SL%2FAssigning%20a%20Water%20Material%20to%20a%20Pool.jpeg?alt=media&amp;token=77bebae4-4ba9-4088-83be-85d6836b9649" alt="The Water Editor interface showing the process of assigning a water material to a pool by adding a material entry and selecting the water/flow material scheme from the material library."><figcaption></figcaption></figure>

### Types of Water Materials

Water materials are divided into two types:

* one-layer;
* two-layer.

The basic scheme that determines the number of layers in the material is selected from the list in the line with the material name.\
When adding a new water material, the one-layer material scheme `water/flow` is used by default.

### Configuring one-layer materials

The SDL file of the scheme is located in the resources at the following path:

`\resource\entity\service\water\water.mtl`

<details>

<summary>Contents of the SDL file for the one-layer water material schema</summary>

```plaintext
{"water/flow"
    {bumpvolume_noise "$/water/nwave02"}
    {bumpvolume_wave "$/water/nwave03"}
    {blend blend}
}
```

</details>

Material parameter values can be configured directly in the Water Editor on the Materials tab by selecting the material from the list.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FpOnAozY3xQJ3OUWel3KR%2F%D0%9E%D0%B4%D0%BD%D0%BE%D1%81%D0%BB%D0%BE%D0%B8%CC%86%D0%BD%D1%8B%D0%B8%CC%86%20%D0%BC%D0%B0%D1%82%D0%B5%D1%80%D0%B8%D0%B0%D0%BB.png?alt=media&amp;token=6bac3e9b-40bd-45b5-ab64-f92673c26775" alt=""><figcaption></figcaption></figure>

<table><thead><tr><th width="191">Parameter</th><th width="420">Description</th><th>Default Value</th></tr></thead><tbody><tr><td>textures</td><td>In the textures block, you need to select textures for noise (bumpvolume_noise) and waves (bumpvolume_wave). The textures should not be the same.</td><td></td></tr><tr><td>color</td><td>The color of the water surface mesh.</td><td>Blue</td></tr><tr><td>specular_power</td><td>The degree of surface gloss, affects the size of the specular spot from the Sun.</td><td>3000</td></tr><tr><td>bumpiness_noise</td><td>The degree of relief of the ripple texture.</td><td>1</td></tr><tr><td>specular_amount</td><td>The amount of specular reflection.</td><td></td></tr><tr><td>soft_attenuation</td><td>Affects the blurriness of the water edges and indirectly the refract/reflect ratio. This parameter should be changed together with fresnel_power.</td><td>0.1</td></tr><tr><td>refraction_scale</td><td>The distortion coefficient of the refract component by water oscillations (0 - no distortion).</td><td>0.1</td></tr><tr><td>density</td><td>The ratio coefficient of color/refract to simulate water transparency. The higher the value, the thicker the water appears and the less visible the bottom.</td><td>0.002</td></tr><tr><td>reflection_scale</td><td>The distortion coefficient of the reflect component by water oscillations (0 - no distortion).</td><td>0.1</td></tr><tr><td>fresnel_power</td><td>The ratio coefficient of refract/reflect - the reflective capacity of the water surface. The higher the value, the less reflective the water surface will be.</td><td>2</td></tr><tr><td>fresnel_scale</td><td>The Fresnel enhancement coefficient.</td><td>1.2</td></tr><tr><td>bumpiness_wave</td><td>The degree of bumpiness of the wave texture.</td><td>0.05</td></tr><tr><td>period_wave</td><td>The frequency of wave oscillations.</td><td>1</td></tr><tr><td>tile_wave</td><td>The stretching of the wave texture. Large tile_wave values should not be used on large water surfaces to avoid visible texture tiling.</td><td>1</td></tr><tr><td>period_noise</td><td>The frequency of ripple oscillations. This parameter should be set so that its value is not equal to period_wave.</td><td>1</td></tr><tr><td>tile_noise</td><td>The stretching of the ripple texture. The parameters tile_noise and tile_wave should be set so that tile_noise is at least twice the size of tile_wave.</td><td>2</td></tr><tr><td>speed_noise</td><td>The speed of the animation playback on the ripple texture.</td><td>0.001</td></tr><tr><td>speed_wave</td><td>The speed of the animation playback on the texture imitating the water flow.</td><td>0.01</td></tr><tr><td>angle</td><td>The angle of texture rotation when painting with the material.</td><td>0</td></tr><tr><td>alpha_min</td><td>The minimum alpha channel value.</td><td>1</td></tr></tbody></table>

### Configuring Double-layer Materials

Double-layer materials `water/layered_2` are used to create visually different water in different areas within a single pool (e.g., a river flowing into a lake).

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FZhDIyRSZVHaBY5pAv9ki%2F%D0%94%D0%B2%D1%83%D1%85%D1%81%D0%BB%D0%BE%D0%B8%CC%86%D0%BD%D1%8B%D0%B8%CC%86%20%D0%BC%D0%B0%D1%82%D0%B5%D1%80%D0%B8%D0%B0%D0%BB.png?alt=media&amp;token=cfa48413-d72d-4504-86da-82d0d4e6ca7e" alt=""><figcaption></figcaption></figure>

#### Double-layer material configuration principle

* Configure the material parameters for the first layer, similar to a single-layer material (e.g., a river).
* Configure the material parameters for the second layer, similar to the second material (e.g., a lake).
* The parameters for each layer are similar to the parameters of a single-layer material.

## Water material transitions

### **Transition using two-layer material**

{% hint style="info" %}
Transitions between water materials are done similarly to transitions between materials on the land surface.
{% endhint %}

The transition between one-layer materials should be painted with a two-layer material so that the materials of the two-layer material align with the corresponding materials of each of the two adjoining one-layer materials.

Use LMB and RMB for materials from layer 1 and 2 respectively.

RMB with Ctrl held down (the ‘pick’ feature) selects the water material at the click point, with the following possible outcomes:

* If it's a material from the current pool, it will become active in the materials list.
* If the current pool is empty (there are no polygons in the pool yet), the material from the scene will replace the current material.
* Otherwise, the material will be added to the current pool's material list.

### **Different materials in one pool**

Spots with different water properties can be made using the two-layer material `water/layered_2`:

* The first layer exactly repeats the settings of the pool's main material, but with the `alpha_min` parameter set to 1.
* Configure the second layer according to the visual requirements of the different water spot and set the `alpha_min` parameter to 1.
* Paint the different water spots with RMB held down.

### Combining materials with different water flow directions

If you need to create different water flow directions in different areas of the water surface, this can be done in several ways:

* Using a two-layer material with different `angle` parameter values in the layers.
* Creating multiple pools and then visually combining the pools.

### **Combining Multiple Pools**

If you need to visually combine several pools with different flow curves, it is convenient to blend the water materials in the pools using the `water/flow` material with the `alpha_min` parameter set to 0.

To prevent the junctions of the pools from flickering, set the `Altitude` parameters of the pools with a height difference of 0.001.

## Additional information on water settings

### Components of water color

Water color consists of the following components:

* reflect - reflection (from the reflection texture)
* refract - bottom (from the scene texture)
* color - the color of the water body, affected by lighting sources
* specular - surface highlights from light sources

### Water parameters affecting color

* color
* density
* fresnel\_power
* specular\_power
* soft\_attenuation

### Water parameters affecting appearance

* bumpiness
* tile
* period
* refraction\_scale
* reflection\_scale


# Specifics of Map Editing

Regardless of your experience level, here you will find useful tips to master all aspects of working with the Gem RTS Map Editor.

The materials in this section provide the necessary knowledge to implement specific technical ideas. The guides cover basic operations for creating and editing maps as well as advanced techniques for optimization and customization.

<table data-view="cards"><thead><tr><th data-type="content-ref"></th><th></th></tr></thead><tbody><tr><td><a href="/editor/map-editor/specifics-of-map-editing/creating-terrain-folds">Creating terrain folds</a></td><td>Methods for creating rocks, slopes and cliffs for various gameplay purposes.</td></tr><tr><td><a href="/editor/map-editor/specifics-of-map-editing/creating-destroyed-vehicle-entities-for-map-entourage">Creating destroyed vehicle entities for map entourage</a></td><td>Step-by-step instructions for placing destroyed/damaged vehicle entities as map entourage elements</td></tr><tr><td><a href="/editor/map-editor/specifics-of-map-editing/stone-entities">Stone entities</a></td><td>Guide to Working with Stone Entities for Creating Rocky Landscapes</td></tr><tr><td><a href="/editor/map-editor/specifics-of-map-editing/entity-for-water-sound-effects">Entity for water sound effects</a></td><td>Guide to Adding Sound Effects to Water Bodies</td></tr><tr><td><a href="/editor/map-editor/specifics-of-map-editing/building-entities">Building entities</a></td><td>Guide to working with construction entities</td></tr></tbody></table>


# Creating destroyed vehicle entities for map entourage

Step-by-step instructions for placing destroyed/damaged vehicle entities as map entourage elements

{% hint style="info" %}
Models from the \_x and \_xx folders with assets of destroyed models of vehicles are not intended to be placed on maps as an entourage elements.

These models are empty technical models that the game engine replaces the original objects with when damage is dealt to them.\
The engine applies necessary tags, volume properties, spawn additional models, and special effects to these models to create realistic visuals and physical interactions.
{% endhint %}

Below is the procedure for creating entourage models of destroyed objects.

## **Creating a destroyed entity**

1. Launch the Editor and create a new test map
2. Open the Mission Editor \[F3].
3. Place the necessary entity on the map.
4. Damage or destroy the placed entity using one of the following ways:
   * **By firing from other units in Simulation Mode:**

     Set up units to attack the target entity.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FjvN80fG23ND1iljPP0k5%2F%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%202024-05-29%20%D0%B2%2014.15.16.png?alt=media&amp;token=20c928f3-8c25-4df7-a4df-d5918697baf3" alt=""><figcaption><p><strong>Destroying vehicle by firing from other units</strong></p></figcaption></figure>

* **By spawning a service explosion entity:**\
  Spawn an explosion entity from the `service/damage` folder under or near the target entity

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FkJ7ASLz3TrV6FzRTqXtf%2F%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%202024-05-29%20%D0%B2%2014.18.30.png?alt=media&amp;token=36857135-481d-473f-8197-dc705c63abe0" alt=""><figcaption><p><strong>Spawning a service explosion entity</strong></p></figcaption></figure>

* **Using the G Hotkey:**\
  Spawn an aerial bomb at the cursor position by pressing the `G` key.
* **Using the Console Command `g_component`:**\
  Apply damage or destroy the objects through the console.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FZlMGT5EKNqAB1lO7yLC4%2F%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%202024-05-29%20%D0%B2%2014.33.15.png?alt=media&amp;token=34de93a3-c11c-4c00-bac6-c898a8cf7bef" alt=""><figcaption><p>Use the console to execute the command to destroy the vehicle's body</p></figcaption></figure>

## **Transferring the destroyed entity to the target map or mission**

1. Select the destroyed entity
2. Copy the selected entity to the clipboard (press `Ctrl+C)`
3. Load the map or mission where you want to place the destroyed entity
4. Paste the clipboard contents onto the map (press `Ctrl+V)`

## **Configuring the destroyed entity**

1. Fine-tune the position, tilt, rotation, alignment with the surface, and other properties
2. Add the `destroyed` tag to the vehicle body
   * Select the destroyed entity
   * Open the **Tags of selection** window with `Ctrl+T`.
   * In the opened window, enter the tag name `destroyed` and click the Add button.

{% hint style="info" %}
The `destroyed` tag removes non-relevant gameplay properties from the entity, such as minimap display.
{% endhint %}

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FNLOd4IeHRGhceEaXQEeJ%2F%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%202024-05-29%20%D0%B2%2014.54.46.png?alt=media&amp;token=eec72150-070d-41b6-8b95-b51709486675" alt=""><figcaption><p>Adding tags to the destroyed entity</p></figcaption></figure>

3. Add the `em_notouch` tag:

* Select all separate parts of the destroyed entity (body, turret) with `Shift` held down.
* Open the **Tags of selection** window with `Ctrl+T`.
* In the opened window, enter the tag `em_notouch` and click the Add button

{% hint style="info" %}
The `em_notouch` tag ensures the entity is excluded from the scene debris cleaning system (`entity_manager`).
{% endhint %}

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FY8yoHvNEDPwD67dTRZWx%2Fimage.png?alt=media&amp;token=ca5ab711-7aa0-4f02-9f19-075720e032f8" alt=""><figcaption><p>Ensure the body has both <code>destroyed</code> and <code>em_notouch</code> tags, while the turret only has the <code>em_notouch</code> tag</p></figcaption></figure>

4. **Save the Map**\
   Save your changes to the map to ensure all modifications are retained.


# Creating terrain folds

In the [Map Editor](/editor/map-editor), there are two ways for terrain modeling, each tailored for different game scenarios and map design. Combining both methods allows for the most effective implementation of gameplay ideas, creating maps that are both beautiful and functional.

<table data-card-size="large" data-view="cards"><thead><tr><th data-type="content-ref"></th><th></th><th></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td><a href="/editor/map-editor/specifics-of-map-editing/creating-terrain-folds/creating-ground-surface-relief">Creating Ground Surface relief</a></td><td>This tutorial is about creating folds in the ground using the Heights brush.</td><td>This approach is ideal for modeling landscapes that do not create significant restrictions on the movement of units.</td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FAt1sRJJqsAcootwCY724%2Fimage.png?alt=media&amp;token=84c4a596-c3fa-4256-a13e-aa4055c0bfa7">Adjusting Slope 1.png</a></td></tr><tr><td><a href="/editor/map-editor/specifics-of-map-editing/creating-terrain-folds/rock-and-cliff-entities">Rock and cliff entities</a></td><td>The tutorial focuses on shaping ravines and cliffs with sharp edges to create natural obstacles on the map.</td><td>Cliff entities can serve as strategic points and add gameplay complexity by limiting or directing unit movement.</td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FNyj7NyeXW2VfBynYOn0P%2F%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%202024-03-05%20%D0%B2%2017.52.38.png?alt=media&amp;token=dd5d7c7a-6df3-4633-8c80-99a419a1bce9">Tinting entity material.png</a></td></tr></tbody></table>


# Creating Ground Surface relief

Step-by-Step instructions for creating smooth slopes using the Heights brush in the Heights Editor and slope edge stamps.

## Steps

1. In the Map Editor, switch to the [Land Editor](/editor/map-editor/3-landscape-editor)
2. Select the Heights brush in Land Editor and adjust the slope to the desired height and shape.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FAt1sRJJqsAcootwCY724%2Fimage.png?alt=media&amp;token=84c4a596-c3fa-4256-a13e-aa4055c0bfa7" alt=""><figcaption><p>Adjusting Slope with Heights Brush</p></figcaption></figure>

3. Switch to the Textures brush and select a suitable material from the list to paint the surface. Paint the surface.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FeQ6kNGicHC974sbElhoz%2Fimage.png?alt=media&amp;token=b58d1de4-afd4-4645-988e-d4f8ca147eb0" alt=""><figcaption><p>Painting Ground Surface with Textures brush</p></figcaption></figure>

## Actions to increase surface detail

1. Increase the polygon density of the ground surface mesh in areas with height differences using the Polygons brush. This will allow for more detailed terrain and smoother transitions between textures.
2. Paint the vertices of the ground surface mesh with the Color brush, highlighting the elevations and depressions on the ground surface.
3. Place edge stamps with characteristic terrain patterns along the lines of height differences.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F6AmCWCSXao8rr9PcIUsL%2Fimage.png?alt=media&amp;token=3f097cb5-1082-4c1b-84c0-8bdc9f98ba2b" alt=""><figcaption><p>Placing Stamp Entities</p></figcaption></figure>

{% hint style="info" %}
Assets of stamps are located in the landscape\stamp folder
{% endhint %}


# Rock and cliff entities

The tutorial focuses on shaping ravines and cliffs with steep sides to create natural obstacles on the map.

## **Asset location in resources**

To create cliffs and ravines with sharp edges that restrict the free movement of units, use asset entities from the `landscape\rock` folder.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FJaUlNE7iwvZ0jw53sO4k%2Fplacing%20cliff%20entities.png?alt=media&amp;token=d6f42596-99d8-493b-9900-3bcbfd998a30" alt=""><figcaption><p>Placing cliff entities</p></figcaption></figure>

## **Placing Cliff entities on the map**

It is recommended to align the placed cliff and rock entities to zero height in their properties. To do this, change the `constrain` parameter from `ground` to `zero`.

**Blending Seamlessly**

After placing cliff entities on the map, you need to visually smooth the seams between the ground surface and the cliff entity surfaces. Let's go through the smoothing process step by step.

1. Select the entity.
2. Find the `materials` block in the entity's properties.
3. In layer 1 of the `textures` block, select a material that matches the ground surface material at the intended seams.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FjoRnEf1skmdqSkLbVupj%2F%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%202024-03-05%20%D0%B2%2017.24.28.png?alt=media&amp;token=a4d145fc-6d94-425b-b24c-f021671f2900" alt=""><figcaption><p>Selecting matching ground material</p></figcaption></figure>

4. Adjust the `tiles` parameter in the cliff entity's properties to visually match the material detail on the entity with the material detail on the ground surface.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FjoRnEf1skmdqSkLbVupj%2F%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%202024-03-05%20%D0%B2%2017.24.28.png?alt=media&amp;token=a4d145fc-6d94-425b-b24c-f021671f2900" alt=""><figcaption><p>Adjusting tiles parameter in the cliff entity material to match the ground material</p></figcaption></figure>

4. Smooth the heights of the ground surface using the \[Heights] brush so that the ground surface transitions smoothly into the cliff entity surface.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F6EZtUW5vuDukuFa0cwnO%2F%D1%81%D0%B3%D0%BB%D0%B0%D0%B4%D0%B8%D1%82%D1%8C%20%D0%BF%D0%BE%D0%B2%D0%B5%D1%80%D1%85%D0%BD%D0%BE%D1%81%D1%82%D1%8C.png?alt=media&amp;token=9db0256e-ad4a-4e8b-bc5a-68a57d883ff2" alt=""><figcaption><p>Smoothing Heights with the Heights Brush</p></figcaption></figure>

5. If necessary, use the \[Polygons] brush to subdivide the ground surface mesh at the seams with cliff entities. This will allow for a more precise transition between the ground surface and the cliff entity.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FNyj7NyeXW2VfBynYOn0P%2F%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%202024-03-05%20%D0%B2%2017.52.38.png?alt=media&amp;token=dd5d7c7a-6df3-4633-8c80-99a419a1bce9" alt=""><figcaption><p>Subdividing mesh for seamless transition</p></figcaption></figure>

As a result of the above steps, the seams between the ground surface and the cliff entities will become visually unnoticeable.

**Additional Options**

If the result is not satisfactory, use the additional options:

1. Use the `diffuse_color` parameter in the `materials` block of the cliff entity's properties to tint the entity's material to match the ground surface material.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FNyj7NyeXW2VfBynYOn0P%2F%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%202024-03-05%20%D0%B2%2017.52.38.png?alt=media&amp;token=dd5d7c7a-6df3-4633-8c80-99a419a1bce9" alt=""><figcaption><p>Tinting entity material with diffuse color</p></figcaption></figure>

2. The `uv_ratio` parameter allows you to adjust the tiling texture of the material for entities with rectangular texture layouts. For example, the `cliff_big_01` entity by default has `uv_ratio x=2, y=1`.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FN13PMrcIpoyIZLiw5HWo%2Fratio.png?alt=media&amp;token=754317b4-1c9c-45d5-96a6-dbef84c3195d" alt=""><figcaption><p>Adjusting UV Ratio for Texture Tiling</p></figcaption></figure>

3. Change the material mask in the entity's properties. To do this, select the cliff entity, find and change the mask by which the layer 1 material is applied to the entity. The masks are located in the folder with the entity.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FXFC7JYtI0fQl2J9tQYp4%2F%D0%BC%D0%B0%D1%81%D0%BA%D0%B0.png?alt=media&amp;token=a37fae65-d3e1-4037-aa3a-5b284e077e08" alt=""><figcaption><p>Changing material mask for better blending</p></figcaption></figure>

4. To enhance the visual effect and create additional natural cover for units, you can diversify the surface with [stone entities](/editor/map-editor/specifics-of-map-editing/stone-entities).


# Stone entities

Guide to working with stone entities for creating rocky landscapes


# Entity for water sound effects

Guide to adding sound effects to water bodies

## Entity for sounding Pools

The **area** entity from the `service/sound/` folder allows you to sound water pools: rivers, lakes, and seas.\
Its difference from a regular speaker object is that all circular subzones created by this entity are combined into one and sounded as a whole.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FkCDrodSGvkHWIlpHRJn1%2Fimage.png?alt=media&amp;token=1ee2e5c0-3268-4c07-92db-1dbfc4fe91e9" alt=""><figcaption><p>Area entity</p></figcaption></figure>

## Sound parameter settings

In the properties of the **area** entity, in the **environment\_sound** block, you need to configure the sound parameters.

<table><thead><tr><th width="155">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>tags</strong></td><td>Preset corresponding to the type of water body.<br>Water bodies with a Flow curve correspond to the <code>river</code> preset for a river with a regular flow and <code>river_fast</code> for a river with a fast flow.<br>For lakes and seas, use the <code>lake</code> and <code>sea</code> presets, respectively.</td></tr><tr><td><strong>curve</strong></td><td>For water bodies with a Flow curve, the name of the water body is entered in the <code>curve</code> field. For water bodies without flow, the <code>curve</code> field should be left empty.</td></tr><tr><td><strong>radius</strong></td><td>The radius of the circle within which the water body is located.</td></tr></tbody></table>

## Sound zone visualization mode

When working with the **area** entity, it is convenient to use the sound zone visualization mode.\
You can enable or disable the sound zone visualization mode using the console command:

* `snd_showEnvironmentSound 1` — enable;
* `snd_showEnvironmentSound 0` — disable.

## Sound Setup for Different Pool Types

### River flow sounding

1. **Place the area entity**\
   Switch to the `Entity` tab and place the **area** entity on the map approximately in the geometric center of the Flow curve of the river pool.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F9gGVFQN8Mnz9BJXEL10r%2Fimage.png?alt=media&amp;token=612d71de-31fd-47fc-b01a-369bbbc5cbc9" alt=""><figcaption></figcaption></figure>

2. **Configure sound parameters**\
   In the properties of the **area** entity, configure the sound parameters in the **environment\_sound** block.

* In the `tags` field, select the `river` or `river_fast` preset
* Enter the name of the river pool in the `curve` field
* Set the `radius` so that the entire river pool fits within the yellow circle

3. **Adjust the placement of the area entity**\
   The **area** entity must be positioned so that the entire river pool is within its radius.\
   Based on the Flow curve, subzones of sound will be added within the yellow circle, displayed as green circles. Along with the green subzones, the sound of the flow will appear.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FGyKzHtYxBsO2UWFOs3ek%2Fimage.png?alt=media&amp;token=90e3babd-3c6c-4e4c-bb7f-2499d8318b01" alt=""><figcaption><p><strong>Adjust the placement of the area entity</strong></p></figcaption></figure>

### Sea or Lake Sounding

1. **Place the area entity**\
   Several **area** entities must be placed to cover the area of the sea or lake pool.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F323o2KpcbZuxhJY9sZdh%2Fimage.png?alt=media&amp;token=f1b51ae5-9d8d-40e7-8207-b6b79fc81207" alt=""><figcaption></figcaption></figure>

2. **Configure sound parameters**\
   In the properties of the **area** entities, configure the sound parameters in the **environment\_sound** block.

* Select the `lake` or `sea` preset in the `tags` field
* Leave the `curve` field empty
* Adjust the radius to cover the entire lake or sea pool with sound zones

{% hint style="success" %}
When sounding water bodies without Flow, use as few area entities as possible, but set large radius values
{% endhint %}


# Building entities

Guide to working with building entities

## **Location of Building Entities**

### **Location in Map Editor**

Building entities can be found on the **Entity** tab of the Map Editor in the list of game assets, in the general construction asset folder:

* town\_e
* town\_ger
* town\_ru
* town\_ua

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2Fe3UoIa2KJnnB7FVBkRvX%2Fimage.png?alt=media&amp;token=c00c67f9-5b69-4c1c-a79e-3086859d89ac" alt=""><figcaption><p>Use structural building entities to place them on the map</p></figcaption></figure>

{% hint style="info" %}
When placing a building entity on the map, you need to select its name from the list of structural entities (the list is located below all folders with identical names).
{% endhint %}

{% hint style="warning" %}
Entities from the **town\_\*/x** folders are not standalone game entities. These are technical entities that are substituted by the engine during gameplay at the moment of building destruction.
{% endhint %}

### **Location in Game Resources**

Building entity files are located in the resources in the folders:`[packagename]\scene\entity\construction\town_*`

## **Structure of Building Entities**

### **Variability**

Building entities are made with a structure.\
Building entities are composed of multiple elements linked to a common base.\
Each element can be enabled, making it visible in the structure, or disabled, making it invisible. This allows for creating partially destroyed structures or adding additional elements, thereby changing the appearance of the building.

The screenshot below shows the same building with different sets of visible elements in the structure.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FHmEDJoxdDj5IT82zV33S%2Fimage.png?alt=media&amp;token=8467bae6-1f6e-43de-b69b-b77552277ec8" alt=""><figcaption><p><em>Example of the appearance of the same building entity with a different set of included elements in its structure</em></p></figcaption></figure>

{% hint style="warning" %}
It is not recommended to place separate parts of entities made with a structure on the map as standalone map entities, as this can lead to errors during the game.
{% endhint %}

### **Flora elements on Building Entities**

Some building elements have an additional "ivy" element.\
It is enabled in the structure as a separate decorative element.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FHlbPKeJzNcwsU6E7wmgI%2Fimage.png?alt=media&amp;token=4e53edb3-b15e-41c1-831c-6a7e47ca9fc3" alt="" width="375"><figcaption><p>Ivy elements in building entities</p></figcaption></figure>

### **Texmods**

Building entities have various texmods for walls, roofs, and other elements.\
Texmods are assigned in the properties of the selected entities.\
You need to select all the necessary elements with **Ctrl** pressed (as shown in the screenshot below) and choose the desired texmod name from the dropdown list in the **texmods** field.

{% hint style="warning" %}
If you select a building entity without pressing **Ctrl** and switch the texmod in the structure properties for the entire structure, the texmod will not be applied to all elements of the structure, leading to visual errors.
{% endhint %}

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FyLoLFz7qTev2nYmzCUbV%2Fimage.png?alt=media&amp;token=0f489bfe-acb7-4247-8706-d7679ce11828" alt=""><figcaption><p><em>Assigning a texmod to building entity elements</em></p></figcaption></figure>

## **Entities of Single and Combined Buildings**

### **Entities of single buildings**

Entities of single buildings can be placed on maps only as standalone buildings.

{% hint style="warning" %}
Creating complexes from entities of single buildings in the editor will lead to errors during the game related to capturing and fortifying the buildings in the complex, as well as errors with unit movement around the buildings.
{% endhint %}

*Entities of single buildings on the right.*

### **Entities of combined buildings**

Entities of combined buildings consist of models of single buildings, assembled in 3D Max, and exported as an independent structural model. This approach allows capturing the combined building as a single complex and avoids situations where one building is simultaneously captured by players from different sides. In addition, in entities of combined buildings, auxiliary entities such as obstacles, volumes, and fortification elements can be configured if necessary.

### **Fortification elements in building entities**

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FIuUU9AqSaVTPdmZsiLPG%2Fimage.png?alt=media&amp;token=46d56c4f-92c6-4968-9817-f9792ca0af81" alt=""><figcaption><p><em>Fortification elements on buildings</em></p></figcaption></figure>

The screenshot above shows the difference in fortification between entities of combined and single buildings: most elements coincide, but the fortification models inside the building are missing. Also, in complex buildings, duplicates of obstacles for adjacent walls of single houses inside the building are disabled. This approach to creating and configuring complex buildings prevents spawning fortification elements and debris from destructions at the junctions of single houses in a complex building during the game.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FBGv48oDqXNmbfPiDDXFT%2Fimage.png?alt=media&amp;token=9271805c-6b95-4f8d-b676-c9f598510232" alt=""><figcaption><p><em>Differences in the number of obstacles in entities of single and combined buildings</em></p></figcaption></figure>


# Creating a minimap

Step-by-step instructions for two ways to create a minimap.

A minimap for the game map can be created in two ways: step-by-step using a screenshot or by using a console command. The first method involves capturing a screen, editing the image, and saving it in the required format. The second method automates the process via a console command, creating a minimap in PNG format.

## Creating a minimap using a screenshot

1. **Open the map** in the map editor (F2). It is recommended not to include weather to maintain default lighting without the sky.
2. **Disable shadows** in the Game Options or through the debug window (F11).
3. **Center the camera** using the `Ctrl+0` key combination.
4. **Lower the camera** to the ground at a 90-degree angle so that the minimap has a square white frame. Disable the minimap display.
5. **Raise the camera** to a height that captures the entire surface of the map.
6. **Switch to F1 mode** and disable the interface elements display using `Ctrl+Alt+Shift+D`.
7. **Take a screenshot** of the map.
8. **Crop the edges** of the image in a raster image editing program so that each side is a multiple of 4. Save the image as `minimap` in DDS DXT1 format without generating MIP maps.
9. **Place the resulting file** in the map folder.

## **Creating a minimap using a Console command**

1. **Open the map** in the map editor (F2). It is recommended not to include weather to maintain default lighting without the sky.
2. **Enter the console command** `ed_storeMinimap 2048` to get the minimap in PNG format.
3. **Check** that the minimap is saved in [the player's profile folder](/foundational-knowledge/game-local-files-and-player-profile-locations#default-path-to-the-player-profile-folder).
4. **Place the resulting file** in the map folder.

## **Handling Warnings**

If a warning "proportions of minimap sprite must correspond land bound.." appears when loading the map, it means that the minimap proportions do not match the size of the land surface on the map. In this case, the minimap needs to be redone.

***


# Mission Editor

The Mission Editor is a set of tools for creating scripted events and multiplayer battles on maps.

You can open the Mission Editor by pressing the F3 key.

## Mission Editor window elements

The window of Mission Editor contains several elements:

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FKx0LU23uAglvHhPJD5T9%2FMission%20Editor%20components.png?alt=media&amp;token=3bfe833e-c753-464f-a741-2485af7a2b17" alt=""><figcaption></figcaption></figure>

<table><thead><tr><th width="63">№</th><th width="244">Element</th><th>Description</th></tr></thead><tbody><tr><td>1</td><td><code>Mission: &#x3C;name></code> button</td><td>Button to call up the main menu of the Mission Editor with the main functions.</td></tr><tr><td>2</td><td>Side menu</td><td>Tabs for groups of Mission editor tools.</td></tr><tr><td>3</td><td>Workspace</td><td>The central working area where the selected tools are used. This is where most of the mission setup takes place.</td></tr><tr><td>4</td><td>Start button</td><td>Initiates and terminates the mission preview mode, essential for testing the elements and dynamics crafted within the mission.</td></tr><tr><td>5</td><td>Scene</td><td>The map's workspace where mission actors, interactive objects, and other functional elements are placed and arranged.</td></tr><tr><td>6</td><td>Active actor indicator</td><td>Highlights the group of actors under the player’s control during the Simulation Mode</td></tr></tbody></table>

### Main menu

The Main menu window (**Mission Editor Menu**) can be accessed in two ways:

* By clicking on the **Mission: \<name>** button at the top of the map editor's workspace.
* By pressing the **Esc** key on the keyboard.

The main menu is presented as a list of the main functions of the Mission Editor.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FqW4cupb6AwhdqjOeRgBp%2FMission%20editor%20menu.png?alt=media&amp;token=3bd05a46-f305-4bd8-8a24-7a1f0ae4483d" alt=""><figcaption></figcaption></figure>

<table><thead><tr><th width="136">Function</th><th width="454">Description</th><th>Key Combination</th></tr></thead><tbody><tr><td>Save</td><td>Saves changes to the current mission.</td><td>Ctrl+S</td></tr><tr><td>Save as</td><td>Allows saving the current mission under a different name</td><td></td></tr><tr><td>Reload</td><td>Reloads the current mission without saving changes</td><td></td></tr><tr><td>Load</td><td>Opens a previously saved mission from a list</td><td></td></tr><tr><td>Unload</td><td>Unloads the current mission, leaving a blank map scene</td><td></td></tr><tr><td>Exit</td><td>Closes the Editor</td><td>Alt+X</td></tr></tbody></table>

### Side menu

The side menu contains the set of main tools for creating and configuring a mission.\
The side menu is presented as a set of tabs located on the left side of the Workspace.\
The active tab is highlighted.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FPEZKOSdL4CjAfUOC3cmp%2Fside%20menu%20of%20mission%20editor%20.png?alt=media&amp;token=6bfc37d6-9618-4a58-9048-e8f009bc1d5a" alt=""><figcaption><p><strong>Appearance of the Mission Editor's Window and Side menu</strong></p></figcaption></figure>

<table><thead><tr><th width="214">Tool</th><th width="128">Tab Name</th><th>Description</th></tr></thead><tbody><tr><td>Mission preview editor</td><td>view [1]</td><td>A set of tools for configuring game speed, camera parameters, and mission properties in Simulation Mode.</td></tr><tr><td>Entity editor</td><td>entity [2]</td><td>Tool for placing mission entities (units and interactive objects) on the map.</td></tr><tr><td>Squad editor</td><td>squad [3]</td><td>Not used in Gem RTS.</td></tr><tr><td>Waypoint editor</td><td>waypoint [4]</td><td>Tool for creating waypoints for unit paths and event start points for missions.</td></tr><tr><td>Zone editor</td><td>zone [5]</td><td>Tool for creating and configuring the properties of game zones.</td></tr><tr><td>Trigger editor</td><td>trigger [6]</td><td>Editor for creating and writing mission scripts.</td></tr><tr><td>Camera editor</td><td>camera [7]</td><td>Editor for creating static cameras and camera flight paths for in-game cutscenes and cinematics.</td></tr><tr><td>Cover editor</td><td>cover [8]</td><td>Tool for configuring cover properties and writing mission scripts for units in cover.</td></tr><tr><td>Clip editor</td><td>clip [9]</td><td>Tool for configuring visual, physical map boundaries and fog boundaries of the map.</td></tr></tbody></table>

{% hint style="info" %}
You can display hidden mission elements using the [Mission Properties Editor.](/editor/mission-editor/mission-properties-editor)
{% endhint %}

### Simulation mode button

The **Star**t button allows you to launch a safe[ Simulation Mode](/editor/simulation-mode) to test the mission.

After starting the simulation mode, the Start button will be replaced by the Finish button to exit the Simulation Mode.

Exiting Simulation Mode initiates a map and mission reload process. Any changes has been made during the Simulation will be lost.


# Mission Properties Editor

The **Mission Properties** window contains settings for the mission components and shortcuts for some auxiliary mission component editors.

The **Mission properties** window can be accessed by pressing the F9 key while in the Mission Editor.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FsQUa3Z70mg6r9uMCQ3ix%2Fimage.png?alt=media&amp;token=fee038dc-c33e-4b53-8f62-97f28086247c" alt=""><figcaption><p>Mission properties window</p></figcaption></figure>

**Auxiliary editors** can be opened from the main window by clicking the `...` button next to the name of the corresponding editor.

## Elements of the Mission properties window

### **Show section**

This section contains settings for displaying mission helpers.

<table><thead><tr><th width="136">Name</th><th>Description</th></tr></thead><tbody><tr><td>waypoints</td><td>Checkbox to make waypoints visible on the map</td></tr><tr><td>zones</td><td>Checkbox to make mission zones visible on the map</td></tr><tr><td>covers</td><td>Checkbox to make the location and types of covers visible on the map</td></tr></tbody></table>

### **Player section**

This configuration controls the number of independent participants in the mission and their relationships. It includes specialized editors for establishing diplomatic relations and associating participants with specific nations.

<table><thead><tr><th width="193">Name</th><th>Description</th></tr></thead><tbody><tr><td>count</td><td>Sets the number of independent mission participants</td></tr><tr><td>diplomacy</td><td>Editor for relationships between participants</td></tr><tr><td>aliaces</td><td>Editor for matching mission participants to nations</td></tr><tr><td>colors</td><td>Editor for setting the display color of unit outlines, game icons, minimap icons, interfaces, and the grid for territory capture battles</td></tr><tr><td>mp_team_relations</td><td>Editor for relationships of AI-controlled mission participants to player participants in multiplayer</td></tr></tbody></table>

### **Helpers**

List of auxiliary editors for configuring mission components.

<table><thead><tr><th width="188">Name</th><th>Description</th></tr></thead><tbody><tr><td>tasks</td><td>Editor for creating and setting mission tasks</td></tr><tr><td>reinforcements</td><td>Editor for creating and setting the logic of reinforcements for AI-controlled units</td></tr><tr><td>events</td><td>Editor for creating events</td></tr><tr><td>vars</td><td>Editor for creating variables</td></tr><tr><td>functions</td><td>Editor for creating and describing functions</td></tr><tr><td>stats</td><td>Editor for creating and setting parameters for statistical data accounting</td></tr><tr><td>achievements</td><td>Editor for creating and setting player achievement badges</td></tr></tbody></table>

### **Additional editors**

<table><thead><tr><th width="158">Name</th><th>Description</th></tr></thead><tbody><tr><td>texts</td><td>Editor for creating dialogues spoken by characters in the mission</td></tr><tr><td>breeds</td><td>Editor for creating and setting equipment for infantry units</td></tr><tr><td>viewport</td><td>Used for debugging</td></tr><tr><td>modifiers</td><td>Editor for creating, setting, and connecting mission modifiers</td></tr></tbody></table>

### **Additional settings**

<table><thead><tr><th width="186">Name</th><th>Description</th></tr></thead><tbody><tr><td>environment</td><td>Calls the Environment Editor to select and set weather and environmental parameters</td></tr><tr><td>entity_manager</td><td>Checkbox to enable or disable the Entity Manager</td></tr><tr><td>azimuth</td><td>Sets the map rotation point in the mission</td></tr><tr><td>map_orientation</td><td>Sets the angle of map rotation relative to azimuth</td></tr></tbody></table>

This detailed structure of the Mission Properties window ensures that developers have comprehensive control and flexibility when designing and fine-tuning their missions, providing a deep level of customization for all aspects of the mission environment.


# FX Editor


# Environment Editor

Environment Editor Overview

The Environment Editor in Gem RTS is an advanced tool designed for the precise configuration and modification of environmental settings within a game. This editor empowers developers to sculpt the atmosphere uniquely for each mission, enhancing the immersive experience.

## Functionalities and features

* Customize lighting settings to simulate different times of the day, enhancing realism and mood
* Adjust the visual parameters for sky and clouds to reflect specific weather conditions or time-of-day effects
* Configure wind effects to influence environment dynamics and particle movements
* Manipulate weather conditions to impact gameplay dynamics and visual aesthetics
* Integrate and control environmental sounds to match the visual settings, adding depth to the scene
* Apply and adjust global visual effects that affect the entire scene, providing a cohesive visual experience
* Utilize comprehensive settings for scene post-processing, including SSAO, Eye Adaptation, Tone Mapping, Glare, Blue Shift, and Depth of Field, as well as video effects that enhance the final visual output

## Usability

* Access a library of pre-configured lighting presets suitable for various scenarios.
* Modify existing presets or use integrated tools to create new presets tailored to specific needs.

Learn more about Environment Editor

<table data-view="cards"><thead><tr><th></th><th data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td>Introduction to lighting concepts in Gem RTS</td><td><a href="/editor/environment-editor/basic-knowledge-about-hdr">Basic knowledge about HDR</a></td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FXqe0ZKqSICsAK0XgCyMC%2Fsplash_editor_3.jpg?alt=media&amp;token=ecb5bb0d-d794-4925-a780-f7d98f315d42">default_cover.jpg</a></td></tr><tr><td>Step-by-step guide to developing custom environment presets</td><td><a href="/editor/environment-editor/creating-environment-preset">Creating environment preset</a></td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FXqe0ZKqSICsAK0XgCyMC%2Fsplash_editor_3.jpg?alt=media&amp;token=ecb5bb0d-d794-4925-a780-f7d98f315d42">default_cover.jpg</a></td></tr><tr><td>Detailed instructions for fine-tuning environment presets</td><td><a href="/editor/environment-editor/setting-environment-preset-parameters">Setting Environment preset parameters</a></td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FXqe0ZKqSICsAK0XgCyMC%2Fsplash_editor_3.jpg?alt=media&amp;token=ecb5bb0d-d794-4925-a780-f7d98f315d42">default_cover.jpg</a></td></tr></tbody></table>


# Basic knowledge about HDR

{% hint style="info" %}
You can open the Environment Editor by pressing the F6 key
{% endhint %}

## **Key components for HDR lighting**

The following sections must be enabled in the environment preset settings:

* eye\_adaptation - enabled
* tone\_mapping - enabled
* tone\_mapping - aces

The main HDR parameter is `target_exposure` in the `eye_adaptation` section.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FagUER0vH3TUpSwn7O3Qc%2FEnvironment%20Editor.png?alt=media&amp;token=7858ab00-2665-41da-a87a-6b33511143c0" alt="" width="375"><figcaption><p>Key components for the HDR lighting</p></figcaption></figure>

## **Conditions for correct HDR operation**

For HDR to function properly, there must be light at varying brightness ranges, with screen brightness differing by at least 5-10 times.

The working range is from 0.001 to 10.

## **Lighting components**

<table><thead><tr><th width="326">Component</th><th>Description</th></tr></thead><tbody><tr><td>light.ambient_intensity</td><td>Intensity of ambient lighting that spreads evenly across the scene.</td></tr><tr><td>light.diffuse_intensity</td><td>Intensity of diffuse lighting that determines the brightness of surfaces facing the light source.</td></tr><tr><td>light.envmap_amount</td><td>Amount of light reflected from the environmental map, used for creating reflections.</td></tr><tr><td>light.environment_intensity</td><td>Intensity of lighting from the environment, including natural and reflected light.</td></tr><tr><td>haze.intensity</td><td>Intensity of haze or fog, adding an atmospheric effect and altering scene visibility.</td></tr><tr><td>HDR sky textures</td><td>Use of high dynamic range textures for the sky to achieve realistic light transitions.</td></tr><tr><td>Quadratic attenuation in light sources</td><td>A light attenuation formula that realistically distributes light as distance increases.</td></tr><tr><td>Speculars for all materials</td><td>Adjustment of specular properties for all materials, adding highlights and reflected light</td></tr></tbody></table>

{% hint style="info" %}
The final color for lighting parameters containing intensity (e.g., light.ambient, light.diffuse, haze.color, and others) is calculated using the formula:

`result_color = color * intensity`

The final brightness depends on the brightness of the color itself and the intensity parameter
{% endhint %}

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FRcK9BMAvbG1HxreVqPW5%2F%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%202024-05-16%20%D0%B2%2017.10.57.png?alt=media&amp;token=0becb785-3b8a-4b73-9900-6e3e6ce935d7" alt="" width="375"><figcaption><p><strong>Examples of lighting parameter settings, including color and its intensity</strong></p></figcaption></figure>

### **Real-life brightness levels**

<table><thead><tr><th>Parameter</th><th width="160">Light Intensity</th><th>Description</th></tr></thead><tbody><tr><td>candle</td><td>10</td><td>Imitation of candle light, creating a cozy atmosphere</td></tr><tr><td>cloud_at_night</td><td>0.00033</td><td>Dim lighting under a cloudy night sky</td></tr><tr><td>cloud_at_night (lit by moon)</td><td>0.0419</td><td>Cloudy night sky illuminated by the moon</td></tr><tr><td>frosted_bulb_60w</td><td>1200</td><td>Light from a 60-watt frosted bulb</td></tr><tr><td>monitor</td><td>3</td><td>Imitation of light from a monitor</td></tr><tr><td>moon_surface</td><td>30</td><td>Light mimicking the luminosity of the moon's surface</td></tr><tr><td>sky_cloudy</td><td>20</td><td>Light on a cloudy day</td></tr><tr><td>sky_day</td><td>60</td><td>Bright sunlight during the day</td></tr><tr><td>sky_night (lit by moon)</td><td>0.00085</td><td>Night light when illuminated by the moon</td></tr><tr><td>sky_night_dark</td><td>4e-006</td><td>Very dim night lighting</td></tr><tr><td>sky_night_noon</td><td>0.00124</td><td>Night lighting without additional light sources</td></tr><tr><td>sky_rise_skyline</td><td>0.0019</td><td>Dawn or dusk</td></tr><tr><td>star</td><td>0.00196</td><td>Light from a distant star</td></tr></tbody></table>

## Tonemapper settings

{% hint style="info" %}
Tonemapper settings should be the same across the entire project
{% endhint %}

If you need a specific frame appearance - use a LUT.

For understanding the operation of adaptation and HDR, it is very useful to enable the display of curves for HDR parameters using the console command `v_hdrHistogramOn 1`

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FGDtyi9MYAmwiegoJj7Qm%2Fimage.png?alt=media&amp;token=67c02fba-8f36-4338-9b3e-ac00da19d078" alt=""><figcaption><p>Fig 1. Tonemapper curve</p></figcaption></figure>

**Decoding Figure 1:**

* Red line - tonemapping curve (automatically calculated by the tonemapping formula and its parameters)
* Yellow line - brightness value selected by auto exposure
* Green lines - exposure\_min, exposure\_max
* Blue lines - horizontal brightness readings

## **Objects for testing color**

To test colors in game resources, there are 3 test entity located in the **service** folder of the **Entity Editor** \[1]:

* color\_checker\_gradient - for testing the display of monochrome gradients
* color\_checker\_kodak - for testing brightness levels
* color\_checker - for testing the transmission of standard shades

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FyVkoeZdFsfVUHGVGuEas%2Fimage.png?alt=media&amp;token=248793c0-9bbc-4442-9baa-33bf7696d00c" alt=""><figcaption></figcaption></figure>

Learn more about creating and configuring environment presets

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td>Step-by-step guide to developing custom environment presets</td><td><a href="/editor/environment-editor/creating-environment-preset">Creating environment preset</a></td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FXqe0ZKqSICsAK0XgCyMC%2Fsplash_editor_3.jpg?alt=media&amp;token=ecb5bb0d-d794-4925-a780-f7d98f315d42">default_cover.jpg</a></td></tr><tr><td>Detailed instructions for fine-tuning environment presets</td><td><a href="/editor/environment-editor/setting-environment-preset-parameters">Setting Environment preset parameters</a></td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FXqe0ZKqSICsAK0XgCyMC%2Fsplash_editor_3.jpg?alt=media&amp;token=ecb5bb0d-d794-4925-a780-f7d98f315d42">default_cover.jpg</a></td></tr></tbody></table>


# Creating environment preset

There are two ways to create an Environment preset.

### Creating an environment preset based on an existing one

1. Select the most suitable preset from the list of existing presets.
2. Right-click on the preset name to open the context menu and select the **Copy** option.
3. In the opened window, enter the name for the new preset.\
   Adding a slash in the name will automatically create a folder for the new preset.
4. After creating the preset, adjust its parameters.

### Creating an environment preset from scratch

1. Right-click on an empty space in the **Presets** column to open the context menu and select **Insert**.
2. In the opened window, enter the name of the preset. Adding a slash in the name will automatically create a folder for the new preset.
3. Select the preset and right-click in the **Parameters** field to open the context menu with a list of parameter blocks. Sequentially add all blocks.
4. Adjust the preset parameters as needed to achieve the desired lighting effect.

{% hint style="info" %}
When adding a block, the parameters within it are set to default values.
{% endhint %}

{% hint style="info" %}
Information from the articles "[Basic knowledge about HDR](/editor/environment-editor/basic-knowledge-about-hdr)" and "[Adjusting environment preset](/editor/environment-editor/setting-environment-preset-parameters)" will be useful.
{% endhint %}


# Setting Environment preset parameters

Description of Parameters in the Environment Editor window \[F6]

{% hint style="info" %}
The Environment Editor window can be opened by pressing the F6 key
{% endhint %}

## Light

### Parameters of the `light` block

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FnBivC9SmVYDI55zKd5xL%2Fimage.png?alt=media&amp;token=32990ee1-89f7-4fc0-baec-3fac8df665e0" alt=""><figcaption></figcaption></figure>

<table><thead><tr><th width="274">Parameter</th><th width="310">Description</th><th>Note</th></tr></thead><tbody><tr><td><code>direction</code></td><td>Direction from which the Sun shines</td><td></td></tr><tr><td><code>ambient</code></td><td>Color of ambient light</td><td>Parameter for <strong>Phong</strong> only</td></tr><tr><td><code>ambient_intensity</code></td><td>Intensity of ambient light</td><td>Parameter for <strong>Phong</strong> only</td></tr><tr><td><code>diffuse</code></td><td>Color of sunlight</td><td></td></tr><tr><td><code>diffuse_intensity</code></td><td>Intensity of sunlight</td><td></td></tr><tr><td><code>specular_intensity</code></td><td>Intensity of specular highlights</td><td></td></tr><tr><td><code>environment_intensity</code></td><td>Intensity of sky lighting</td><td>Parameter for <strong>PBR</strong> only</td></tr><tr><td><code>lights_intensity</code></td><td>Intensity multiplier for local light sources</td><td></td></tr><tr><td><code>envmap_amount</code></td><td>Sky lighting brightness in some schemes</td><td></td></tr><tr><td><code>night</code></td><td>Day or night for gameplay</td><td></td></tr><tr><td><code>night_vision</code></td><td>Night vision range multiplier for soldiers</td><td></td></tr><tr><td><code>color_saturation</code></td><td>Color saturation with values [0..2]:<br>0 - gray;<br>1 - normal;<br>2 - oversaturated</td><td></td></tr><tr><td><code>fx_additive_intensity</code></td><td>Intensity for <strong>additive</strong> effects</td><td></td></tr><tr><td><code>fx_blend_intensity</code></td><td>Intensity for <strong>blend</strong> effects</td><td></td></tr></tbody></table>

{% hint style="warning" %}
The Sun's position on the sky texture and the light direction must match.\
The Sun's position is adjusted in the `sky` block using the `relative_rotation` parameter.
{% endhint %}

### Parameters for unit highlighting

Used to `highlight` active units on the map (own/allied/enemy) to make them clearly visible.

Unit highlighting works by modifying the main light source settings (Sun) and adding additional lighting.

**Pros**: units are clearly visible on the map\
**Cons**: disrupts normal lighting

#### Highlight option

Highlight units can be toggled in the Options:

1. Open the Game tab.
2. Check the Highlight units box.

Highlight units can be toggled in the Options:

1. Open the Game tab.
2. Check the `Highlight Units` box.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FBNJedSao6uSlRRCUdPow%2Fimage.png?alt=media&amp;token=eed91a07-a7b4-4470-822c-ff3fe8fc4d7b" alt=""><figcaption></figcaption></figure>

#### Highlight parameters in the Environment preset

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FS34O3dCX61dCatctw1ez%2Fimage.png?alt=media&amp;token=54f4c7bb-e865-442a-9349-6a62f76c21e3" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
Parameters that do not work for [PBR](/textures-and-materials/physically-based-rendering/pbr-parameters#pbr-lighting-model-components):

* `ambient_bounced`
* `rim_intensity`
* `rim_glossiness`
  {% endhint %}

| Parameter              | Description                                                                                                                                                                                               | Value Range |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| `brightness`           | <p>Used to calculate <code>ambient</code>/<code>diffuse</code> in the new light source for unit highlighting.<br>Base colors are taken from light/<code>ambient</code> and light/<code>diffuse</code></p> | \[0..100]   |
| `ambient_bounced`      | <p>Light comes from below and sides.<br>Base color - light/<code>ambient</code></p>                                                                                                                       | \[0..100]   |
| `rim_intensity`        | Light intensity perpendicular to the camera direction, highlighting object contours                                                                                                                       | \[0..1]     |
| `rim_glossiness`       | How sharp or blurred the highlight spot edges are                                                                                                                                                         | \[0..1]     |
| `highlight_brightness` | <p>New ambient when hovering over a unit.<br>Base color - light/<code>ambient</code></p>                                                                                                                  | \[0..100]   |

**Brightness value ranges for the** `brightness`, `ambient_bounced`, `highlight_brightness` parameters:

<table><thead><tr><th width="182">Value Ranges</th><th>Description</th></tr></thead><tbody><tr><td>0</td><td>Black color</td></tr><tr><td>[1..49]</td><td>Midway between black and base color</td></tr><tr><td>50</td><td>Does not change the base color</td></tr><tr><td>[51..99]</td><td>Midway between base color and white</td></tr><tr><td>[100]</td><td>Shift towards white</td></tr></tbody></table>

## Sky

The parameter block for configuring the sky.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FNMs4e4KLfKIQVjchyX6c%2FEnvironment%20sky.png?alt=media&amp;token=0d55c3d6-19c0-4bbc-8235-1829d650aa8e" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
The position of the Sun on the sky texture and the light direction must match.
{% endhint %}

| Parameter                 | Description                                             | Note                                                                                                                                                                                                                                                                                                                                                   |
| ------------------------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| enable                    | Enabled/Disabled                                        |                                                                                                                                                                                                                                                                                                                                                        |
| mesh                      | Sky model                                               | <p>Different models can be used, but it is recommended to use the <code>sky\_farspace</code> model.</p><p>In the <code>sky\_farspace</code> model:</p><p>- alpha is used for smooth transition into haze;</p><p>- parameters from the sky material are output to the <code>sky</code> block;</p><p>- the second set of UVs can be used for clouds.</p> |
| color                     | Color for tinting the sky texture                       | Default is white                                                                                                                                                                                                                                                                                                                                       |
| global\_environment       | Main sky texture                                        |                                                                                                                                                                                                                                                                                                                                                        |
| relative\_rotation        | Sky rotation, in radians                                |                                                                                                                                                                                                                                                                                                                                                        |
| textures/clouds\_mask     | Mask for gradually fading clouds to zero visibility     | It is recommended to make the texture in RF16 format to avoid banding. The mask works well, and it is recommended not to change it.                                                                                                                                                                                                                    |
| textures/clouds           | Texture of clouds floating in the sky                   |                                                                                                                                                                                                                                                                                                                                                        |
| clouds\_scale             | Scale of the clouds                                     |                                                                                                                                                                                                                                                                                                                                                        |
| clouds\_pan\_y            | Speed of cloud movement across the sky along the y-axis |                                                                                                                                                                                                                                                                                                                                                        |
| clouds\_pan\_x            | Speed of cloud movement across the sky along the x-axis |                                                                                                                                                                                                                                                                                                                                                        |
| clouds\_opacity           | Cloud density                                           | \[0..1]                                                                                                                                                                                                                                                                                                                                                |
| clouds\_opacity2          | Cloud density                                           | \[0..1]                                                                                                                                                                                                                                                                                                                                                |
| clouds\_color             | Tint of the clouds                                      |                                                                                                                                                                                                                                                                                                                                                        |
| clouds\_color\_luminosity | Brightness of the clouds                                |                                                                                                                                                                                                                                                                                                                                                        |
| environment\_luminosity   | Sky brightness multiplier                               |                                                                                                                                                                                                                                                                                                                                                        |
| tone                      | Overall tint of the sky and clouds                      |                                                                                                                                                                                                                                                                                                                                                        |
| tone\_luminosity          | Overall brightness multiplier for the sky and clouds    |                                                                                                                                                                                                                                                                                                                                                        |
| global\_luminosity        | Overall brightness multiplier for the sky and clouds    |                                                                                                                                                                                                                                                                                                                                                        |
| haze\_falloff\_start      | Start of fog application at the lower edge of the sky   |                                                                                                                                                                                                                                                                                                                                                        |
| haze\_falloff\_end        | End of fog application at the lower edge of the sky     |                                                                                                                                                                                                                                                                                                                                                        |
| haze\_falloff\_power      | Fog intensity                                           |                                                                                                                                                                                                                                                                                                                                                        |

{% hint style="info" %}
To prevent the color from degrading into white or gray, its brightness should be in a wide range. For this, HDR textures are used for the sky.
{% endhint %}

{% hint style="info" %}
Sky brightness can be adjusted with the global\_luminosity parameter or by changing the brightness in the texture itself.
{% endhint %}

**Recommended ranges for HDR sky textures**:

* bright areas: \[1.0..2.0]
* dark areas: \[0.001..0.01]

Tool for converting HDRI textures to cubemap versions: [HDRI to CubeMap](https://matheowis.github.io/HDRI-to-CubeMap/).

## Weather settings

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FXMu43WcQuRbpQvEZLcUZ%2FEnvironment%20weather.png?alt=media&amp;token=cdbbf3e4-6cd1-46ca-8cd1-3410383a09ca" alt="" width="563"><figcaption><p>Weather settings</p></figcaption></figure>

### Wind

Creating wind effect in the game.

**Wind parameters:**

<table data-header-hidden><thead><tr><th width="188">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>direction</code></td><td>Wind direction.<br>Affects the direction of visual effects (vfx) and the swaying direction of trees</td></tr><tr><td><code>power</code></td><td><p>Wind strength is measured on the Beaufort scale:</p><ul><li>0: No wind (calm)</li><li>10: Storm-level wind strength</li></ul><p>*Values above 10 are not used in the wind settings.</p></td></tr></tbody></table>

### Haze

Creates a fogging effect at the edges of visibility.\
Used to hide objects beyond the visibility range and at the edges of the map.

**Haze parameters:**

<table data-header-hidden><thead><tr><th width="185">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>enabled</code></td><td>Enabled/Disabled</td></tr><tr><td><code>color</code></td><td>Haze color</td></tr><tr><td><code>intensity</code></td><td>Fog brightness. Also used for HDR sky.<br>To avoid fog glowing, this parameter should be reduced</td></tr><tr><td><code>start</code></td><td>Start of the haze in game units</td></tr><tr><td><code>end</code></td><td>Maximum haze density in game units</td></tr></tbody></table>

### Weather

Includes weather effects such as snow or rain.

**Weather parameters:**

<table data-header-hidden><thead><tr><th width="186">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>enable</code></td><td>Toggles weather effects on/off</td></tr><tr><td><code>density</code></td><td>Density of the weather effects</td></tr><tr><td><code>rain</code></td><td>Indicates whether it is raining</td></tr><tr><td><code>fx</code></td><td>Specifies the visual effect to display</td></tr><tr><td><code>sound</code></td><td>Selects the sound effect (sfx) for weather phenomena like rain or snow</td></tr></tbody></table>

### Thunder

Thunder and lightning effects.

**Thunder parameters:**

<table data-header-hidden><thead><tr><th width="183">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>enable</code></td><td>Enables/disables thunder and lightning</td></tr><tr><td><code>interval</code></td><td>Range for random selection of thunder and lightning intervals, in seconds</td></tr><tr><td><code>color</code></td><td>Color of the lightning</td></tr><tr><td><code>sound</code></td><td>Sound to be played after a lightning strike</td></tr></tbody></table>

## Additional visual effects

### Video Overlay

`Video Overlay` refers to the process of displaying a video on top of the existing visual content. This means that the video appears superimposed on the current game or application visuals.\
It is used for various purposes, such as adding special effects, informational videos, or cinematic sequences without interrupting the main content.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FdbZoToypCpQQFKzqeegH%2FEnvironment%20video_overlay.png?alt=media&amp;token=4c6adc28-4589-4c84-a665-efacb829b71e" alt=""><figcaption></figcaption></figure>

<table data-header-hidden><thead><tr><th width="189">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>enable</code></td><td>Enables/disables the video overlay</td></tr><tr><td><code>file</code></td><td>Path to the video file to be overlaid</td></tr><tr><td><code>color</code></td><td>Tint color for the video overlay</td></tr></tbody></table>

### Lens Flare

`Lens Flare` refers to visual artifacts that occur when a bright light source, such as the sun, shines directly into a camera lens, causing light to scatter and create various shapes and patterns. In a game engine, lens flare effects are used to simulate this phenomenon, adding realism and visual appeal to scenes where the sun or other bright light sources are present. This effect can enhance the immersive experience by mimicking how cameras and the human eye perceive intense light sources.

<table data-header-hidden><thead><tr><th width="198">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>enable</td><td>Enables/disables the lens flare effect</td></tr><tr><td>preset</td><td>Name of the configuration file with sprites located in the <code>resource\set\lens_flare</code> folder</td></tr><tr><td>brightness</td><td>Brightness of the lens flare effect</td></tr><tr><td>fade</td><td>Time for the lens flare effect to appear when sunlight is on the screen and disappear when the sun is off the screen</td></tr></tbody></table>

## Post Process

Post-processes in lighting are effects and techniques applied after the main scene rendering to enhance the visual quality of lighting, add realism, and stylize the image.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FGmAPAms4h5aeXkeHQkmL%2FEnvironment%20post_process.png?alt=media&amp;token=a254fff2-44f1-419e-ac9a-ad73300ba267" alt=""><figcaption></figcaption></figure>

### Eye Adaptation

Automatic brightness adjustment of the image

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FlrANFUQ6rqWs3FHRAaNc%2FEnvironment%20eye_adaptation.png?alt=media&amp;token=6491b79a-8bb3-43b6-bea1-9434fcb2121e" alt=""><figcaption></figcaption></figure>

<table><thead><tr><th width="257">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>enabled</code></td><td>Enabled/disabled</td></tr><tr><td><code>target_exposure</code></td><td>Increase/decrease the image brightness before applying the tone mapping curve</td></tr><tr><td><code>exposure_min</code></td><td>Minimum exposure value, below which the image brightness will not decrease. Maintains dark scenes properly dark</td></tr><tr><td><code>exposure_max</code></td><td>Maximum exposure value, above which the image brightness will not increase. Helps prevent overexposure and detail loss in bright scenes. Can be used to create controlled-bright effects.</td></tr><tr><td><code>rate</code></td><td>Brightness adaptation speed</td></tr><tr><td><code>fix_exposure</code></td><td>Ignore image brightness data for exposure calculation</td></tr><tr><td><code>fix_whitepoint</code></td><td>Ignore image brightness data for white point calculation. Does not work with ACES tonemapper</td></tr></tbody></table>

{% hint style="info" %}
The exposure\_min and exposure\_max parameters are used to control the brightness range of the scene during automatic exposure adaptation (eye adaptation). These parameters help maintain the visual integrity of the scene under various lighting conditions.
{% endhint %}

### Tone Mapping

Tone Mapping is the process of converting HDR brightness range to LDR range for proper display on standard screens. HDR images contain a wider range of bright and dark values than standard displays can reproduce. Tone Mapping helps preserve details and contrast in these images when displayed on a screen.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FhqBevL0lrEg3VnvpRnnP%2FEnvironment%20tone_mapping.png?alt=media&amp;token=2e9a7e8d-f0b1-474e-9fb5-deab4d3bc359" alt=""><figcaption></figcaption></figure>

<table><thead><tr><th width="154">Parameter</th><th width="401">Description</th><th>Note</th></tr></thead><tbody><tr><td>enabled</td><td>Enables or disables the use of tonemapper.<br>If disabled, colors in the [0..1] range are directly output to the screen</td><td></td></tr><tr><td>aces</td><td>Enables the standard ACES tonemapper, which emulates film shooting. In ACES mode, all curve parameters are ignored.</td><td>Should be enabled in lighting presets for MoWII.</td></tr></tbody></table>

{% hint style="info" %}
Achieving the desired effect is usually possible by adjusting the `target_exposure` parameter in the [eye\_adaptation](#eye-adaptation) block or using [LUT](#lut).
{% endhint %}

When the aces option is disabled, the manual tone mapping parameters become available.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FivXupBgjcOstnv9bwP0k%2Fimage.png?alt=media&amp;token=12d8f1ac-1469-45c3-bc2a-96ab1bfc0021" alt=""><figcaption><p>Example of configuring tone mapping parameters in the Environment Editor</p></figcaption></figure>

**Histogram Explanation:**

* **Toe**: The lower bend of the curve
* **Shoulder**: The upper bend of the curve
* **Linear**: The straight part connecting the toe and shoulder

**The tone mapping curve parameters**

<table><thead><tr><th>Parameter</th><th width="297">Description</th><th>Note</th></tr></thead><tbody><tr><td><code>white_point</code></td><td>Intensity of the HDR scene corresponding to white in the resulting LDR image</td><td></td></tr><tr><td><code>linear_angle</code></td><td>Slope of the linear part of the curve</td><td>Contrast in midtones</td></tr><tr><td><code>shoulder_length</code></td><td>Defines the shape of the <code>shoulder</code></td><td>Contrast in highlights</td></tr><tr><td><code>shoulder_strength</code></td><td>Defines the steepness of the <code>shoulder</code></td><td>Contrast in highlights</td></tr><tr><td><code>toe_numerator</code> and <code>toe_denominator</code></td><td>Define the shape of the <code>toe</code></td><td>Contrast in shadows</td></tr><tr><td><code>toe_strength</code></td><td>Defines the steepness of the <code>toe</code></td><td>Regulates contrast in shadows</td></tr></tbody></table>

The influence of each parameter on the output brightness overlaps.\
For example, adjusting the `toe` parameter will also affect the midtones, while adjusting the `shoulder_strength` will affect the entire curve to varying degrees.\
Therefore, a sequential adjustment of a series of parameters is necessary (`white_point` -> `linear_angle` -> `shoulder` -> `toe`).

During the adjustment process, there may be situations where intermediate parameter changes result in incorrect image display, making it difficult to evaluate their impact.\
Therefore, the editor includes a histogram feature that displays the range of incoming brightness and the function of converting HDR to LDR. This helps visualize the impact of parameters on the tone mapping process during intermediate adjustment stages. The histogram components in the editor can be enabled via console commands.

#### Console command parameters for histogram

<table><thead><tr><th width="335">Console Command</th><th>Description</th><th>Note</th></tr></thead><tbody><tr><td><code>v_hdrHistogramOn [0 | 1]</code></td><td>Disables/Enables the histogram display</td><td>Default is 0</td></tr><tr><td><code>v_hdrHistogramLinearRange</code></td><td>Sets the scale of incoming brightness</td><td>0 - linear,<br>1 - logarithmic<br>(default is 0)</td></tr><tr><td><code>v_hdrHistogramFixedLumRange</code></td><td>Maximum incoming brightness</td><td>Default is 0, which sets the maximum scale equal to the scene's maximum brightness if adaptation is enabled. Otherwise, the maximum brightness of the scene must be set manually using this command.</td></tr><tr><td><code>v_hdrHistogramScaleBinHeight</code></td><td>Scales the height of the histogram bins</td><td>0 - no scaling</td></tr></tbody></table>

### Glare

Glare around bright areas of the screen

<table><thead><tr><th width="188">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>threshold</code></td><td>Brightness threshold above which glare appears</td></tr><tr><td><code>scale</code></td><td>Glare intensity adjustment</td></tr></tbody></table>

### Blue Shift

The image becomes gray in unlit areas, useful for night maps

<table><thead><tr><th width="197">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>enabled</code></td><td>Enable/Disable</td></tr><tr><td><code>threshold</code></td><td>Brightness threshold at which the transition to gray starts</td></tr></tbody></table>

### Depth of Field

Simulates the work of a camera.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F2e4kra5K3P8gDTx7jG5y%2Fenvironment%20depth_of_field.png?alt=media&amp;token=db137e2c-681c-493c-a534-38e9b1e8d938" alt=""><figcaption></figcaption></figure>

<table><thead><tr><th width="166">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>enable</code></td><td>Enable/Disable</td></tr><tr><td><code>focus</code></td><td>Distance from the camera to the center of the focus area</td></tr><tr><td><code>width</code></td><td>Width of the focus area</td></tr><tr><td><code>far</code></td><td>Distance from the far edge of the focus area</td></tr><tr><td><code>near</code></td><td>Distance from the near edge of the focus area</td></tr><tr><td><code>blur</code></td><td>Level of blurriness for areas outside the focus zone</td></tr><tr><td><code>smooth</code></td><td>Smooth transition between sharp and blurry areas</td></tr></tbody></table>

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FuvjAnFLTgcI9DLiRRkhb%2Fdepth%20of%20field%20view.png?alt=media&amp;token=2491cc80-b6f2-4fcd-ba79-e933b6ae03e1" alt="" width="563"><figcaption></figcaption></figure>

### SSAO

SSAO stands for Screen Space Ambient Occlusion. It emulates shadowing at surface intersections.

| Parameter | Description                     |
| --------- | ------------------------------- |
| enable    | Enable/Disable                  |
| standard  | Standard or extended parameters |

### LUT

Instead of brightness, contrast, saturation, and tone modifiers, image adjustment is implemented via texture.

The reference texture that does not alter colors when used is called `lut_default.tga`.

## Local Light sources

The brightness of local light sources is influenced by the global light\_intensity parameter. The brightness parameters are multiplied when calculating the resulting brightness of local light sources.

| Parameter   | Description                                             | Value Range           |
| ----------- | ------------------------------------------------------- | --------------------- |
| intensity   | Sets the brightness of the center of the light          |                       |
| radius      | How far the light reaches                               |                       |
| compression | Compression of the attenuation curve towards the center | 2..100 (default is 2) |

**Examples of attenuation curves**

* X-axis: normalized distance from 0 to 1 to the center
* Y-axis: normalized intensity from 0 to 1

| <p><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXehC_n8xBZaCKE30zmfXK8kxmPUDBwIfWAhen1U_BMwrDPOD1WBAbu8QVZFl2BP7JF5HE1GtpJ0AUjwpAwJzBUyp0eczpr8QfdrobR0ysHhiDKbVmLjf5lkvwEw2E1dp_47Xh4wXmXBE0P447enD7OHWhk?key=AvjlGCEv98DkJLJw2y3z_g" alt="" data-size="original"></p><p>compression = 2</p> | <p><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXffBpD0kLIuE5J0nBoMav6a8tw4rVtgcYPoI2AVC3uC4IP56zDfnwUmiFR2O_y5T6rVP9xpVrx_OgbGacSY_Xc2eUY5yzEC_O89PdZ-gRVE71bS35urtyW9svBBWG_0W49SDaEqIMdGRy25VBLtTlMWSAQk?key=AvjlGCEv98DkJLJw2y3z_g" alt="" data-size="original"></p><p>compression = 16</p> | <p><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXcbONkG5-HbKmvJCvQWbtwC6hDT5C0GYxbGg4VmlkgzZ5O3txiJKgpaSaZBpk_90cc7bdYa7N1VeJMmhhs9rv0zNfjIVtlY-irDRRPOQZbqQeBCGH3qu_wfS6fYr-WVpHtcuBJkiz4TQjrltgKI-2c-htE?key=AvjlGCEv98DkJLJw2y3z_g" alt="" data-size="original"></p><p>compression = 100</p> |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |


# Debug Tools


# Console


# Debug Processes Window


# Render Layer List Window


# Simulation Mode


# Game settings


# Movement on slopes

Penalties for unit movement on slopes, depending on the direction (uphill or downhill), are configured in the `pather.set` file. The slope angle of a map cell affects movement speed, which is critical for heavy units such as tanks.

## Key parameters

* `SlopeDown` - defines penalties for moving downhill. This is similar to the `Height` parameter from **Men of War**.
* `SlopeUp` - defines penalties for moving uphill.

### Settings examples

#### Downhill movement penalties

The following is an example of penalties for moving downhill:

```plaintext
{SlopeDown
    0  0  0  0  0
    0.1 0.3  0.5  0.8  1
    1  1  1 -1 -1
}
```

In this configuration:

* `cost < 0` - movement is prohibited.
* `cost = 0` - movement occurs without penalties.
* `cost > 0` - movement incurs a penalty, and the total path cost is calculated as follows:

$$
pathCost = distance \* (terrainCost + slopeCost)
$$

#### Uphill movement penalties

The following is an example of penalties for moving uphill:

```plaintext
{SlopeUp
    0  0  0  0  0 ; free movement up to 30 degrees
    1 -1  -1  -1  -1 ; penalties apply from 30 degrees
    -1 -1 -1 -1 -1 ; movement prohibited from 60 to 90 degrees
}
```

{% hint style="info" %}
Upon loading the `SlopeDown` table, it automatically applies to `SlopeUp` unless a separate `SlopeUp` table is specified.\
To configure different penalties for uphill movement, a distinct `SlopeUp` table should be provided after `SlopeDown`.
{% endhint %}

## Debugging

Quantized slope angles used for pathfinding can be displayed with the heightmap grid. Enable this view by pressing `Alt+H` or checking the `heightmap` option in the Heights tab of the Heights Editor.

For example, if the heightmap grid shows a value of 5, the angle corresponds to 30 degrees, using the 5th entry in the table.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FD131uxbh6DXkrYTqzcXH%2FPath%20planner%20heightmap.png?alt=media&amp;token=f4666070-1dbb-4721-8e1a-cf2eeb5c2a96" alt=""><figcaption><p>Path planner heightmap</p></figcaption></figure>

## Configuration recommendations

* **Vehicle units**\
  Vehicle units should descend directly downhill without special path recalculations. For uphill movement, the system should prioritize alternative routes.
* **Infantry units**\
  Infantry units should not attempt to traverse cliffs. They should always select bypass routes when necessary.

## Usage notes

In multiplayer mod (`mod_mp`), human units do not support the `SlopeUp` parameter for pathfinding. Movement penalties for these units are controlled through the `Height\SlopeDown` table.

For vehicle units, both `SlopeDown` and `SlopeUp` must be configured to ensure proper movement behavior on slopes.

### Map requirements

For slope movement to function correctly, ensure that relevant areas on the map are not marked with the `no_pass` flag.


# Configuration of movement types for human units

The movement speeds of units of the `human` type are configured in the file: `/scene/properties/human.ext`\
The `Chassis` extender, located within the file, defines the movement types in blocks:

* `Crawl` (crawling)
* `Swim` (swimming)
* `Run` (main movement type)
* `Strafe` (lateral movement)

Each movement type contains a set of movement modes.\
These descriptions include parameters for movement speed, animation speed, turning speed, and other components defining unit movement.

Units of measurement for speed parameters:

* movement speed S=\[km/h];
* animation speed A=\[km/h];
* turn rate in degrees per second rotation \[degree/s].

The animation playback speed (`Sa`) for unit movement in the game is calculated using the following formula:

$$
Sa = S/A\*As
$$

where `As` is the animation scale factor.

## Movement types description

### Crawl and swim movement types

The crawling `Crawl` and swimming `Swim` description blocks include three movement modes, which differ in movement speed:

* `Slow` — slow movement when the unit is tired or injured;
* `Normal` — normal speed;
* `Fast` — accelerated movement by the player's command.

### Main movement type

The `Run` block describes several movement modes, adapting to the unit's state and received commands.

* **Walking modes**\
  Units employ walking modes for patrolling or carrying heavy objects with one hand (e.g., a jerrycan) or both hands (e.g., a crate or a corpse).\
  Key walking modes:
  * `Spot` and `Sneak`: used by AI-controlled units for searching hidden enemies.
  * `Walk`: represents relaxed or encumbered walking.
* **Slow run mode**\
  The `Slow` mode automatically activates when unit states impose movement speed limitations, such as fatigue or traversing difficult terrain.
* **Normal run mode**\
  The `Normal` mode provides moderate running intensity, triggered in situations like fatigue or challenging terrain. It differs from `Slow` mode in speed parameters.
* **Sprinting modes**\
  The sprinting modes are the primary movement modes for `human` units.\
  Variants include:
  * `Fast`: used during combat unless the `charge` command is issued for accelerated movement.
  * `Assault`: activated by the `charge` command, enabling shooting while running. Commonly used for advancing under fire or attacking from cover.
  * `Bow`: triggered by the `withdraw` command, preventing shooting while running. Typically used for retreating or taking cover during escape.

{% hint style="info" %}
In mission scripts, `Fast` and `Assault` are the most frequently employed modes.
{% endhint %}

### Aiming movement

`Strafe` is a movement type representing walking or running while aiming.\
It is used by AI-controlled units for short-distance movements during combat.

The aiming movement description block specifies not only the speeds but also the names of animations for both the upper and lower parts of the body during movement.

{% hint style="info" %}
The `Strafe` mode cannot be activated or deactivated via mission scripts.
{% endhint %}

## Example of movement parameters configuration

```
{Chassis "foot"
	;	 	S(km/h)  A(km/h) rotation(degree/s)
	{Crawl
		{Slow      3.00   5   100 }
		{Normal    3.75   5   200 }
		{Fast      5.25   5   200 }
	}
	{Swim
		{Slow      1.50   5   200 }
		{Normal    2.25   5   200 }
		{Fast      3.75   5   200 }
	}
	{Run
		{Sneak     3.75   2   400 }   ; x 0.85
		{Spot      4.50   2   400 }   ; x 0.5
		{Walk      5.25   1.8 400 }   ; x 0.48
		{Slow      6.00   3   800 }   ; x 1
		{Normal   10.50   5   800 }   ; x 0.55
		{Fast     13.50   7   800 }   ; x 0.33
		{Bow      20.25   7  1200 }   ; x 0.55
	}
	{Strafe
		;	m  m+v  km/h  	speed   animation up               animation down
		{Forth   3  2 0   6.50   3     "walk_spot_gun_up_1"    "walk_spot_gun_down_1"}   ; 6.5 km/h move 2 km/h animation 0.37 scale --> in Run
		{Forth   3  2 1  11.00   1     "run_spot_gun_up"       "run_spot_gun_down"}
		{Forth   8  0 0  13.20   1.2   "run_spot_gun_up"       "run_spot_gun_down"}
		{Left    4  0 0  10.50   1.22  "run_spot_back-strafe_gun_up"   "run_spot_back-strafe_gun_down"}
		{Right   8  0 0  13.00   1.1   "run_spot_left-strafe_gun_up"   "run_spot_left-strafe_gun_down"}
		{Back    8  0 0  10.50   1.22  "run_back_spot_gun_up"   "run_back_spot_gun_down"}
	}
}
```


# Wind behavior settings

## Object wind sensitivity

### Wind sensibility parameter

The `wind_sensibility` parameter defines the sensitivity level of scene entities to wind.\
It is specified in configuration files using the following syntax:

> **Syntax:**
>
> ```
> {wind_sensibility X}
> ```

Parameter values (`Х`):

* `0` — wind disabled (default);
* `1` — low sensitivity (e.g., for trees);
* `3` — high sensitivity (e.g., for grass).

### Configuring wind\_sensibility parameter

The `wind_sensibility` parameter is defined in the following configuration files:

* **properties/tree.inc** — for trees;
* **properties/bush.inc** — for bushes;
* **properties/grass.inc** — for grass;
* or in the entity's **.def** file.

<details>

<summary>Example: Configuring <code>wind_sensibility</code> for bush entities</summary>

```
{wind_sensibility 2}
```

</details>

{% hint style="success" %}
Adding the `no_wind` property to the `props` block of an entity's **.def** file turns off the entity's ability to react to wind
{% endhint %}

## Controlling an entity's ability to interact with wind through scripts

The `depend_on_wind` command is a script function that enables or disables an entity's ability to interact with wind.\
It is used in script files located in the **scene\set\interaction\_entity** folder, which define entity interactions with other scene objects during gameplay.

> Syntax:
>
> ```
> {depend_on_wind [0|1]}
> ```

Parameter value&#x73;**:**

* `0`: disables the entity's ability to interact with wind;
* `1`: enables the entity's ability to interact with wind.

The `depend_on_wind` command dynamically manages the wind interaction state of an entity based on gameplay conditions.\
For instance, if an entity transitions to a state where it should no longer respond to wind (e.g., after being destroyed or burned), the `{depend_on_wind 0}` command can be invoked to disable wind interaction.

Below is an example script demonstrating how to manage an entity's sensitivity to wind during gameplay.

<details>

<summary>Example: Entity's interaction with wind based on its state</summary>

```plaintext
{on "update_wind"
    {if flag "bare"
        {depend_on_wind 0}
    else fallen
        {depend_on_wind 0}
    else
        {depend_on_wind 1}
    }
}
```

Explanation:

* `on "update_wind"`: Event triggered to update the entity's wind sensitivity.
* Conditions:
  * if the `bare` flag is active, wind response is disabled (`depend_on_wind 0`);
  * if the entity is in a fallen state, wind response is also disabled;
  * otherwise, the entity responds to wind (`depend_on_wind 1`).

</details>

## Configuring wind parameters

The wind parameters are configured in the `main/scene/set/wind.set` file.

**Wind parameter descriptions:**

| `global_wind_speed`            | Animation speed of wind gust textures, measured in units per frame.                                                    |
| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------- |
| `tree_bend_offset`             | Base angle of tree bending towards the wind direction, excluding gusts, measured in degrees.                           |
| `tree_bend_range`              | Maximum angle range of tree bending during gusts, measured in degrees.                                                 |
| `grass_bend_gust_start`        | Minimum wind gust threshold for grass animation, value range `[-1..1]`.                                                |
| `grass_bend_gust_end`          | Maximum wind gust threshold for grass animation, value range `[-1..1]` (must be greater than `grass_bend_gust_start`). |
| `grass_bend_angle_offset`      | Base angle of grass bending towards the wind direction, excluding gusts, measured in degrees.                          |
| `grass_bend_angle_range`       | Grass bending angle range during gusts, measured in degrees. Avoid values that visually bury grass under the ground.   |
| `grass_bend_angle_power`       | Amplitude of grass oscillations during gusts, measured in degrees.                                                     |
| `grass_bend_angle_freq`        | Frequency of grass oscillations during gusts, measured in arbitrary units.                                             |
| `grass_large_scale_power`      | Intensity of large-scale grass wave oscillations without gusts, value range `[0..1]`.                                  |
| `grass_large_scale_gust_power` | Intensity of large-scale grass wave oscillations during maximum gusts, value range `[0..1]`.                           |
| `grass_large_scale_freq`       | Frequency of large-scale grass wave oscillations, measured in arbitrary units.                                         |
| `grass_small_scale_power`      | Intensity of small-scale grass wave oscillations without gusts, value range `[0..1]`.                                  |
| `grass_small_scale_gust_power` | Intensity of small-scale grass wave oscillations during maximum gusts, value range `[0..1]`.                           |
| `grass_small_scale_freq`       | Frequency of small-scale grass wave oscillations, measured in arbitrary units.                                         |

### Step-by-step setup of wind parameters

{% hint style="info" %}
Each wind parameter is tied to a value table, configured according to the **Beaufort scale**, which maps real-world wind conditions to in-game effects:

* `0`: no wind (calm);
* `10`: storm-level wind strength.
  {% endhint %}

1. Set the `global_wind_speed` parameter
2. Configure tree wind parameters: `tree_bend_offset`, `tree_bend_range`
3. Configure grass parameters:
   * `grass_bend_gust_start`, `grass_bend_gust_end`;
   * `grass_bend_angle_offset`, `grass_bend_angle_range`;
   * `grass_bend_angle_freq`, `grass_bend_angle_power`;
   * `grass_large_scale_*`, `grass_small_scale_*`.

Below is an example of configuring the `grass_small_scale_power` parameter using a value table based on the **Beaufort scale**. This parameter adjusts the intensity of small-scale grass wave oscillations in response to varying wind conditions.

{% hint style="info" %}
Configure other parameters similarly to ensure consistent wind responses.
{% endhint %}

<details>

<summary>Example: Configuring wind parameters</summary>

```plaintext
{grass_small_scale_power
    0  0.004 ; value for calm wind
    1  0.010
    2  0.014
    3  0.020
    4  0.026
    5  0.032
    6  0.040
    7  0.050
    8  0.060
    10 0.100 ; value for hurricane
}
```

Description:

* Key: represents the Beaufort scale level (0 for calm, 10 for hurricane).
* Value: adjusts the intensity of small-scale oscillations in grass, measured in arbitrary units.
* Usage: these values define how grass reacts to different wind strengths, creating a realistic animation effect.

</details>

### Console commands

For diagnosing and controlling wind effects during gameplay, the following console commands are available:

* Reload wind settings from the `wind.set` file:

```
ed_reloadWind
```

* Display entities' wind sensitivity on screen:

```
v_entityWind [0 | 1]
```

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FrlBauPh7Ds4St0HVys7e%2Fv_entityWind.png?alt=media&amp;token=76a464e4-e863-424f-a5ec-d8acb868475f" alt=""><figcaption><p>Displaying entities' wind sensitivity on screen using the <code>v_entityWind</code> command.</p></figcaption></figure>


# Sensor

#### Sensor Block Parameters

The **Sensor** block controls the radius of the approximate location of an object known to the AI. This radius changes based on various factors, such as initial detection, receipt of new signals, object movement, and detection of activity nearby. Below are the parameters that define these changes, along with their default values and corresponding formulas.

<table><thead><tr><th width="216.7265625">Parameter</th><th width="83.03515625">Default Value</th><th>Description</th></tr></thead><tbody><tr><td><code>radiusInitial</code></td><td>0.5</td><td>A coefficient that determines the initial radius of the approximate location of an object known to the AI. Calculated using the formula:<br><strong>r = radiusInitial * distance to the object</strong></td></tr><tr><td><code>radiusChangeOnSignal</code></td><td>0.7</td><td>A coefficient that determines how the radius changes when a repeated signal is received. Calculated using the formula:<br><strong>r = r * radiusChangeOnSignal</strong></td></tr><tr><td><code>radiusChangeOnShift</code></td><td>0.5</td><td>A coefficient that determines how the radius changes when the object has moved from its position. Calculated using the formula:<br><strong>r = Max(radiusChangeOnShift * shift distance, r)</strong></td></tr><tr><td><code>radiusOnMove</code></td><td>0.3</td><td>A coefficient that determines how the radius changes if movement of an object is detected nearby. Calculated using the formula:<br><strong>r = Min(radiusOnMove * distance to the object, r)</strong></td></tr></tbody></table>

All parameters are constrained within the range **\[0..1]**.

<details>

<summary>Example of Sensor Block Configuration</summary>

```
{sensor
    {radiusInitial 1.0}
    {radiusChangeOnSignal 0.1}
    {radiusChangeOnShift 0.1}
    {radiusOnMove 1.0}
}
```

</details>

## Sensor modifiers and debugging tools

By default, visibility operates under the **observed** principle, meaning an object is considered **visible** if it enters the visor range of at least one allied unit.

To debug unit sensors and visibility mechanics, the following console commands are available:

* **v\_visor 1** – displays unit visors.
* **v\_visorInfo 1** – shows additional information about visors.

Additionally, the **inform\_range** modifier is used to configure data transmission between allied soldiers. This command passes a multiplier to the engine, influencing how information is shared. In single-player mode, a value of **150 meters** is considered excessively large.

## **AI search debugging tools**

For an AI-controlled soldier to actively search for an enemy, all of the following conditions must be met simultaneously:

* **move\_mode** is set to **free;**
* **control = AI;**
* the unit is not currently moving due to a **move task** or **waypoints;**
* the unit is allowed to advance based on **advance/retreat** settings.

**Console Commands for Debugging**

* `v_aiSearchPoints` – spawns **spherewater\_small** at all points of interest, allowing visualization of key areas the AI considers during searches.
* `v_sensorBasic` – enables symbolic and color-coded marking of detected targets:
  * **red** – enemy;
  * **green** – ally;
  * **yellow** – neutral;
  * **white** – external target;
  * **cyan** – unidentified target;
  * **darker colors** – target is not currently visible;
  * **circle (○)** – approximate location of the target;
  * **asterisk (\*)** – primary enemy;
  * **question mark (?)** – object is not studied; the unit should approach and investigate

## Sensor configuration in mission

Sensor configuration settings for missions are written in the `<name>.info` file within the game `settings` block or in a global configuration file for all missions of a specific game type.

<table><thead><tr><th width="200.140625">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>fogOfWar</code></td><td><p>Defines the fog of war mode.</p><p>Possible values:</p><ul><li><code>fog_off</code> – <strong>Fog of war</strong> is disabled.</li><li><code>fog_simple</code> – works like in <em><strong>Men of War 2</strong>,</em> only visibility radius and distances are considered, ignoring terrain, bushes, and other obstacles.</li><li><code>fog_realistic</code> – functions like in <em>Men of War original</em>, but is currently disabled and needs restoration.</li></ul></td></tr><tr><td><code>fogOfWarModeForAI</code></td><td>Defines how AI processes visibility.</td></tr><tr><td><code>fog_per_entity</code></td><td>Useful for single-player missions to prevent AI units from rushing toward the player.<br>Each unit sees independently, with information shared only within its communication radius.<br>Applies only to units with <strong>control = AI</strong>.</td></tr><tr><td><code>fog_per_player</code></td><td>Used in PVP <em>Frontline Mode</em>.<br>Visibility is shared across all of a player's units—if one unit sees an enemy, all units see it.<br>Enabled by default.</td></tr></tbody></table>

<details>

<summary>Example of sensor configuration in a mission</summary>

```plaintext
{settings
    {options gameDuration}
    {optionsAdvanced floraRespawn friendlyFire fogOfWar}
    {fogOfWar fog_simple}
    {fogOfWarForAI fog_per_entity}
    {difficulty normal}
    ...
}
```

* `fogOfWar` `fog_simple` - the **fog of war mode** is set to *simple*, working like in *Men of War 2:* visibility is determined only by range, ignoring terrain and obstacles.
* `fogOfWarForAI` `fog_per_entity` – AI units will perceive visibility individually, meaning they won’t collectively react to an enemy unless within their information-sharing radius.

</details>


# User control sound

User Control Sound (UCS) allows you to modify playing sounds parameters or start new sounds depending on user control conditions.

UCS provides fine-grained control over sound behavior in real-time by:

* Modifying **listener parameters** (HDR, LPF) based on camera or selection state;
* Applying **conditional sound logic** via includes and operations;
* Grouping sounds for organized control and activation;
* Supporting both **static** and **dynamic** group outputs;
* Integrating with scripts using the `active` flag.

## Listener Control

The `listener` block defines how UCS modifies the audio listener’s parameters in response to user input or state.

> **Template**
>
> ```
> {listener
>     {includes
>         // Conditions that must be met
>     }
>     {operations
>         // Listener parameter modifications
>     }
> }
> ```
>
> * {includes \[...]} : contains conditions (e.g., camera, selection) required to apply the operations block
> * {operations \[...]}: defines parameter modifications such as HDR, LPF, and occlusion.

### Occlusion

Occlusion controls high-frequency dampening of sound:

* **Default value**: `1` (no effect)
* **Range**: `1–10`
* **Higher values** = stronger high-frequency filtering

{% hint style="info" %}
Occlusion works together with the group's **LPF** level. To cancel occlusion, set the LPF level equal to the occlusion value.
{% endhint %}

### HDR

The HDR block modifies how the listener reacts to loud sounds:

* Increasing the **loudness** simulates listener adaptation to intense audio events.
* This is separate from the sound’s own HDR values — the listener’s loudness applies globally when include conditions are met.

{% hint style="info" %}
Listeners Includes and operations examples and description see inside sound/user\_control.set
{% endhint %}

## Group

UCS works with groups. Group is a named set of includes conditions and array of output operations.

To make a sound respond to **User Control Sound (UCS)**, follow these **three steps.**

{% stepper %}
{% step %}
Create a named group in the `sound/user_control.set` file.\
Example:

```c
{group hit
    // includes and outputs
}
```

{% endstep %}

{% step %}
Assign this group to the sound inside the `loudness` block, a `folder.set`, or `composite` parameters.\
Example:

```c
{group "hit"}
```

{% endstep %}

{% step %}
For the script commands you must specify the “active” flag.\
Example:

```c
{start_sound "hit/big/metal_hit" active}
{link_sound "move" "vehicle/groundborne/pz1/pz1_tracks" active}
```

{% endstep %}
{% endstepper %}

### Group options

By default the group is static. It means that outputs select only once before start. At all playback time output is set the same.

To update output set by the way of sound playback you must specify a dynamic flag.

{% hint style="info" %}
Group options see inside sound/user\_control.set
{% endhint %}

### Group includes

By default UCS applies outputs for any sound inside a group.

You can Include only required user control options with Includes block.

All includes related to the user player.

{% hint style="info" %}
See parameters specification inside sound/user\_control.set.
{% endhint %}

### Group outputs

Group output is a set of conditions and operations with sound parameters. Depending on static or dynamic groups parameters modify only when sound starts or continuously all the playback time.

{% hint style="info" %}
Output Includes and operations examples and description see inside sound/user\_control.set
{% endhint %}


# Grass brush template configuration

The `grass.set` file, located in the `scene\set\` directory, defines patterns used by [the **Grass** brush](/editor/map-editor/3-landscape-editor/grass-editor) in the Landscape Editor to generate vegetation.

Each grass pattern specifies a list of entity models and the density parameters for their placement on the ground surface. All models must be prepared in advance and placed in the `scene\entity` folder.

> **Syntax**
>
> ```
> {"pattern_name"
>     {models
>         {"entity_name" "texmod_name"}
>         {...}
>     }
>     {dencity N}
> }
> ```

<table><thead><tr><th width="169.16015625">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>pattern_name</code></td><td>A unique identifier for the template (template name), enclosed in double quotes.<br>The list of template names appears in <a href="/editor/map-editor/3-landscape-editor/grass-editor#the-grass-patterns-list">the <strong>Patterns</strong> window </a>under the <strong>Grass</strong> tab of the Landscape Editor.</td></tr><tr><td><code>models</code></td><td>A block containing a list of models that will be randomly spawned on the ground surface when painting with the selected brush template.<br>For each model, specify its name in the game resources and, optionally, a texture modifier name (the texture modifier can be omitted if the model has only one texture variant).</td></tr><tr><td><code>dencity</code></td><td>A numeric parameter that determines the object spawn density per square meter. The higher the number, the denser the vegetation.<br><strong>Recommended values:</strong><br><code>0.5</code> — sparse grass<br><code>1.0</code> — medium density<br><code>2.0+</code> — densely overgrown terrain</td></tr></tbody></table>

**Example: `sunflower`** template

```
{"sunflower"
    {models
        {"sunflower_01" "green"}
        {"sunflower_02" "green"}
        {"sunflower_03" "green2"}
    }
    {dencity 1}
}
```

***

{% hint style="info" %}
[Wind behavior settings](/game-settings/wind-behavior-settings) for grass models
{% endhint %}


# Modeling


# 3ds Max Plugin

## Installation and Configuration of the 3ds Max Plugin

### Prerequisites

Before installing the plugin, ensure that the correct version of 3ds Max is installed on your computer. You need 3ds Max version 2017 or later to work with the plugin.

The plugins for exporting models to the game, along with sample models and necessary resources, are located in the `modeling` folder in the game's root directory.

{% hint style="info" %}
For information on how to locate the game's root folder, refer to the article [Game Local Files and Player Profile Locations](/foundational-knowledge/game-local-files-and-player-profile-locations)
{% endhint %}

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FcluT9KzvvIgTh4m29jlD%2Fimage.png?alt=media&amp;token=5707f25a-b762-4408-8830-137d79fd17fe" alt=""><figcaption><p>Contents of the <code>modeling</code> folder</p></figcaption></figure>

### Selecting Plugin version

Plugin versions for different versions of 3ds Max are located in the `modeling\plugins` folder.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FRtF3EDVL3bK0FNk0O8Mx%2F%D1%81%D0%BE%D0%B4%D0%B5%D1%80%D0%B6%D0%B8%D0%BC%D0%BE%D0%B5%20%D0%BF%D0%B0%D0%BF%D0%BA%D0%B8%20plagins.png?alt=media&amp;token=f41f46b2-c31f-4ca6-81e9-19fe9f85add7" alt="" width="563"><figcaption><p>Contents of the <code>plugins</code> folder</p></figcaption></figure>

Identify and select the folder that matches your installed version of 3ds Max (for example, if you have **3ds Max 2025**, select the plugin version from the **3dsmax\_2025\_x64** folder).

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FBstrIko9JefZt8GXp7wr%2F%D1%84%D0%B0%D0%B8%CC%86%D0%BB-%D1%83%D1%81%D1%82%D0%B0%D0%BD%D0%BE%D0%B2%D1%89%D0%B8%D0%BA%203ds%20max%20plagin.png?alt=media&amp;token=7eac7f2e-1a92-4227-b8b3-67f5ada61853" alt="" width="563"><figcaption></figcaption></figure>

### Installing the 3ds Max Plugin

{% hint style="info" %}
This guide covers the installation of the 3ds Max plugin, specifically demonstrating the process using 3ds Max 2025. The installation and configuration steps described here are applicable to other versions of 3ds Max, following the same procedures.
{% endhint %}

1. Launch 3ds Max with an empty scene
2. Drag and drop the `gem3export.mzp` file into the 3ds Max window.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F1TbUgp2M82dKxZ0EISJS%2Fimage.png?alt=media&amp;token=80402ab5-c89a-4545-9e3a-7c212be42308" alt=""><figcaption><p>Drag and drop the <code>gem3export.mzp</code> file into the 3ds Max window</p></figcaption></figure>

3. Close 3ds Max
4. Open `gem3export.mzp` as you would a zip archive and open the `max_root` folder:
   1. Copy the file `Gem3Export.dle` to the plugins folder: `%path%\Autodesk\3dsMax\2025-64bit\ENU\Plugins`;
   2. Copy the file `nvtt.dll` to the root folder of 3ds Max: `%path%\Autodesk\3dsMax\2025-64bit\ENU`,\
      where `%path%` is the path to the 3ds Max folder.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FM9HVy12ac2yzLA3Jy9t6%2Fimage.png?alt=media&amp;token=1e8b945e-5254-4d5e-b670-f0ea353791ac" alt=""><figcaption></figcaption></figure>

### **Enabling GEM Materials in 3ds Max**

1. Launch 3ds Max
2. Go to the `Customize` menu
3. In the `Custom Defaults Switcher` menu, switch to `MAX Legacy`.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2Fa8EMqUnytz53O9k4UENJ%2Fimage.png?alt=media&amp;token=dcb546c7-17e3-497b-aff3-b56b753a3501" alt=""><figcaption><p>Switching to MAX Legacy in 3ds Max</p></figcaption></figure>

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FQurX3sFOIQazMPcQhBAw%2Fimage.png?alt=media&amp;token=81961945-c8d7-41d2-9548-329317588797" alt="" width="528"><figcaption></figcaption></figure>

4. Close 3ds Max.

### **Add the Plugin to the 3ds Max Utilities**

1. Open 3ds Max.
2. Go to the Utilities settings and click the `More…` button.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FkUc9B27kC3tkEFZQqAzC%2Fimage.png?alt=media&amp;token=9c9c4696-1dfe-4064-8c60-64084a4dbf13" alt="" width="359"><figcaption></figcaption></figure>

3. In the list that appears, select `GEMPlugin` and click `OK` to confirm.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F6K2tGnDBG1dqsbxAc08l%2Fimage.png?alt=media&amp;token=8c784eb4-d59e-4e67-a88d-be08ef428ef9" alt="" width="422"><figcaption></figcaption></figure>

The GEMPlugin panel is now added to your Utilities.

### Configuring Plugin Settings

1. **Open GEMPlugin options**\
   On the plugin panel, click the `Options` button to open the `Gem3 export options` window.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FFfQDXO6x0TiRqDxDt8n6%2FGEMPlugin%20Options.png?alt=media&amp;token=83628789-9065-4108-8b75-b3b121038550" alt=""><figcaption><p>GEMPlugin panel</p></figcaption></figure>

2. **Set Up the game folder**\
   In the `Gem3 export options` window, specify the path to the game's root folder under the `Game folder` field. This should automatically fill other fields in the settings window.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FCTjSGYA848APGmDsvSi2%2FGEMPlugin%20Options%20window.png?alt=media&amp;token=17fb89b1-5796-456d-abce-c677d7f9edbd" alt=""><figcaption></figcaption></figure>

3. **Configure paths to export resources**

* Change the path in the `Additional Resources` line to point to the mod's folder (ensure a mod package is created beforehand).
* Add a path to the texture folder in the `External folders: Textures` section. For example, point it to `modeling/models_samples/texture/common`.

3. **Environment Settings**

* In the `Environment` section, set the path to the environment settings files folder and select the appropriate file from `set/environment/common`.

{% hint style="warning" %}
All paths should be written in lowercase to ensure they are recognized correctly
{% endhint %}

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FgrBaxiYE15RKfL2XbSVK%2F%D0%9D%D0%B0%D1%81%D1%82%D1%80%D0%BE%D0%B8%CC%86%D0%BA%D0%B0%20Gem3%20export%20options.png?alt=media&amp;token=1bcaa89a-7b61-4fad-b8fa-a9cf0dbc2d02" alt="Configuring Gem3 export options in the export dialog"><figcaption></figcaption></figure>

### Adding the Export Button to the Toolbar

1. Right-click on the toolbar and select `Customize`

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FNgPpUriSPPmw9qRR95kJ%2FAdding%20the%20Export%20Button1.png?alt=media&amp;token=312a7032-6801-4c0b-91ff-c9eae1558d4b" alt=""><figcaption></figcaption></figure>

2. Go to the `Toolbars` tab.
3. In the `Actions` list, find `Gem3 Export…`

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FTLfvDz9j9CfpoxRWyrEJ%2FAdding%20the%20Export%20Button2.png?alt=media&amp;token=101f817c-cd46-407b-9013-89fc60aeb729" alt=""><figcaption></figcaption></figure>

4. Drag `Gem3 Export…` to the desired location on your toolbar.

## Getting Started

### **Material Conversion**

After installing the plugin, when you first open a `.max` file, any existing materials (such as EclipseMtl and Gem2) will be automatically converted to Gem3 materials. If the plugin cannot find the necessary textures or schemes:

* A dialog box will appear, allowing you to select a folder containing the textures and schemes.
* Alternatively, use the `Auto repair` feature, which will find the texture folder based on paths specified in the `mdl common` files located alongside the `.max` file.

### **Configuring the Viewport**

To ensure that materials appear in the Viewport as they do in the game, it’s important to adjust the gamma settings in 3ds Max.

1. **Disable Gamma Correction**
   1. Open the `Rendering` menu and select `Gamma/Lut setup`.
   2. In the `Preference Settings` window, go to the `Gamma and LUT` tab.
   3. Uncheck the `Enable Gamma/LUT Correction` checkbox.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FRMhDu0pP7iiDQEOq6JPT%2FDisable%20Gamma%20Correction1.png?alt=media&amp;token=3050c3e7-70e9-44c4-8159-763c6587796f" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FqILZUnPfd4aHQTr3KPZA%2FDisable%20Gamma%20Correction2.png?alt=media&amp;token=a3d61027-70b5-495f-9b04-782088c1553b" alt=""><figcaption></figcaption></figure>

2. **Set Environment Background**

In the Viewport Menu, check the `Environment Background` option under `Viewport Background`.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FKdg7ckoE9cqlmjSm2WK3%2FSet%20Viewport%20Background.png?alt=media&amp;token=eabc07e8-3948-4cf6-95cd-9e60e011417e" alt=""><figcaption></figcaption></figure>

3. **Texture Quality Settings in Viewport**
   1. Open the Viewport Menu and select `Viewport Configuration`.
   2. In the window that appears, go to the `Display Performance` tab.
   3. Adjust the `Texture Maps` setting to control the display quality of textures.

{% hint style="warning" %}
A higher `Texture Maps` setting increases the load on the system’s RAM.\
A recommended setting is 2048 for optimal performance and quality.
{% endhint %}

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FnW31lr0XQfp2qKZ0Cs2C%2FTexture%20Quality%20Settings%20in%20Viewport.png?alt=media&amp;token=e9a6071d-88d8-4a62-a521-529b00170485" alt=""><figcaption></figcaption></figure>

## Export Process

### **Export Settings**

When you click the export button, set the following options:

* **Gem RTS compatible**
* **Don’t rename bones**

Other options can be toggled based on the specific components of the scene you need to export, such as geometry, textures, lights, cameras, and animations. These can be exported as a whole or separately.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FvJ3hc9mjsBFGh7R2bLIB%2FExport%20settings.png?alt=media&amp;token=5ec33aee-244a-413c-95f7-fd1cc4bbf6a4" alt=""><figcaption></figcaption></figure>

### **Default export path**

By default, the model is exported to the `modeling\scene\entity\` directory.\
You can directly set an export path to the mod folder by entering it in the `Additional Resources` field in the [GEMPlugin options](#configuring-plugin-settings)

## Resources Required for Plugin Operation

Below is a summary of the resources needed for the plugin to function correctly and their locations:

| Resource Description            | Location                 |
| ------------------------------- | ------------------------ |
| Resources needed for the Plugin | `modeling/resource`      |
| Model samples                   | `modeling/models_sample` |
| Textures and schemes            | `texture/common`         |


# Vehicle Model Setup Pipeline

## Recommendations for model development and configuration

To optimize the workflow of creating and exporting assets into the game, it is recommended to adhere to the established production pipeline.

Start by creating the base model and perform initial in-game testing to identify any visual artifacts and verify the correct functionality of the primary features.

After successful validation, proceed to generate Levels of Detail (LODs). Then create the X-model and XX-model, along with their respective LODs. Integrate animations at the final stage, once the model is fully polished and no further adjustments are needed.

Following this sequence will allow for timely identification of issues and help avoid extensive rework.

{% stepper %}
{% step %}

### Pre-setup checklist

* **Verify model scale and proportions**

  Ensure that the vehicle's overall dimensions (length, width, height) and the gun barrel caliber are accurately scaled to match the original specifications or reference data.
* **Confirm model orientation**

  Align the model so that its front faces the positive X-axis, adhering to the standard coordinate system conventions used in the game engine.
* **Assign materials and shaders**

  Apply the appropriate materials and shaders to the model to facilitate correct visualization and rendering within the engine.
* **Create the `basis` root bone**

  Add the `basis` root bone to the model's skeletal hierarchy.\
  In its **Object properties window**, set the game entity type and specify the export path for integration into the game's asset pipeline.

[More about this step](/modeling/vehicle-model-setup-pipeline/bone-hierarchy-in-vehicle-models#basis-bone)
{% endstep %}

{% step %}

### Working with the mesh

* **Merge and split mesh components**\
  Organize the mesh by splitting or merging it into components that correspond to the **visible bones** of the model. Assign appropriate names to each bone according to the specification.\
  In the **Object Properties** of each bone, set the parameter `poly` to indicate that it is a visible bone of the model.\
  [More about the visible bones](/modeling/vehicle-model-setup-pipeline/bone-hierarchy-in-vehicle-models#visible-bones-of-the-vehicle-model)
* **Establish layer hierarchy**\
  Set up a hierarchical layer structure to manage various aspects of the model for better workflow efficiency. Include layers for meshes, Levels of Detail (`lod0` to `lod3`), volumes, special effects, and **auxiliary bones**. Using layers allows you to easily isolate and work on specific parts of the model.
* **Add occlusion geometry to simulate interiors**\
  For vehicle parts where the interior might be visible — such as the hull, turret, or engine compartment — add simple box geometry to cover openings. Apply textures with dark or non-reflective materials on these occluders to create the illusion of depth without modeling detailed interiors. This technique improves rendering performance and visual fidelity by preventing the camera from seeing through the model.
  {% endstep %}

{% step %}

### Working with bones and hierarchy

* **Build the hierarchy**\
  Organize the model elements into the correct hierarchy by linking all branches of elements to the model's root bone (`basis`). Ensure that **primary bones** and **secondary bones** are properly connected, and that **auxiliary bones** are correctly integrated to support the model's functionalities.\
  [Additional details](/modeling/vehicle-model-setup-pipeline/bone-hierarchy-in-vehicle-models#visible-bones-of-the-vehicle-model)
* **Set parameters in Object Properties**\
  Specify the necessary parameters for objects (including meshes and both visible and auxiliary bones) in their **Object Properties**, according to the project's specifications.\
  [Additional details](/modeling/vehicle-model-setup-pipeline/bone-hierarchy-in-vehicle-models#bone-properties)
* **Adjust pivots**\
  Check and, if necessary, adjust the pivot points for meshes, **visible bones**, and suspension components. Ensure that all pivots are correctly oriented. Verify that the rotations of movable parts like wheels, turrets, and barrels occur around the Z-axis.
* **Add helper bones**\
  Include the necessary **helper bones** required for the correct functioning of all features of the model. These may include:
  * bones for the starting points of specific animations (`emit`);
  * bones for passenger positions (`seat`);
  * bones for all visible crew members and machine gunners;
  * bones for visors;
  * bones used for enumeration purposes;
  * bones for special effects;
  * bones for chassis components and suspension control;
  * any other bones as necessary.\
    [Additional details](/modeling/vehicle-model-setup-pipeline/bone-hierarchy-in-vehicle-models#helper-bones)
    {% endstep %}

{% step %}

### **Working with volumes**

* **Create and configure volumes**

  Create the required volumes and rename them appropriately.\
  For each volume, specify the parameter `volume` in its **Object Properties** to designate it as a volume object.\
  Then, link each volume to its corresponding parent object in the model hierarchy.\
  [Additional details](/modeling/vehicle-model-setup-pipeline/bone-hierarchy-in-vehicle-models#creation-and-configuration-of-volumes)
* **Verify armor mapping**

  Ensure that each face of the volume primitive has the correct **ID** assigned in the **Polygon: Material IDs** window. If a volume is a polyhedron, reassign the Material IDs of its faces according to the established [rules for armor calculation](/modeling/vehicle-model-setup-pipeline/bone-hierarchy-in-vehicle-models#reassigning-material-id-for-polyhedron-volume-surfaces).
* **Define volumes in the .def file**

  If a component has additional volumes (e.g., `body01_vol`, `body02_vol`, etc.), after the first export, you need to add their definitions to the model's **.def** file.
  {% endstep %}

{% step %}

### The first export

* **Verify export settings**\
  Check the export settings of the **3ds Max Plugin** and the export path specified in the properties of the `Basis` bone.
* **Post-export .def file verification**\
  After exporting, review the .def file.\
  Ensure that the .def file includes all the necessary elements required for conducting the initial in-game testing of the model and verifying its core functionality.
  {% endstep %}

{% step %}

### Test basic functionality in the game

* **Verify visual conformity**\
  Ensure that the model visually matches its representation in the 3ds Max workspace after export to the game and texture conversion to DDS.\
  Confirm that the model has the correct orientation and proportions.
* **Test unit movement and movable parts**\
  Verify the proper functioning of all primary components:
  * verify that movable parts respond correctly if applicable;
  * the main weapon fires and has correct rotation limits;
  * machine guns (if any) fire and have correct rotation limits;
  * suspension behaves correctly during movement;
  * wheels and/or tracks rotate and steer in the proper directions;
  * armor screens (if any) detach upon damage;
  * test collision volumes for proper physical interactions.
    {% endstep %}

{% step %}

### Working with LODs

**Create LODs**

* **LOD 1:** Retain \~75–80% of the original triangles.
* **LOD 2:** Retain \~50% of the original triangles.
* **LOD 3:** Retain \~30–35% of the original triangles.
  {% endstep %}

{% step %}

### Working with textures

* **Assign materials**\
  Assign materials to the model and apply the corresponding textures.
* **Verify material assignments with alpha channel support**\
  Create a separate material with alpha channel support and assign it exclusively to polygons with transparent elements to optimize rendering.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FlbmFkE5ZigY5ZD5HqQOf%2Fimage.png?alt=media&amp;token=f3867663-9503-4c9d-b64a-f6cbabb8f6ab" alt=""><figcaption></figcaption></figure>

* **Check seams and edges**\
  Ensure that textures are not distorted at cuts, seams, and displacements. If necessary, reassign using UVW mapping.
* **Clear shadows**\
  Ensure that shadows are absent in areas where objects were removed in X- and XX-model textures.
  {% endstep %}

{% step %}

### Creating X-models

* **Modify the export path**\
  Change the export path of the `Basis` bone to the X-model folder.
* **Create X-model textures**\
  Textures should include damage elements (rust spots, soot marks, burned-out paint, broken glass, etc.)
* **Refine the X-model mesh**\
  Remove unnecessary elements, add dents, penetrations, and damage areas.
* **Refine LODs for X-models**\
  Apply the same actions to all LODs (or simultaneously to all).
* **Refine broken tracks**\
  For tracked models, refine the broken track mesh.
* **Clear shadows on the X-model**\
  Remove shadows from areas where objects were removed on the X-model texture.
* **Test component destructibility**\
  Test using the following console commands:
  * destroy a component: `g_component break "component_name"`;
  * repair a component: `g_component restore "component_name"`;
  * shoot at the unit with two shell types;
  * fire at the unit with an anti-tank weapon (e.g., Bazooka);
  * throw an anti-tank grenade at the unit.
    {% endstep %}

{% step %}

### Creating XX-models

* **Modify the export path**\
  Change the export path of the `Basis` bone to the XX-model folder.
* **Remove helpers**\
  Delete unnecessary helpers.
* **Reassign diffuse texture**\
  Use a `Multiply` material for the diffuse texture.\
  For models using PBR materials, the `pbr/standard_dirt` scheme is used; otherwise, use `gem2/bump_specular_lightmap`.
* **Move the UV mapping**\
  Transfer UVs to the second channel for lightmap purposes across all elements and LODs.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FEEoAUS8AjPiA5e7WgL7q%2FChanging%20Channels.png?alt=media&amp;token=165a255d-53fc-4cad-bc60-7612352ab927" alt=""><figcaption></figcaption></figure>

* **Refine the XX-model mesh**\
  Remove unnecessary elements, including tire meshes for wheeled models.
* **Refine LODs**\
  Apply the same refinements to all LODs.
* **Create parts and volumes**\
  Create and configure parts and volumes for XX-models.
* **Test component destructibility**\
  Use the following commands:
  * destroy a component: `g_component destroy "component_name"`;
  * trigger an explosion effect: `g_effect "explosion"`;
  * fire at the unit with two shell types;
  * use an anti-tank weapon (e.g., Bazooka) to fire at the unit and verify the destruction of vehicle components upon impact.
  * throw an anti-tank grenade;
  * verify that `part` bones detach upon explosion.
    {% endstep %}

{% step %}

### Configuring the .def file

During the first export of the model into the game, a simplified version of the **.def** file is generated, which is sufficient for testing the model's main functionality in-game.\
Once the model is fully completed, you need to refine the **.def** file using a text editor. It is acceptable to copy a **.def** file from an already completed and configured model of similar type and functionality, then make the necessary adjustments.

* **Add basic props**\
  Add props corresponding to the model's type and functionality.
* **Describe additional volumes**\
  Ensure that all additional volumes are properly described in the **.def** file.
* **Define crew bones and emit points**\
  In the **.def** file, describe the emitters and bones for crew placement.\
  \&#xNAN;*If the **crew\.ext** file is specified, make entries in that file.*
* **Add crew animations and poses**\
  Specify the appropriate animations and poses for the crew members.
* **Describe additional equipment**

  If applicable, describe any additional equipment, such as mesh-mounted machine guns or machine guns integrated via auxiliary bones.
* **Specify physical properties**\
  Define the model's physical properties (mass, speed, fuel tank volume, etc.).
  {% endstep %}

{% step %}

### Adding animations

* **Configure tracks**\
  Apply and configure the `Skin` modifier for all tracks.
* **Create basic animations:**
  * `start/stop`;
  * `hit`;
  * `fire`;
  * `fire_mgun`;
  * animations for opening/closing doors and hatches during crew embarkation/disembarkation;
  * other animations if necessary.
    {% endstep %}
    {% endstepper %}


# Bone hierarchy in vehicle models

## Basis bone

The `basis` bone serves as the **root bone** in the skeletal hierarchy of any vehicle model.\
It functions as a **dummy helper** that defines critical properties of the model, including:

* model type;
* export path for the model to the game;
* wheel rotation speed and size (applied if all wheels are uniformly sized; otherwise, sizes are set in individual wheel bones);
* inverse kinematics (IK) parameter `IKType=revolute` with rotation constraints, if the vehicle supports body rotation.
* animation type and duration for key sequences;

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F2IXiZ56aICtggYyIHxcy%2Fimage.png?alt=media&amp;token=889874fa-77e3-4aa2-9765-60cecc2fd459" alt="Object properties of basis bone" width="563"><figcaption><p>Example Object Properties window of the <code>basis</code> bone</p></figcaption></figure>

### Placement and orientation of the basis bone

* The `basis` bone is positioned at the **origin point** `(X=0, Y=0, Z=0)` in world space, ensuring the model aligns correctly within the game.
* In the **"Front" orthographic view**, the vehicle is displayed from the **right side**, which must be accounted for during configuration.
* The **forward movement vector** of the `basis` bone—and consequently the entire model—is aligned with the **positive X-axis**.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FlYFpF9mFWcfEix3Ijiaf%2FBasis%20bone.png?alt=media&amp;token=c09caa3f-f322-4999-a52c-92e3cbd66b54" alt="Example: Orientation of the basis bone in the &#x22;Front&#x22; orthographic view"><figcaption><p>Example: Orientation of the <code>basis</code> bone in the "Front" orthographic view</p></figcaption></figure>

**Accurate orientation of the `basis` bone is vital for:**

* proper alignment and movement of the model in the game space;
* correct placement and visualization of the **selection circle sprite** beneath the model.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FXfFxTTa8gMXbBdcxxbz3%2Fselectioncircle.PNG?alt=media&amp;token=f9c249ad-ed20-4ef9-a3f9-2744685e25df" alt="Example: Selection circle alignment under a tank model when the unit is selected"><figcaption><p>Example: Selection circle alignment under a tank model when the unit is selected</p></figcaption></figure>

## Visible bones of the vehicle model

**Visible bones** of the model are the **primary bones** and **secondary bones** in the model's element hierarchy that contain the meshes of the model's components.

### **Primary bones**

{% hint style="info" %}
**Primary bones** represent the parent bones in the model element hierarchy, forming the primary part of the visible mesh of **vehicle components**
{% endhint %}

The primary bones include the following bones:

* `body` (hull);
* `turret`;
* `cabin`;
* `gun_rot` (gun elevation mechanism);
* `gun`;
* `engine`;
* `track` and `wheel` (transmission bones).

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FNkZpNCsYnObE5nS2xsQV%2F%D0%A1%D1%85%D0%B5%D0%BC%D0%B0%20%D1%81%D0%BE%D0%B5%D0%B4%D0%B8%D0%BD%D0%B5%D0%BD%D0%B8%D1%8F%20%D0%B2%D0%B8%D0%B4%D0%B8%D0%BC%D1%8B%D1%85%20%D0%BA%D0%BE%D1%81%D1%82%D0%B5%D0%B8%CC%86%20%D0%BC%D0%BE%D0%B4%D0%B5%D0%BB%D0%B8%20%D1%82%D0%B5%D1%85%D0%BD%D0%B8%D0%BA%D0%B8.png?alt=media&amp;token=217051a4-2e09-4b0f-b062-660cbd4864b7" alt=""><figcaption><p>Primary bones hierarchy scheme</p></figcaption></figure>

### **Secondary bones**

{% hint style="info" %}
**Secondary bones** of a model are bones that contain the mesh of additional visual elements for Components. They are used to add detail and variability, complementing the primary components of the model, such as the Hull, Engine, or Turret.
{% endhint %}

The secondary bones include the following bones:

* `detail` (visual detail);
* `shield` (additional armor part);
* `enumerator` (vehicle identifier);
* `cover`/`door`;
* bones associated with the vehicle's suspension mechanism.

**Secondary bones** are typically linked to the **primary bones** they are part of.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F3OvVWz9dxS1G8oVvY38w%2FSecondary%20bones.png?alt=media&amp;token=6c868b74-fd16-4fb9-95f2-c644c1c701cc" alt=""><figcaption><p>Illustration of linking secondary bones to the primary bone</p></figcaption></figure>

## Bone properties

Properties of **bones** are defined in the **Object Properties** window.

<table><thead><tr><th width="249">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>poly</code></td><td>Defines bone visibility.<br>Absence of this parameter makes the bone invisible.</td></tr><tr><td><code>ID=&#x3C;value></code></td><td>Component identifier.<br>Links the bone to a specific <strong>vehicle component</strong> (e.g., Hull, Turret, Left track, Gun).</td></tr><tr><td><code>Animation=&#x3C;name></code></td><td>List of animations if the bone is animated</td></tr><tr><td><p><code>IKType=revolute</code>,</p><p><code>IKType=socket</code>,</p><p><code>IKSpeed=&#x3C;value></code>,</p><p><code>IKLimit=&#x3C;value></code>.</p></td><td>Inverse kinematics parameters allow the bone to operate under IK rules, setting the speed and rotation limits for the bone.</td></tr></tbody></table>

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FPmvAGz9aJbyRVq2mEcP5%2Fimage.png?alt=media&amp;token=18e0bcc5-2ef8-4f26-ae49-1fb308e98cfc" alt="Example of turret component properties"><figcaption><p><strong>Example of turret component properties</strong></p></figcaption></figure>

### ID values for vehicle components

<table data-header-hidden><thead><tr><th width="230">ID</th><th>Component</th></tr></thead><tbody><tr><td><code>body</code></td><td>Hull</td></tr><tr><td><code>engine</code></td><td>Engine</td></tr><tr><td><code>cabin</code></td><td>Vehicle cabin</td></tr><tr><td><code>turret</code></td><td>Turret</td></tr><tr><td><code>gun</code></td><td>Gun</td></tr><tr><td><code>trackleft</code> / <code>trackright</code></td><td>Left /Right tracks</td></tr><tr><td><code>wheelright&#x3C;N></code> / <code>wheelleft&#x3C;N></code></td><td>Right and Left wheels (<code>&#x3C;N></code> is the wheel's index)</td></tr></tbody></table>

The ID value of **secondary bones** corresponds to the ID value of the **primary bones** of which they are a visual part.

{% hint style="warning" %}
Despite identical naming, a bone is not equivalent to a **vehicle component**.

A **vehicle component** can consist of multiple bones with different names but the same ID value. As a whole, bones with the same ID form a specific vehicle component in the game.

**Examples:**

* the bones `turret`, `cover`, and `detail`, each assigned the property `ID=turret`, together form the **Turret** component in the game;
* the bones `body`, `cover`, and `detail`, each assigned the property `ID=body`, together form the **Hull** component in the game.
  {% endhint %}

### Animation types for components

* `break`: destruction animation assigned to the bone of the intact part of the model, representing the undamaged **vehicle component**.
* `repair`: animation for repairing the **x-model** of a **vehicle component**.

***

To explore more about configuring the hierarchy of visible bones, consult the following articles

<table data-view="cards"><thead><tr><th data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td><a href="/modeling/vehicle-model-setup-pipeline/bone-hierarchy-in-vehicle-models/body">Body</a></td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FkVns2gSMeaPI74LoU2lc%2FBody.png?alt=media&amp;token=12e3b4a8-b88f-4929-af93-0f5fc01b67df">Body.png</a></td></tr><tr><td><a href="/modeling/vehicle-model-setup-pipeline/bone-hierarchy-in-vehicle-models/turret">Turret</a></td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2Fu6zBroHr70qg2fWMOSS1%2FTurret.png?alt=media&amp;token=bc5f43e7-150c-40a4-8078-27b97245fa4f">Turret.png</a></td></tr><tr><td><a href="/modeling/vehicle-model-setup-pipeline/bone-hierarchy-in-vehicle-models/gun">Gun</a></td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2Fyohs0XXDDDGaCo4OUFBW%2FGun.png?alt=media&amp;token=ba6a6253-b703-4e5d-9f88-922732c27d83">Gun.png</a></td></tr><tr><td><a href="/modeling/vehicle-model-setup-pipeline/bone-hierarchy-in-vehicle-models/transmission">Transmission</a></td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FW5f7sMapVH3mznv4dx4x%2FTrack%20and%20suspension%20wheels.png?alt=media&amp;token=8f952bbe-5645-404a-8181-2e949335ea61">Track and suspension wheels.png</a></td></tr><tr><td><a href="/modeling/vehicle-model-setup-pipeline/bone-hierarchy-in-vehicle-models/engine">Engine</a></td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FkJ3zIlFsc5rkWrVZ52ys%2FEngine.png?alt=media&amp;token=881901bc-c6b5-431f-8b9b-a9037becd75e">Engine.png</a></td></tr><tr><td><a href="/modeling/vehicle-model-setup-pipeline/bone-hierarchy-in-vehicle-models/secondary-bones">Secondary bones</a></td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F3OvVWz9dxS1G8oVvY38w%2FSecondary%20bones.png?alt=media&amp;token=6c868b74-fd16-4fb9-95f2-c644c1c701cc">Secondary bones.png</a></td></tr></tbody></table>

## Helper bones

{% hint style="info" %}
**Helper bones** are invisible objects that define linkage points to support the model’s visual, functional, and animation elements
{% endhint %}

### Vision bones

* `visor1`: an invisible helper linked to the `turret` bone, representing the turret's field of view.
* `visor2`: an invisible helper acting as the "eyes" of the tank, aligned with the movement vector and linked to the `body` bone, positioned near the frontal armor's view slit.

These bones are aligned along the X-axis

### Special effects bones

Special effect bones (effectors) are used to create visual effects in the game. These bones are aligned along the X-axis for correct effect orientation.

<table data-header-hidden><thead><tr><th width="173"></th><th width="111"></th><th></th></tr></thead><tbody><tr><td><strong>Effector name</strong></td><td><strong>Purpose</strong></td><td><strong>Naming rules and specifics</strong></td></tr><tr><td><code>fxfire1</code></td><td>Engine fire effect</td><td>If multiple bones are needed, they are named sequentially (e.g., <code>fxfire1</code>, <code>fxfire2</code>, etc.).</td></tr><tr><td><code>fxfire2</code></td><td>Body fire effect</td><td>Similar naming convention as above.</td></tr><tr><td><code>fxfire3</code></td><td>Turret fire effect</td><td>The naming continues sequentially if additional bones are required.</td></tr><tr><td><code>fxshot</code></td><td>Dust effect from tank firing</td><td>This bone is used without variation in naming unless additional directional effects are required.</td></tr><tr><td><code>fxsmoke</code></td><td>Exhaust effects</td><td>For multiple exhaust effects, sequential numbering is added (e.g., <code>fxsmoke1</code>, <code>fxsmoke2</code>, etc.).</td></tr><tr><td><code>fxstop</code></td><td>Brake lights</td><td>If more than one brake light is needed, bones are named sequentially (e.g., <code>fxstop1</code>, <code>fxstop2</code>, etc.).</td></tr><tr><td><code>headlight</code></td><td>Headlight glow</td><td>If multiple headlights exist, side indices (<code>L</code> for left, <code>R</code> for right) are included in the names (e.g., <code>headlightL</code>).</td></tr><tr><td><code>fxlight</code></td><td>Additional headlight glow effects</td><td>Sequential numbering is added, but the first bone does not include a number (e.g., <code>fxlight</code>, <code>fxlight1</code>, <code>fxlight2</code>).</td></tr><tr><td><code>fxtrace</code></td><td>Dust and dirt from tracks or wheels</td><td>Bones are named sequentially with side indices (e.g., <code>fxtraceL1</code>, <code>fxtraceR1</code>, <code>fxtraceL2</code>, <code>fxtraceR2</code>).</td></tr><tr><td><code>foresight</code></td><td>Weapon or machine gun firing effects</td><td>If multiple effects are needed, the bones are numbered sequentially (e.g., <code>foresight1</code>, <code>foresight2</code>, etc.).</td></tr></tbody></table>

### Boarding animation bones

Helper bones known as `emit` define the starting points for boarding animations of crew and passenger units. Proper positioning of these bones is essential for accurate animation playback.

<table><thead><tr><th width="157">Name</th><th>Description</th></tr></thead><tbody><tr><td><code>emit0</code>, <code>emit1</code>, <code>emit2</code></td><td>Primary bones defining entry points for animations of crew boarding directly into the tank: <code>emit1</code> and <code>emit2</code> are positioned on either side of the model near the turret, while <code>emit0</code> is optional and used for a driver's hatch animation if present.</td></tr><tr><td><code>emit3</code>, <code>emit4</code>, <code>emit5</code>, etc.</td><td>Bones defining points in space near the tank, marking positions for soldiers boarding the vehicle's armor as passengers.</td></tr></tbody></table>

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FEBWbJKL5ofY8KyodgDDJ%2Fimage.png?alt=media&amp;token=6e0e8f02-1388-4c71-a69a-6615cf33f613" alt=""><figcaption><p>Correct placement and orientation of <code>emit</code> bones for crew members and passengers boarding animations</p></figcaption></figure>

**Rules for `emit` bones**

* The **number of `emit` bones** must match the animation requirements. Missing bones can cause incorrect unit behavior.
* The **pivot orientation** of `emit` bones should align along the X-axis towards the `body` bone for proper crew alignment.
* These bones remain **invisible** and do not require properties in the **Object Properties** window.

### Passenger seating bones

Invisible `seat` bones define the seating positions for passengers on the vehicle’s armor and mark the endpoints of boarding animations starting from `emit` bones.

<table><thead><tr><th width="149">Bone name</th><th>Description</th></tr></thead><tbody><tr><td><code>seat01</code>, <code>seat02</code>,<br>etc.</td><td>Bones placed opposite their corresponding <code>emit</code> bones for passengers</td></tr></tbody></table>

**Rules for `seat` bones**

* The number of `seat` bones must match the `emit` bones for visible passengers.
* Proper positioning ensures realistic passenger animations.
* These bones remain invisible and do not require properties in the **Object Properties** window.

### Crew and gunner bones

In tank and vehicle models with open-top compartments, helper bones must be added and configured for all visible units, including crew members and gunners. These bones define positions and enable realistic functionality and animations, such as operating or firing mounted weapons.

<table><thead><tr><th>Bone name</th><th width="591">Description</th></tr></thead><tbody><tr><td><code>commander</code></td><td>Serves as the position for the tank commander and as a reference for playing animations related to the command role.</td></tr><tr><td><code>driver</code></td><td>Defines the position of the driver and enables animations for operating the vehicle.</td></tr><tr><td><code>charger</code></td><td>Serves as the position for the loader and as a reference for playing animations related to loading tasks.</td></tr><tr><td><code>gunner</code></td><td>Serves as the position for the main gunner and as a reference for playing animations related to using the machine gun.</td></tr><tr><td><code>gunner2</code></td><td>Serves as the position for the anti-aircraft gunner and as a reference for playing animations related to operating the anti-aircraft machine gun.</td></tr></tbody></table>

**Rules for crew and gunners bones**

* Proper positioning ensures realistic animations for units.
* These invisible bones do not require any settings in the **Object Properties** window.

### Machine gun bones

Helper bones named `mgun` are used to designate machine gun mounting points on a vehicle. These bones can either be visible, incorporating a mounting mesh, or invisible, acting as a helper bone to mark positions, such as gun slots in the vehicle's hull.\
The `mgun` bone is linked to the component where the machine gun is intended to be mounted.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2Fyovwreu2A7A0bDP238FH%2Fimage.png?alt=media&amp;token=52cd29a2-d06a-4749-95fc-e69e5e92cc9a" alt="Positioning of an invisible mgun bone"><figcaption><p>Positioning of an invisible <code>mgun</code> bone</p></figcaption></figure>

#### Properties of `mgun` bones

The properties of `mgun` bones are specified in the **Object Properties** window and can include the following parameters:

| `poly`                                                            | Makes the bone visible. Should be applied if the machine gun mesh is part of the model. If the gun is hidden or only the mounting point is present, the bone remains invisible. |
| ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `IKType=revolute`                                                 | Enables inverse kinematics for rotational aiming.                                                                                                                               |
| <p><code>IKMin=\<value></code><br><code>IKMax=\<value></code></p> | Defines the minimum/maximum rotation limit for inverse kinematics.                                                                                                              |

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FtGZuDMJKVxZikudSmAab%2Fimage.png?alt=media&amp;token=a52a0b2a-7b9d-47f5-91dc-6e78414c942b" alt="Properties of a mgun bone operating with inverse kinematics"><figcaption><p>Properties of a <code>mgun</code> bone operating with inverse kinematics</p></figcaption></figure>

**Linking effectors to `mgun` bones**

Helpers named `foresight` are linked to `mgun` bones to spawn machine gun firing effects along the X-axis.

#### Naming rule for `mgun`-`foresight` linkage

{% hint style="success" %}
If the vehicle has multiple additional machine guns, the naming of the `foresight` helper must match the corresponding `mgun` bone:

* `mgun` → `foresight3`
* `mgun1` → `foresight4`
* `mgun2` → `foresight5`
* `mgun3` → `foresight6`
  {% endhint %}

{% hint style="danger" %}
Failure to follow the naming convention will result in script errors.
{% endhint %}

#### Configuring `mgun` bones

When modeling, it is essential to include a sufficient number of `mgun` bones to accommodate the maximum possible machine gun placements on the vehicle.

<table><thead><tr><th width="181">Machine gun type</th><th>Description</th></tr></thead><tbody><tr><td><code>aa</code></td><td>Anti-aircraft gun</td></tr><tr><td><code>hull</code></td><td>Fixed machine gun mounted in the chassis</td></tr><tr><td><code>coaxial</code></td><td>Coaxial machine gun mounted in the turret</td></tr><tr><td><code>rear</code></td><td>Rear-mounted machine gun</td></tr></tbody></table>

The configuration for linking machine guns to bones is defined in the model's `.def` file within `placer` blocks.

> **Syntax:**
>
> ```
> {placer "mgun<N>" [...]}
> Where <N> represents the sequential number of the mgun bone.
> ```

<details>

<summary>Example of the mgun bone description in a .def file of a vehicle model</summary>

```
{place "mgun2"  
  {type "coaxial"}  
  {weapon "dt_vh" filled}  
  {foresight "foresight5"}  
  {gunner "gunner"}  
  {charger "gunner"}  
  ("sequential_aim")  
  ("abm_mgun")  
  {basic}  
}
```

</details>

## Volumes

A `volume` is a parametric shape (e.g., `box`, `sphere`, `cylinder`) or a mesh-based form (`edit poly`) that envelops the model's mesh and is used to calculate the physical interactions of the unit in the game.

### Creation and configuration of volumes

Bones of the `volume` type are created for all major bones of the model.\
Each primary bone requires its own volume or a set of volumes.

{% hint style="warning" %}
It is unnecessary to create volumes for `detail` bones because the game engine does not support volumes for visual parts.
{% endhint %}

The shape of the volume mesh should ensure realistic physical interactions. The `volume` parameter must be set in the **Object Properties** of the volume.\
A `Material ID` is assigned to the polygons of the volume mesh, which determines armor penetration calculations.

{% hint style="success" %}
Volumes should be extruded from a rectangle in the Top viewport. This ensures that `Material IDs` are automatically assigned to the volume surface, eliminating the need for additional verification or reassignment according to the established rules.
{% endhint %}

{% hint style="warning" %}
Volumes must remain standard primitives.\
Converting a primitive into polygonal forms using `editable poly` tools is recommended only when the complex geometry of a part of the model cannot be represented with a primitive.
{% endhint %}

Geometry adjustments at the sub-object level are permissible if the created model is not a single volume. In such cases, creating multiple `volume` bones with identical properties is allowed.\
There should be no gaps between such volumes; however, minor overlaps are acceptable.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2Fpd8ZZ1rCssK6BFOUqhqi%2Fimage.png?alt=media&amp;token=1d69be98-bba2-49b3-a032-71ebf33cfedd" alt="Example of volumes for the Body and Engine"><figcaption><p>Example of volumes for the Body and Engine</p></figcaption></figure>

**Examples of volume creation**\
In the first screenshot, the volumes are created correctly.\
In the second screenshot, the volume is created incorrectly as it obstructs projectiles/bullets from hitting units located in the cabin.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FREtlfQqrROzRJPeGngFX%2Fimage.png?alt=media&amp;token=2088bb4c-66e6-4a81-847d-a42b87ac279e" alt="Correct volume modeling example"><figcaption><p>Correct volume modeling example</p></figcaption></figure>

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FXrToNHSAZO3Vv6VEnBF4%2Fimage.png?alt=media&amp;token=cb92bfaf-3b9d-4b30-9e92-f587d007d90d" alt="Incorrect volume modeling example"><figcaption><p>Incorrect volume modeling example</p></figcaption></figure>

### Rules for naming volumes

The volume covering the mesh of the main bone includes the name of that bone.\
For example: `body_vol`, `turret_vol`, `engine_vol`.

If multiple volumes cover a single bone, numbering is used in the volume names. The naming template is: `bonenameN_vol`, where `N` is the serial number.\
For example: `body01_vol`, `body02_vol`, `body03_vol`.

### Reassigning Material ID for polyhedron volume surfaces

In polyhedron volumes for the hull, each polygon must be assigned a `Select ID` value in the `Material IDs` parameter within the `Polygon` properties block. The value must strictly correspond to the following table:

* **Front** - `1`
* **Top** - `2`
* **Left** - `3`
* **Right** - `4`
* **Back** - `5`
* **Bottom** - `6`

The `ID` parameter determines the virtual armor of the vehicle components: front armor, side armor, rear armor, etc.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F2r5L1xEBUow3AYiFuGO1%2Fimage.png?alt=media&amp;token=972009a6-f203-4115-9952-b3535dee2c8c" alt=""><figcaption></figcaption></figure>

### Volumes for cabin windows

For vehicles and other units with windows, volumes are created for the glass.\
They are named `window<N>_vol`, where `<N>` is the unique index of the volume.

To add glass destruction animations, the `windowed` property must be included in the `props` block of the unit's `.def` file.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2Flu4onWwlHgCiJ1j0rKf0%2Fimage.png?alt=media&amp;token=f6389912-0056-47e9-a84e-eb499015719d" alt=""><figcaption></figcaption></figure>

### Special-purpose volumes

**Volume for ram collision**

The `ram_vol` volume is used to calculate collisions during vehicle ramming.\
It is a polyhedron with a central convexity to minimize the chance of the vehicle getting stuck when colliding perpendicularly with other objects.\
Assigning `Material ID` to surfaces is not required.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FxwVVNJDe1tghAwEp5b7U%2Fimage.png?alt=media&amp;token=d1bc023d-85f9-4984-8476-ea7ca1950786" alt=""><figcaption></figcaption></figure>

**Crew volume**

The `crew_vol` volume ensures interaction with the crew inside the vehicle.\
It is used in models of heavy vehicles with open cabins or transport vehicles with open cargo areas.\
This volume can be implemented as a primitive geometric shape or as a polyhedron, depending on the model structure.\
Assigning `Material ID` to surfaces is not required.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FLd23EHGkjeXUQJ4QwvIA%2Fimage.png?alt=media&amp;token=40375e0a-153e-4157-9c0b-14cb31913bc8" alt=""><figcaption></figcaption></figure>

**Grenade catcher volume**

The `sticky_vol` volume is responsible for attracting grenades thrown at the vehicle to specific zones.\
It is used in heavy vehicles with open cabins or transport vehicles with open cargo areas.\
The volume is formed based on the internal space of the vehicle to increase the likelihood of a grenade entering the vulnerable area.

**Fuel tank volume**

The `fuel_vol` volume defines the geometry for interacting with external fuel tanks on vehicles.


# Body

## The `body` bone configuration

The `body` bone serves as the primary visible part of the model that corresponds to the **Hull** component.\
The `body` bone is linked to the `basis` bone.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2Faz664Kvk67t9vwFJZclM%2Fimage.png?alt=media&amp;token=eaccdbed-5e4e-4cd7-9928-42c7be3a4e4e" alt=""><figcaption><p>The <code>body</code> bone linked to the <code>basis</code> bone</p></figcaption></figure>

**Properties of the `body` bone:**

<table data-header-hidden><thead><tr><th width="211">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>poly</code></td><td>Makes the hull of the vehicle visible.</td></tr><tr><td><code>ID=body</code></td><td>Unique identifier for the "Hull" component.</td></tr><tr><td><code>Animation</code></td><td><p>Specifies animation name and parameters, separated by commas:</p><ul><li><code>break</code>: hull destruction animation (if applicable)</li><li><code>repair</code>: hull repair animation for the X-model (if applicable).</li></ul></td></tr></tbody></table>

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2Fwb7dyRMDxJ4B0l1wewOO%2Fimage.png?alt=media&amp;token=9d21313c-fc0d-47ed-b8df-147fca6948a8" alt="Properties window of the body bone"><figcaption><p>Properties window of the <code>body</code> bone</p></figcaption></figure>

## Elements linked to the `body` bone

* **Primary component bones:**
  * `turret`;
  * `engine`;
  * `cabin`: vehicle cabin;
  * transmission elements.
* **Secondary bones:**
  * `detail`: additional visual elements of the hull;
  * `cover`;
  * `shield`: additional armor parts;
  * `enumerator`: vehicle identifier (if applicable).
* **Volumes:**
  * `body_vol`: volumes for armor and collision calculations;
  * `ram_vol`: volume for ramming calculations;
  * and other types of volumes in the presence of corresponding model components.
* **Helper bones:**
  * `visor2`: vision bone aligned with the movement vector;
  * `emit`: passenger and crew entry points into the vehicle;
  * `seat`: passenger seating points on the armor;
  * `mgun`: machine gun bones;
  * effectors for headlights and brake lights.


# Turret

## Main turret bone

The `turret` bone represents the visible part of the hull corresponding to a tank's turret.\
It is linked to `body` bone.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FzGAauNsfuSnJXboG2c6x%2FTurret%20bone.png?alt=media&amp;token=b7b3d185-57b3-4d7a-ab52-8577336c82bb" alt=""><figcaption><p>Turret bone linkage to the body bone</p></figcaption></figure>

If the real-life counterpart has rotation functionality, the `turret` bone operates using inverse kinematics.

**Properties of the `turret` bone:**

<table data-header-hidden><thead><tr><th width="210">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>poly</code></td><td>Makes the turret visible.</td></tr><tr><td><code>ID=turret</code></td><td>Identifies the turret.</td></tr><tr><td><code>Animation</code></td><td>Defines animations for destruction and restoration (if applicable).</td></tr><tr><td><code>IKSpeed=&#x3C;value></code></td><td>Sets the rotation speed of the turret (if rotation is implemented).</td></tr><tr><td><code>IKType</code></td><td>Specifies <code>revolute</code> if turret rotation is supported.</td></tr><tr><td><code>IKTerminate</code></td><td>Locks turret rotation.</td></tr><tr><td><code>IKMin=&#x3C;value></code> / <code>IKMax=&#x3C;value></code></td><td>Defines turret rotation limits (if applicable).</td></tr></tbody></table>

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FvEJU5QhPZjzezouUPtuG%2Fimage.png?alt=media&amp;token=1b36beb8-0c86-4e62-b5e6-5b58125d18c3" alt="Illustration of turret bone properties"><figcaption><p>Illustration of <code>turret</code> bone properties</p></figcaption></figure>

## Checklist of possible elements linked to the `turret` bone

* **Primary bones**:
  * `rot_gun`: the main gun of the turret.
* **Secondary bones**:
  * `detail`: visual detail, if specified by the model's design;
  * `shield`: additional armor part, if specified by the model's design;
  * `enumerator`, if the vehicle model typically features an **Identification Number** on the turret);
  * `cover`.
* **Helper bones**:
  * Machine gun bones (if specified by the model's design);
  * `gunner2`: the position for the anti-aircraft gunner;
  * `fxfire2`: effector for spawning special effects like turret fire;
  * `turret_vol`: defines the visible turret shape and manages its collision with the game environment.

*Last updated 4 months ago.*


# Engine

The `engine` bone corresponds to the **Engine** component. It can be either invisible or contain a visible mesh.\
It has a volume, `engine_vol`, which is hidden inside the volumes of the `body_vol` group.

**Properties of the `engine` bone**

<table data-header-hidden><thead><tr><th width="167">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>poly</code></td><td>Makes the component visible.</td></tr><tr><td><code>id=engine</code></td><td>Identifier of the <strong>Engine</strong> component.</td></tr><tr><td><code>Animation</code></td><td>Specifies the animation name (if available).</td></tr></tbody></table>

#### **Checklist of possible elements linked to the `engine` bone**

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F1OXgOJPg3ZDu1GucB9tV%2Fimage.png?alt=media&amp;token=bb98c84d-6ccb-4036-9ba9-4c4902445b65" alt=""><figcaption><p>Elements linked to the engine bone</p></figcaption></figure>

Depending on the model, the following elements may be linked to the `engine` bone

* Engine\_LOD branches
* **Secondary bones**
  * `cover`: hatch bones, if specified by the model's design
  * `detail`: additional details, if specified by the model's design
* **Helper bones**:
  * `FXsmoke`: exhaust smoke effec
  * `FXfire`: engine fire effect
  * `fxstop1`: brake lights
  * `seat`: bones for passengers


# Gun

## Description of gun elements

The `gun_rot` bone is the parent bone of the weapon and is linked to the `turret` bone.\
This bone operates based on inverse kinematics.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2Fyohs0XXDDDGaCo4OUFBW%2FGun.png?alt=media&amp;token=ba6a6253-b703-4e5d-9f88-922732c27d83" alt=""><figcaption><p>Gun component structure</p></figcaption></figure>

<table><thead><tr><th width="171">Name</th><th width="245">Description</th><th>Object Properties</th></tr></thead><tbody><tr><td><code>gun_rot</code></td><td>Responsible for vertical aiming of the weapon. Works based on inverse kinematics.</td><td><code>poly</code><br><code>ID=gun_rot</code><br><code>IKType=revolute</code><br>Defines rotation constraints that limit the elevation and depression angle of the gun barrel.</td></tr><tr><td><code>gun</code></td><td>Simulates the moving part of the tank gun barrel and has an animation.</td><td><code>poly</code><br><code>ID=gun</code><br><code>Animation</code></td></tr><tr><td><code>gun_vol</code></td><td>A volume that covers the visible parts of the <code>gun</code> and <code>gun_rot</code> bones.</td><td><code>volume</code></td></tr><tr><td><code>foresightN</code></td><td>Simulates a machine gun mounted on the gun mantlet.<br><code>N</code> is a number according to the rule that determines the correspondence between the <code>foresight</code> bone number and the type of mounted machine gun.</td><td>-</td></tr><tr><td><code>foresight1</code></td><td>An effector used for spawning the tank gun firing effect.</td><td>-</td></tr></tbody></table>

### Gun element linkage structure

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F4YElosEr3luqPsZRLtgn%2Fimage.png?alt=media&amp;token=a23fc9a0-d26b-4476-b51b-3f843878133c" alt=""><figcaption><p>Gun element linkage structure</p></figcaption></figure>

* turret
  * `gun_rot`
    * `gun`
      * `foresight1`
      * `gun_vol`
    * `foresightN`

## Extension for rotational mechanisms

The `bone_rotator` extender is used to implement various aiming mechanisms, particularly for rotational systems in guns and other devices.\
The core principle is to create a connection between two bones using inverse kinematics (IK), ensuring their rotation along the Z-axis.

## Operating principle

The `bone_rotator` extension links two bones, usually named `gun_rotator1` and `gun_rotator2`. These bones function under inverse kinematics rules, creating a "magnetic" attraction effect along the X-axis.\
The engine adjusts the positions of these bones so that their X-axes are aligned toward each other. This technology is particularly useful for implementing telescopic mechanisms (e.g., pistons), where the rotation of one bone depends on the other.

### Bone properties

Bones involved in this mechanism have the same properties as any other IK bones.

| `poly`            | Defines whether the bone is visible.                         |
| ----------------- | ------------------------------------------------------------ |
| `ID`              | Component identifier associated with the extension.          |
| `IKType=revolute` | Specifies the type of inverse kinematics (rotational joint). |
| `IKMin=<value>`   | Minimum rotation limit (if needed).                          |
| `IKMax=<value>`   | Maximum rotation limit (if needed).                          |

**Applications:**

* Telescopic mechanisms
* Pistons
* Other systems with dependent bone rotation


# Secondary bones

This section describes the setup of secondary bones, which are a visual complement to the primary bones of model Components.

## Visual details

Meshes of additional geometric elements that introduce visual variety to the model without affecting its functionality are referred to as `detail` bones. When the model spawns in-game, these bones are selected randomly, creating different visual variations.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FEELEWnv8Vmk6Oi75C7dk%2Fdetail.png?alt=media&amp;token=2afd1c91-4670-4ca7-85c2-9c5c90ed953e" alt=""><figcaption></figcaption></figure>

Each `detail` bone must have a unique name in the format detail\<N> , \<N> is a sequential number, and be linked in the bone hierarchy to the **primary bone** of the **Component** it visually belongs to. For example, if it adds elements to the hull, it should be linked to the `body` bone (`id=body`), while one affecting the turret should be linked to the `turret` bone (`id=turret`).

Each `detail` bone must have a unique name, achieved by adding a sequential number to its name, e.g., `detail1`, `detail2`, etc.

**Properties of `detail` bones:**

<table data-header-hidden><thead><tr><th width="170">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>poly</code></td><td>Indicates that the bone will be visible.</td></tr><tr><td><code>ID=&#x3C;value></code></td><td>Specifies the identifier of the component to which the bone belongs.</td></tr><tr><td>Animation (optional)</td><td></td></tr></tbody></table>

{% hint style="warning" %}
No volumes are required for `detail` bones.\
The game engine does not support volumes of this type.
{% endhint %}

***

## Hatches

Meshes representing hatches are assigned to `cover` bones.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FM4zf9HzmClzLvlPOGImj%2Fcover.png?alt=media&amp;token=7abe25fd-5515-4492-aa21-da4fca790fd6" alt=""><figcaption><p>Cover bones</p></figcaption></figure>

Depending on the functional design of the hatch, it may consist of multiple independent parts. In this case, each part must be represented by a separate `cover` bone.

Each `cover` bone must be linked in the bone hierarchy to the primary bone of the **Component** to which the hatch belongs.\
The bone name must be unique and follow the format `cover<N>`, where `<N>` is a sequential number (`cover1`, `cover2`, etc.).

The `ID` of the `cover` bone must match the identifier of the **Component** to which the hatch belongs.

**Properties of `cover` bones:**

<table><thead><tr><th width="309">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>poly</code></td><td>Indicates that the bone will be visible.</td></tr><tr><td><code>ID=&#x3C;value></code></td><td>Specifies the identifier of the <strong>Component</strong> to which the hatch belongs.</td></tr><tr><td><code>AnimationResume=open,cover</code></td><td>Defines the animation name.<br>This animation plays when the tank crew member enters or exits the vehicle.</td></tr></tbody></table>

{% hint style="warning" %}
No volumes are required for `cover` bones.\
The game engine does not support volumes of this type.
{% endhint %}

***

## Add-on armor shields bones

f the model includes **add-on armor**, it can be configured as part of the vehicle's armor system.\
Each armor piece can be set up as a unique element by separating the mesh into individual shields and assigning each a unique identifier: `ID=shield<N>`, where `<N>` is a unique identifier segment.

In most cases, add-on armor shields are symmetrical. Therefore, the `<N>` index in the name can include a combination of `L`or `R` to indicate whether the shield belongs to the left or right side, along with a sequential number.\
For example: `shieldL1`, `shieldR1`.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FGlgPD9NKEQpuZtwvE1Q2%2FShield.png?alt=media&amp;token=46232240-3661-4edf-81de-a4fce4a04907" alt=""><figcaption><p>Add-on armor shields and their bones</p></figcaption></figure>

**Properties of `shield` bones:**

<table data-header-hidden><thead><tr><th width="178">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>poly</code></td><td>Makes the armor shield visible.</td></tr><tr><td><code>ID=shield&#x3C;N></code></td><td>Unique identifier of the shield.<br><code>&#x3C;N></code> represents the shield number.</td></tr></tbody></table>

A **volume** `shield<N>_vol` is linked to the corresponding `shield<N>` bone, defining the physical volume of the armor.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FJqkh8OdGFR1qFCjrLPxh%2Fimage.png?alt=media&amp;token=2446bd29-8f8f-4356-9d5a-3a027b0180a1" alt="Shield bone hierarchy"><figcaption><p>Shield bone hierarchy</p></figcaption></figure>

### **Shield attachment bones**

Each shield is also linked to its own attachment bone, `shield_binding<N>`.\
These bones serve as anchor points for the shields and define their movement and destruction behavior.

A `shield_binding` bone can be either:

* An auxiliary invisible bone that exists purely for positioning and hierarchy purposes.
* A part of the shield mesh itself, acting as the attachment point.

In the bone hierarchy, `shield_binding<N>` bones must be linked to the primary bone of the **Component** to which the shield is attached. For example:

* If the shield is part of the hull, the attachment bone should be linked to `body`.
* If the shield is part of the turret, it should be linked to `turret`.

If the model supports destruction effects for shields, animations or physics constraints can be applied to these attachment bones.

**Properties of `shield_binding` bones:**

| `poly` (optional)      | If the attachment bone is part of the mesh, this property determines its visibility.                 |
| ---------------------- | ---------------------------------------------------------------------------------------------------- |
| `ID=shield_binding<N>` | <p>Unique identifier of the attachment point.<br><code>\<N></code> represents the shield number.</p> |

{% hint style="warning" %}
No volumes are required for `shield_binding` bones.\
The game engine does not support volumes of this type.
{% endhint %}

***

## Vehicle identification number

The `enumerator` bone represents a model composed of three (or six for U.S. vehicles) polygons, each assigned a unique `id material` corresponding to textures displaying the identification number.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FE85aOzJX2CIHigTT3PSg%2Fimage.png?alt=media&amp;token=d0950f40-452d-4781-a44d-ad1f122eb1e0" alt=""><figcaption><p>Enumerator bone hierarchy</p></figcaption></figure>

**Number attachment to a model component**

In the bone properties, the `ID` of the component where the unit number is visually applied must be specified.\
For tank models, this is typically `ID=body` or `ID=turret`.


# Transmission


# Chassis mechanisms

## Chassis Mechanisms in GEM RTS

In GEM RTS, chassis mechanisms are used to control the movement and physical behavior of `vehicle`-type units.

**Chassis Mechanisms for Ground Vehicles**

These mechanisms enable movement and control for wheeled or tracked units:

* `roller`
* `roller_joint`
* `align`
* `wheel`
* `track`
* `steer`
* `trailer`
* `steam piston`

**Chassis Mechanisms for Aircraft**

These mechanisms control the aerodynamic elements of an aircraft:

* `flap`
* `rudder`
* `aileron`
* `elevator`

***

## Preliminary Notes

{% hint style="warning" %}
All bone names and associated parameters must be checked for compliance with **internal standards**. This ensures the **correct operation** of the mechanism in the game engine.
{% endhint %}

In **GEM RTS**, different chassis mechanisms are used depending on the suspension type.\
Tracked vehicles use either the **Roller-Lever (roller + roller\_joint)** or **Roller-Rocker (roller + align)** mechanism.

## **Roller-Lever**

**Functionality**\
During unit movement, each roller is placed on the ground by rotating the **IK bone** so that the roller (wheel) maintains contact with the **ground surface**.

**Bone naming rules**\
All roller bones must start with the prefix `roller`.

<table><thead><tr><th width="216">Bone Name</th><th>Description</th><th>Internal Parameters</th></tr></thead><tbody><tr><td><code>roller&#x3C;N>_joint</code></td><td>Bone containing the <strong>suspension mesh</strong>.<br>Works under <strong>Inverse Kinematics (IK)</strong> rules.</td><td><code>poly</code>,<br><code>IKType=revolute</code>,<br><code>IKMin=&#x3C;value></code>,<br><code>IKMax=&#x3C;value></code></td></tr><tr><td><code>roller&#x3C;N></code></td><td>Support bone for the <strong>roller/wheel</strong>.</td><td><code>radius=&#x3C;value></code></td></tr></tbody></table>

{% hint style="success" %}
The index `N` of a `roller` bone must match the index `N` of the `roller_joint` bone to which the `roller` is linked. Example:

* `rollerL1` must be linked to `rollerL1_joint`.
* `rollerR1` must be linked to `rollerR1_joint`.
  {% endhint %}

**Bone features**

* The `roller<N>_joint` bone is positioned at the **pivot axis** of the lever, to which the `roller<N>` bone is attached. The **Z-axis** of `roller<N>_joint` must align with the **lever’s rotation axis**.
* **Roller radius**: The `radius` parameter is defined in **meters**.

{% hint style="warning" %}
The roller’s radius should be **slightly larger** than the visible roller radius in the model to account for the **track thickness**. Otherwise, visually, the roller will **sink into the track**.
{% endhint %}

***

## **Roller-Rocker**

**Functionality**\
This mechanism functions like **a seesaw**. The chassis tries to align two bones with defined **radii** to the ground by rotating the main bone under **Inverse Kinematics (IK)** rules.

**Bone naming rules**\
All alignment bones must start with the prefix `align`.

<table><thead><tr><th width="199">Bone Name</th><th width="294">Description</th><th>Internal Parameters</th></tr></thead><tbody><tr><td><code>align</code></td><td>Bone containing the <strong>suspension mesh</strong>. Works under <strong>IK</strong> rules.</td><td><code>poly</code>,<br><code>IKType=revolute</code>,<br><code>IKSpeed=&#x3C;value></code>,<br><code>IKMin=&#x3C;value></code>,<br><code>IKMax=&#x3C;value></code></td></tr><tr><td><code>roller</code></td><td>Support bone for the <strong>roller/wheel</strong>.</td><td><code>radius=&#x3C;value></code></td></tr></tbody></table>

**Bone features**

* Two child bones act as **support points**, which must ultimately align with the ground.

***

## **Wheel**

**Functionality**\
Rotates bones based on the **wheels’ movement** relative to the ground.

**Bone naming rules**\
All wheel bones must start with the prefix `wheel`.

**Internal Parameters**

* The `radius` parameter defines the **wheel radius in meters**.

{% hint style="info" %}
If all wheels are identical, the default wheel radius can be set in the `basis` bone using the `wheelradius` parameter.
{% endhint %}

***

## **Track**

**Functionality**\
Track movement is **simulated** by shifting the **V texture coordinate** of the track according to the **unit's movement**.

**Internal Parameters**\
Track settings are defined in the **.def model file**:

* `bone` – name of the **track bone**.
* `length` – length of the track in **meters**.

***

## **Steer**

**Functionality**\
Steering is controlled by setting the **rotation angle** on the **IK bone**.

**Bone Naming Rules**\
All **steering bones** must start with the prefix **`steer`**.

**Internal Parameters**\
Inverse Kinematics parameters:

```plaintext
IKType=revolute, 
IKSpeed=<value>, 
IKMin=<value>, 
IKMax=<value>
```

***

## **Trailer**

**Functionality**\
The **trailer mechanism** works similarly to **artillery pieces attached to a tractor**. It **rotates the pivot bone** to ensure the **support bone** remains stationary, ensuring stability and correct movement behavior.

**Bone Naming Rules**

| **Bone Name**         | **Description**                                                                                                             | **Internal Parameters**                                                                                                |
| --------------------- | --------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| `trailer`             | Support bone. In the bone hierarchy, it is linked to the pivot bone.                                                        | `poly`                                                                                                                 |
| `<trailername>_joint` | Pivot bone defining the **rotation point** of the hitch. Positioned at the **hitch’s rotation axis** in the bone hierarchy. | <p><code>poly</code>,<br><code>IKType=revolute</code>, <code>IKMin=\<value></code>,<br><code>IKMax=\<value></code></p> |

**Bone features**

* **Pivot Bone Positioning**\
  The `<trailername>_joint` bone must be placed **at the hitch’s rotation axis**, where the trailer connects in the **bone hierarchy**.
* **Pivot Bone Orientation:**
  * The **Z-axis** must align with the **hitch’s rotation axis**.
  * The **X-axis** must be directed towards the **support bone** to **prevent lateral displacement** in the rotation plane. Other minor displacements are allowed.

***

## **Steam Piston**

**Functionality**\
Designed specifically for **steam locomotives**, aligning the **piston’s movement** with the **wheels’ rotation**.


# Textures and Materials


# Physically Based Rendering

## Introduction to PBR

Physically Based Rendering (PBR) is a rendering technique based on physical and mathematical principles, providing realistic visual reproduction of materials in modern game engines and visualization software.\
PBR achieves significant visual similarity to real materials, including metals and dielectrics.

## From Phong to PBR

Past lighting models like Phong used an empirical approach that simulated materials like plastic well but was limited for other surfaces.\
Unlike Phong, PBR offers a unified approach backed by physically-based lighting models.

## Cook-Torrance Model

Within the GEM RTS, the Cook-Torrance model, one of the most validated and effective within the PBR framework, is used. This model accurately reproduces the interaction of light with different types of surfaces.

## Key benefits of Physically Based Rendering

* **Efficiency**\
  Optimized for modern graphics cards, PBR can be used in real-time without significant performance losses.
* **Consistency**\
  Rendering with PBR ensures visual effect stability when lighting conditions change.
* **Intuitiveness**\
  PBR material parameters are easy for artists and modelers to understand, simplifying the material creation and editing process.
* **Tools**\
  Many tools are available for working with PBR materials, such as Substance Painter, 3D Coat, and Marmoset, which offer capabilities for creating, editing, and exporting PBR textures.

PBR has become the standard in modern 3D rendering, providing developers with tools to create visually appealing and physically plausible scenes and objects in games.

## Useful PBR Resources

Here is a list of resources related to PBR (Physically Based Rendering) that may be useful for learning and applying this technology:

* [Physically Based Rendering in Filament](https://google.github.io/filament/Filament.md.html)\
  Detailed information about physically-based rendering.
* [CRAFTING PHYSICALLY-BASED MATERIALS](https://google.github.io/filament/Material%20Properties.pdf)\
  A document explaining the properties of materials in the context of PBR.
* [Filament Materials Guide](https://google.github.io/filament/Materials.html)\
  A guide to creating materials for use with the PBR system.
* [\[SH17C\] Physically Based Shading](https://www.shadertoy.com/view/4sSfzK)\
  An interactive program on ShaderToy that allows real-time adjustment of material and lighting parameters.
* [PBR Texture Conversion](https://marmoset.co/posts/pbr-texture-conversion/)\
  An article on converting traditional textures to formats suitable for PBR.
* Texture Library\
  Ambientcg.com provides a variety of textures that can be used in PBR workflows.


# Texture compression formats in GEM RTS

This table provides detailed descriptions and features of each texture compression format supported in GEM RTS, including their applications, advantages, and disadvantages.

| Format          | Description                                                                                                                                  | Features                                                                                                                                          |
| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| BC1 (DXT1)      | Full-color images without alpha. Used for general textures without transparency.                                                             | Pros: Most compact size. \<br> Cons: Low quality on specific images.                                                                              |
| BC1a (DXT1a)    | Full-color images with 1-bit alpha. Used for textures with minimal transparency, such as small details or effects.                           | -                                                                                                                                                 |
| BC2 (DXT3)      | Full-color images with sharply changing alpha channel. Rarely used due to compatibility limitations.                                         | Cons: Not recommended for use in the current engine version.                                                                                      |
| BC3 (DXT5)      | Full-color images with smooth alpha transitions. Ideal for textures of grass or foliage.                                                     | -                                                                                                                                                 |
| BC4 (ATI1)      | Single-channel textures, such as alpha only or roughness only.                                                                               | Pros: Optimized for high-quality compression of single-channel textures.                                                                          |
| BC5 (3Dc, ATI2) | Two-channel textures, such as normal maps. Particularly useful for textures containing two different data types, such as normals and height. | <p>Pros: Optimized for two-channel textures.<br>Note: Use <code>dds\_bc5\_fix \<path></code> to correct channel errors.</p>                       |
| BC6             | Used for HDR textures, such as sky or lighting textures.                                                                                     | Pros: Ideal for HDR textures.                                                                                                                     |
| BC7             | High-quality full-color images with and without alpha, as well as composite textures with separate information in each channel.              | <p>Pros: Provides significantly better image quality post-compression than BC1.<br>Cons: Larger in size and much slower to compress than BC1.</p> |

{% hint style="info" %}
When you find a texture with incorrectly swapped R and G channels in the normal map, run the console command `dds_bc5_fix <path>`, where `<path>` is the full path to the folder containing all .dds files with BC5 or ATI2 compression that need correction. This command does not degrade the compression quality, as it swaps the channels directly in the binary file.
{% endhint %}


# PBR parameters

## PBR Lighting Model Components

<table><thead><tr><th width="186">Name</th><th>Description</th><th>Components</th></tr></thead><tbody><tr><td>Indirect Diffuse</td><td>Models diffuse lighting from the environment.</td><td>Specified by a special diffuse texture created from the sky texture.<br>Controlled via <code>envmap_intensity</code> in the environment.<br>Affected by the angle of incidence.</td></tr><tr><td>Indirect Reflection</td><td>Models environmental reflections.</td><td>Specified by a special specular texture created from the sky texture.<br>Controlled via <code>envmap_intensity</code> in the environment.<br>Affected by the angle of incidence and surface roughness.</td></tr><tr><td>Direct Diffuse</td><td>Models lighting by a light source on matte surfaces.</td><td>Set in the environment as <code>diffuse*diffuse_intensity</code><br>Affected by the angle of incidence.</td></tr><tr><td>Direct Reflected</td><td>Models lighting by a light source on glossy surfaces.</td><td>Set in the environment as <code>diffuse*diffuse_intensity</code><br>Affected by the angle of incidence and surface roughness.</td></tr></tbody></table>

## Key PBR parameters

### **Diffuse**

(Also known as Albedo) Reflects the color of the material without considering lighting. This texture defines the basic color of an object under white light, making it a fundamental texture for most materials in 3D scenes.

<table><thead><tr><th width="160">Texture name</th><th width="147">Components</th><th>Map decryption</th></tr></thead><tbody><tr><td><code>&#x3C;name></code></td><td>3 channels in sRGB gamma space</td><td>The map contains the color information of each surface pixel under white light</td></tr></tbody></table>

{% hint style="info" %}
Diffuse maps do not contain information about the glossiness or reflectivity of the material; these aspects are controlled by other texture maps.
{% endhint %}

{% hint style="info" %}
Diffuse values can't be near zero since even materials like soot and coal reflect some light.
{% endhint %}

### **Ambient Occlusion**

Essential for ensuring that indirect lighting does not illuminate gaps in objects such as tree trunks, dark spaces between pipes, and similar areas.\
This texture setup helps to realistically portray how light interacts with complex surfaces by emphasizing areas that should remain dark due to blocked light sources.

<table><thead><tr><th width="153">Texture name</th><th width="143">Components</th><th>Map decryption</th></tr></thead><tbody><tr><td><code>&#x3C;name>_ao</code></td><td>1 channel<br>linear space ranging from [0..1]</td><td><strong>White areas</strong> in the texture represent open parts of the model.<br><strong>Black areas</strong> are fully self-shadowed regions where diffuse light cannot reach.<br><strong>Dark areas</strong> define parts of the model or material that are shadowed from external lighting due to obstructions by other parts of the model or material.</td></tr></tbody></table>

### **Metallic**

Metallic texture is crucial for simulating metallic materials in models, as metallic components reflect light differently compared to dielectrics.

<table><thead><tr><th width="152">Texture name</th><th width="154">Components</th><th>Map decryption</th></tr></thead><tbody><tr><td><code>&#x3C;name>_mt</code></td><td>1 channel<br>linear space ranging from [0..1]</td><td><strong>Black</strong> represents non-metallic parts of the model (dielectrics).<br><strong>White</strong> indicates metallic areas.<br><strong>Intermediate</strong> values are used for regions where metal partially appears.</td></tr></tbody></table>

{% hint style="info" %}
The diffuse color defines the inherent color of the metal where `metallic` is non-zero.
{% endhint %}

{% hint style="info" %}
The `metallic` should be set to 0 for non-metallic materials such as soil, water, stones, tree bark, leaves, wood, and concrete.
{% endhint %}

### **Roughness**

Roughness **t**exture determines the light reflection pattern on a surface based on the physical properties of the material, thus affecting the perception of the material's realism.

<table><thead><tr><th width="155">Texture name</th><th width="153">Components</th><th>Map decryption</th></tr></thead><tbody><tr><td><code>&#x3C;name>_rg</code></td><td>1 channel<br>Linear space ranging from [0..1]</td><td><p><strong>Black</strong> represents smooth surfaces such as glass or calm water.</p><p><strong>White</strong> indicates rough surfaces like dry dirt or dust.<br><strong>Intermediate</strong> values determine the degree of roughness.</p></td></tr></tbody></table>

{% hint style="info" %}
Roughness **v**alues close to 0 should be avoided as they produce very small, high-contrast highlights, leading to aliasing in the image.
{% endhint %}

### **Normal**

**The Normal map** texture simulates detailed surface relief by reflecting light, applicable in both PBR and Phong lighting models.

<table><thead><tr><th width="152">Texture name</th><th width="178">Components</th><th>Map decryption</th></tr></thead><tbody><tr><td><code>&#x3C;name>_nm</code></td><td>3 channels in sRGB gamma space</td><td>Each pixel contains normal coordinates encoded in RGB channels as XYZ coordinates.</td></tr></tbody></table>

{% hint style="info" %}
The difference between normal maps for OpenGL and Direct3D (DirectX) lies in the orientation of the green channel (Y-axis).\
In OpenGL, the green channel is positive (Y+), indicating that normals are lit from above. In contrast, Direct3D (DirectX) uses a negative green channel (Y-), which suggests that normals are lit from below.\
This difference affects how light and shadow are perceived on textured surfaces within 3D environments.
{% endhint %}

### **Lightmap**

**Lightmap** contains pre-calculated diffuse lighting information for use in scenes, useful when local ambient occlusion for the material and a global map for the entire object are present.

<table><thead><tr><th width="155">Texture name</th><th width="142">Components</th><th>Map Decryption</th></tr></thead><tbody><tr><td><code>&#x3C;name>_lm</code></td><td>1 channel in linear space ranging from [0..1]</td><td><strong>Black</strong> <strong>areas</strong> denotes fully shaded areas of the model.<br><strong>White</strong> <strong>areas</strong> indicates illuminated areas.<br><strong>Intermediate values</strong> represent varying degrees of lighting.</td></tr></tbody></table>

**Usage examples**:

* A fence model utilizes a tiled material texture with an ambient occlusion map and a lightmap for the assembled fence.
* A tank's tracks model includes an ambient occlusion texture for a tiled section of the track and a lightmap accounting for both the tank and the position of the rollers.

### **Translucency**

**Translucency map** texture dictates the translucency and thickness of the material, determining how much light passes through.

<table><thead><tr><th width="149">Texture name</th><th width="146">Components</th><th>Map decryption</th></tr></thead><tbody><tr><td><code>&#x3C;name>_tl</code></td><td>1 channel<br>Linear space [0..1]</td><td><strong>Black areas</strong> represent opaque sections of the model.<br><strong>White areas</strong> indicate full transparency.<br><strong>Intermediate values</strong> denote varying degrees of translucency.</td></tr></tbody></table>

**Usage examples:**\
The channel dictates only light passage; color is determined by the diffuse texture.\
Used in textures like grass and leaves to prevent them from appearing dark on the side opposite the light source.

### **Height**

Special texture used to simulate three-dimensional details on flat surfaces using parallax technique, enhancing detailed surfaces without significant performance costs.

<table><thead><tr><th width="149">Texture name</th><th width="146">Components</th><th>Map decryption</th></tr></thead><tbody><tr><td><code>&#x3C;name>_hm</code></td><td>1 channel<br>Linear space [0..1]</td><td><strong>White areas</strong> represent "high" points of the surface.<br><strong>Black areas</strong> are "low" points. <strong>Gray</strong> scale indicates various height levels.</td></tr></tbody></table>

{% hint style="warning" %}
Not considered in the current PBR implementation.
{% endhint %}

### **Emissive**

Texture simulates glowing effects and other light sources that should appear self-illuminating.

<table><thead><tr><th width="152">Texture name</th><th width="145">Components</th><th>Map decryption</th></tr></thead><tbody><tr><td><code>&#x3C;name>_em</code></td><td>3 channels<br>Linear space</td><td>The color on the map directly influences the color of the emitted light.<br>The intensity of the glow is determined by the color brightness on the map.<br>Brighter colors lead to more intense glow.</td></tr></tbody></table>

**Usage example:**\
Ideal for visual representation of light sources within textured objects, often used to add visual depth and enhance scene perception.

### **Reflectance**

Sets the reflectivity for dielectrics, used as a material parameter.\
The reflectance is fixed at 4% as this is the typical value for most materials.

## Texture names in the game resources

### **Textures from GEM2**

<table><thead><tr><th width="190">File name</th><th>Corresponding texture map</th></tr></thead><tbody><tr><td><code>&#x3C;name></code></td><td>Diffuse</td></tr><tr><td><code>&#x3C;name>_nm</code></td><td>Normal Map</td></tr><tr><td><code>&#x3C;name>_sp</code></td><td>Specular</td></tr><tr><td><code>&#x3C;name>_lm</code></td><td>Light Map</td></tr><tr><td><code>&#x3C;name>_hm</code></td><td>Height Map</td></tr><tr><td><code>&#x3C;name>_prlx</code></td><td>Alternative Version of Height Map</td></tr></tbody></table>

### **Added in PBR**

<table><thead><tr><th width="193">File name</th><th>Corresponding texture map</th></tr></thead><tbody><tr><td><code>&#x3C;name>_ao</code></td><td>Ambient Occlusion</td></tr><tr><td><code>&#x3C;name>_mt</code></td><td>Metallic</td></tr><tr><td><code>&#x3C;name>_rg</code></td><td>Roughness</td></tr><tr><td><code>&#x3C;name>_tl</code></td><td>Translucency</td></tr></tbody></table>


# Texture Conversion in Gem RTS

## **Introduction**

Texture conversion is necessary for transforming texture sets created for Phong materials into PBR[^1] material components. In the Gem RTS engine, the conversion process can be performed automatically using material schemes created in the Scheme Editor.

### **Differences between texture components for Phong and PBR materials**

**Phong material components**

* The `lightmap` is baked into the `diffuse` texture map, located in a separate upper layer of the original `.tif` file and overlaid on the color map using the Multiply Blend mode.
* `Specular` texture map is used to define the shininess and reflectivity of surfaces..

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FRaqDEVWDhRLe8zkMNHrn%2Fimage.png?alt=media&amp;token=a585d529-2c96-482a-b24d-d5580d1f309d" alt=""><figcaption><p><strong>Diffuse Texture (with baked lightmap) for Phong Material</strong></p></figcaption></figure>

**PBR material components:**

* The `diffuse` texture retains only the material color, while the `lightmap` is transferred to a separate `ambient occlusion` texture.
* `Metallic` and `roughness` texture maps are used to simulate how light interacts with surfaces in a realistic way

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FmLMs2NgQcbfiQr3tuYWu%2Fimage.png?alt=media&amp;token=b989146f-dbf8-4733-9daf-87be58e1a2e3" alt=""><figcaption><p><strong>Diffuse Texture for PBR Material</strong></p></figcaption></figure>

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F1jHN2GsgJPIYOJedyn7h%2Fimage.png?alt=media&amp;token=e63a7eb1-5afb-4433-9ba7-d19506c6dd39" alt=""><figcaption><p><strong>Ambient Occlusion Texture for PBR Material</strong></p></figcaption></figure>

## **Texture conversion using the Scheme Editor**

Using conversion blocks in the Scheme Editor, you can create material schemes that automatically convert Phong texture sets into PBR materials during rendering.

The conversion works by transforming Phong texture sets (diffuse and specular) into PBR components diffuse, metallic, roughness, and ambient occlusion. The generation of PBR materials from Phong texture sets is based on the following assumptions:

<table><thead><tr><th width="235">Component</th><th>Conversion assumption</th></tr></thead><tbody><tr><td><strong>Metallic</strong></td><td>A high <code>specular</code> value corresponds to the physical properties of metal.<br>The lower threshold of <code>specular</code> brightness, beyond which metals begin, is taken into account.</td></tr><tr><td><strong>Roughness</strong></td><td>The higher the specular value, the smoother and more reflective the material.<br>The minimum specular brightness value is taken into account to avoid very smooth surfaces. The original scheme's <code>specular_power</code> parameter indicates the glossiness of the surface.</td></tr><tr><td><strong>Ambient Occlusion</strong></td><td><code>Ambient occlusion</code> is baked into the diffuse texture.<br>Lower brightness values of the diffuse texture are taken as a sign of <code>ambient occlusion</code>.</td></tr></tbody></table>

### **Conversion Blocks**

| Conversion Block Name                                                                              | Input Pin                   | Output Pins                                               |
| -------------------------------------------------------------------------------------------------- | --------------------------- | --------------------------------------------------------- |
| <p><strong>Specular</strong><br><strong>to</strong><br><strong>metallic and roughness</strong></p> | specular                    | <ul><li>metallic,</li><li>roughness</li></ul>             |
| <p><strong>Diffuse</strong><br><strong>to</strong><br><strong>ambient occlusion</strong></p>       | diffuse with baked lightmap | <ul><li>clean diffuse</li><li>ambient occlusion</li></ul> |

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F8Ybhfr4oH3JY4ueCMrcj%2Fimage.png?alt=media&amp;token=6aa0e9ba-0e91-48c7-8edc-e1b1ba9032d1" alt=""><figcaption><p>'S<strong>pecular to metallic and roughness' Conversion Block</strong></p></figcaption></figure>

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FtXAh8OXfuxkeSBz4EDZQ%2Fimage.png?alt=media&amp;token=f46c1817-c837-44f0-87fd-a988d6b99118" alt=""><figcaption><p>'<strong>Diffuse to ambient occlusion' Conversion Block</strong></p></figcaption></figure>

### **Creating a Scheme for automatic conversion of Phong texture sets to PBR material**

1. Launch the Scheme Editor.
2. Open the Phong material scheme.
3. Add Conversion blocks to the scheme.
4. Connect the Phong `diffuse` and `specular` textures to the input pins of the Conversion blocks.
5. Combine all data from the output pins of the Conversion blocks into the Material block with the chosen lighting method.
6. Save the scheme to the `/gem2` folder.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FAlQ5hmo3PeTFblr2iHlj%2Fimage.png?alt=media&amp;token=aa5df50b-e4e6-465a-ae1b-70b1f2381a3a" alt="" width="555"><figcaption><p><strong>Example of combining data into the 'Material: metallic + roughness' block</strong></p></figcaption></figure>

**Example of using conversion blocks in the bump material scheme from the gem2 folder**

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FIvWANm6qqiKLl52iX8C8%2Fimage.png?alt=media&amp;token=ea7f9ee4-9420-4397-99d4-5ef00da97b56" alt=""><figcaption><p><strong>Bump material scheme from the gem2 folder</strong></p></figcaption></figure>

{% hint style="info" %}
New PBR material schemes can be created using the Scheme Editor.
{% endhint %}

## **Methods of Converting Phong Textures to PBR**

### **Automatic Conversion**

* Using conversion blocks in the material scheme, Phong texture sets (diffuse, specular) are transformed into PBR material components (diffuse, ambient occlusion, metallic, roughness) automatically during rendering.

### **Partially-Automatic Conversion**

* Extract the lightmap from the diffuse texture and save it as a separate ambient occlusion texture using a graphic editor.
* The specular map is converted into metallic and roughness components using a conversion block in the material scheme.

### **Conversion using a graphic editor**

**Steps:**

1. Transfer the `lightmap` from the Phong `diffuse` texture to a separate `ambient occlusion` texture.
2. Convert the Phong `specular` texture to a `roughness` texture map. Usually, inverting the `specular` image and adjusting it with levels is sufficient.
3. Create a `metallic` map based on the Phong `specular` texture, leaving the brightest areas white (metallic = 1).
4. Assemble the PBR material scheme in the Scheme Editor using the PBR material texture maps.

## **Assigning the PBR material scheme to a model**

{% hint style="info" %}
When creating new models, it is recommended to assign materials from the `pbr/` folder.
{% endhint %}

{% hint style="info" %}
Material schemes from the `gem2/` folder support the automatic conversion of Phong texture sets to PBR material during rendering.
{% endhint %}

### **Re-exporting the model**

1. In 3D Max, assign the PBR material scheme to the model.
2. Export the model to the game using the [3D Max Plugin](/modeling/3ds-max-plugin).\
   During export, the .material file in the model folder is automatically updated to include the material scheme and the paths to the textures for the material components.

### **Without Re-exporting the model**

1. Open the `.material` file from the model folder using a text editor.
2. Replace the material scheme name and paths to the corresponding PBR textures (textures must be in `.dds` format).

[^1]: [Physically Based Rendering](/textures-and-materials/physically-based-rendering)


# Texture conversion to PBR materials using Nvidia Texture Exporter

To convert textures into PBR materials using the Nvidia Texture Exporter, apply the following settings to ensure optimal results.

## General settings

* Generate mipmaps: ✔️
* mipmap options:
  * Filter type:
    * Box - for testing purposes
    * Kaiser - for production use
  * Override filter width : leave blank
  * Premultiplied alpha blending: leave blank
* Effects: leave blank
* Compression Effort:
  * Normal - for testing purposes
  * Production - for production use
* Scale / Bias output - do not use
* Wrap to output range: leave blank
* Scale alpha to mipmap coverage : leave blank

## Settings for leaf and grass textures

* Format: BC3
* Gamma Correct: ✔️
* Premultiplied alpha blending : leave blank
* Scale alpha to mipmap coverage : ✔️

## Settings for Diffuse texture maps

* Format: BC1 / BC1a / BC7
* Image Type: Color map
* Gamma Correct: ✔️

## Settings for Roughness, AO, Metallic maps

* Format: BC4u
* Image Type: Color map
* Gamma Correct: leave blank

## Settings for Normal maps

* Format: BC5u
* Image Type: Color map
* Gamma Correct: leave blank


# Animation


# Animation system for actor

This overview introduces the structure of the animation system and provides links to detailed documentation for each component.

## Animation System overview

The animation system in **Gem RTS** handles animation control and switching for game entities with complex skeletal animation, such as humans, animals, or robots. It consists of two main components:

* **Finite State Machine (FSM)** — ensures correct transitions between states based on requests from external control systems such as AI, player commands, game physics, and others.
* **State handler** in the engine provides feedback from the FSM to other game systems and manages animations and effects according to the unit’s active state. Most animation selection rules are defined in configuration files of the **Animation Selector**.

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2F6BDNTIH7Asg4sbqrYlXb%2Fanimation_system_flow.jpeg?alt=media&amp;token=5220a004-ec62-4be9-afd6-f61bbd02560b" alt="" width="375"><figcaption><p>Interaction between FSM and Animation Selector for animation control in Gem RTS</p></figcaption></figure>

***

<table data-view="cards" data-full-width="true"><thead><tr><th data-type="content-ref"></th><th></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td><a href="/animation/animation-system-for-actor/finite-state-machine-fsm">Finite State Machine (FSM)</a></td><td>Explanation of the purpose and working principles of the FSM in the Gem RTS engine, including its structure and main configuration components.</td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FXqe0ZKqSICsAK0XgCyMC%2Fsplash_editor_3.jpg?alt=media&amp;token=ecb5bb0d-d794-4925-a780-f7d98f315d42">default_cover.jpg</a></td></tr><tr><td><a href="/animation/animation-system-for-actor/animation-selection-setup">Animation selection setup</a></td><td>Explanation of how the Animation Selector works: configuration structure for selecting animations based on FSM state and other parameters.</td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FXqe0ZKqSICsAK0XgCyMC%2Fsplash_editor_3.jpg?alt=media&amp;token=ecb5bb0d-d794-4925-a780-f7d98f315d42">default_cover.jpg</a></td></tr><tr><td><a href="/animation/animation-system-for-actor/animation-debugging-in-the-editor">Animation Debugging in the Editor</a></td><td>A guide to debugging FSM and animations in the editor.</td><td><a href="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FRjt9BS3VikoL6GTSZTId%2F%D0%9E%D1%82%D0%BB%D0%B0%D0%B4%D0%BA%D0%B0%20%D0%B0%D0%BD%D0%B8%D0%BC%D0%B0%D1%86%D0%B8%D0%B8%CC%86%20%D0%B2%20%D1%80%D0%B5%D0%B4%D0%B0%D0%BA%D1%82%D0%BE%D1%80%D0%B5.jpeg?alt=media&amp;token=631cfd13-9805-418d-98cf-6182346dca87">Animation Debugging in the Editor - cover.jpeg</a></td></tr></tbody></table>


# Finite State Machine (FSM)

The **Finite State Machine (FSM)** system provides centralized management of game object states in Gem RTS. It processes incoming state change requests from various control subsystems — such as AI, user commands, physics, and others — and ensures valid and consistent state transitions.

The primary purpose of the FSM is to resolve conflicts between multiple requests and select the most appropriate state for the object. This maintains logical consistency, smooth animation transitions, and correct operation of gameplay mechanics.

{% hint style="info" %}
The FSM does not execute animations or behavior logic directly. It only determines and updates the object’s current state. Other systems handle animations, behavior, and scripts based on the active state provided by the FSM.
{% endhint %}

**Main functions of the FSM:**

* receiving requests from external control systems;
* resolving conflicts between competing requests;
* selecting a valid transition and updating the unit's current state;
* passing the current state to other systems: animations, behavior, scripts, etc.

***

## FSM Components

### **State**

A **state** represents the current position or action of a unit (e.g., `stand`, `walk`, `fire`, `blown_away`).\
At any given moment, a unit can be in only one state.\
States function as nodes in the FSM transition graph.

Each state:

* has a unique name;
* has at least one tag;
* is connected to other states through defined transitions, forming possible state switches.

### **Tags**

A **tag** is a textual label assigned to a state. Tags serve two purposes:

* They allow external systems to identify the logical condition of the unit.
* They define which request should trigger a transition to that state.\
  \&#xNAN;*Example:* A state tagged with `fire` will be selected in response to a `fire` request.

### **Requests**

A **request** is an external command issued by control subsystems (AI, user input, physics, etc.) that initiates the process of transitioning a controlled object to a new state within the FSM.

Unlike a **signal**, which is an instantaneous event, a request can remain active for a period of time — until it is either processed or canceled.

Each request is associated with at least one FSM state via a tag that matches its name. The presence of this tag enables the FSM to identify which state can handle the given request, provided the transition conditions are met.

Tags in states are used not only to handle FSM requests but also by other game subsystems.

The result of request processing depends on:

* the current state of the unit;
* the priority of the request;
* the transition rules defined in the FSM graph.

FSM supports multiple types of requests.

{% hint style="info" %}
**Request types** are defined in the code and cannot be overridden through FSM configuration files.
{% endhint %}

*The table of request types is provided for reference to give a complete understanding of how the Finite State Machine (FSM) works in Gem RTS.*

#### Request Types

<table><thead><tr><th width="118.9453125">Type</th><th width="479.30859375">Description</th><th>Example</th></tr></thead><tbody><tr><td><code>Switch</code></td><td>A one-time request triggered in the code. It enters a queue and waits for an opportunity to execute. Once executed, it is removed.</td><td>Command: “Go prone”</td></tr><tr><td><kbd>Job</kbd></td><td>This request type is called every tick by the code after the unit transitions into the target FSM state. It holds the unit in that state as long as the request remains active.<br>The request is reset if it is not called for longer than the <code>duration</code> parameter or if a higher-priority request is received.<br>When reset, it triggers a <em>Switch</em> request from the <code>exit</code> block in the FSM description, if the unit is still in the target state.</td><td>Command: “Repair”</td></tr><tr><td><code>Action</code></td><td>This request is triggered every tick before the unit is allowed to enter the target state. If conditions are met, it transitions the unit into the state to perform the action, and then it is removed.<br>If not triggered for at least one tick, it is discarded without execution.</td><td>Command: “Throw grenade”</td></tr><tr><td><code>State</code></td><td>A one-time request that causes an immediate transition into the target state. The state is maintained until it is canceled or a higher-priority request arrives.</td><td>Hide the weapon if it gets stuck in a wall</td></tr></tbody></table>

**The request and tag system** is used in the engine to coordinate the behavior of various gameplay subsystems.\
Some requests and tags are hardcoded, while others can be defined in configuration files (e.g., interface elements, inventory items, weapons), allowing developers to modify and extend object behavior without altering the source code.

{% hint style="info" %}
See the [list of hardcoded requests and tags](/animation/animation-system-for-actor/finite-state-machine-fsm/hardcoded-requests-and-tags)
{% endhint %}

### State Subsets

An **FSM Subset** is a component of the finite state machine that defines restrictions on state transitions by excluding states that are incompatible with the unit’s current state.

**Example:**\
If a unit is holding a fuel canister, the FSM subset excludes the states *prone*, *squat*, and *repair*, as performing these actions would be incompatible with the unit's current condition.

***

## **Request Processing in FSM**

**Stages of the request processing workflow**

1. **FSM Subset Selection**\
   Based on the unit’s current state, the state handler selects an FSM subset that limits the pool of states available for transition.
2. **Priority Analysis**\
   If multiple requests are received simultaneously, the FSM analyzes their priorities. The request with the highest priority takes precedence when selecting the next state. Requests with equal priority are resolved in the order they were received.
3. **Transition Availability Check:**
   * Whether the FSM graph defines a transition to the target state from the current state.
   * Whether the conditions are met (e.g., presence of specific tags or additional request parameters).
4. **Request Processing Result**\
   The FSM selects the nearest available state in the graph that matches the request tag, regardless of whether it is directly connected to the current state — state transitions may pass through intermediate states.

**Typical FSM Scenario**\
Initial position: the unit is in an idle state.\
Combat begins: the unit detects an enemy, receives an attack command from the AI, and simultaneously a “dig in” command from the player. A nearby explosion occurs, with a blast strong enough to knock the unit back and cause damage. State change requests are sent to the FSM.\
Since the unit cannot be in multiple states at once (digging in, attacking, reacting to the explosion, healing, or dying), the FSM resolves this conflict by selecting the most prioritized and valid state.

When the new state is activated, the state handler passes the state to the game systems and triggers the scripts and animations associated with that state.

Upon exiting the state, the handler notifies the game systems of the state’s completion, stops the corresponding animations and effects, terminates all processes and scripts linked to the state, and then clears the used resources.

***

## FSM Configuration Components

The logic of the finite state machine is defined in the unit’s `.def` file using the `fsm` block:

> **FSM block syntax**
>
> ```
> {fsm "name"
>   ...
> }
> ```
>
> where `"name"` is the name of the FSM.

The FSM description can be placed in a separate file or directory.\
For example, in the resources of the **Men of War** game series:

* `\properties\animal.ext` — FSM for the `horse` entity
* `\properties\human_fsm\` — FSM for the `human` entity

### Request List

A complete description of requests is available in the source code.\
Only parameters available for configuration are exposed in the configuration file.

The `request` parameter blocks are used to declare the requests handled by the state processor within the FSM description. Each block contains values for configurable parameters.

> **Request block syntax**
>
> ```
> {Request "name"
>     {priority N} 
>     {interrupt}
>     {duration N}
>     {exit "state_name"} 
> }
> ```

<table><thead><tr><th width="148.6953125">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>Request</code></td><td>Request name. The FSM selects a state whose tag matches this name.</td></tr><tr><td><code>priority</code></td><td>Defines the request’s priority. When processing competing requests, the one with the higher value is selected.</td></tr><tr><td><code>interrupt</code></td><td>Allows immediate transition to a new state, forcibly terminating the current one regardless of active animations.Optional</td></tr><tr><td><code>duration</code></td><td>Sets the maximum number of ticks between consecutive calls to the request from code. If the request is not called within the specified time, it is automatically canceled.Optional; applicable only to Job-type requests</td></tr><tr><td><code>exit</code></td><td>Specifies the name of the state to transition to automatically when the request is canceled due to a timeout as defined by the duration parameter.Optional; applicable only to Job-type requests</td></tr></tbody></table>

<details>

<summary>Example: Request definition</summary>

```
{Request "move"
    {priority 30}
    {interrupt}
    {duration 2}
    {exit "stop-move"}
}
```

</details>

### Initial State

The `Start` parameter block is used to specify the name of the initial state for unit initialization.

**Initial FSM State Definition Format**

> Start block syntax
>
> ```
> {Start "state_name"}
> ```

### State List

The `state` parameter blocks are used to define the nodes of the FSM graph.\
Nested blocks are used to describe available transitions between states, state tags, and other parameters.

**State Block Syntax**

```
{State "state_name"
    {from "source_state"}
    {fromTagged "source_tag"}
    {transit "transit_state"}
    {to "target_state"}
    {tag "name"}
    {condition "name"}
    {split "part1" "part2"}
}
```

<table><thead><tr><th width="263.11328125">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>State "state_name"</code></td><td>Unique identifier of the defined state.</td></tr><tr><td><code>from "source_state"</code></td><td>Defines the source state from which a transition to this state is allowed.</td></tr><tr><td><code>fromTagged "source_tag"</code></td><td>Allows transition into this state from any state that has the specified tag.</td></tr><tr><td><code>transit "transit_state"</code></td><td><em>(Optional)</em> Defines an automatic transition to the next state without an external request, as soon as conditions allow.</td></tr><tr><td><code>to "target_state"</code></td><td>Declares a valid transition from this state to the specified target state. Multiple <code>to</code> parameters can be used for alternative transitions.</td></tr><tr><td><code>tag "name"</code></td><td>Tag assigned to the state. Multiple <code>tag</code> entries may be specified for a single state. <em>(Optional)</em></td></tr><tr><td><code>condition "name"</code></td><td>Condition required for entering this state. The value should match the name of a request.</td></tr><tr><td><code>split "part1" "part2"</code></td><td>Divides the object into semi-independent parts (e.g., <code>"walk_all"</code> <code>"linked"</code>). Used for complex transitions or actions when unit animation can be split into parts — for example, upper and lower body.</td></tr></tbody></table>

{% hint style="success" %}
State names and tag values must be enclosed in double quotes.
{% endhint %}

<details>

<summary>Example: State definition</summary>

```
{State "stand_bazooka_pick"
    {from "stand"}
    {fromTagged "up"}
    {transit "stand"}
    {to "stand"}
    {tag "up"}
    {tag "bazooka-pick"}
    {condition "knock-down"}
    {split "walk_all" "linked"}
}
```

</details>

### State Subset

The `subset` parameter block is used to define FSM subsets that restrict the list of valid states available for selection based on the unit’s current FSM state.

> **Subset block syntax**
>
> ```
> {subset "name" from "source_subset"
>   {disable "state_A"}
>   {enable "state_B"}
> }
> ```

<table><thead><tr><th width="166.0234375">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>subset</code></td><td>Name of the FSM subset.<br>Defines a set of allowed and disallowed states for this subset.</td></tr><tr><td><code>from</code></td><td>Name of the parent subset from which allowed states are inherited.(Optional)</td></tr><tr><td><code>disable</code></td><td>Disables access to states tagged with the specified value within this subset.<br>Can be used multiple times for different tags.</td></tr><tr><td><code>enable</code></td><td>Enables access to states tagged with the specified value within this subset.<br>Can be used multiple times for different tags.</td></tr></tbody></table>

<details>

<summary>Example: Subset definition</summary>

```
{subset "with_item" from "default"
    {disable "down"}
    {disable "squat"}
    {disable "looking"}
    {disable "repair"}
    {disable "step-aside"}
    {enable "open-with_item"}
}
```

The subset named `with_item` inherits the states from the `default` subset but excludes the following states from the selection: *prone* (`down`), *crouching in cover* (`squat`), *looking around* (`looking`), *repairing* (`repair`), and *strafing* (`step-aside`). These states are incompatible with the condition in which the unit is carrying a heavy object, such as a canister or a crate.

</details>


# Hardcoded Requests and Tags

Many subsystems in the human-related code are tied to specific requests or state tags.

The list below does not include all possible requests. Some requests may be defined in inventory items or weapons.

**Saving**

* `stored` — used during save operations

**Movement Between Cover Positions**

* **Vertical Cover:**
  * `looking`
  * `look-right-in`
  * `look-sright-in`
  * `look-sleft-in`
  * `look-left-in`
  * `look-out`
  * `peep-left-in`
  * `peep-right-in`
* **Tall Horizontal Cover:**
  * `snipe`
  * `cover`
* **Low Horizontal Cover:**
  * `squat-hide`
  * `squat-cover`

**Repair**

* `repair`

**Healing**

* `heal-head` — bandaging the head
* `heal-leg` — bandaging the leg
* `heal-hand` — bandaging the arm
* `healing` — indicates active healing
* `stop-heal-fast` — request to interrupt healing

**Rotation**

* `rotate` — general turning
* `rotate-l45` — turn 45 degrees left
* `rotate-r45` — turn 45 degrees right
* `no-rotate-animation` — indicates lack of turning animation (spins in place)

**Movement**

* `move` — moving
* `switch-move` — request to switch movement animation
* `stop-move` — request to stop moving
* `rush` — strafing
* `step-aside-left` — reacts to contact on the left
* `step-aside-right` — reacts to contact on the right
* `swim` — swimming

**Idle**

* `idle` — plays idle animations
* `idle-prepare` — request to prepare for idle

**Stance Change**

* `up` — standing
* `down` — lying prone
* `quick-down` — request to quickly lie down without kneeling
* `quick-up` — request to quickly stand up without kneeling
* `squat` — kneeling

**Miscellaneous**

* `animation` — plays a custom animation
* `recoil` — recoil from firing

**Hit Reaction**

* `kick` — received a hit
* `knock-down` — unconscious state
* `keep-knock-down` — request to remain unconscious
* `throwoff` — thrown and tumbling

**Corpses**

* `dead` — soldier is dead
* `corpse` — carried corpse

**Grenade Reaction**

* `grenade-lie`
* `grenade-cover`

**Boarding**

* `board` — boarding in progress
* `board-begin` — request to prepare for boarding
* `unboard` — disembarking in progress
* `unboard-to-water` — disembarking into water
* `unboard-to-ground` — disembarking onto ground

**Item Interaction**

* `pickup-hand` — pick up item from the ground by hand
* `pickup-stand` — pick up item from standing position
* `ground-drop` — place item on the ground

**With Weapons**

* `hold-back` — hold weapon close to body
* `stop-hold-back` — return weapon to normal position


# FSM states for the human entity

FSM state names follow the pattern `<Position>_<Action>`, with optional modifiers to specify details of the action.

**Positions**

* `stand` — actions while standing
* `lie` — actions while lying down
* `squat` — actions while crouching
* `snipe` — peeking from behind cover
* `swim` — swimming
* `look` — peeking around a wall
* `peep` — stealth peeking

**Actions**

* `pick` / `pickup` — pick up from the ground
* `drop` — place on the ground
* `reload` — reload a weapon
* `unload` — unload a weapon
* `aim_prepare` — transition into aiming
* `recoil` — recoil from firing
* `dying` — dying animation
* `knock_down` — loses consciousness
* `belt_in` — hand moves to belt
* `belt_out` — hand returns from belt
* `inventory_in` — hand moves into inventory
* `inventory_out` — hand leaves inventory
* `breath` — breathing
* `idle` — idle animation
* `holdback_in` — pull weapon away from wall
* `holdback_out` — return weapon to position
* `rotate` — rotate in place
* `throw_begin` — start of a throw
* `throw_end` — end of a throw
* `healing` — self-bandaging
* `repair` — vehicle repair
* `hide_in` — hide behind cover
* `hide_out` — peek out from cover
* `step_aside` — step to the side
* `kick` — reaction to a hit (actual hit animations are defined in melee combat)
* `from` — position change


# Animation selection setup

**Animation Selector** is a set of configuration files used to define rules for selecting and playing animations based on the current FSM-state of a unit’s.

**How the Animation Selector works**

When a unit transitions to a new state, the state handler queries the Animation Selector files to determine which animation should be played. The file defines:

* animation sets available for the given state;
* conditions for selecting a specific animation (e.g., depending on pose, weapon, view direction);
* priorities and fallback animations

Each FSM definition in the resources has a corresponding **Animation Selector file** with the same name.

**Animation Selector files** are stored in the `\properties\animation_selector\` folder. Files have the .set extension.

Examples:

* `human.set` — used for the `human` entity
* `animal.set` — used for animal entities, such as `horse`

**Animation files** are stored either in the corresponding entity’s folder or in the shared directory: `\properties\animation\` and its subfolders.

## Animation Selector description structure

The **Animation Selector** description includes the following elements:

* Request name
* Condition;
* Animation assignment;
  * Animation playback speed.

{% hint style="info" %}
To simplify editing and reuse, it is recommended to extract logical and repetitive animation selection blocks into separate .inc files\
For example, in the Men of War II resource, the file human.set includes logic blocks via include from external files
{% endhint %}

### Animation Request Name

The request name in the Animation Selector usually matches the name of the animated object’s state. The request name may include words that clarify the context

Examples:

* `stand_idle`
* `walk`
* `lie_holdback_in`

### Animation Specification Methods

#### 1. Specifying a Direct Animation

To play a specific animation, use the `anm` block:

> **Syntax:**
>
> ```
> {anm "animation_name"}
> ```
>
> * The animation name is written in double quotes.
> * The string `" "` (empty string) means no animation will be played — the current animation will remain active.

<details>

<summary><strong>Example: Direct Animation Selection</strong></summary>

```
{lie_belt_in
	{if human_stuff holding "pistol"
		{anm "lie_take_pistol" -1}
	}
	{anm "lie_put_small" 0.75}
}
```

* `lie_belt_in` — the name of the query.
* `if` block — condition for triggering the animation.
* `lie_take_pistol` — animation name played at speed `-1` (reverse playback from end to start).
* `lie_put_small` — animation played at speed `0.75`.

</details>

#### 2. Random Animation Selection

The `random_select` block allows specifying a list of alternative animations with weighted probability:

> **Syntax:**
>
> ```
> {random_select
>     {weight n1 "animation_1"}
>     {weight n2 "animation_2"}
>     ...
> }
> ```
>
> * `weight` sets the relative probability `n`, from `0.01` to `100`.
> * Animation names are written in double quotes.

<details>

<summary><strong>Example: Random Animation Selection by Weigh</strong></summary>

```
{squat 
    {random_select
        {weight 5 "squat_idle_rifle_2"}
        {weight 2 "squat_idle_rifle_3" -1}
        {weight 1 "squat_idle_rifle_4"}
        {weight 1 "squat_idle_rifle_5"}
        {weight 1 "squat_idle_rifle_6"}
    }
}
```

* `squat_idle_rifle_2` has weight 5.
* `squat_idle_rifle_3` has weight 2 and is played in reverse (`-1` playback speed).

</details>

### 3. Counter-based Animation Selection

Looped switching of animation sets based on a numerical counter is done using the `switch_by_counter` block. This mechanism is useful for creating varied animations such as poses, walk cycles, reactions, emotions, and other repeating states.

> **Syntax:**
>
> ```
> {switch_by_counter <counter_name> 
>     {common [...]}
>     {pick <N> [...]}
>     {pick <N> [...]}
>     ...
> }
> ```

<table><thead><tr><th width="203.71875">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>&#x3C;counter_name></code></td><td>The name of the counter that determines the current switch state.</td></tr><tr><td><code>common</code></td><td><em>(Optional)</em> Base animation set copied into each <code>pick</code> block before it is applied.</td></tr><tr><td><code>pick &#x3C;N></code></td><td>A pick option. The value <code>N</code> means this pick is used for <code>N</code> consecutive counter values.</td></tr></tbody></table>

#### How it works:

1. The counter starts at `0`, selecting the first `pick` block.
2. Each time the counter is triggered, its value increases by `1`, moving to the next pick.
3. The counter wraps around: once it reaches the total sum of all `N` values in `pick`, it resets to `0`.
4. Inside each `pick`, the contents of `common` (if defined) are copied and then overridden or extended by the current `pick`.\
   This means each `pick` can:
   * inherit from `common`;
   * Override specific fields;
   * Extend the base animation set with additional keys.

{% hint style="warning" %}
If `common` is not defined, all animation sets are taken directly from each `pick`.
{% endhint %}

<details>

<summary><strong>Example: Counter-based Animation Selection</strong></summary>

```
{switch_by_counter "pose"    
    {common
        {aim "aim_default_1" "aim_default_2"}
        {fire "fire_default_1" "fire_default_2"}
    }
    {pick 1} 
    {pick 2
        {aim "aim_alt_1" "aim_alt_2"}
        {fire "fire_alt_1" "fire_alt_2"}
    }
    {pick 1
        {idle "idle_look_around"}
    }
    {pick 1
        {idle "idle_gun_aside"}
    }
}
```

The `pose` counter has a cycle length of `1+2+1+1 = 5` (the sum of all `pick` values)

<table><thead><tr><th width="82.5390625">Step</th><th width="168.18359375">Value (counter pose )</th><th width="143.43359375">Pick block used</th><th>Animation Behavior</th></tr></thead><tbody><tr><td>1</td><td>0</td><td>First <code>pick</code></td><td>Uses animations from <code>common</code> (no overrides)</td></tr><tr><td>2</td><td>1</td><td>Second <code>pick</code></td><td>Overrides <code>aim</code> and <code>fire</code> from <code>common</code></td></tr><tr><td>3</td><td>2</td><td>Second <code>pick</code></td><td>Same as step 2</td></tr><tr><td>4</td><td>3</td><td>Third <code>pick</code></td><td>Adds <code>idle</code>, inherits <code>aim</code> and <code>fire</code> from <code>common</code></td></tr><tr><td>5</td><td>4</td><td>Fourth <code>pick</code></td><td>Replaces <code>idle</code>, retains <code>aim</code> and <code>fire</code> from <code>common</code></td></tr><tr><td>6</td><td>5 → reset to 0</td><td>First <code>pick</code></td><td>Loop restarts</td></tr></tbody></table>

</details>

### Animation playback speed

Animation playback speed is defined by a number following the animation name:

**Example:**

```
{anm "animation_name" 0.75}
```

* If speed is not defined, the default is `1.0`.
* Negative values (e.g., `-1`) play the animation in reverse.

### Conditions in the Animation Selector

The Animation Selector system supports **conditions** that adapt animation selection to the actor's current state or environment.

Conditions are defined within `if` blocks and can be:

* simple;
* compound;
* nested.

Any valid condition for the actor type can be used.

If the condition evaluates as true, only the animations within that block are considered.\
If no condition is met and no fallback animation is defined, the current animation remains unchanged.

> **Syntax of a Condition in the Animation Selector**:
>
> ```
> {if [condition]  
>     [...] ; anm or random_select
> }
> ```

Multiple conditions can be combined (implicitly using `and`).

> **Syntax of Compound Conditions**
>
> ```
> {if cond1 cond2 cond3
>     [...]
> }
> ```

{% hint style="success" %}
In the idle-selector, logical operators like `and` , `not` and `or` are also supported in compound conditions.
{% endhint %}

Conditions can be nested.

> **Syntax of Nested Conditions**
>
> ```
> {if cond1   
>     {if cond2
>         {anm "animation_1"}
>     }
>     {anm "animation_2"}
> }
> ```


# General conditions of Animation Selector

Below are the conditions currently used in the engine.\
However, the engine also supports additional condition types.

{% hint style="info" %}
Conditions used in the editor interface can also be applied in Animation Selector configurations.
{% endhint %}

<table><thead><tr><th width="274.40234375">Condition</th><th>Description</th></tr></thead><tbody><tr><td><code>fsm_tags ["name" ... ]</code></td><td>Checks whether the current FSM state contains the specified tags. The list of valid tags can be found in the FSM configuration files. For human units, these are located in <code>resource\properties\human_fsm\*</code>.</td></tr><tr><td><code>terrain_pp "&#x3C;terrain_type>"</code></td><td>Checks if the unit is located on the specified terrain type.<br>See: <a href="#terrain-type-reference"><strong>Terrain Type reference</strong></a>.</td></tr><tr><td><code>place_mask "&#x3C;mask>"</code></td><td>Checks whether the actor is linked to a place with a name matching the given mask. Wildcard <code>*</code> is supported. If the mask contains no <code>*</code>, the comparison is exact.<br>See: <a href="#actor-to-vehicle-place-linking-reference"><strong>Actor-to-vehicle place linking reference</strong></a>.</td></tr><tr><td><code>linked ["&#x3C;prop>" ... ]</code></td><td>If no properties are specified, checks whether the actor is linked. If properties are listed, checks whether the linked object (via <code>uplink</code>) has the specified tags. Property values can be found in the <code>.def</code>file of the target object.</td></tr><tr><td><code>have_enemy</code></td><td>Returns true if the actor has detected enemies.</td></tr><tr><td><code>movement_mode "&#x3C;mode>"</code></td><td>Checks whether the actor is currently using the specified movement mode.<br>See: <a href="#movement-mode-reference"><strong>Movement mode reference</strong></a>.</td></tr><tr><td><code>throwing_range &#x3C;min> &#x3C;max></code></td><td>Checks if the target is within throwing range. The values are in meters.</td></tr><tr><td><code>cover_type "&#x3C;name>"</code></td><td>Checks whether the unit is currently in a cover of the specified type.<br>See: <a href="#cover-type-reference"><strong>Cover type reference</strong></a>.</td></tr></tbody></table>

<details>

<summary><strong>Terrain Type reference</strong></summary>

In the **Gem RTS** engine, the condition `terrain_pp "<terrain_type>"` uses a predefined set of **Terrain Types**. These are defined in map configurations and influence unit behavior and animation selection (e.g., for walking, cover, vehicle movement, etc.).

* `ground`
* `swamp`
* `road`
* `deep_snow`
* `water`

</details>

<details>

<summary><strong>Actor-to-vehicle place linking reference</strong></summary>

These are common place names used for linking actors to vehicle or weapon positions:

* `driver`, `driver1`, `driver2` — driver seats
* `commander` — commander seat
* `gunner`, `gunner2`, ... — gunner positions
* `seat1`, `seat2`, ... `seat10` — passenger seats on vehicle hull
* `support1`, `support2` — gun crew positions
* `supportmove1`, `supportmove2` — mobile gun crew positions

</details>

<details>

<summary><strong>Movement mode reference</strong></summary>

Running:

* `slow` — slow run
* `normal` — standard run
* `fast` — fast run
* `bow` — crouch run
* `assault` — assault run

Walking:

* `walk` — standard walk
* `spot` — movement while scanning for targets
* `sneak` — stealth walk with alternate animations

</details>

<details>

<summary><strong>Cover type reference</strong></summary>

* `none` — not in cover
* `look_left`, `look_right`, `look_2way` — vertical covers that allow peeking
* `snipe_cover` — low cover suitable for accurate fire
* `squat_lie` — lying behind a wall
* `hide_stand` — standing cover
* `hide_squat` — crouch cover
* `open_lie` — lying in open terrain
* `terrain_lie` — terrain-based cover (dips, craters)
* `bush_stand`, `bush_squat`, `bush_lie` — cover in bushes (offers no bullet protection)

</details>


# Human-specific conditions

The following conditions are used in the Animation Selector specifically for actors of type `human`.

<table><thead><tr><th width="387.65625" valign="top">Condition</th><th>Description</th></tr></thead><tbody><tr><td valign="top"><code>human_fsm_semaphore "&#x3C;name>"</code></td><td><p>Checks whether the specified semaphore is currently active.</p><p>See: <a href="/animation/animation-system-for-actor/animation-selection-setup/configuring-idle-for-human-actor#semaphores-in-the-idle-request-selector"><strong>Semaphore documentation</strong></a></p></td></tr><tr><td valign="top"><code>human_fsm_state "&#x3C;state_name>"</code></td><td>Checks whether the current FSM state matches the specified one. Registered FSM state names can be found in FSM definitions (<code>state</code> blocks).</td></tr><tr><td valign="top"><code>human_kill_flags "&#x3C;kill_flag_name>" [...]</code></td><td>Checks whether all listed kill flags are active for the <code>human</code> actor.<br>See: <a href="#kill-flags-reference"><strong>Kill flags reference</strong></a>.</td></tr><tr><td valign="top"><code>human_fsm_counter</code></td><td>Checks the value of an FSM counter for a <code>human</code> actor.<br>See: <a href="#conditions-for-checking-fsm-counters"><strong>FSM counters reference</strong></a>.</td></tr><tr><td valign="top"><code>human_hold_strap</code></td><td>Checks whether the unit needs to hold the strap of a weapon slung over their back.</td></tr><tr><td valign="top"><code>human_throw_type</code></td><td>Checks which grenade throwing method has been selected.<br>See: <strong>Grenade throw types</strong>.</td></tr><tr><td valign="top"><code>human_stuff [holding | mounting | picking] "&#x3C;item_type>"</code></td><td><p>Checks the unit’s interaction with the specified items at the current moment:</p><ul><li><code>holding</code> — the item is currently held in hands</li><li><code>mounting</code> — the item is being equipped</li><li><code>picking</code> — the item is being picked up from the ground</li></ul><p>The item type is determined by the <code>props</code> names defined in the item’s <code>.def</code> file.<br>Multiple item types can be checked simultaneously.<br>See: <a href="#item-type-to-props-mapping"><strong>Item type to props mapping</strong></a></p></td></tr></tbody></table>

<details>

<summary>Item type to props mapping</summary>

| Item type | Properties names (props)   | Description                       |
| --------- | -------------------------- | --------------------------------- |
| `nothing` | —                          | Unit is holding nothing           |
| `bazooka` | `weapon`, `rocketlauncher` | Shoulder-fired rocket launcher    |
| `mgun`    | `weapon`, `mgun`           | Machine gun                       |
| `smg`     | `weapon`, `smg`            | Submachine gun                    |
| `rifle`   | `weapon`, `rifle`          | Rifle                             |
| `pistol`  | `weapon`, `pistol`         | Pistol                            |
| `flamer`  | `weapon`, `flame_thrower`  | Flamethrower                      |
| `small`   | `smallitemin1hand`         | Small item, e.g., a grenade       |
| `1hand`   | `itemin1hand`              | One-handed item, e.g., a canister |
| `2hands`  | `itemin2hands`             | Two-handed item, e.g., a crate    |
| `body`    | `human`                    | Corpse                            |
| `flag`    | `flag`                     | Flag                              |

</details>

<details>

<summary>Kill flags reference</summary>

<table><thead><tr><th width="160.14453125">Flag</th><th width="449.42578125">Description</th></tr></thead><tbody><tr><td><code>front</code></td><td>Killed from the front</td></tr><tr><td><code>back</code></td><td>Killed from behind</td></tr><tr><td><code>blast</code></td><td>Killed by explosion</td></tr><tr><td><code>piercing</code></td><td>Killed by bullet</td></tr><tr><td><code>go</code></td><td>The soldier was moving</td></tr><tr><td><code>run</code></td><td>The soldier was running</td></tr><tr><td><code>cover_in_trench</code></td><td>The soldier was in a trench in <code>snipe</code> state<br>⚠️ Note: The standard <code>linked</code> check won’t work here because at the moment of death, the unit is already unlinked.</td></tr></tbody></table>

</details>

#### Conditions for checking FSM counters

> **FSM counter condition syntax**
>
> ```
> if human_fsm_counter <name> [inc|get|once] <value> of <loop_number>
> ```
>
> Where:
>
> * `<name>` — the name of the counter
> * The available check modes are:
>   * `inc` — increment the counter by 1 and compare it to `<value>`
>   * `get` — check the current value without changing it
>   * `once` — return `true` if the counter value is greater than 0, and reset it to 0

<details>

<summary>FSM counter names for <code>human</code> actors</summary>

* `knife` — knife throw
* `down` — going prone
* `alert` — dodge from grenade
* `pose` — pose selection
* `forced_smoke` — smoking request triggered by script

</details>

<details>

<summary><strong>Examples:</strong> FSM counter check</summary>

```
{if human_fsm_counter "down" inc 0 of 2 [...]}
{if human_fsm_counter "down" get 0 of 2 [...]}
```

</details>


# Configuring idle for human actor

## General Principles

The following FSM states allow idle animations to be triggered:

* `board` — actor is linked to another object
* `lie_idle` — lying down
* `snipe` — peeking from behind cover
* `squat` — sitting
* `idle` — standing without performing any action

Idle animation selection occurs in two stages:

{% stepper %}
{% step %}

### Selecting r**equest** for the Animation Selector

The logic for choosing the request is defined in the **Idle Request Selector** file:\
`\properties\animation_selector\`**`human_idle_selector.set`**

{% hint style="info" %}
At this stage, you can optionally:

* switch the FSM state and/or apply semaphore locks;
* set a new FSM state.
  {% endhint %}
  {% endstep %}

{% step %}

#### Selecting idle animations

Based on the request selected in step one, specific idle animations are chosen.\
The selection logic is defined in **`human_idle.inc`**, which is part of the animation selector file:\
`\properties\animation_selector\`**`human.set`**
{% endstep %}
{% endstepper %}

The actor's current idle state is stored in the FSM to support chained transitions between idle states.

***

### **Idle Request Selector** configuration

> **Syntax of `human_idle_selector.set`**
>
> ```
> {init
> 	{state "<initial_state>"} ; required parameter
> 	{semaphore "<name>" <time_from> <time_to>} 
> }
> {selector
> 	{if <condition>
> 		{idle
> 			{run "<request_name>"} ; request to the Animation Selector
> 			{state "<new_state>"} ; optional FSM state change
> 			{semaphore "<name>" <time_from> <time_to>} ; optional semaphore override
> 		}
> 	}
> 	[...]	
> 	{idle
> 		{run ""} ; empty request
> 	}
> }
> ```

| Component                                  | Description                                                                                                                                                                                                                                                                                                                                                                                                  |
| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `{init ...}`                               | Initialization block called at game start or unit spawn. Sets the initial FSM state and semaphore locks.                                                                                                                                                                                                                                                                                                     |
| `state "<initial_state>"`                  | <p>Sets the FSM state of the actor immediately after spawning.</p><p><strong>Required</strong>.</p><p>Example: <code>"idle"</code></p>                                                                                                                                                                                                                                                                       |
| `semaphore "<name>" <time_from> <time_to>` | <p>Locks or unlocks a semaphore for a randomized time interval (in seconds).<br>Example: <code>semaphore "can\_smoke" 10 30</code> disables smoking for 10–30 seconds.</p>                                                                                                                                                                                                                                   |
| `{selector ...}`                           | Main block that defines the logic for choosing requests of the Animation Selector based on current FSM state and conditions.                                                                                                                                                                                                                                                                                 |
| `{if <condition> ...}`                     | <p>Conditional block.<br>Checks FSM state (<code>fsm\_tags</code>, <code>human\_fsm\_idle\_state</code>), semaphore status (<code>human\_fsm\_idle\_semaphore</code>), item interaction (<code>human\_stuff holding</code>), etc.<br>See: <a href="/animation/animation-system-for-actor/animation-selection-setup#conditions-in-the-animation-selector"><strong>Condition syntax reference</strong></a></p> |
| `{idle ...}`                               | <p>Defines what to execute if the condition is met. Typically includes a <code>run</code> command to call the Animation Selector.<br>May also include optional <code>state</code> and <code>semaphore</code> parameters.</p>                                                                                                                                                                                 |
| `run "<request_name>"`                     | <p>Triggers the specified request, which is then handled in <code>animation\_selector/human.set</code>.<br>Example: <code>run "stand\_smoking\_begin"</code> will use that request name to find matching animations.<br>An empty string means no new animation is triggered and the current one continues playing.</p>                                                                                       |

{% hint style="info" %}
When an empty request is triggered, the actor remains still for a short time, after which the request selection restarts.
{% endhint %}

### Idle states

In **Men of War II**, two idle states are used:

* `idle` — plays regular idle animations
* `smoking` — plays smoking animations

{% hint style="danger" %}
To enable idle animation selection for a state that didn’t previously support it, FSM logic must be extended to include idle handling.
{% endhint %}

### Semaphores in the **Idle Request Selector**

Semaphores are used to control the frequency and conditions under which specific requests can be triggered.\
They provide time-based restrictions that prevent all units from animating in sync.

> **Semaphore syntax**
>
> ```c
> {semaphore "<semaphore_name>" N}
> ```
>
> * `N` is the lock time in seconds

Semaphore states:

* **unlocked** — `N = 0`
* **locked** — for the specified time `N`

{% hint style="success" %}
Using two values for semaphore lock time is recommended to introduce random duration, promoting natural variation in unit behavior and avoiding synchronized animations.
{% endhint %}

{% hint style="info" %}
New semaphores are defined inside the `init` block
{% endhint %}

<details>

<summary>Idle request semaphores used in <strong>Men of War II</strong></summary>

<table><thead><tr><th width="176.09765625">Semaphore Name</th><th>Description</th></tr></thead><tbody><tr><td><code>can_smoke</code></td><td>Controls whether the smoking cycle can begin. While this semaphore is locked, the unit cannot trigger the request <code>stand_smoking_begin</code>. It is locked after each cigarette and unlocked after a random delay (e.g., 5–10 or 60–120 seconds).</td></tr><tr><td><code>can_inhale</code></td><td>Controls the interval between inhales during smoking. Used within the <code>smoking</code> state to determine when the <code>stand_smoking_process</code> request can be triggered. It is locked for a few seconds after each inhale.</td></tr><tr><td><code>can_action</code></td><td>Allows the execution of active idle behaviors (e.g., scratching, shifting weight). While locked, the unit will only play neutral idle animations such as <code>stand_breath</code>, <code>squat_breath</code>, or <code>lie_breath</code>. The lock controls the frequency of animation changes.</td></tr><tr><td><code>stop_smoking</code></td><td>Restricts the ability to end the smoking cycle. While active, the request <code>stand_smoking_end</code> will not be triggered. This is used to ensure a minimum duration in the <code>smoking</code> state to make smoking appear realistic.</td></tr></tbody></table>

</details>

<details>

<summary><strong>Example:</strong> Using semaphores in the <strong>Idle Request Selector</strong></summary>

```c
{init
	{state "idle"}
	{semaphore "can_smoke" 10 30} ; don't smoke right away
	{semaphore "can_inhale" 3 5}
	{semaphore "can_action" 5 15} ; start from breathing
}
{selector
	[...]
	{idle
		{run "stand_smoking_begin"} ; request to animation_selector/human.set
		{state "smoking"} ; change FSM state
		{semaphore "stop_smoking" 20 40} ; lock completion for 20–40 sec
		{semaphore "can_inhale" 3 5} 
	}
	[...]
}
```

Explanation

**`init` block**

* `{state "idle"}`\
  Sets the unit’s initial FSM state to `idle`.
* `{semaphore "can_smoke" 10 30}`\
  Prevents the unit from starting the smoking cycle immediately. Smoking becomes available only after 10–30 seconds.
* `{semaphore "can_inhale" 3 5}`\
  Sets the delay before the first inhale, in case the unit starts smoking soon after spawning.
* `{semaphore "can_action" 5 15}`\
  Sets a pause before the unit can perform more active idle animations. While the semaphore is locked, only breathing idles will play.

**`idle` block**

* `{run "stand_smoking_begin"}`\
  Triggers the `stand_smoking_begin` request. It will be passed to `animation_selector/human.set`, where the appropriate smoking start animations will be selected.
* `{state "smoking"}`\
  Updates the FSM state to `smoking`, which affects future request selection and conditions.
* `{semaphore "stop_smoking" 20 40}`\
  Locks the `stop_smoking` semaphore for 20–40 seconds. While active, the unit will not trigger `stand_smoking_end`.
* `{semaphore "can_inhale" 3 5}`\
  Sets the pause before the next inhale (e.g., to allow `stand_smoking_process` in the next cycle).

</details>

### Conditions

Compound conditions in the **Idle Request Selector** use logical operators `and`, `or`, and `not`.

Conditions used with highest priority:

```
{if human_fsm_idle_semaphore "can_smoke"}
{if human_fsm_idle_state "smoking_begin"}
{if fsm_tags "board"}
```

<details>

<summary>Examples of conditions used in the Idle Request Selector</summary>

| Condition                               | Meaning                                                                                          |
| --------------------------------------- | ------------------------------------------------------------------------------------------------ |
| `fsm_tags "board"`                      | Checks whether the FSM state has the `board` tag.                                                |
| `human_fsm_counter "forced_smoke" once` | <p>Checks the FSM counter <code>forced\_smoke</code>.<br>See: \[FSM Counter Check Reference]</p> |
| `human_stuff holding "nothing"`         | Checks that the actor is holding nothing in their hands.                                         |
| `human_fsm_idle_state "idle"`           | Checks the current FSM idle state.                                                               |
| `human_fsm_idle_semaphore "can_smoke"`  | Checks whether the specified semaphore is unlocked.                                              |
| `able "attention"`                      | Checks if the `attention` ability is available.                                                  |
| `not able "attention"`                  | Inverse check — confirms that `attention` is not available.                                      |

</details>

<details>

<summary>Example: Nested compound condition in Idle Request Selector</summary>

```
{if fsm_tags "up" 
    {if human_fsm_counter "forced_smoke" once and human_stuff holding "nothing" and human_fsm_idle_state "idle" 
        {idle [...]} 
    } 
} 
```

This example uses a two-level nested condition, where each sub-condition must be true for the idle block to be executed.

**First-level condition:** `{if fsm_tags "up"}`

This block is only evaluated if the unit’s FSM state includes the tag up — for example, standing, not in cover, and ready to act.

**Second-level condition**\
All three conditions must be met:

1. `human_fsm_counter "forced_smoke" once`\
   Checks the forced\_smoke counter:
   1. If the value is greater than 0 → returns true and resets the counter to 0;
   2. If the value is 0 → returns false.\
      This is used for one-time forced actions (consume and reset).
2. `human_stuff holding "nothing"`\
   Verifies that the unit is not holding any item or weapon. I\
   f the unit is holding something, the condition fails.
3. `human_fsm_idle_state "idle"`\
   Ensures that the current internal FSM idle state is `idle`.\
   Prevents conflicts — for example, avoids triggering the same request again if the unit is already smoking.

</details>

### Examples of Requests for Idle Animation Selection

The table below shows request names defined in the idle request selector and used with the `run` command.

{% hint style="info" %}
The `_idle` index in request names typically denotes more active idle behaviors,\
while the `_breath` index denotes breathing or subtle movement animations.
{% endhint %}

<table><thead><tr><th width="249.09375">Request name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>stand_idle</code></p><p><code>stand_breath</code></p></td><td>Standing — idle or subtle breathing animation</td></tr><tr><td><p><code>squat_idle</code></p><p><code>squat_breath</code></p></td><td>Sitting idle</td></tr><tr><td><code>snipe_breath</code></td><td>Peeking over low cover (e.g., trench, waist-high fence)</td></tr><tr><td><p><code>lie_idle</code></p><p><code>lie_breath</code></p></td><td>Lying idle</td></tr><tr><td><code>stand_smoking_begin</code></td><td>Lighting a cigarette</td></tr><tr><td><code>stand_smoking_process</code></td><td>Inhaling</td></tr><tr><td><code>stand_smoking_end</code></td><td>Putting out the cigarette</td></tr></tbody></table>

{% hint style="info" %}
Custom animation requests can be defined and mapped in `human_idle.inc`
{% endhint %}


# Pose selection for human actor

The pose selection logic is defined in `\properties\animation_selector\`**`human_pose_selector.set`**

By default, on spawn the unit has no pose animation assigned.\
The Pose Selector triggers on the first valid match of one of four requests whose names correspond to pose types.

**Pose types:**

* `snipe` — peeking over a fence or out of a trench;
* `squat` — sitting;
* `stand` — standing;
* `lie` — lying.

For each of the four requests, the logic for selecting a specific pose is described using `if`-block conditionals.

## Pose animation set

Each human pose has three animation sets:

* aim — aiming;
* fire — recoil animation on shot;
* idle — the position from which idle animations start.

Each of the aim, fire, and idle sets may contain either a full-body animation or two separate animations for the torso (head and arms) and the pelvis (legs).

## Pose Selector configuration

To specify the animation set that corresponds to the selected pose, use the `pose` block.\
It is also possible to select an animation set by the FSM counter pose.

> **Pose Selector file template**
>
> ```
> {stand
>     {if <condition>
>         {pose
>             {aim ["<anm_aim" | "<anm_aim_down>" "<anm_aim_up>"]}
>             {fire ["<anm_fire" | "<anm_fire_down>" "<anm_fire_up>"]}
>             {idle ["<anm_idle" | "<anm_idle_down>" "<anm_idle_up>"]}
>         }
>     }
>     [...]
>     {pose [...]}
> }
> {snipe [...]}
> {squat [...]}
> {lie [...]}
> ```

Specifying animations for the **fire set** is optional; if omitted, firing is performed without a body animation.\
If only the **aim set** is defined, idle animations are taken from `aim`.\
The **idle set** alone may be defined if the pose does not allow aiming or shooting.

<details>

<summary>Example: Pose selection with specified animations</summary>

```
{pose
    {aim "pose_stand_fire_mgun_down" "pose_stand_fire_mgun_up"}
    {fire "stand_fire_mgun_down_1" "pose_stand_fire_mgun_up_1"}
    {idle }
}
```

</details>

<details>

<summary>Pose selection by FSM counter <code>pose</code></summary>

<pre><code>{switch_by_counter "pose"
    {common
        {aim "pose_stand_fire_mgun_down" "pose_stand_fire_mgun_up"}
<strong>        {fire "stand_fire_mgun_down" "stand_fire_mgun_up"}
</strong>    }
    {pick 1}
    {pick 1
        {aim "pose_stand_fire_mgun_down_1" "pose_stand_fire_mgun_up_1"}
        {fire "stand_fire_mgun_down_1" "pose_stand_fire_mgun_up_1"}
    }
    {pick 1
        {idle "pose_stand_look_around_gun_1"}
    }
    {pick 1
        {idle "pose_stand_gun_aside_2"}
    }
}
</code></pre>

</details>




---

[Next Page](https://docs.bestway.com.ua/llms-full.txt/1)

