“reducing the world to mathematical equations!” using randomness: both sides of the coin dave...

Post on 14-Jan-2016

212 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

“Reducing the world to mathematical equations!”

Using Randomness:Both Sides of the Coin

Dave Mark – Intrinsic Algorithm LLCBrian Schwab – Blizzard

“Reducing the world to mathematical equations!”

Dave Mark• President & Lead Designer of Intrinsic Algorithm LLC

– Independent Game Studio– AI Consulting Company

• Author of Behavioral Mathematics for Game AI• Contributed to:

– AI Game Programming Wisdom 4– Game Programming Gems 8

“Reducing the world to mathematical equations!”

Eye of the Beholder

1256

0.4%

“Reducing the world to mathematical equations!”

Eye of the Beholder

1256

0.4%

“Reducing the world to mathematical equations!”

Eye of the Beholder

“Reducing the world to mathematical equations!”

Eye of the Beholder• People are conditioned to see patterns

– Inflate their importance– Easier to recall

• Chunking – Packaging info into memorable chunks

• “The magical number 7, plus or minus 2”– George A. Miller, Princeton, 1956

“Reducing the world to mathematical equations!”

Eye of the Beholder• People can identify shorter patterns or

groupings.• Forget to consider the entire context

“Reducing the world to mathematical equations!”

Opportunity != Outcome• The long-term odds (or % chance) of an event

happening can be a poor predictor of short term results.

• People suck at remembering that.• People suck at calculating that.• It can be used for good or eeevviiilllll!

“Reducing the world to mathematical equations!”

Opportunity != Outcome

Sid Meier

“But I had 3…and he only had 1!”

“Reducing the world to mathematical equations!”

Opportunity != Outcome

Team A has a 55% chance of winning each game

Team B will win series40% of the time

Team A has 66.6% chance of winning each game

Team B will still win series 20% of the time

7-game series (e.g. baseball, basketball)

“Reducing the world to mathematical equations!”

That’s a lot of games…• Statistically significant –

i.e. weaker team wins < 5% of the time– Stronger team has 66.7% advantage

• Best 12 out of 23

– Stronger team has 55% advantage• Best of 135 out of 269!

“Reducing the world to mathematical equations!”

Law of Large NumbersAs the number of trials increases, the outcome approaches the theoretically expected value.

“Reducing the world to mathematical equations!”

When Is it “Large Enough”?

Statistical Significance Minimum Trials± 5% 370± 2% 1000

To achieve a 90% chance of getting within ± n%.

(Think polls)

“Reducing the world to mathematical equations!”

Law of… small numbers?• Kahneman & Tversky

– Judgment and decision-making– Behavioral economy

• Sarcastic reference to misconception that a small sample accurately reflects underlying probabilities.

“Reducing the world to mathematical equations!”

Gambler’s Fallacy• Idea that the odds of an independent event

with fixed probability changing based on recent occurrences.– “Catching up.”– “His luck will run out sooner or later.”– “He’s due!”

“Reducing the world to mathematical equations!”

We all do it…22

14

20

35

30

4

11

24

6

19

22

13

8

17

31

10

4

00

24

31

29

25

17

35

“Reducing the world to mathematical equations!”

What do People Perceive?

0 0.15 0.3 0.45 0.6 0.75 0.9000000000000010.0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1.0

“Reducing the world to mathematical equations!”

Determinism that Looks Random• 3 Sine waves

– Different frequencies– Different magnitudes

• For each value of x– Sum y values– Normalize

3

1

3

1

sin

nn

nnn

magnitude

periodxmagnitudexf

Period 50 133 271

Mag. 1.0 1.1 2.0

“Reducing the world to mathematical equations!”

Complexity Obscures Patterns• People can only keep track of a limited

number of factors• As factors increase, complexity increases• People can no longer keep track of

relationships• Deterministic result looks “random”

“Reducing the world to mathematical equations!”

Complexity Obscures Patterns

“Reducing the world to mathematical equations!”

Complexity Obscures Patterns

“Reducing the world to mathematical equations!”

Hidden Factors Look Random• People can only take into account what they

perceive• If input factors are hidden, people ascribe it to

randomness

“Reducing the world to mathematical equations!”

Brownian Motion• Robert Brown – 1827• Under a microscope – pollen grains moved in

“jittery” manner• Ascribed it to pollen being alive• Heat-based molecular vibration bumping the

grains

“Reducing the world to mathematical equations!”

Brownian Motion? ? ?

“Reducing the world to mathematical equations!”

Brownian Motion? ? ?

Fake it!

“Reducing the world to mathematical equations!”

Further Reading

“Reducing the world to mathematical equations!”

So what can we do with this?• Random sequences that look rigged…• Unseen deterministic factors that look random…• Intentional randomness to fake complex

determinism…

“Reducing the world to mathematical equations!”

Two Ways to Use It• Fuzzying Things Up• Weighted Randoms

“Reducing the world to mathematical equations!”

Fuzzying Things Up

“Reducing the world to mathematical equations!”

Fuzzying Things Up• Start with a defined anchor point• Add “parametric noise” (i.e. ± n)

“Reducing the world to mathematical equations!”

Fun with Distributions• 1 die = flat ±• 2 die = triangular distribution• 3+ die = bell curve

– More die → squished curve• Fun tricks

– Skewing dist. (e.g. 4 die, drop the lowest)– Combining different types of dice

“Reducing the world to mathematical equations!”

Single Die• Adds variation• Quick to process

– Single random call• Easy to visualize• Easy to tweak

Anchor

range

“Reducing the world to mathematical equations!”

2 Dice• Triangular distribution• Mostly clustered

towards center• Fairly quick to process

– Two random calls• Easy to visualize• Easy to tweak

Anchor

range

“Reducing the world to mathematical equations!”

1 die vs. 2 dice

“Reducing the world to mathematical equations!”

3+ Dice• Normal distribution

– Gaussian distribution– Bell curve

• Very clustered towards center

• Very expressive

• Slower to process– n random calls

• Harder to tweak

“Reducing the world to mathematical equations!”

3+ Dice

“Reducing the world to mathematical equations!”

Increase the Number of Dice

“Reducing the world to mathematical equations!”

3 dice vs. 5 dice

“Reducing the world to mathematical equations!”

3 dice vs. 5 dice

“Reducing the world to mathematical equations!”

Where to Use Randomness• Perception• Decision• Action

“Reducing the world to mathematical equations!”

Where to Use Randomness• Perception• Decision• Action

“Reducing the world to mathematical equations!”

Randomizing Perception• Range

– I can see 30’ ± 5’ = [25-35’]• Accuracy

– I have an 80% chance of seeing you ± 10%• Frequency

– Check senses every n ticks where n is 500-2000 ms

“Reducing the world to mathematical equations!”

Where to Use Randomness• Perception• Decision• Action

“Reducing the world to mathematical equations!”

Where to Use Randomness• Perception• Decision• Action

“Reducing the world to mathematical equations!”

Randomizing Actions• Delay before acting• Speed of acting• Acceleration into act

“Reducing the world to mathematical equations!”

Clap when you see the light…

“Reducing the world to mathematical equations!”

Human Response Times• Average is ≈250ms• Not everyone clapped at

250ms• Distributed over a range• Everyone clapping at 250ms

would be odd

“Reducing the world to mathematical equations!”

Human Response Times

195 200 205 210 215 220 225 230 235 240 245 250 255 260 265 270 275 280 285 290 295 300 305 310 315 320 325 330 335 340 3450.0%

1.0%

2.0%

3.0%

4.0%

5.0%

6.0%

7.0%

8.0%

Reaction Time

Per

cen

tag

e O

ccu

rren

ce

“Reducing the world to mathematical equations!”

Deliberative Decisions Take Time

“Reducing the world to mathematical equations!”

Deliberative Decisions Take Time

Action

ActionDeliberation

“Reducing the world to mathematical equations!”

Action Parameters• Reaction Time

– Initial (startle)– With decision

• Movement– Max speed– Acceleration– Turn rate

• Combat– Acquisition time– Fire rate– Accuracy– Reload speed

• [Whatever]

“Reducing the world to mathematical equations!”

What is different?• Each person is different

– People have different reflexes and reaction times– Why I can’t play twitch games very well

• Each action is different– Every time you clap after the light, it will be

different

“Reducing the world to mathematical equations!”

Instantiation vs. ActionIndividual People• Parameter’s base value for

all people• Fuzzy it up a bit• New base value for this one

person

Isolated Events• Take base value for this

person• Fuzzy it up a bit• New value for this event

“Reducing the world to mathematical equations!”

Instantiation vs. Action

250 ±50

200

300

230 ±25

205

255237

220

248

GeneralParam.

ThisAgent

ThisAction

“Reducing the world to mathematical equations!”

Instantiation vs. Action

250 ±50

200

300

262 ±25

237

287269

252

280

GeneralParam.

ThisAgent

ThisAction

“Reducing the world to mathematical equations!”

Where to Use Randomness• Perception• Decision• Action

“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

“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

“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

“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

“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• Simulate that differences do

exist– Not completely random selection– Must be reasonable– Can be simulated with weighted

randoms

“Reducing the world to mathematical equations!”

Brownian Motion? ? ?

Fake it!

“Reducing the world to mathematical equations!”

Multiple Agents – Multiple ReactionsStraight Deterministic Method• Same inputs• Same decision algorithms• Arrive at a decision• Same results

Random Noise Method• Same inputs• Same decision algorithms• Randomized selection• Varied results

“Reducing the world to mathematical equations!”

Weighted Randoms

“Reducing the world to mathematical equations!”

Weighted Randoms• Score all the possible

actions– Pre-set %– Contextual %– Dynamic %

• Calculate a weight– Normalized or not

• Line them up end-to-end– Covert weights into edges– Creates “buckets” sized

based on weights

• Throw a random at it– Which bucket does it land

in?

“Reducing the world to mathematical equations!”

Throw a Dart at It

A20%

B10%

C12%D

35%

E8%

F15%

“Reducing the world to mathematical equations!”

Let the bouncing ball choose!

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

A B C D E F

“Reducing the world to mathematical equations!”

The Payoff of Weighted Randoms• People aren’t all the same• There are reasonable options• Simulate how reasonable people may differ• Utilize the scoring of actions that we already do• Just do more than simply choose the “best”

“Reducing the world to mathematical equations!”

We Aren’t Solving an Equation• Computers are good at finding “the best”• People suck at it• Pollen grains aren’t alive

– They shouldn’t move– But they do (randomly?)

• People are alive– They should be different– List the likely decisions and pick (randomly)

Randomness in AIBrian Schwab

Humans + Random = DERPStatistics: we coolProbability: say wuh?

The LotteryCalifornia alone: over a billion a year. It’s like a 2.5% income tax subsidy.

StreaksSports. Gambling. Stock Prediction.

DangerRare events are grossly overestimated. Common events are largely ignored.

Skill + Chance = OutcomeWhat is important to your target audience?

Who are you working for?Skill/fiero Oriented

Twitch skills

Planning

Optimization

Fighting, RTS, FPS

Steep learning curve

Higher skill wins

Randomness BAD

Who are you working for?Distraction/play

orientedExploration

Easy access to positive reinforcement

Intuitive play

Puzzle, Social MMOs

Anybody can win

Randomness OK, not necessarily GOOD

…Or somewhere in between?

Skill

Chance

Chess,Fighters

FPS Zelda

TetrisPokerRPGDoom CS Roulette

YahtzeeRTS Diablo

MtG

Interaction + Outcome = FeelHow does playing the game feel?

Problem:Game feels overly random, or “streaky”

Adjusting Randomness Feel

Altered RandomnessFilters can mellow Law of Small Numbers effects

Rule based, Gaussian

Problem:Randomness is ruining game pacing

Adjusting Randomness Feel

Dynamic ResponseAllows game to hover around a particular emotional feel

Problem:Game needs randomness, but players are feeling cheated

Adjusting Randomness Feel

Fudged NumbersReal probabilities fall more in line with expectation

Problem:Random chance occasionally ruining the game

Adjusting Randomness Feel

Randomness Elimination

Some things can’t be left to chance

Adjusting Randomness Feel

Altered RandomnessFilters can mellow Law of Small Numbers effects

Rule based, Gaussian

Fudged NumbersReal probabilities fall more in line with expectation

Dynamic ResponseAllows game to hover around a particular emotional feel

Randomness Elimination

Some things can’t be left to chance

Random DevelopmentsThings to consider

Development ConcernsNetworked Games

Deterministic requirements

Development ConcernsNetworked Games

Deterministic requirements

DebuggingBug reporting and reproducing

Development ConcernsNetworked Games

Deterministic requirements

Difficulty RatingsDynamic settings

Last minute changes

DebuggingReplays

Bug reporting and reproducing

Development ConcernsNetworked Games

Deterministic requirements

Difficulty RatingsDynamic settings

Last minute changes

DebuggingReplays

Bug reporting and reproducing

System VisibilityTournament Play

Editors

RememberHumans suck at probability

Adjust level of usage for specific audience

Watch out for unintuitive biases

Thank You!

brian_schwab@yahoo.com

top related