# 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="/files/htK3Crf5XWLJx1rc3n9e" 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.&#x20;

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.


---

# Agent Instructions: Querying This Documentation

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

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

```
GET https://docs.bestway.com.ua/game-settings/movement-on-slopes.md?ask=<question>
```

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

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