The three virtues of a programmer: Laziness, Impatience, and Hubris. – Larry Wall

Legacy:Basic Bot Pathing

From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 20:07, 23 September 2006 by SuperApe (Talk)

Jump to: navigation, search

This is an introductory tutorial on Basic Bot Pathing, aka Pathing.

Prerequisites

This tutorial assumes you know many of the Category:Legacy Basic Procedures: Create a Room, Add an Actor, Set the following Properties and Match these Tags. It assumes you have already been through many of the Mapping Lessons and have a custom map of your own, ready to implement Bot Support.

Overview

Pathing is a necessary step before release of any custom map, and the better the pathing is, the better the reviews your map will receive.

Bots navigate a map by moving through a network of NavigationPoints, the simplest of which is called a PathNode. When a bot wants to get somewhere, the game finds the node nearest his current position and the node nearest his objective, calculates the shortest path through the network from one to the other, and tells the bot to follow that path. Thus, in order to get bots to play your map, you need to place enough PathNodes for bots to be able to use them to get to anywhere they might need to go.

Placing Basic PathNodes

Simply right-click on the location where you want to place a pathnode, and then select "Place PathNode Here." Build up the botpath network by placing more PathNodes at junctions and intersections where you want your bots to be able to go. You'll need to Rebuild your paths (use the Build Paths button on the Toolbar) for any changes you make to take effect. While you don't need to litter the map with PathNodes, it's important to make sure of a few things:

  • Each intersection or junction has a PathNode.
  • Changes in elevation or line-of-sight are marked with a PathNode. (such as the top and bottom of a staircase)
  • Long stretches between PathNodes are filled in with enough nodes to link them together.
  • Any tight hallway has a PathNode set at either end, in the center of the entrance and exit.
  • Lines-of-sight between PathNodes are clear. (Imagine bots may travel in straight lines between connected PathNodes)
  • Various actors such as inventory items act as pathnodes themselves, so there is no need to place a node right on top of them.

See the tips section below for more info.

Placing Advanced PathNodes

Bring up the Actor Browser, and under NavigationPoint, select the type of PathNode you wish to create to make it your current actor. In the 3D view, place a node by right-clicking on the floor and clicking the option with the name of the PathNode actor you just selected.

Viewing The Path Network

To see the path network you're building, right-click on the grey bar at the top of the 3D viewport to bring up the Viewport Context Menu and select "Show Paths" under the view submenu.

Buidling The Path Network

Be careful not to place too many; an excessive number of nodes may slow your map down, and is likely to confuse bots. A good strategy is to start with only the PathNodes you know you'll need. Then try to Build Paths. If you get errors regarding "orphaned" or "stranded" nodes, you can adjust them or add more to link them together. Add a few more and try to Build Paths again. Little by little, you'll be adding only the PathNodes necessary and limiting overkill. Too many pathnodes can slow the map down and make the network overly complicated – your goal should be to cover all of the map with the minimum of nodes.

Tips

  • Line of Sight For a bot to be able to move from one node to another, the two nodes must be within a line-of-sight of one another, and not too far apart. See "Viewing the Path Network" Above, and then see how far two nodes can be moved apart before the connection dissapears to get a good esitmation of the max. distance.
  • Distances A distance of 300 to 700 UUs seems to work well. Place them closer together on uneven or broken ground and farther apart on open floors. No farther then 300 to 350 on steps and ramps. The absolute minimum distance should be 50UU. UnrealEd will notify you if your paths are too close together.
  • No space to add nodes If you ever select Add PathNode and nothing appears, it means that there wasn't room to add it. Keep trying in different spots nearby until it works. You can check the ScriptEditor for error messages that indicate why the PathNode wasn't placed.
  • Minimize the number of nodes Don't forget that too many NavigationPoints can slow the map down; the more nodes in the network, the more time it takes to calculate a path through it. So don't go overboard. Try to economize as much as possible. Too many nodes can also cause bots to start running in circles or other erratic behavior.
  • Bots like inventory items. MiniHealth pickups, for example, can be used as incentive to follow a route. Remember that inventory items also act as pathnodes, whether they are spawned or not, so there's no need to put a pathnode at the item. Keep in mind that bots will go out of there way to collect them. See Inventory Item Placement for how these items should best be added.

Other NavigationPoints

Once you've got the whole level covered with PathNodes, you can begin to look for special points that need more than a basic PathNode NavigationPoint. JumpSpots, for example, are points that are good destinations from a jump. You would want to identify any PathNode near the edge of or at the bottom of a ledge and replace it with a JumpSpot.

Other types of NavigationPoints such as PlayerStarts, FlagBases in CTF maps, ControlPoints in Domination maps, Pickups and InventorySpots also act as nodes in the botpath network, so you don't need to add PathNodes near those items.

When it's time to handle the more advanced bot behaviors such as riding lifts, using jump pads, ImpactJumping, Translocator use, etc., here are some specific pages to look over:

Testing & Troubleshooting

While working on the bot support, you will need to make sure the botplay is working. You will have to focus on the bots as they try to play in the map. By spectating a bots-only game, you can identify trouble spots or behaviors that you'd like to change.

Occasionally a bot can get "stuck" and moves from one node to another, back and forth. The cause is related to the bot's current goal; a pickup, a LiftExit, etc. For one reason or another, the bot believes the goal is reachable, but it cannot reach it, so it turns back only to decide it should try and reach it again. That behavior can continue on indefinately in some cases. The are two possible solutions for this:

  1. Place another node to allow the bot to reach their goal.
  2. Move things around a bit; either the PathNodes or the bot's goal item.

See also Bot Mind and Testing Botplay for more on troubleshooting and how to determine what the bot's goals are.

External Links

Related Topics

Discussion

SuperApe: Revised to look more like a tutorial. Comments welcome.

Bob_The_Beheader: Pathnodes can be created without having to bring up the Actor Browser. On the right-click menu there is a command "Add Path Node Here." Path node does not need to be selected in the actor browser for this to appear. It works with PlayerStarts and Lights as well.

SuperApe: Very true. Thanks for the revision.