Basic BotPathing
Telling Bots Where to Go

Back to Actors | Up to Your First Level directory | Continue to Texturing
Home | UT2004 Tutorials | Key Terms | Multiplayer Design

    So now you know how to make a room and run around in it.  You've probably played around with it some to experiment with different layouts (if you haven't, do that now) and maybe you've discovered some important aspects of flow and height variation that we'll get to later.  Regardless, if you've done any fighting you're probably getting pretty tired of the bots, who seem to be completely oblivious that there's anything more to the map than the Playerstart they spawned at.

    Subtract out a couple rooms so you have a decent-sized layout.  Maybe throw in a little height variation--say a ledge 80 units high.  Don't make any passages too thin or low.  Now, right-click on the floor and choose PathNode from the context menu.  You should see an icon that looks like an apple appear above where you clicked.  Pathnodes are the basic instrument in "botpathing" a map; they act as waypoints to tell the bots where they can and cannot go.  As bot skill increases from Novice to Godlike, bots will stray farther and farther from the points, but while Novice bots travel essentially straight from one pathnode to the next with little variation, even Godlike bots won't go places where no pathnodes have been placed.  Pathnodes should be placed within sight of each other, no more than 1000 units away.  Don't put them really close to each other, but you don't need to have them as far away from each other as possible.  The point is to create a web of paths that will reach pretty much every part of your map.  Be aware that pathnodes indicate that the space around it and around the paths to other pathnodes is okay for bots to move in.  Go ahead and place some pathnodes around your map now, keeping in mind that Playerstarts act like pathnodes as well.

    Playerstarts and pathnodes are part of a larger family called NavigationPoints.  Any subclass of NavigationPoint does essentially the same thing as a pathnode, but all the other actors are more complex with varying functions.  For now, just remember that PlayerStarts are part of this family, and that inventory items automatically create their own NavigationPoints for bots called InventorySpots.  InventorySpots are invisible by default.

    If you've finished placing the pathnodes, go ahead and try out your map (don't forget to add playerstarts, lights, and rebuild when you're done).  Type 'addbots 1' in the console to insert a bot into your map.  Hit [Esc] and click "Spectate" to watch your bot run around with reasonably more intelligence than he did before, or just have a quick match.  Don't be too worried if it doesn't move--right now, it doesn't have any objectives.

    Back in the editor, right-click on the gray bar above any of the viewports (preferably the 3D one, as it's the most flexible) choose View from the context menu, and click Paths.  You will see a lot of colored lines appear between pathnodes.  These lines represent the paths bots can take from one navigationpoint to another; if no line is showing, no path exists there.  Remember that paths are just a general guide, and that bots will treat the paths as wider and wider areas (not just thin, linear paths) as their skill level rises.

    Notice the different colors of paths.  Depending on how wide you made your rooms/corridors, you probably see some white, green, and maybe blue paths.  The white paths are the widest, and bots will usually choose this path over others if the "reward" (explained later) is the same.  Vehicles can travel down these paths without special vehicle-pathnodes (explained later).  Green paths (there are some minor variations in the shade of green, but they don't really mean anything) indicate medium-wide paths which bots will often take on foot.  Blue paths are the smallest, and will be avoided by bots as much as possible unless they yield an especially inviting result.  Other colors of paths which you shouldn't be seeing at this point include purple, which indicate "special" paths for ladders, JumpPads, and teleporters; yellow, which shows "forcedpaths"; and red, which show "proscribedpaths."

    Forcedpaths, contrary to what the name implies, do not actually force bots to travel along that path.  Instead, they require that a path exists between two navigationpoints, though bots can still choose not to go that way.  They're usually used to connect certain essential actors, as you'll see in a moment.  Similarly, proscribedpaths mean that the path is 'cut,' so bots will not voluntarily travel directly between the points that have been proscribed from each other.  However, bots can still be forced between the points if they are pushed by a shock beam, for example, and they may still travel along the same path if a nearby path is wide enough to overlap.  To use the Forced/Proscribedpaths option, open the properties of a navigationpoint and expand the NavigationPoint tab.  At the bottom of the options that appear will be two arrays called ForcedPaths and ProscribedPaths.  Notice that only four actors can have a path forced/proscribed to them from each actor.  In the cells of either array, you must put the Name of the relevant actor--not the Tag--which you can find in that actor's Object tab in its properties.

    You may have noticed as you watched your bot run around in your map just now that he didn't jump up onto the high ledge we made, though if you made any height variation small enough to reach with a single jump, he probably went there.  However, if the bot started on the ledge, he probably jumped down.  As you may have noticed, this is because paths are generated from the pathnodes higher up on the ledge to those on the lower level, but not the other way around.  To get bots to do special kinds of jumps (including double-jumps back up to the ledge) we use JumpSpots.  Find the JumpSpot in the Actor Browser by expanding NavigationPoint>>JumpDest.  Choose JumpSpot (don't expand it) and use the right-click context menu to place the actor as you learned in the last section.  Place it a about 32 units away from the edge of the ledge.  Now, force a path from a pathnode on the lower level to the JumpSpot.  Rebuild and View Paths, and you should see a yellow line connecting those actors.  Make sure the connected pathnode is close enough to the ledge, because bots usually start their double-jump from that actor.  In addition, set the JumpDest>>bForceDoubleJump property to True.

    Other important properties of NavigationPoints (and in particular, JumpSpots) include:

NavigationPoint tab
bBlocked=True: makes this navigationpoint unusable.
bMakeSourceOnly=True: paths are generated away from this navigationpoint, but not towards.
bOneWayPath=True: if Advanced>>bDirectional=True, bots who have reached this navigationpoint can continue only in the direction towards which the navigationpoint is pointing.
bVehicleDestination=True: forced paths take on maximum width so that all vehicles think they can pass through, regardless of how wide the path actually is.  Use with caution.
ExtraCost: raising this value from its default (0) makes bots use it less and less as the value goes up.  Values higher than 100 should make them avoid it altogether unless it's the only way to a very powerful incentive, but you'll have to experiment with the number to use.

JumpSpot tab
bDodgeUp=True: bots will dodge-jump against slopes to reach this navigationpoint.
bForceAllowDoubleJumping=True: shortens the time it takes to calculate a double-jump by assuring the bot that he won't miss.
bNeverImpactJump=True: bots will not use the Shield Gun to reach this navigationpoint.
bNoLowGrav=True: bots will not attempt to reach this navigationpoint if LowGrav is enabled.
bOnlyTranslocator=True: bots will only use the translocator to reach this navigationpoint.
TranslocTargetTag: if bots are having trouble translocating to the desired place, you can place another actor (generally a LookTarget) in the place that you want them to aim the translocator and put that actor's tag in this field.
TranslocZOffset: if bots are shooting the translocator too low or too high, you can set a number here to specify how many units higher than the JumpSpot actor the bots should aim when attempting to translocate to this navigationpoint.

    As you may have guessed from the last 3 properties, JumpSpots are also used to indicate locations where bots should translocate to.  Bots will translocate to any pathnode on the same vertical level as themselves, but they will not use the translocator to get across gaps, through small holes, or up large distances unless specifically directed using these properties.

    There are many other types of navigationpoints, some of which will be covered in special sections because they pertain to other actors or ideas (such as LiftCenters and LiftExits).  In addition, some types will be covered in the "Other Play-Affecting Actors" section.  To get a good idea of how, where, and why to place navigationpoint actors, refer to the later chapter on Bot Mind or check out the relevant UnrealWiki page.

    As a last note, a couple of console commands should help you in your quest to debug your botpathing (often, Spectator mode is your most powerful tool, but these are useful as well):

RememberSpot causes the place you're standing to be memorized.  Typing ShowDebug will then show a white path going directly back to that spot and green paths going back to that spot via navigationpoints (if possible) in addition to its other functions.
ReviewJumpSpots
adds a bot into the map at every location with a forcedpath to a jumpspot and has it try to do all types of jumps on every jumpspot.  Optionally, you can add the words "transloc," "combo," "jump," or "lowgrav" to specify the type of jump the bot will attempt.  Most useful in Spectator mode.
ShowAI is similar to ShowDebug except that it shows a lot of information about the bot that's currently being viewed, including its goals and where it's trying to go.
ShowDebug shows a lot of information about the character you're using or viewing.  Most useful when Spectating.
SoakBots will pause the game immediately if any bot finds an error.  The view will snap to the bot and the error will be reported.  Press any key bound to a command to resume.
Viewclass [class] snaps the view to the specified actor class.  For example, typing viewclass pathnode will snap your view to a pathnode, and repeating the command will cycle through the other pathnodes.
ViewFlag snaps the view to a player carrying either flag.

    Because there's nothing in your map right now, you might have to use some of these to make sure your bot can get up onto the ledge.  Go ahead and try it.

    In addition, there are various botpathing errors that will be reported upon rebuild if the engine encounters them.  They are mostly self-explanatory, so they won't be explained here, but most of them are listed on the Map Build Errors page on the UnrealWiki, which I wrote.

 

Review

Top | Back to Actors | Up to Your First Level directory | Continue to Texturing
Home | UT2004 Tutorials | Key Terms | Multiplayer Design