Bot Path Noding 101
By:
Adam ‘Muad'dib’ Stiles
http://www.planetunreal.com/muad
PRE-REQUISITES:
Basic knowledge of UnrealEd
An amount of time and patience
Bot pathnoding. A lot of mappers cringe at those words, but they're really not all that terrifying if you know the basics first. If you're new to mapping or even if you're from the old-school quake community, bot path noding may be an entirely new concept. Gone are the days when a mapper could build a nice map intended for living breathing people to populate and play within - now, with the advent of Unreal Tournament (as well as Quake 3) bots are becoming a standard feature and mappers have to take good bot action into account as well. First lets discuss a bit about bots, as well as just what pathnoding is.
Bots are the generic term for a computer controlled opponent. In a way, you could think of every computer opponent as a "bot" of sorts. Ever play a fighting game like Mortal Kombat (tm), or perhaps Street Fighter (tm) ? Well, if you play the single player of those games you are, in effect, playing against bots. Bots can be essentially boiled down to lines of computer code being executed on the machine. Now, as such, bots have well defined limitations. They are NOT human opponents, and will undoubtedly have certain predictabilities.
Within the Unreal engine bots are controllable and definable, to a degree, by the map author. This control is achieved through a process called path noding. Path noding is, essentially, what it sounds like - it is creating a pathway/group of pathways or a network, of "nodes" or pre-defined positions that the bots will use to navigate the map, find powerups or weapons, as well as locate elevators, lifts, teleporters and the like.
Now the question is "what exactly is a node?" Good question. The definition of a "node" can vary within the Unreal Tournament realm. Basic definition: A node is a 3D position in your map that the bots in Unreal can travel to. However, a node can be much more than just a point that a bot goes to. A node can also contain special information about the location it is placed at. There are special nodes that tell the bot that a weapon, for instance, is located there, or that an elevator is located there, or even a place where the bot is to make a leap or a jump.
So now that you have a basic definition of this path noding business, lets get to applying it to your level so you can get bots running around your map!
Basic path noding isn't really that hard, however as a UT map author a main objective of yours should be attempting to path node well so that bots play better or more like a *human* would. THAT is the difficult part. Path noding is an art form, just as mapping is, so treat it as such!
First let's figure out how to place a pathnode in the map. First open up your Classes Browser and expand NavigationPoint (makes sense doesn't it?) Locate the sub item called "PathNode". There you go. Go about adding a path node to your map the same way you'd add any other actor (like a light for instance) with the usual right-click on the 3d view and choose "place PathNode here"
It can't be that easy can it? Well, yes and no. Like I said, you want to place your path nodes in a way to simulate human like movement with the bots. So place your path nodes in logical places that you'd want the bot to travel to - think about it - put them where YOU would go if you were to play the map.
A logical rule of thumb with path noding is to at the very LEAST place a path node at every intersection. Also path nodes work from line of sight - that is, if a path node can't be "seen" from the location of another path node, then no path will be made between the two (result: the bots won't run in between those two points). You also don't want to cram path nodes right next to each other and at the same time you don't want them too far away. What's too far away? Judgement call really - we'll get into that later down when we actually build the paths themselves...
Now I said earlier that there were special pathnodes to tell a bot where weapons and items were. These path nodes are actually *the items and weapons themselves*. So if you plop a mini gun down somewhere and want a bot to get to it, just add a pathnode somewhere around (but not to close) to the gun. The gun itself will act like a pathnode and the bot will then see it as a weapon. Ditto with things like ammo, health packs, armor, shields, invisibility and TELEPORTERS (well the right kind anyway). When using a teleporter that the bots will use you'll want to go to your classes browser, expand NavigationPoint, then expand Teleporter and find and use the class called "VisibleTeleporter" we'll get into that in a second pathnoding tutorial. The "PlayerStarts" that you place around your map will also act as path nodes.
Ok so you should now be able to plop down path nodes around your map making sure that the pathnodes you want the bots to travel between can "see" each other and with the nodes not too far apart or close together. How to tell if the distance is right? Well, to tell that you need information on the paths themselves which first need to be "built" between those nodes you plopped down. Press F8 to bring up the Rebuilder Dialogue Box. You should be familiar with this dialog, but may have wondered when you clicked on that "Lighting" tab, just what that "Paths Define" button does. Got any ideas on it now? :) Click it to actually generate the paths between those PathNodes you created. UnrealEd will chug for a while and finally finish.
Now you'll probably want to actually see the paths to get an idea of how you're bots are going to do. On your 3D view port, click the "View" menu item and choose "Show Paths" - you should now see a nice network of blue and red lines all over your map drawn in between your path nodes. REMEMBER: whenever you change the position of any of your pathnodes, weapons, items, or anything that can ACT like a pathnode you need to click that "Paths Define" button again to rebuild the paths. Just like when you rebuild your map!
Great - lots of red and blue lines. What are the red and blue colors supposed to signify? Well, these are the paths that the bots CAN (but not always necessarily) take. BLUE paths are paths that are attractive to the bots. These are the paths that the bots are most likely to take. Red paths are paths that a bot will take, but probably only if it has to for some reason. In other words, they're paths that are unattractive to the bots. So when you rebuild your paths, remember, RED is ok, but BLUE is better!
If you need to move your path nodes around, go ahead, but be sure to rebuild those paths with "paths define" before saving your map! By moving your path nodes around, you can sometimes get the red lines to change to blue. The red lines sometimes mean that the nodes are too far apart or too close together. MOST LIKELY, though, a red line means that there's an easier path to take to get to the desired location. After this is all done give your map a test run with some bots! Remember to place plenty of PlayerStart actors in your map to accommodate the number of bots you want to use. In short, it's not a good idea to have 3 PlayerStarts in your map and then decide you want to play with 6 bots. You'll get telefragging happening right out of the gate (two people will attempt to start or spawn into the game in the same position). Name your map with the appropriate prefix (like DM- for a deathmatch, CTF- for capture the flag, etc) so it will be available in the in-game map selection screen.
Most of all HAVE PATIENCE with path noding. It's easy enough to start, but takes practice to get good results with. Like I said - it's an artform! We'll discuss advanced topics like elevators, doors, teleporters, and even some CTF specific path noding techniques in another tutorial.