| Home Page | Recent Changes | Preferences

# Pathnoding

Merging & refactoring needed:

- this page
- Bot Navigation
- Basic Bot Pathing

Tarquin: I think there's a need to seperate the basic actions involved in bot pathing (how to place, building, seeing) and strategies for smart pathing (keep bots moving, tackle obstacles etc). Thoughts?

## Overview

Bots are dumb. They know how to walk, run and shoot and that's about it. The AI code that drives them doesn't have the power to interpret the 3D world we see them in. Instead, a map has to have a set of waypoints, joined together to make a network which the bots follow, much like Pacman did in days of yore. These waypoints are mostly actors of the class Actor >> NavigationPoint >> PathNode. Other types allow bots to tackle more complex things, such as lifts, jumping, translocating and camping.

## Creating the network

### Placing nodes

There are several ways to place nodes:

Manually
  simply place Actor >> NavigationPoint >> PathNode actors like you would add an actor of any other class. Placing in the 3D view will usually place them at the appropriate height, although you may want to adjust them manually when placing on ramps and stairs. port with Surface Context Menu → Add Pathnode here. See below for spacing & dealing with obstacles.
Path Build button
  The paths build button (not a good things to use, I hear)
PathLogic
  PathLogic

Dark Pulse: Isn't the Paths Build option to make the Paths, and not to create new PathNodes?

Nomad Robot: I think he means the "Create New Path Network" button, which deletes all existing nodes and generates new ones.

### Building

Once nodes are placed the path network must be built, in the same way that geometry and lighting are. See Build for more...

## Seeing the network

Use Show Paths to trouble shoot the network after re-building paths. Do Viewport Caption Context Menu → View → Show Paths.

Once the paths are visible, you can hit Q to hide the BSP and W to hide static meshes, so the 3D viewport shows just the network. (see Hiding Actors for more)

You should see a bunch of lines connecting the pathnodes. They are color coded depending on their nature:

### UT2003 Color Codes

White: A nice, wide path for the bots to follow. The bots will have no trouble following this path. (In theory.)

Green: Not as good as a white path, but still a perfectly good path. Bots prefer white paths but generally there are other factors that influence their decision so this is not as big of an issue.

Blue: This path is technically a good path, but is quite narrow. Bots will prefer a green or white path but will attempt to take this one if it is the only path availible.

Purple: Purple paths designate jumpspots, lifts, teleporters, etcetera. They have their own UScript to define how bots feel about this type of path. If paths are not shown, a pink arc will show the expected path that a pawn will take when launched from the jumppad. When paths are shown this pink line will disappear.

Light Purple: A path that takes the bot up or down a ladder.

Yellow: A forced path. Bots will always take this path even if better paths availible. A path must be specifically set as forced in the pathnode properties.

Red: A proscribed path. The pathnodes joined by this line, while technically connected, should never be taken from bots. However, that is not to say that a bot will not end up at the other pathnode as a result of being hit, etc. and may continue along the path by "skipping" over the proscribed path. A path must be specifically set as proscibed in the pathnode properties.

### UT Color Codes

In UT, there is only two colors of path - good ones and bad ones. Blue paths are good paths that the bots should have no trouble with. Red paths are not very good paths but the bot will attempt them anyway if it has no blue paths to take.

## Pathing Techniques

Pathnodes should generally be placed at eye level more than 50 units and no farther than 700 units apart, and no farther than 300-350 units apart on steps and ramps. Some good rules to follow are to place them at intersections and to not place them too close together. If pathnodes are too close together, UnrealED will notify you the next time you build the paths. Also note that since pickups are pathnodes too, you should not place pathnodes too close to pickups, or for that matter, place pickups too close together, unless the paths between them are proscribed (though this will result in unrealistic pickup tendencies by bots).

#### Water

Don't place pathnodes above water but in it or bots will bob up and down under the pathnode trying to reach it.

### Keep them moving

Bots are "DM Machines". They love powerups, health, weapons, and ammo and will not do a thing if you have none in your map, no matter how many pathnodes you place. Use inventory and powerups in place of pathnodes. I usually place inventory and powerups first and then "connect" them with pathnodes.

Bots like inventory items – use them as incentive to make a bot follow a route. Inventory items also act as pathnodes, whether they are spawned or not, so there's no need to put a pathnode at the item.

### Assorted Notes

- Don't forget that too many pathnodes can slow the map down. So you have to be careful of that as well.

## Advanced Bot Behaviour

Other pages cover in detail how to make bots tackle more complex elements of their environment:

- Pathnoding Lifts: dealing with lifts
- Pathnoding Kickers: dealing with jump pads
- Pathnoding Translocators: dealing with tranlocators.
- Strategic Bots: DefensePoints, Sniping

### How the Pathnode Network is Used

The bot movement is actually quite simple. The bot first decides where it wants to end up. Usually a powerup or a weapon, but sometimes it is an enemy flag, ball, ball gate, etcetera. If that object is not a pathnode itself, it finds the pathnode nearest it's goal. If it is a pathnode than the object itself is used.

The bot then finds the pathnode nearest itself. It then traces the "best" path from it's goal/goal's nearest pathnode to the nearest pathnode. It then makes a beeline from pathnode to pathnode until it reaches it's goal. The bot will interpolate a little bit to prevent it from suddenly changing direction when it touches a pathnode. Note that a bot will generally only make beelines between pathnodes, so you must place a pathnode at any place that the bot is going to have to turn. If the lines connecting pathnodes cross ANY solid obstacle, the bots will probrably (but not always) have problems getting around that obstacle.

Bots do not generally seek out other players, preferring to find pickups until the player eventually finds itself within their field of view. If the player runs away the bot may "hunt" it for a short while. During this time the bot has the target player as it's "goal" actor.

## When Bots get Confused

- Occasionally a bot gets 'stuck' and keeps running from one node to another, back and forth. The are two possible causes for this:
  - There's no link to another pathnode on the other side of a 'dead end' in pathing. The bot keeps trying to get somewhere but can't. Solution: make another node to allow the bot to reach the other side of the dead end.
  - The bot is trying to go to a pathnode, inventory item or LiftExit/Center and cannot reach it. Solution: Move things around a bit, make them a little farther/closer to the bot. Keep experimenting until the problem ceases.

Link to Mind Reader

## Related Topics

- Artificial Intelligence is the main topic page for bots and the like
  - Bot Navigation covers bot pathing from a more technical side.
  - Types of Pathnode

## External Links

- [The Nucleus - Basic Bot Pathing]: Learn how to properly path your level for bots, and discover how bots think.

## Discussion

Category To Do

Category Mapping

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

Mapping Topics

Mapping Lessons

UnrealEd Interface

Questions&Answers

Scripting Topics

Scripting Lessons

Making Mods

Class Tree

Questions&Answers

Modeling Topics

Questions&Answers

Log In