The three virtues of a programmer: Laziness, Impatience, and Hubris. – Larry Wall
Legacy:Basic Bot Pathing
This is an introductory tutorial on Basic Bot Pathing, aka Pathing. To better understand the concepts and elements of a bot path network, see Bot Pathing.
Contents
Prerequisites[edit]
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 Pathing.
Overview[edit]
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[edit]
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.
Viewing The Path Network[edit]
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[edit]
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[edit]
- Line of Sight For a bot to be able to move from node to node, the two nodes must be within a line-of-sight of one another, and not too far apart. See "Viewing the Path Network" above.
- Distances See how far two nodes can be moved apart before the connection dissapears to get a good esitmation of the maximum distance. 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 distance must be at least 50UU, otherwise UnrealEd will notify you that your paths are too close together upon rebuild.
- 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 or momentarily turn off grid snap until it works.
- 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.
- 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 may go out of their way to collect them.
See also Inventory Item Placement for how Inventory items should best be added.
[edit]
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.
[edit]
Bring up the Actor Browser, select the type of NavigationPoint you wish. In the 3D view, place a node by right-clicking on the floor and selecting the "Place <YourActor> Here" option.
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:
- Bot Pathing – Concepts and elements of a bot path network.
- The full list of available NavigationPoints
- Strategic Bots – Advanced bot support.
Testing & Troubleshooting[edit]
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:
- Place another node to allow the bot to reach their goal.
- 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[edit]
Related Topics[edit]
- Bot Support – Main topic
- Bot Pathing – Concepts and elements of a bot path network
- Strategic Bots – Advanced bot support
- Bot Mind – Understanding the bots
- Testing Botplay – Ensuring reliable bot support
- Topics On Mapping
- Map Design
- Inventory Item Placement – Placing inventory items from a gameplay standpoint
Discussion[edit]
SuperApe: Revised to look more like a tutorial. Comments welcome.