3 states and a plan: the ai of f.e.a.r. -...

23
1 3 States and a Plan: The AI of F.E.A.R. Jeff Orkin Monolith Productions/ MIT Media Lab FSM: 3 States FSM: 3 States Goto Animate Use Smart Object

Upload: others

Post on 26-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 3 States and a Plan: The AI of F.E.A.R. - WPIweb.cs.wpi.edu/~rich/courses/imgd4100-b11/lectures/L-Planning.pdf · 1 3 States and a Plan: The AI of F.E.A.R. Jeff Orkin Monolith Productions

1

3 States and a Plan: The AI of F.E.A.R.

Jeff Orkin Monolith Productions/

MIT Media Lab

FSM: 3 States

FSM: 3 States

Goto Animate

UseSmartObject

Page 2: 3 States and a Plan: The AI of F.E.A.R. - WPIweb.cs.wpi.edu/~rich/courses/imgd4100-b11/lectures/L-Planning.pdf · 1 3 States and a Plan: The AI of F.E.A.R. Jeff Orkin Monolith Productions

2

FSM: 3 States

Goto Animate

Animate

FSM: 2 States!

Goto Animate

FSM: Transition Logic void StateAttack::Update() {

//...

if( Ammo == 0 ) {

pState = Reload(bCrouch); return;

}

//... }

Shogo, 1998

Page 3: 3 States and a Plan: The AI of F.E.A.R. - WPIweb.cs.wpi.edu/~rich/courses/imgd4100-b11/lectures/L-Planning.pdf · 1 3 States and a Plan: The AI of F.E.A.R. Jeff Orkin Monolith Productions

3

No One Lives Forever, 2000

F.E.A.R., 2005

Halo 2, 2004 Allowable behaviors for infantry, drivers, and passengers

FSM vs Planning

FSM Planning - How - What

Page 4: 3 States and a Plan: The AI of F.E.A.R. - WPIweb.cs.wpi.edu/~rich/courses/imgd4100-b11/lectures/L-Planning.pdf · 1 3 States and a Plan: The AI of F.E.A.R. Jeff Orkin Monolith Productions

4

FSM vs Planning

FSM Planning - How - What - Procedural - Declarative

Motivation

Here’s the Plan:

•  STRIPS Planning Overview •  Planning in F.E.A.R. •  Differences from STRIPS •  Squad Behaviors & Communication •  Beyond F.E.A.R.

What is Planning?

•  Planning is a formalized process of searching for sequence of actions to satisfy a goal.

•  Process is called “Plan Formulation.”

Page 5: 3 States and a Plan: The AI of F.E.A.R. - WPIweb.cs.wpi.edu/~rich/courses/imgd4100-b11/lectures/L-Planning.pdf · 1 3 States and a Plan: The AI of F.E.A.R. Jeff Orkin Monolith Productions

5

STRIPS Planning

…in a nutshell

STRIPS Planning

STRIPS =

STanford Research Institute Problem Solver

STRIPS Planning

•  STRIPS Goal: Desired state of the world to reach.

•  STRIPS Actions: – Preconditions – Effects

States

Page 6: 3 States and a Plan: The AI of F.E.A.R. - WPIweb.cs.wpi.edu/~rich/courses/imgd4100-b11/lectures/L-Planning.pdf · 1 3 States and a Plan: The AI of F.E.A.R. Jeff Orkin Monolith Productions

6

States: FSM

Attack Search

States: Planning Represented as a logical sentence:

AtLocation(Home) ^ Wearing(Tie)

Represented as a vector: (AtLocation, Wearing) = (Home, Tie)

States: Planning Example: Lemonade Stand

( weather, #lemons, $$ )=

( ? , , ) or

( , , )

Desired (Goal, Final) State Example: Lemonade Stand

( weather, #lemons, $$ )=

( -- , -- , )

[slide added by C. Rich]

Page 7: 3 States and a Plan: The AI of F.E.A.R. - WPIweb.cs.wpi.edu/~rich/courses/imgd4100-b11/lectures/L-Planning.pdf · 1 3 States and a Plan: The AI of F.E.A.R. Jeff Orkin Monolith Productions

7

STRIPS Planning Example STRIPS Planning Example

STRIPS Planning Example STRIPS Planning Example

Page 8: 3 States and a Plan: The AI of F.E.A.R. - WPIweb.cs.wpi.edu/~rich/courses/imgd4100-b11/lectures/L-Planning.pdf · 1 3 States and a Plan: The AI of F.E.A.R. Jeff Orkin Monolith Productions

8

STRIPS Planning Example STRIPS Planning Example

State: (phone#, recipe, hungry?) Goal: ( -- , -- , NO ) ( , -- ,YES) ( , -- ,NO ) ( -- , ,YES) ( -- , ,NO )

STRIPS Planning Example

State: (phone#, recipe, hungry?) Goal: ( -- , -- , NO ) ( , ,NO ) ( , ,YES) ( , ,NO )

STRIPS Planning Example

Page 9: 3 States and a Plan: The AI of F.E.A.R. - WPIweb.cs.wpi.edu/~rich/courses/imgd4100-b11/lectures/L-Planning.pdf · 1 3 States and a Plan: The AI of F.E.A.R. Jeff Orkin Monolith Productions

9

STRIPS Planning Example

State: (phone#, recipe, hungry?) Action

Preconditions: ( , -- , -- ) Effects:

Delete List: Hungry( YES ) Add List: Hungry( NO )

STRIPS Planning Example

STRIPS Planning Example STRIPS Planning Example

Page 10: 3 States and a Plan: The AI of F.E.A.R. - WPIweb.cs.wpi.edu/~rich/courses/imgd4100-b11/lectures/L-Planning.pdf · 1 3 States and a Plan: The AI of F.E.A.R. Jeff Orkin Monolith Productions

10

STRIPS Planning Example STRIPS Planning Example

Here’s the Plan:

•  STRIPS Planning Overview •  Planning in F.E.A.R. •  Differences from STRIPS •  Squad Behaviors & Communication •  Beyond F.E.A.R.

Design Philosophy

Designer’s job is: Create environments that allow AI to

showcase their behaviors. Designer’s job is NOT: Script behavior of individual AI.

Page 11: 3 States and a Plan: The AI of F.E.A.R. - WPIweb.cs.wpi.edu/~rich/courses/imgd4100-b11/lectures/L-Planning.pdf · 1 3 States and a Plan: The AI of F.E.A.R. Jeff Orkin Monolith Productions

11

Planning Video #1

Planning Video #1

Planning Video #1

Planning Video #1

Page 12: 3 States and a Plan: The AI of F.E.A.R. - WPIweb.cs.wpi.edu/~rich/courses/imgd4100-b11/lectures/L-Planning.pdf · 1 3 States and a Plan: The AI of F.E.A.R. Jeff Orkin Monolith Productions

12

Planning Video #1

Planning Video #1

Planning Video #2

Planning Video #3

Page 13: 3 States and a Plan: The AI of F.E.A.R. - WPIweb.cs.wpi.edu/~rich/courses/imgd4100-b11/lectures/L-Planning.pdf · 1 3 States and a Plan: The AI of F.E.A.R. Jeff Orkin Monolith Productions

13

Planning Video #4

Planning Video #4 Soldier Assassin Rat

Benefits of Planning

1.  Decoupling Goals & Actions 2.  Layering Behaviors 3.  Dynamic Problem Solving

Decoupling Goals & Actions

Page 14: 3 States and a Plan: The AI of F.E.A.R. - WPIweb.cs.wpi.edu/~rich/courses/imgd4100-b11/lectures/L-Planning.pdf · 1 3 States and a Plan: The AI of F.E.A.R. Jeff Orkin Monolith Productions

14

Decoupling Goals & Actions

AttackFromCover

tt

t

t

t

Priority: 8.0Sensors: Vision, CoverNodes

Patrol

tt

t

t

t

Priority: 1.0Sensors: PatrolNodes

Investigate

tt

t

t

t

Priority: 3.0Sensors: HearDisturbance

Search

tt

t

t

t

Priority: 6.0Sensors: Vision, SearchNodes

Decoupling Goals & Actions

Decoupling Goals & Actions

+ =

Benefits of Planning

1.  Decoupling Goals & Actions 2.  Layering Behaviors 3.  Dynamic Problem Solving

Page 15: 3 States and a Plan: The AI of F.E.A.R. - WPIweb.cs.wpi.edu/~rich/courses/imgd4100-b11/lectures/L-Planning.pdf · 1 3 States and a Plan: The AI of F.E.A.R. Jeff Orkin Monolith Productions

15

Layering Behaviors Layering Behaviors

Layering Behaviors

Layering Behaviors

Page 16: 3 States and a Plan: The AI of F.E.A.R. - WPIweb.cs.wpi.edu/~rich/courses/imgd4100-b11/lectures/L-Planning.pdf · 1 3 States and a Plan: The AI of F.E.A.R. Jeff Orkin Monolith Productions

16

Layering Behaviors

Layering Behaviors

Layering Behaviors

Layering Behaviors

Page 17: 3 States and a Plan: The AI of F.E.A.R. - WPIweb.cs.wpi.edu/~rich/courses/imgd4100-b11/lectures/L-Planning.pdf · 1 3 States and a Plan: The AI of F.E.A.R. Jeff Orkin Monolith Productions

17

Layering Behaviors

Layering Behaviors

Layering Behaviors

Layering Behaviors

Page 18: 3 States and a Plan: The AI of F.E.A.R. - WPIweb.cs.wpi.edu/~rich/courses/imgd4100-b11/lectures/L-Planning.pdf · 1 3 States and a Plan: The AI of F.E.A.R. Jeff Orkin Monolith Productions

18

Layering Behaviors

Layering Behaviors

Layering Behaviors

Layering Behaviors

Kill Enemy

Attack Ranged

Page 19: 3 States and a Plan: The AI of F.E.A.R. - WPIweb.cs.wpi.edu/~rich/courses/imgd4100-b11/lectures/L-Planning.pdf · 1 3 States and a Plan: The AI of F.E.A.R. Jeff Orkin Monolith Productions

19

Layering Behaviors

Kill Enemy

Attack Ranged

Attack Melee

Layering Behaviors

Kill Enemy

Attack Ranged

Attack Melee

Dodge Shuffle

Dodge Roll

Dodge

Layering Behaviors

Kill Enemy

Attack Ranged

Attack Melee

Dodge Shuffle

Dodge Roll

Dodge

Cover

Goto

Dodge Covered

Layering Behaviors

Kill Enemy

Attack Ranged

Attack Melee

Dodge Shuffle

Dodge Roll

Dodge

Cover

Goto

Dodge Covered

Blind Fire

Page 20: 3 States and a Plan: The AI of F.E.A.R. - WPIweb.cs.wpi.edu/~rich/courses/imgd4100-b11/lectures/L-Planning.pdf · 1 3 States and a Plan: The AI of F.E.A.R. Jeff Orkin Monolith Productions

20

Layering Behaviors

Kill Enemy

Attack Ranged

Attack Melee

Dodge Shuffle

Dodge Roll

Dodge

Cover

Goto

Dodge Covered

Blind Fire

Ambush

Layering Behaviors

Kill Enemy

Attack Ranged

Attack Melee

Dodge Shuffle

Dodge Roll

Dodge

Cover

Goto

Dodge Covered

Blind Fire

Ambush

Layering Behaviors

Benefits of Planning

1.  Decoupling Goals & Actions 2.  Layering Behaviors 3.  Dynamic Problem Solving

Page 21: 3 States and a Plan: The AI of F.E.A.R. - WPIweb.cs.wpi.edu/~rich/courses/imgd4100-b11/lectures/L-Planning.pdf · 1 3 States and a Plan: The AI of F.E.A.R. Jeff Orkin Monolith Productions

21

Dynamic Problem Solving

Dynamic Problem Solving

Planning Algorithm

[Slide added by C. Rich]

Cost Per Action

Page 22: 3 States and a Plan: The AI of F.E.A.R. - WPIweb.cs.wpi.edu/~rich/courses/imgd4100-b11/lectures/L-Planning.pdf · 1 3 States and a Plan: The AI of F.E.A.R. Jeff Orkin Monolith Productions

22

Cost Per Action

2 8

Cost Per Action

2 8

* A

Cost Per Action

A

Cost Per Action

A* Navigation Planning

Nodes: NavMesh Polys World States

Edges: NavMesh Poly Actions Edges

Goal: NavMesh Poly World State

Page 23: 3 States and a Plan: The AI of F.E.A.R. - WPIweb.cs.wpi.edu/~rich/courses/imgd4100-b11/lectures/L-Planning.pdf · 1 3 States and a Plan: The AI of F.E.A.R. Jeff Orkin Monolith Productions

23

Here’s the Plan:

•  STRIPS Planning Overview •  Planning in F.E.A.R. •  Differences from STRIPS •  Squad Behaviors & Communication •  Beyond F.E.A.R.

Summary •  Goals and actions as data (vs. code)

–  easier development –  additivity –  actions specified as add/delete lists

•  AI planner automatically strings together actions (vs. manually coded FSM’s or BT’s) –  flexibility, “problem solving” –  search using backward chaining

[Slide added by C. Rich]