# 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>
