> For the complete documentation index, see [llms.txt](https://docs.bestway.com.ua/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bestway.com.ua/game-settings/movement-on-slopes.md).

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