the art of game ai - intrinsic algorithm · 2010-10-20 · “reducing the world to mathematical...

72
“Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse Dave Mark President & Lead Designer Intrinsic Algorithm LLC Kevin Dill R* New England Blue Fang Boston University

Upload: others

Post on 07-Jun-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

The Art of Game AI:Sculpting Behavior with

Data, Formulas, and Finesse

Dave MarkPresident & Lead

DesignerIntrinsic Algorithm LLC

Kevin DillR* New England

Blue FangBoston University

Page 2: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Dave Mark• President & Lead Designer of

Intrinsic Algorithm LLC• Game Studio• AI Consulting Company

• Author of Behavioral Mathematics for

Game AI• Co-founder of

AI Game Programmers Guild• Organizer and co-host of the

AI Summit at GDC 2009(soon to be 2010!)

Page 3: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Premises/DisclaimersThe examples you will see are only

scratching the surface.

There is no way to show concrete implementation in a 1-hour lecture.

We want to make you think aboutwhat you can do.

Page 4: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

What makes a game a game?

“A game isa series of interesting choices.”

- Sid Meier

Page 5: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

AI is Your World!

Boring AI = Boring WorldDeep AI = Immersive World

Repetitive AI = Monotonous WorldDynamic AI = Dynamic World

Page 6: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

What is your reaction?

• Want to pet• Want to meet• Just curious• Annoyed• Want to kick• Want to run screaming

Want to pet

Just curious Annoyed

Want to kick

Want to run screaming

Want to meet

Page 7: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

• Want to pet• Want to meet• Just curious• Annoyed• Want to kick• Want to run screaming

Now what is your reaction?

Want to pet

Want to meet

Just curious

Annoyed Want to kick

Want to run screaming

Page 8: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Varieties of Reactions

Want to pet

Just curious Annoyed

Want to kick

Want to run screaming

Want to meet

Want to pet

Want to meet

Just curious

Annoyed Want to kick

Want to run screaming

Page 9: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Same Model for All Agents

Want to meet

Want to run screaming

Want to kick

Annoyed

Just curious

Want to pet Want to run screaming

Want to kick

Annoyed

Just curious

Want to meet

Want to pet

Extreme Reactions

Page 10: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Varieties of Reactions

Want to pet

Just curious Annoyed

Want to kick

Want to run screaming

Want to meet

• Differences Exist• Don’t need to know why• Need to simulate that

difference do exist– Not completely random

selection– Must be reasonable

Page 11: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

How Can We Express Differences?

• Not that information exists (e.g. yes or no) but what that information says.

• Identifying more than one factor for input

• Allowing for more than one possible result

Page 12: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

How Can We Express Differences?

• Not that information exists (e.g. yes or no) but what that information says.

• Identifying more than one factor for input

• Allowing for more than one possible result

Page 13: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Processing One Piece of Info

Simple example:As the distance changes,how much anxiety do you

have?

Page 14: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Simple Rule

Binary Threshold

0.00

0.25

0.50

0.75

1.00

0 10 20 30 40 50 60 70 80 90 100

Distance

Anx

iety

Binary

If distance <= 30

Page 15: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Linear Formula

Linear Threshold

0.00

0.25

0.50

0.75

1.00

0 10 20 30 40 50 60 70 80 90 100

Distance

Anx

iety

Linear

Anxiety = (100 – distance) / 100

Page 16: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Exponential Formula

Exponential Threshold

0.00

0.25

0.50

0.75

1.00

0 10 20 30 40 50 60 70 80 90 100

Distance

Anxi

ety

Exponent ial

Anxiety = (100 – distance3) / (1003)

Page 17: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Threshold / Linear/ Exponential

Exponential Threshold

0.00

0.25

0.50

0.75

1.00

0 10 20 30 40 50 60 70 80 90 100

Distance

Anxi

ety

Binary

Linear

Exponent ial

Page 18: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Changing Exponents

Exponent Function Variations

0.00

0.25

0.50

0.75

1.00

0 10 20 30 40 50 60 70 80 90 100

Distance

Anxi

ety

Exponents of 2, 3, 4, 6

Page 19: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Shifting the Curve

Exponent Function Variations

0.00

0.25

0.50

0.75

1.00

0 10 20 30 40 50 60 70 80 90 100

Distance

Anx

iety

Page 20: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Logistic Function

xey −+=

11

Page 21: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Logistic Function

Logistic Function Threshold

0.00

0.25

0.50

0.75

1.00

0 10 20 30 40 50 60 70 80 90 100

Distance

Anxi

ety

Logist ic

Anxiety = 1/(1+(2.718 x 0.45)distance+40 )

Page 22: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Curve Comparison

Exponential Threshold

0.00

0.25

0.50

0.75

1.00

0 10 20 30 40 50 60 70 80 90 100

Distance

Anx

iety Binary

Linear

Exponent ial

Logist ic

Page 23: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Variations on the Logistic Curve

Logistic Function Variations

0.00

0.25

0.50

0.75

1.00

0 10 20 30 40 50 60 70 80 90 100

Distance

Anx

iety

Page 24: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Shifting the Logistic Function

Logistic Function Variations

0.00

0.25

0.50

0.75

1.00

0 10 20 30 40 50 60 70 80 90 100

Distance

Anx

iety

Page 25: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

How Can We Express Information?

• Increasing or Decreasing?• Rates of change

– Steady or Variable?– Inflection Point?

• Amount of change– Constrained or Infinite?– Asymptotic?

Page 26: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Know when to walk away…

• Design Decision: “Enemies don’t always fight to the death”

• Enemies can sometimes retreat– Flat % chance

• Is random… therefore looks random• Not realistic

– Situational random• Based on circumstances• Circumstances are flexible and dynamic

Page 27: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Know when to walk away…

Page 28: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Know when to walk away…How many on my side are still fighting?

8

How many of my enemies are still fighting?

5

1.6

Page 29: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Know when to walk away…

PercentChance = (4 – Ratio)4 / (44)Percent Chance that an Individual will Retreat

0%

25%

50%

75%

100%

0 0.5 1 1.5 2 2.5 3 3.5 4

Page 30: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Know when to walk away…

PercentChance = (4 – Ratio)4 / (44)

PercentChance = (4 – 1.6)4 / (44)

PercentChance = 13%

Page 31: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Know when to walk away…

Page 32: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Know when to walk away…How many on my side are still fighting?

7

How many of my enemies are still fighting?

5

1.4

Page 33: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Know when to walk away…

PercentChance = (4 – Ratio)4 / (44)

PercentChance = (4 – 1.4)4 / (44)

PercentChance = 18%

Page 34: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Know when to walk away…

PercentChance = (4 × Ratio)4 / (44)Percent Chance that an Individual will Retreat

0%

25%

50%

75%

100%

0 0.5 1 1.5 2 2.5 3 3.5 4

Page 35: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Know when to walk away…

Page 36: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

How Can We Express Differences?

• Not that information exists (e.g. yes or no) but what that information says.

• Identifying more than one factor for input

• Allowing for more than one possible result

Page 37: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Know when to walk away…PercentChance =

( ( MaxRatio – Ratio )k × MaxPct ) / (MaxRatio k )

80.50In Base60.75Near Base41.00In FieldkMaxPct

Page 38: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Percent Chance that an Individual will Retreat

0%

25%

50%

75%

100%

0 0.5 1 1.5 2 2.5 3 3.5 4

Know when to walk away…

( ( 4 – Ratio )4 × 1.00 ) / ( 44 )( ( 4 – Ratio )4 × 1.00 ) / ( 44 )

( ( 4 – Ratio )6 × 0.75 ) / ( 46 )( ( 4 – Ratio )6 × 0.75 ) / ( 46 )

( ( 4 – Ratio )8 × 0.50 ) / ( 48 )( ( 4 – Ratio )8 × 0.50 ) / ( 48 )

Page 39: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Know when to walk away…

• Factors to Consider– Number of allies– Number of enemies– Proximity to Base– Strength of allies – Strength of enemies– My own health– Proximity of my leader

Page 40: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Know when to walk away…Numberof Allies

Numberof Enemies

Threat Ratio

My HealthProximityto Leader

Strengthof Allies

Strengthof Enemies

Allied Strength Enemy Strength

My Morale

Retreat %

Proximityto Base

Urgency

“Compartmentalized Confidence”

Page 41: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

How does this look to the players?

• Enemies aren’t completely fearless• They are slightly unpredictable• They are still reasonable• Curiosity: “Where is he going?”• “If we show force, they might break and run.”• “If we back them up, they are more aggressive.”• We have to react to their reactions.

Page 42: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

How Can We Express Differences?

• Not that information exists (e.g. yes or no) but what that information says.

• Identifying more than one factor for input

• Allowing for more than one possible result

Page 43: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

More than “Fight or Flight”

• Fight normally• Flee• Charge

Page 44: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

More than “Fight or Flight”Percent Chance that an Individual will Retreat or Charge

0%

25%

50%

75%

100%

0 0.5 1 1.5 2 2.5 3 3.5 4

Page 45: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

More than “Fight or Flight”

• Fight– Melee weapon– Ranged weapon– Special rare weapon

• Advance– Press forward– Berserker charge

• Retreat– Fighting withdrawal– Find Cover– Organized pull back– Flee in abject terror– Surrender

Too many individual curves!!

Page 46: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

More than “Fight or Flight”Special Press Forward

Berserk Charge

Withdrawal

Cover

Pull Back

Flee

Surrender

Melee

Ranged

Page 47: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

More than “Fight or Flight”SpecialPress ForwardBerserk Charge

Withdrawal

Cover

Pull Back

FleeSurrender

Melee

Ranged

Page 48: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

More than “Fight or Flight”

Special Press Forward

Berserk Charge

Withdrawal

Cover

Pull Back

Flee

Surrender

Melee

Ranged

“Normal” “Wounded”

SpecialPress ForwardBerserk Charge

Withdrawal

Cover

Pull Back

FleeSurrender

Melee

Ranged

How do we get to this point?

Page 49: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Selecting from Multiple Actions

• We can’t run one check for each possible action– Too cumbersome– Each action is mathematically independent

• Structure to place all possible actions in play at the same time.– Auto-balancing– Expandable– Easy to select one action

Page 50: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Preferences = Differences

Page 51: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Ordinal Rankings

1

2

3

4

5

6

Page 52: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Measuring Information

• Identifying differences– Is ordinal enough?

(i.e. a < b < c)– If more, then how much more?

(e.g. a = 2 x b)

• Normalization (e.g. 0..1)

Page 53: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Normalizing Ratings

0 1

0.1 0.3 0.5 0.6 0.75 0.9

1.0 = “the best possible”0.0 = “the worst possible”

Normalized Satisfaction

Page 54: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

You Can’t Always Get What You Want

• Multiple Preferences– Mine– Kevin’s

• Cost (Is Kevin paying?)• Time (Do we still need to finish our

slides?)

Page 55: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

You Can’t Always Get What You Want

Kevin’sPreference

MealScore

Time

Dave’sPreference

CombinedPreference

MealCost

0.6 0.9

0.2 0.1

1x 2x

0.8

3x 1x 2x

0.46

Page 56: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

You Can’t Always Get What You Want

Kevin’sPreference

MealScore

Time

Dave’sPreference

CombinedPreference

MealCost

Kevin’sPreference

MealScore

Time

Dave’sPreference

CombinedPreference

MealCost

Kevin’sPreference

MealScore

Time

Dave’sPreference

CombinedPreference

MealCost

Kevin’sPreference

MealScore

Time

Dave’sPreference

CombinedPreference

MealCost

Kevin’sPreference

MealScore

Time

Dave’sPreference

CombinedPreference

MealCost

Kevin’sPreference

MealScore

Time

Dave’sPreference

CombinedPreference

MealCost

Page 57: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

You Can’t Always Get What You Want

0.33

0.40

0.33

0.63

0.63

0.80

Pref.

0.570.80.80.10.8Pasta

0.620.90.70.30.6Salad

0.380.40.50.40.2Tacos

0.480.30.40.60.7Chicken

0.680.80.60.70.5Pizza

0.470.10.20.90.6Steak

ScoreTimeCostDaveKevinMeal

Page 58: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Selecting a Result

• Select Top Score• Random from top n choices

– E.g. “Pick evenly from top 3”• Weighted random

– All possible– Top n

Want to meet

Want to run screaming

Want to kick

Annoyed

Just curious

Want to pet

Page 59: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Selecting a ResultWhat's for Dinner?

Steak15%

Pizza21%

Chicken15%

Tacos12%

Salad19%

Pasta18%

Want to pet

Just curious Annoyed

Want to kick

Want to run screaming

Want to meet

Page 60: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Weighted Random Selection

Steak Pizza Chicken Tacos Salad Pasta

0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%

Generate a random number…And let the bouncing ball choose.

Page 61: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

So what have we learned?• People are different.

– Different reactions to the same stimulus– Not random but reasonable

• Beyond just checking for information– What does that information mean to the decider?– How do different inputs relate to each other?

• Allow multiple reactions– Not just “the best” (Don’t always pet nice doggie.)– Base the possibility of a reaction on its merit

Page 62: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Dave MarkIntrinsic Algorithm LLC

[email protected]

www.IntrinsicAlgorithm.com

(402) 208–7054

IADaveMarkon:

Yahoo – AIM - Twitter

Page 63: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Kevin Dill

• Senior AI Engineer, R* New England• Lecturer, Boston University• Section Editor, AI Game Programming Wisdom 4

Page 64: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

This Is A Tiger

Tiger.mov

Page 65: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

This Is A Tiger• Constantly moving, constantly attending• No looping or repetitive animations• No straight lines or crisp turns

• Believable, organic, grounded in and reactive to the world around him

• We won’t be truly photorealistic until we achieve this

Page 66: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

The Big Picture• Build strong cross-disciplinary teams

– AI & animation– AI & sound

• Build capabilities from game to game– e.g. Natural Motion

• Retain (and develop) your core talent!!

– AI & dialog writers– Designers, QA, etc.

Page 67: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Be An AI Artist• Become an observer

– How people move – How they interact

• Different situations– Halls & doorways– The mall

• Get lots of eyes on it– Your wife & friends – Your players

• Crave criticism!!

– How they gesture– What they say

– Parties & social groups– The boss’s office

– The animators– QA

Page 68: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Behavioral Building Blocks• Get core behaviors to work, build up• Think about our tiger

– Breathing– Fidgets: yawning, stretching, twitching, etc.– Attention

• Build those animation performances• Build idles, movement behaviors• Build play, eat, fight, sleep, work, …

Page 69: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Believable, Organic• Break the animation loop• Multiple asynchronous animations

– Separate out breathing, tail, etc.– Attention

• Random variance– Speed– Blend weights

• Blend procedural techniques & animation

– Bone positions– Wiggle (Perlin noise)

Page 70: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Grounded & Reactive• Types of targets:

– Neutral– Random

• Types of attention– Ear twitch / cock head– Headlook– Behavior change

• Library of reactions• What to do next?

– Object / entity– Event

Page 71: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

No Straight Lines• Path planner is just a general guide• Do good smoothing, add a little wander

– Use your terrain abstraction• Or, flow fields to guide animation selection• Support multiple locomotion modes

– Walk, run, crawl, jump, climb, swim– Smooth, natural transitions

• Stop anywhere. Reach from anywhere.

Page 72: The Art of Game AI - Intrinsic Algorithm · 2010-10-20 · “Reducing the world to mathematical equations!” The Art of Game AI: Sculpting Behavior with Data, Formulas, and Finesse

“Reducing the world to mathematical equations!”

Dave Mark [email protected]

(402) 208–7054IADaveMark

on:Yahoo – AIM - Twitter

Kevin Dill [email protected]