FIRST PERSON SHOOTER ARTIFICIAL INTELLIGENCE
Xavier Otero Keil
Four Layered AI Animation
Control characters body makes sure that animation fits situation handles requests to perform actions
Combat Possibly most important subsystem Determine tactics
Behavior Highest level, has precedence over other systems Sets broad goals like a CEO
Movement Determine how to move (path finding) Not where to move
Animation Controller Plays pregenerated animation mostly Some animations take control of entire
character such as dying Others require only a specific part
Arm waving Head turning These are more complex because more than one can
be applied at one time Needs to be aware of which animations are
playing (if currently arm waving stop before attacking)
Gathers information from other Layers
Animation Continued Generation of context related animations
on the fly. Generalizing the position of objects.
Causes problems with believability.
Modern games do not take this shortcut
Solution similar to robotic arm movement
Movement Basically a path finding system Given a starting point uses a database of
how the level is laid out and the A* search
Dynamic obstacles create a problem http://www.youtube.com/watch?v=UZf89
ejZavc (example of bad dynamic obstacle handling) Quake 2.
Local Path finding You can use Local path finding to solve
this problem Integration of physics system and
movement system Uses global path finding as a guideline
then polls the physics system for dynamic obstacles and adjusts accordingly
Crysis with local path finding turned off http://www.youtube.com/watch?v=FA6SYhFHS6M
Combat Spatial Reasoning
Humans are very good at this almost second nature
Most games embed hints for the AI into the levels like the anchors in Far Cry
This creates a tactical database that allows the computer to simulate an understanding of Spatial Reasoning
Again problems with Dynamic Obstacles
Combat Continued Solved with geometrical analysis.
Uses a lot of processor power
Dynamic object tagging
Changing Battle Environments
http://www.youtube.com/watch?v=pWyoQoEgPBA&NR=1 (Crysis Nuke Gun)
Combat Tactics Very basic selection of combat tactics
Camp Joust Circle of death Ambush Flee and ambush
Generally a FPS will have far more tactics in its arsenal. However these basic ones give insight into how the tactical selection is done
Firing To-hit roll random number
If in the hit threshold attempt to hit Otherwise attempt to miss With high damage weapons always miss first
shot Takes into account environmental variables
Prevents perfect accuracy which can be frustrating
Where to shoot When attempting to hit
Angle of animation does not have to match angle of shot Most games use bounding boxes for collisions with
bullets and other objects Choose random point near the center
When attempting to miss Shoot too close to the target could possibly hit Too far away AI looks stupid Want shot to be visible and audible. Alert player to
enemy presence and create feel of tension Some games place invisible markers in player character
models of good places to shoot at in order to miss Always test shots (ray-testing)
Friendly Fire Makes the AI look really bad if it happens too
often Use ray-testing to avoid this Sometimes it can be used as a player reward
Player dodges out of the way so a rocket launch hits an enemy behind him
In this situation auditory acknowledgment by the offending NPC is a good idea “Ohh **** sorry Hank”
Some games solve this problem by simply not accepting damage from friendly fire. This is a poor solution, if it becomes obvious players feel cheated
Firing Continued If a hit is necessary use dead reckoning
Can produce over accurate fire
Radius testing is a another way
Projectiles should report back to the AI
Searching for the player Should be range of searching behaviors
Not sure player is even in the search area (Idle searching)
Maybe the player is there (normal searching) Sure the player is there (intense searching)
Multiple Paths
Low efficiency searches
Idle searching Wander about aimlessly or follow a set
patrol schedule Should not use the players location in
calculations at all as this is usually detectable by the player
If the player is seen do not immediately drop into combat unless the player is very obvious or firing at you
http://www.youtube.com/watch?v=3nzMdPwO2Qw
normal searching NPC has caught a glimpse of the player Should scan the area where it “saw” the
player and then give up after a short time Should immediately drop into combat
mode if the player is seen in this stage At this point upholstering of weapons or
unsheathing of swords is appropriate
Intense searching This should be activated if the NPC sees the
player go somewhere where there is no escape or has attacked or been attacked by the player
At this stage for believability the NPC should not give up until it finds the player or a very large period of time has elapsed.
Games where the give up time is too low seem unrealistic.
Should use actual player location in calculations but add a randomness factor so the NPC does not make a bee line to the players location.
Stealth Sensory Perception
Darkness levels and sound levels Alertness levels
Auditory cues Thief 3
http://www.youtube.com/watch?v=9sSICYp8ssI Perceptual Modeling
Visual Auditory Tactile
Increasingly all first person shooters are employing stealth elements for believability
Behavior High Level command issuer Chooses between states such as Idle,
Patrolling, Combat, Searching etc… then notifies the other layers of what they need to do.
Generally a Finite State Machine Very important for believability especially
in idle and combat modes Often times uses triggers in order to
choose a state.
Teaming UpWith the Player
Has become very popular in recent years When done well highly increases the
immersion of the player What the AI needs
Follow commands Not get in the way Follow logical rules Interact with the player Survive until the end of the game
Correct Movement Generally stay out of field of view Prevents friendly fire and view
obstruction During points of non combat teammates
should occasionally appear in the field of view to reassert that they are there
Use auditory cues during combat for this same purpose
Correct Movement Continued
When there are multiple targets there are two options for staying out of the players field of view. smallest angle viewing angle
More on Movement Should be maximum distance set that the
NPC’s can wander away from the player. Let the player be the hero
take no risk unless ordered to Don’t be first through doors, choke points, over
hills etc… Generally good practice to match the
player’s actions. Many games “cheat” Rainbow Six Vegas
Match player speed to avoid annoyance
Player is important NPC’s should be secondary to the player Should never perform better than the player Select weapons that are similar or less
powerful than the players weapons Always allow the player first chance to
collect items Should report all sightings of enemies
before attacking unless currently under attack
http://www.youtube.com/watch?v=yxQ-09OcIP0
Enemy Teams
All these rules can apply to enemy teams as well
One NPC should be team leader and treated as the player Mimics normal team dynamic
Thank You