First Person Shooters - Computer Science & Engineering

advertisement
Zubair Chaudary, Kenny Rentschler, Constantin Savtchenko


Game Genre that involves projectile weapons
Played “though the eyes” of game character
 First Person point of view
 Creates a game play, AI, and game design Issues

Popular FPS Titles
 Quake, Doom, Wolfenstein 3D, Goldeneye 007,
Half Life, Halo, Call of Duty, Counter Strike, Unreal
Tournament…













First known FPS: Maze War (1974)
FPS Stepping Stone: Wolfenstein 3D (1992)
Intro of Deathmatch: Doom (1993)
3D Polygons: Quake (1996)
Major Console FPS: Goldeneye 007 (1997)
Entirely Script Based FPS: Half-Life (1998)
Exceptional Plot and Story: Half-Life (1998)
Team play focused FPS: Unreal Tournament (1999)
New Millennium FPS: Halo (2001)
MMOFPS: Planetside (2003)
FPS as Story Medium: Bioshock (2007)
Graphics Killer: Crysis (2007)
$1 Billion Dollar FPS: Call of Duty – Modern Warfare 2
(2009)


Arguably the most valuable to the gaming
industry
Envelope Pushing sector
 Graphics, Game Play, AI, Audio

Genre Bending
 Has created spinoff genres
 FPS medium allows developers to incorporate
elements from other genres

Movement Layer
 Does not determine where to move to, only how to do so.
 Avoid obstacles, follow characters, and path finding through
complex environments

Animation layer
 Selecting, parameterizing, and playing character animation
sequences
 Generating specific animations that are situational, and not prerendered/coded

Combat Layer
 Assessing characters current tactical situation
 Selecting tactics in combat
 Performance is key, as this is the fundamental aspect of FPS

Behavior Layer
 Determines character’s current goal, and attempts to reach its
goal



Pathfinding
Dynamic Obstacles
Spatial Reasoning
Algorithms and
methods to find most
efficient movement
from point A to Z
 Most FPS levels tend
to be static, so AI use a
pre-generated
Database
 Allows for A* search
algorithms


Situation changes significantly with the
addition of dynamic level elements
 Player can move objects in front of AI paths
 Level Destruction can block paths
 If the AI does not adapt, will walk into a wall and
get stuck.

Handling of dynamic
objects
 Some games ignore them
(pseudo random
movement)

Introduction of Local
Pathfinding
 Uses Global Pathfinding to
establish a general path
from A to Z
 Create lots of “waypoints”
in-between A-Z

Local Pathfinding determines if subpath A-B
are clear
 If they are, continues to waypoint B, where it
evaluates B-C
 If not, it computes an alternate path to waypoint
B

Local Pathfinding also uses A* search




AI Data generation tool
3D Pathfinding
Part of the Unreal 3 Engine
Management of perceptions (sight, smell,
and sound)


Subsystem that performs tasks assigned by
higher level systems
Performs discrete movement commands
▪ Move to (X,Y,Z)



Only be executing one movement command
at a time.
Movement controller is an object that owns
the current movement command
Can be use to handle different kinds of
movement, like walking or swimming


When AI enters Combat, almost all control is
given to combat controller
Attempts to assess tactical situation
 Number of enemies, direction, health, ammo
 More Advanced: cover locations, camping
locations

Issues commands to other systems
 Movement, aiming, shooting


Most difficult task for AI combat controller
Spatial Reasoning requires understanding of
level (Spatial Configuration)
 Needs to know where things are, and how objects
are going be use
 3-Dimensonal Levels increase complexity
significantly

Pathfinding solution can be used
 Pre-generate database of objects and their
significance
 Works poorly with dynamic levels

Level Designers can embed ‘hints’
 Makes Level design cumbersome
 Error prone

Customized tools analyze geometry
 Can be run dynamically to populate database

Physical properties of objects?


We will use Valve’s Left 4 Dead to discuss and
examine spatial reasoning.
Things to think about:
 Navigating In 3D
 Optimal Paths
 CPU Calculations

Example comes from a
presentation created by Michael Booth.


Path finding algorithms help AI’s navigate
optimally through environments.
How do you define an environment?
By using a Navigation Mesh!!
• Used instead of waypoints
• AI can move anywhere in
between the grids.
However note the Jagged Path.


We could hardcode a “smooth” path…
Or we could use what Valve calls “Reactive
Path Following”…
 Look ahead in the path and
calculate
 Use local obstacle avoidance


Oh, it’s a crate!?
We would press
spacebar, and
bunny hop over it,
should be easy for computers right? Wrong

AI has to deal with the environment as we do:
 Quickly
 Efficiently
 Humanly

Combining the two strategies we examined
allows for an AI that deals with the presented
necessities

An Example of a Tactical Situation
 Current Location
▪ In cover, or out in the Open?
 Ammo (unless they cheat)
 Enemy
▪ How Many?
▪ From where?
 Current Objective(s)
 Behavioral Situation

Tactic Selection Problem
 Nature of Tactic under Consideration
 Relative Tactical situation of all combatants
 Current Tactical Situation

Use of Tactical Library is common
 FSMs
 Databases
 Databases with Q-Learning

Basic Tactics
 Camp
▪ AI hides in a location, and waits for an opponent to appear
▪ Effective, but behavior can seem very scripted
 Joust
▪ AI rushes opponent, while firing
▪ Runs past opponent with the hopes of being able to turn around and
rush from behind
 Circle of Death
▪ AI circles opponent while firing
▪ Keeps a variable radius away from target
 Ambush
▪ AI ducks behind cover, periodically pops out of cover and shoots at
enemy.
▪ Similar to camp, but AI must know where enemy is coming from
 Flee and Ambush
▪ AI runs away from enemy, and then takes cover and gets ready to
ambush

As games evolve, game designers strive to
give players more freedoms:
 Dynamic level designs
 Interactive objects
 Large, multi-approachable
situations

We will study how AI has
kept up through Killzone©’s
implementation.

Old AI would use “hints” and series of “ifthen” scripts.
 Hints remain static, rely on game designers
 Enormous amount of effort for responsive AI’s to
react to situations and terrain

The AI must take into account:
 Multiple approach points
 Dynamic environments
 Dynamic positioning

End Result: Responsive AI

AI analyzes the situation
 Inputs are dynamic

Using gathered information, the AI acts:
 Goal setting/discarding
 On-fly-algorithms allow for on-the-fly decision
making


Tactics are procedures, not scripts
Summary: tactics are _______ based on the
___________ and the _________.

Killzone AI Summary
 Accomplish goals, or change based on
desirability/feasability
 Move To Position, Do Action

Killzone’s describes situations:





Cover from threats
Lines-of-fire
Danger zones
Area of operation
Decisions made using:
 Position evaluation
 Line-of-sight and Line-of-Fire


The assignment of values to the waypoints of
Killzone
Some factors that give higher values






Distance to primary target
Amount of cover
Not in the way of friendly-fire
Wall hugging
Outside of danger-zone (grenades, tank shells)
Position Evaluation Helps Movement
 Tactical Positioning
 Tactical Movement

Position evaluation functions assign values to
the waypoints of Killzone

Tactical Movement is smarter movement
 Movement usually done by “lowest weight”
 Notice we can use some of the existing position evaluation
algorithm to make “dumb” paths cost more
▪ Line of fire
▪ Close proximity to danger zones
▪ Running at the target

Position evaluation algorithms, can also be used
for attacking
 Indirect Fire
▪ Different determiners can be used to predict where to throw
grenades
 Suppression Fire
▪ Other determiner can be used to figure
out at which cover to lay suppressive
fire onto

Advantages
 Parameterization – change values, not code
 Easily adapted for other uses, such as multiplayer
 Procedural tactics are easier to adjust, and work with
– compared to scripts/hints
 Removes extra ray-casts

Disadvantages
 Difficult to debug, the AI is “on its own” – compared
to scripts/hints
 Also, difficult to get it to do your bidding – if you want
to actually script something

Opponent Selection
 How to Target?
▪ Most FPSs pit all AI against an enemy
▪ Kung-Fu tactics?
 Need for Targeting Heuristic
▪ Tactical Situation Awareness
▪ Worry about defending itself first
▪ Most vulnerable, nearest target
▪ Ranking function can simplify
 Need to be able to change targets based on changes
in Tactical situation

To-Hit Roll
 Less than perfect aiming for believability
 Calculating factors ([0.0,1.0] range)
▪ AI skill
▪ Range
▪ Size
▪ Relative target velocity
▪ Visibility
▪ Target state
▪ AI state
 Probability to hit = skill*range*size*…*state

Aiming
 Cheat Angle
▪ Maximum that a projectile can differ from gun barrel
while still being believable
▪ Doesn’t need to match line of sight
 Location
▪ Point with high probability of being hit
▪ Model target as overlapping boxes and pick center of
volume

Shooting and Missing
 Pick point close to target
▪ Low probability of hitting
 Should be visible to player
 Missing when close and hitting from a far distance
seems unreal

Ray Testing
 Test projectiles trajectory before firing
 Avoid obstacles and friendly fire

Dead Reckoning
 Estimation of enemy position at given time
 Shoot where the enemy will be when bullet arrives

Weapon Trajectories
 Difficult to predict slow moving projectiles (arrows)
 Use physics in ray testing to test trajectory

Collision Notifications
 Projectiles store pointers to object that fired it
▪ On hit or miss object is notified
 Helps firing object adjust targeting

Radius Testing
 Helpful for area effect weapons
 Treats everyone as cylinders or spheres
 Tests area damage on everyone to avoid friendly
fire and maximize enemy damage


Responsible for controlling current state and
high level goals
Most FPS use a Finite State Machines
 Idle – Standing Guard
 Patrolling – AI following a designed patrol path
 Combat – AI is engaged in combat and most
control is given to combat controller
 Searching – AI is looking for an opponent to fight
or searching for an opponent who fled
 Summoning Help – AI is searching for help
sound, patrol -> ɛ
quiet, ɛ -> patrol
search
patrol
kill, ɛ -> patrol
kill, ɛ -> search
see, search -> ɛ
see, patrol -> ɛ
fight

Scripting and Trigger Systems
 Need scripting and triggering events to tell the AI
to do something
 Triggered events set AI parameters
 Send commands to various subsystems
▪ Changes state from Idle to Searching, or Searching to
Combat
 Disadvantages?

Adds fairness to the game
 Even though the game knows where a player is,
the AI needs to “see” or “hear” a player
approaching

Realism
 A sleeping enemy has to be startled to enter
combat mode
 Sneaking element is possible and quantized

Visual
 Use ray casting to look for players
 Distance, angle, and visibility factor into vision

Auditory




AI needs to receive sound notifications
Everyone in earshot should hear the sound
Priority of sounds (e.g. bird chirping and gunshot)
Audio Occlusion
▪ Interference of sounds to create noise

Tactile(touch)
 Alert when run into or wounded

AI is initially designed to be very smart
(usually)
 Based on designers, the AI is given flaws to dumb
it down
 Also changed by difficulty settings
▪ Affects parameters for targeting, etc
 Player Modeling
▪ On the fly difficulty adjustment


Aiming very similar
Movement may change
 How to move so the AI does not block a
teammate’s vision?

Behavior
 How to choose objectives?
Download