---
description: Getting around.
---

# Navigation

Navigating through the game world can be complicated, but RuneMate provides various path-finding algorithms to make this easier.

* BresenhamPath - a straight path between two points
* ScenePath - (fast) content-aware pathing within the current game scene
* WayPointPath - connects waypoints using ScenePath for traversing longer distances
* WebPath - obstacle/teleport handling pathing across the whole game world

Each of these pathing APIs has their own pros and cons.

{% hint style="info" %}
When using these path-finding algorithms it is important to ensure that both the start and destination positions can be walked on - you can't path to something you can't stand on!
{% endhint %}

### BresenhamPath

This pathing algorithm generates a straight line between two points. This is useful for very short distances or as a last-resort fallback.

```java
Path path = BresenhamPath.buildTo(coordinate);
path.step();
```

### ScenePath

This pathing algorithm attempts to mimic the pathing used by RuneScape when you click on the minimap or use "Walk here" on a tile in-game. ScenePaths are not able to handle obstacles like doors and agility shortcuts.

```java
Path path = ScenePath.buildTo(coordinate);
if (path != null) {
    path.step();
}
```

{% hint style="warning" %}
Remember your null checks! RuneScape is a dynamic game and queries are not guaranteed to succeed, so failing to properly null check may result in crashes due to NullPointerExceptions.
{% endhint %}

### Pathfinder (Global)

This is a pathing system capable of tranversing across the majority of the game world, including the use of teleports, obstacles, charter ships, etc.

See more:&#x20;

{% content-ref url="global-pathfinding" %}
[global-pathfinding](global-pathfinding)
{% endcontent-ref %}

### Legacy WebPath

This path-finding algorithm attempts to build a path that can handle obstacles, shortcuts and teleports across large distances. Building these kinds of paths can be very slow, so it may be worthwhile to implement a caching system that allows you to re-use the paths.

```java
WebPath.buildTo(coordinate);
```
