UDN
Search public documentation:
NavigationAIUT2003
Interested in the Unreal Engine?
Visit the Unreal Technology site.
Looking for jobs and company info?
Check out the Epic games site.
Questions about support via UDN?
Contact the UDN Staff
Unreal Tournament 2003 AI for Level Designers
Version 2.0Steven Polge
2/15/03
Overview
This document describes how to set up navigation networks in a level so that NPCs can efficiently navigate to any point in the level. It also describes AI actors and level issues specific to UT 2003. The intended audience is level designers.Basic Pathing
Level designers place PathNodes? (a subclass of NavigationPoint?) in their levels on surfaces which NPCs can walk on, or in volumes which NPCs can swim in. For PathNodes? to connect, they should be less than 1000 Unreal units apart. PlayerStarts? are also NavigationPoints?, and they perform the same navigation function. In addition, InventorySpots? are automatically placed at the location of every pickup in the level when building paths (they are invisible, but you will be able to see path connections to them). Having two NavigationPoints? too close together (overlapping) can cause AI problems and should be avoided. When placing PathNodes?, the goal is to make sure that every area of the level is covered by a PathNode? or some other NavigationPoint?. An area is covered if an NPC could walk to some pathnode less than 1000 units away completely unobstructed (i.e. without having to step around anything). After placing PathNodes?, the level designer can build the connections between NavigationPoints? by using the "Build AI Paths" option in the Build menu (or by doing a full rebuild). Once paths have been built, they can be seen in the various level view windows by using the "Show Paths" option under the View menu. Paths will be displayed as lines from one NavigationPoint? to another. If NPCs can traverse the path in either direction, there will be two lines, with an arrowhead pointing in each direction. Otherwise, the line will show with an arrowhead in which direction the path can be traversed. Paths will be displayed in various colors, indicating important information about the path:- White - very wide path, which large NPCs can use (maximum collision radius of 120 units).
- Green - wide path, which moderately large NPCs can use (maximum collision radius of 72 units).
- Blue - narrow path, useable by smaller NPCs.
- Purple - path using a lift or teleporter.
- Light Purple - path using a ladder.
- Yellow - forced path. A path between two NavigationPoints? can be forced, if no connection is automatically made, by putting the name of the destination NavigationPoint? in the ForcedPaths?[] array of the source NavigationPoint? (in the NavigationPoint? properties sheet).
- Red - proscribed path. A path between two NavigationPoints? can be proscribed by putting the name of the destination NavigationPoint? in the ProscribedPaths?[] array of the source NavigationPoint? (in the NavigationPoint? properties sheet).
Debugging Paths
After building paths, a window may pop up in the editor with a list of pathing errors. Click on an error to take you to the offending NavigationPoint?. After the level is completely pathed and paths have been defined, use the 'Review Paths' option in the Tools menu. The following items are checked:- All NavigationPoints? with bMustBeReachable true (such as flagbases) can be reached from any path in the level.
- All movers have an appropriate NavigationPoint? associated with them (unless the mover's editable bNoAIRelevance property is true).
- Checks if PathNodes? should be converted to JumpDests?.
- No NavigationPoint? ExtraCost? can be less than zero.
ViewBot
console command, and use the ShowAI
console command to see what it's thinking and the path it is following. Each time you enter ViewBot
, your view will switch to another bot in the level. You can also use ViewFlag
to directly view flag carriers. To check navigation paths while in the level, use RememberSpot
to mark a location. Then, using ShowDebug
while viewing your own player will show you a continually updated path to the marked location.
An additional valuable tool for debugging/testing AI in your level is the console command SoakBots?. After entering SoakBots
in the UT console, any time a bot encounters a significant problem, the game is paused with the view shifted to looking at the bot, with debugging information about the bot's state displayed (including the error at the top). While this will catch many bot problems, it won't catch everything, so watching bots play is still vital.
PlayerStart? (subclass of NavigationPoint?)
Each PlayerStart? has a TeamNumber option, which specifies what team can spawn at that start. TriggeredPlayerStarts toggle the PlayerStart? bEnabled attribute whenever they are triggered. Also, whenever a player spawns at a playerstart, its event (if any) is triggered.UnrealScriptedSequence? (subclass of Keypoint->AIScript->ScriptedSequence)
UnrealScriptedSequence? is the subclass of ScriptedSequence? that should be used for all UT2003 scripted sequences (typically used as defense points around bases). It contains several defense script related attributes:- bDontChangeScripts: Bot should return to this defense script after being interrupted, rather than possibly changing to another compatible script.
- Priority: Used to prioritize selection of script when several compatible scripts are available.
- EnemyAcquisitionScriptTag: Tag of script that bot will use after leaving this script and acquiring an enemy.
- EnemyAcquisitionScriptProbability: Likelihood that bot will use the acquisition script.
- bSniping: Bot should snipe when using this scripted sequence as a defense point.
- SnipingVolumeTag: area defined by volume in which to look for (distant) sniping targets (use only if needed).
- WeaponPreference: bots using this defense point will preferentially use this weapon.
- bRoamingScript: bots won’t re-use the same script, but will keep moving.
Doors
Door NavigationPoints? should be placed in conjunction with any mover that acts as a door (based on its position, it allows or blocks movement between two areas). The Door should be placed in the center of the affected area (typically, in the middle of the actual static mesh used for the door - but low enough to touch the ground). There are also several important properties of a Door NavigationPoint? that should be updated as needed:- DoorTag - the tag of the mover with which this Door is associated.
- DoorTrigger - if the door is triggered, this is the tag of the trigger actor which will open the door.
- bInitiallyClosed - whether the default state of the mover allows movement (if false), or prevents it (if true, the default value).
- bBlockedWhenClosed - if the mover is closed, there is no way for the NPC to open it. (false by default)
CTF
Level designers will place one xRedFlagBase actor, and one xBlueFlagBase actor in their level for CTF games. CTF bases have the following important AI attribute, that should be set:- DefenseScriptTags: All UnrealScriptedSequences? with this tag will be used as defense scripts for this objective. Bots will choose between these defense scripts when defending this objective.
Double Domination
Level designers will place one xDomPointA actor and one xDomPointB actor in their level for Double Domination games. Just like with CTF Bases, each domination point should have its DefenseScriptTags? property set to match the UnrealScriptedSequences? used as defense scripts for this point.Bombing Run
Level designers will place on xBombSpawn actor in the center of their level, and two xBombDelivery actors for Bombing Run games. Just like with CTF Bases, each bomb delivery point, or goal, should have its DefenseScriptTags? property set to match the UnrealScriptedSequences? used as defense scripts for this point. xBombDelivery actors also have a couple of other important attributes. The Team property needs to be set for each goal. The TouchDownDifficulty? property is used to modify whether bots are more likely to shoot goals or try to jump through (higher values make bots more likely to shoot). For bots to shoot goals from a distance, the level designer will need to set up ShootSpots? to identify locations bots should shoot from. Use a BlueShootSpot? to mark where red team bots should shoot at the blue goal, and RedShootSpots? to mark where blue team bots should shoot at the red goal. You can have several shootspots for each goal.AssaultPath? (subclass of NavigationPoint?)
AssaultPaths? are used to specify alternate routes for squads of bots attacking an objective (for example a CTF Base). The following attributes are important for setting up basic assault paths:- ObjectiveTag - set the ObjectiveTag? to the tag of the destination objective for this AssaultPath?.
- Priority - 0 to 1, higher means heavier weighting when determining whether to use this path from among all potential candidates.
- bNoReturn - Set this to true if this AssaultPath? shouldn't be used when returning from the enemy base.
- bReturnOnly - Set this to true if this AssaultPath? should only be used for returning from the enemy base.
- bNoGrouping - Normally, squads of two or three bots will try to attack flag bases together. A lone bot will wait for a team mate near the assault path, unless this flag is set to true. It should be set to true if the assault path is in an open area, where it would be foolish to hang out for a few seconds.
Advanced Assault Pathing
Most level designers will not need to put together more complex configurations of assault paths, so this section is intended for advanced users only. These properties were almost never used in the levels shipped with UT, and may cause problems if not used correctly.- Position - specifies relative position in a chain of AssaultPaths? with the same PathTag? and the same ObjectiveTag?
- PathTag[4] - Each AssaultPath? belongs to one to four ordered groups of AssaultPaths?.
- bEnabled - toggled by triggering the AssaultPath?. If bEnabled is false, the path won't be used.
UTJumpPad?
UTJumpPad? is the UT2003 version of JumpPads?. JumpPads? will throw any pawn touching them in a specified direction. JumpPads? are set up by specifying a destination pathnode in the first entry of the ForcedPaths?[] array of the JumpPad?. The appropriate jump velocity is automatically calculated when paths are rebuilt. The JumpZModifier? property of the JumpPad? can be set if for any reason the automatically generated velocity is problematic.JumpSpot?
JumpSpot? is the UT2003 version of JumpDest?. JumpDests? should be used instead of PathNodes? at any spot that is too high to jump up to, but is linked to paths below it. JumpSpots? will be used by NPCs in low gravity, or if they have some kind of jump boost. The path from which the bot should jump to the JumpSpot? should have the JumpSpot? in one of its ForcedPath?[] array entries. Jumpspots should be used as the destination at the top of jumps. They should never be used on the "bottom" side of a jump, unless the fall is so great that the bot should translocate down rather than taking damage. Unnecessary jumpspots should be avoided, since they cost slightly more to evaluate for the navigation AI. JumpSpots? have the following important properties:- bOnlyTranslocator - This JumpDest? can only be reached on the forced path by translocating (because a full sized pawn wouldn't fit - through bars for example).
- bNeverImpactJump - This JumpDest? should never be reached by impact jumping (shield belt regular fire used to push off).
- bNoLowGrav - This JumpDest? should never be reached by low gravity jumping.
- TranslocZOffset - Used to adjust the point bots aim at to translocate, to fix any translocation problems you might find.
ReviewJumpSpots
console command. To use it, start the level, and type ReviewJumpSpots? at the console before hitting fire to start the game (and don't hit fire). It will spawn a bot who tries to reach every jumpspot using the following modes:
- translocator
- double jump
- jumping with Speed combo enabled and impact jump
- low gravity jump
Lifts
A Mover used as a lift should never use theBumpOpenTimed
state (use StandOpenTimed
instead). Movers used as lifts have two types of NavigationPoints? associated with them. A LiftCenter should be placed on the lift at its center. A LiftExit should be placed at each exit from the lift (but far enough away so that an NPC standing there will not interfere with the lift). Both the LiftCenter? and LiftExits? have a LiftTag
property which must be set to the tag of the Mover. In addition, if the lift is triggered, put the tag of the triggering actor in the LiftTrigger
property of the LiftCenter?. LiftExits? also have an optional property, SuggestedKeyFrame
, which can be set to the keyframe number of the mover when the liftexit can be used. This may improve navigation by NPCs in some situations.
Ladders
LadderVolumes must be oriented to face the wall being climbed (by adjusting theirWallDir
property, which is displayed as a directional arrow when the LadderVolume? is selected). In most cases, level designers can allow Ladder NavigationPoints? to be automatically added when paths are built, at the top and bottom of the LadderVolume?. However, if there are any problems with the automatically placed ladders, level designers can manually place the ladders after setting the LadderVolume? bAutoPath
to false. The Ladder centers must be within the LadderVolume?. The LadderVolume? should touch the floor at its bottom, and poke over the edge at the top by at least the height of the largest NPC using the ladder.