CS 380: ARTIFICIAL INTELLIGENCE AI FOR GAMES 11/25/2013 Santiago - - PowerPoint PPT Presentation

cs 380 artificial intelligence ai for games
SMART_READER_LITE
LIVE PREVIEW

CS 380: ARTIFICIAL INTELLIGENCE AI FOR GAMES 11/25/2013 Santiago - - PowerPoint PPT Presentation

CS 380: ARTIFICIAL INTELLIGENCE AI FOR GAMES 11/25/2013 Santiago Ontan santi@cs.drexel.edu https://www.cs.drexel.edu/~santi/teaching/2013/CS380/intro.html What is Game AI? Artificial Intelligence for Computer Games Different from


slide-1
SLIDE 1

CS 380: ARTIFICIAL INTELLIGENCE AI FOR GAMES

11/25/2013 Santiago Ontañón santi@cs.drexel.edu https://www.cs.drexel.edu/~santi/teaching/2013/CS380/intro.html

slide-2
SLIDE 2

What is Game AI?

  • Artificial Intelligence for Computer Games
  • Different from traditional AI

Traditional AI: Optimality, efficiency Game AI: Fun, artificial “stupidity”

slide-3
SLIDE 3

What is Game AI?

  • Intersection of games and AI:
  • Two (three) main communities working on it:
  • Academics:
  • Artificial Intelligence community: how can games help us have better AI

(AI centric)

  • Computer Game scholars: how can AI help us have better/more

interesting/new forms of games?(Games centric)

  • Game industry:
  • Their goal is to make games that sell more units (games centric)

Games AI

slide-4
SLIDE 4

Examples of Game AI

Pac-Man (1980) First ever game to feature AI AI: finite state machine

slide-5
SLIDE 5

Examples of Game AI

“Pac-Man” (1980) First ever game to feature AI AI: finite state machine

slide-6
SLIDE 6

Examples of Game AI

“Double Dragon” AI: Finite State Machines

slide-7
SLIDE 7

Examples of Game AI

Chess AI needs to provide a collection of difficulty levels. Only one: hardest (to be played only against grand-masters), falls into the realm of traditional AI.

slide-8
SLIDE 8

Examples of Game AI

“The Secret of Monkey Island” “And Then There Were None” Dialogues, storytelling

slide-9
SLIDE 9

Examples of Game AI

“Left 4 Dead 2” AI Director adjusts game pace to ensure desired dramatic effects

slide-10
SLIDE 10

Examples of Game AI

“Black & White” Uses machine learning to simulate a learning creature

slide-11
SLIDE 11

Examples of Game AI

“Starcraft II” Strategy, planning, path- finding, economics, etc.

slide-12
SLIDE 12

Types of Game AI

  • Inside the game:
  • Character control
  • Director (drama management)
  • During game development:
  • Help in behavior/content design
  • After game deployment:
  • Analysis of game data
slide-13
SLIDE 13

Typical Game AI problems

  • Pathfinding:
  • Given start/end positions, how to find a path that connects them?
  • Movement:
  • E.g. given a path, how can we control a vehicle to follow it?
  • Decision Making:
  • E.g. in a combat situation, when to attack? Who to attack? Which

weapon/spell to use?

  • Game Adaptation:
  • How can we customize the game to the player at hand
  • etc.
slide-14
SLIDE 14

Pathfinding

  • After so many years, pathfinding is still a problem even in

modern commercial games:

  • http://www.youtube.com/watch?

v=lw9G-8gL5o0&feature=player_embedded

slide-15
SLIDE 15

Pathfinding

  • After so many years, pathfinding is still a problem even in

modern commercial games:

  • http://www.youtube.com/watch?

v=lw9G-8gL5o0&feature=player_embedded

  • Algorithms:
  • A*
  • TBA*
  • LRTA*
  • D*
  • D*-LITE
  • etc.
slide-16
SLIDE 16

Quantization and Localization

  • Pathfinding computations are performed with an abstraction over the

game map (a graph, composed of nodes and links)

  • Quantization:
  • Game map coordinates -> graph node
  • Localization:
  • Graph node -> Game map coordinates
  • Example: Navigation Mesh (NavMesh)
slide-17
SLIDE 17

Movement

slide-18
SLIDE 18

Movement

Pathfinding Movement

?

slide-19
SLIDE 19

Steering Behaviors: Uses

Pathfinding Movement In car racing games, Pathfinding is typically hard coded. The game designers create a set of waypoints in the track (or in the track pieces), and cars go to them in order.

slide-20
SLIDE 20

Steering Behaviors: Uses

Pathfinding Movement Movement is in charge of driving the car to each of the waypoints, avoiding opponents, braking, accelerating, turning, etc.

slide-21
SLIDE 21

AI Requirements in a Typical Game (FPS)

  • The two basic needs in all FPS are:
  • Movement
  • Firing
  • With those two you can already have a basic FPS running

like:

  • Wolfenstein 3D (for which you most likely only need movement,

since there are no projectiles, and thus firing is just line-of-sight testing)

  • Doom
  • But you need way more than that for a modern FPS!
slide-22
SLIDE 22

AI Requirements in FPS

  • In Modern FPS you don’t expect:
  • Enemies to get stuck behind a wall (enemies in old games like

Wolfenstein do)

  • To stand still while you kill their camarades (they do in Wolfenstein

and Doom!)

  • To be trapped just because you closed a door!
  • To move independently of each other
  • etc.
slide-23
SLIDE 23

AI Requirements in FPS

  • Perception
  • Movement and Firing
  • Pathfinding
  • Decision Making
  • Group Control
  • Camera Control
  • Drama Management
slide-24
SLIDE 24

Perception

  • The base of all Game AI is a good perception module
  • If perception is properly designed, the cost of building the

rest of the AI can be significantly reduced

  • In FPS games perception needs to handle mainly:
  • Line-of-sight checks
  • Proximity checks
  • Easy access to “distance to point” and “path to point” calculations

for tactical AI

  • Recall lecture on perception (games like “Metal Gear”, or

“Commandos”)

slide-25
SLIDE 25

Game Engine

Game State Physics Collision Input Character AI User Rendering

slide-26
SLIDE 26

Game Engine

Game State Physics Collision Input Character AI User

World Interface (perception)

Rendering

slide-27
SLIDE 27

Movement and Firing

  • Movement is typically done with a combination of Steering

Behaviors and animation managers:

  • Coordinating the animation of the 3D model of a character with its

movement is sometimes complex:

  • Blend predefined animations (e.g. from Maya) with dynamic ones (aim)
  • Firing is important in modern games:
  • “Doom” doesn’t have any firing management: enemies have

PERFECT aim. They solve it by making the bullets very slow

  • Modern games have aim models:
  • Enemies miss
  • They miss in a place where the player can see the bullet (show off your

AI!)

slide-28
SLIDE 28

Character AI

Game Engine

Game State Physics Collision Input User

World Interface (perception) Movement Firing

Rendering

slide-29
SLIDE 29

Character AI

Game Engine

Game State Physics Collision Input User

World Interface (perception) Movement Firing

Rendering At this point we already have the AI for “Wolfenstein 3D” (It had no pathfinding)

slide-30
SLIDE 30

Path-finding

  • Not all enemies are given path-finding capabilities:
  • Path-finding makes characters look smart, the ones that should not

be smart do not have path-finding

  • Representation of the navigation graph:
  • Navigation meshes is the most popular
  • Embedded navigation:
  • Annotate each link in the navigation graph with the action required

to traverse it (walk, crawl, climb, open door, etc.)

  • Characters look smart knowing they have to perform those actions,

but it’s all hand annotated or precomputed

slide-31
SLIDE 31

Character AI

Game Engine

Game State Physics Collision Input User

World Interface (perception) Movement Firing

Rendering

Path-finding

slide-32
SLIDE 32

Character AI

Game Engine

Game State Physics Collision Input User

World Interface (perception) Movement Firing

Rendering

Path-finding

At this point we already have the AI for “Doom”!

slide-33
SLIDE 33

Decision Making

  • Decision Making in FPS controls what characters do at a

high level: do they attack? Do they retreat? Do they execute other actions?

  • Classic games: Finite-state machines
  • Modern games: Behavior Trees
  • Some exceptions:
  • F.E.A.R.: Goal-oriented behavior
  • Characters have a set of goals, and each goal associated with an FSM,

the most relevant goal takes control and its FSM is executed.

slide-34
SLIDE 34

Waypoints

  • (we will cover them in a couple of weeks)
  • Special markers in the map that indicate special locations:
  • Good places for cover, attack, ambush, etc.
  • They are hand annotated, and when close to one the AI

knows how to do.

  • Characters look smart without requiring complex AI.
  • ALL modern FPS games use waypoints.
slide-35
SLIDE 35

Character AI

Game Engine

Game State Physics Collision Input User

World Interface (perception) Movement Firing

Rendering

Path-finding Decision Making

slide-36
SLIDE 36

Group Control

  • Can be defined also using behavior trees
  • Most common approach:
  • Each tactic defines a set of “roles”
  • A role is filled by one character
  • Each tactic has a behavior tree that executes it
  • For example:
  • A “flank” tactic can have 3 roles for “left attack”, “front attack”, and

“right attack”

  • Only 3 enemies will execute it at once (if there are more, they will

wait, kung-fu style)

  • Enemies look smart, and do not crazily over-power the player
slide-37
SLIDE 37

Character AI

Game Engine

Game State Physics Collision Input User

World Interface (perception) Movement Firing

Rendering

Path-finding Decision Making Tactics (Group Behavior)

slide-38
SLIDE 38

Character AI

Game Engine

Game State Physics Collision Input User

World Interface (perception) Movement Firing

Rendering

Path-finding Decision Making Tactics (Group Behavior)

At this point we already have the AI for “Half-Life”!

slide-39
SLIDE 39

Character AI

Game Engine

Game State Physics Collision Input User

World Interface (perception) Movement Firing

Rendering

Path-finding Decision Making Tactics (Group Behavior)

At this point we already have the AI for “Half-Life”! But there is more…

slide-40
SLIDE 40

Experience Management

  • Premise:
  • Different players have different preferences
  • Each player enjoys a different subset of the elements of a game
  • Problem:
  • How can a game automatically adapt to match the current player?
  • Maintain the dramatic arc expected by the game designer
  • Prevent the players from dealing with parts of the game not appealing to

them

  • Adjust difficulty level, etc.
  • Solution:
  • Drama Management / Experience Management / AI Director
slide-41
SLIDE 41

Experience Management Examples

  • Façade:
  • http://www.youtube.com/watch?v=GmuLV9eMTkg
  • Left 4 Dead:
  • http://www.youtube.com/watch?v=VVIdHPG0wYI
  • AI Director controls: spawning enemies and items, music, map (can

block or open paths)

  • Not random spawns: AI Director has a set of predefined patterns

with parameter ranges, and selects the appropriate pattern with the appropriate parameters.

slide-42
SLIDE 42

Character AI

Game Engine

Game State Physics Collision Input Rendering User

World Interface (perception) Path-finding Movement Firing Decision Making Tactics (Group Behavior) Drama Management

slide-43
SLIDE 43

Character AI

Game Engine

Game State Physics Collision Input Rendering User

World Interface (perception) Path-finding Movement Firing Decision Making Tactics (Group Behavior) Drama Management

At this point, we have the AI of “Left 4 Dead 2”

slide-44
SLIDE 44

Character AI

Game Engine

Game State Physics Collision Input Rendering User

World Interface (perception) Path-finding Movement Firing Decision Making Tactics (Group Behavior) Camera Control Drama Management

slide-45
SLIDE 45

Character AI

Game Engine

Game State Physics Collision Input Rendering User

World Interface (perception) Path-finding Movement Firing Decision Making Tactics (Group Behavior) Camera Control Drama Management

This is a complete state

  • f the art AI architecture

for a modern FPS (or RPG) game

slide-46
SLIDE 46

Character AI

Game Engine

Game State Physics Collision Input Rendering User

World Interface (perception) Path-finding Movement Firing Decision Making Tactics (Group Behavior) Camera Control Drama Management

Some specific platforms (e.g. Wii, Kinect) have specific AI needs, like gesture recognition.

slide-47
SLIDE 47

What’s Next in FPS AI?

  • As of 2011, a study by A. Champandard concluded that the
  • pen AI problems in FPS Games were:
  • Sensory Performance
  • Motion Planning
  • Tactical Pathfinding
  • Dynamic Terrain Analysis
  • Combat Reasoning
  • Player Prediction
  • Scripting for Conjunctive Goals
  • Squad Coordination
  • Experience Management
  • However, I think those are too low level. Except for two, the rest

refer more efficient ways to have what we already have

slide-48
SLIDE 48

What’s Next in FPS AI?

  • Why is multiplayer so much more interesting than single

player in FPS games?

  • Because the AI sucks
  • (and because you want to beat your friends)
  • The next big thing in FPS (or RPG/MMORPG) AI are

believable characters:

  • Intelligent interactive characters to which the player can relate to
  • Interaction with NPCs/enemies/friendlies in games is very bad

nowadays

  • What do you think is next?