Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 4730 Probability and Risk CS 4730 – Computer Game Design Credit: Several slides from Walker White (Cornell)

Similar presentations


Presentation on theme: "CS 4730 Probability and Risk CS 4730 – Computer Game Design Credit: Several slides from Walker White (Cornell)"— Presentation transcript:

1 CS 4730 Probability and Risk CS 4730 – Computer Game Design Credit: Several slides from Walker White (Cornell)

2 CS 4730 Quick Recap The game state is the current positioning/value of all entities in the game world Actions a player takes is input into the current game state An interaction is a function between game states as determined by the actions (of both player and world) in generating a new game state The Game Loop 2

3 CS 4730 The Game Loop In general: –Handling time –Gathering player input –Networking –Simulation –Collision detection and response –Object updates –Rendering –Other miscellaneous tasks 3

4 CS 4730 In MonoGame Initialize() –Network, DB, etc. LoadContent() –Graphics and other assets loaded Update(GameTime) –Update the game state based on input Draw(GameTime) –Refresh the screen 4

5 CS 4730 MonoGame Design doc due Friday –Follow requirements for Written Word Prototype due next Friday –We will expect at least one realized mechanic in the game –We do NOT expect great art, music, etc. –If you expect controller input later, we expect that now 5

6 CS 4730 It All Start With Numbers Hope you remember your APMA classes… Statistics is the study of what HAS happened Probability predicts what WILL happen The interesting this is that people are reasonably good at statistics, but horrible at probability “What’s the likelihood it will rain tomorrow?” 6

7 CS 4730 Randomness Computers are actually horrible at being truly random Which is both good and bad Bad for security purposes Good for networked games to have the same state without transmitting that state Probability of any value is written as P(x) 7

8 CS 4730 Traditional Randomness Cards and dice are still used as metaphors for randomness (and non-metaphors…) We still uses these items in both board and video games for randomness 8

9 CS 4730 Cards and Dice Card notation: –4S – 4 of Spades –AH – Ace of Hearts Dice notation –xdn, where x is the number of dice to roll and n is the number of sides on each dice –2d6 – roll 2 6-sided dice, values will be 2-12 –3d8+4 – roll 3 8-sided dice and add 4 to the result, values will be 7-28 9

10 CS 4730 The Outcome Tree We can calculate the probability of any random event by working out the outcome tree and counting the possibility Monte Carlo simulations run the function for a large number of times and using that to determine percentages 10

11 CS 4730 Combining Probabilities P(not A) = 1 – P(A) P(A or B) = P(A) + P(B) P(A and B) = P(A) * P(B) 11

12 CS 4730 Expected Value The expected value is the average of all the possibilities of a random variable Each value is weighted by its probability E(x) = Sum(k * P(“x=k”)) over the possible values of k E(1d2) = 1 * P(“x=1”) + 2 * P(“x=2”) = 1 *.5 + 2 *.5 = 1.5 12

13 CS 4730 Dice Expected Values E(1d4) = 2.5 E(1d6) = 3.5 E(1d8) = 4.5 E(1d10) = 5.5 E(1d12) = 6.5 E(1d20) = 10.5 13

14 CS 4730 Variance What is the distribution of possible values about the expected value? Var(x) = E((x – E(x)) 2 ) Uniform (high variance) Bimodal (low and high variance) Gaussian (low and high variance) Zero variance 14

15 CS 4730 Compound Expressions E(x + y) = E(x) + E(y) E(x + c) = E(x) + c E(c * x) = c * E(x) E(x * y) = E(x) * E(y) Var(x + y) = Var(x) + Var(y) Var(x + c) = Var(x) Var(c * x) = c 2 * Var(x) 15

16 CS 4730 Probabilities of Catan Let’s look at the math of Catan to figure out how probabilities play into the game Quick overview of the rules of Settlers of Catan –http://www.catan.com/service/game-rules 16

17 CS 4730 Settlers of Catan 17

18 CS 4730 Probabilities of Catan It’s actually pretty easy to know what’s the “best” option –Just add up the dots! Probability and randomness plays a HUGE role in Catan working “correctly.” What about games in which probability and randomness is the entire game? 18

19 CS 4730 Chutes and Ladders 19

20 CS 4730 Chutes and Ladders The game is ALL RANDOM. But a video game that is ALL SKILL can eventually get boring! –You’ve learned every pattern –You’ve seen every level and enemy –Nothing varies! We need to consider games that have some aspects of both! 20

21 CS 4730 Why do people gamble? Let’s face it – gambling in Vegas is a losing proposition Over time, everyone loses money But in the (very) short term, it’s definitely possible to win And besides – risk and uncertainty can be a lot of fun! 21

22 CS 4730 Psychology of Randomness Player’s like longshots! –How many times have you gone for the “super move” to win the game? –Even if it’s a low probability, players will optimize for it! Player’s suffer from too much Monte Carlo –“Oh, I’ve gotten bad results for so long… a good card/good roll has to come up soon!” –Probability does not care what the last roll was, but players will think the game is “unfair” otherwise! 22

23 CS 4730 Psychology of Randomness But think about it another way – I bet you remember those big payoff moments And THAT’S what gets you coming back to a game! 23

24 CS 4730 Other Forms of Risk Imperfect information can add to the challenge/risk in a game without as much randomness Perhaps you don’t know everything about the game state –Either AI or another player Perhaps don’t know about the game might change 24

25 CS 4730 Fog of War - Partial 25

26 CS 4730 Fog of War - Total 26

27 CS 4730 Information Types Info known to all players Info known by one player Info known by the game only –Some game state information, like next card in the deck Info unknown –Next random number to be generated 27

28 CS 4730 Difference Between Video and Board Table top games rely on randomness to work –Information that the game only knows can be hard to manage –D&D does this through a Dungeon Master However, while computers aren’t as good at randomness, they are fantastic at managing information Implementation and adherence to rules also varies greatly 28


Download ppt "CS 4730 Probability and Risk CS 4730 – Computer Game Design Credit: Several slides from Walker White (Cornell)"

Similar presentations


Ads by Google