1 / 27

Probability and Risk

Probability and Risk. CS 4730 – Computer Game Design Credit: Several slides from Walker White (Cornell). 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

PamelaLan
Télécharger la présentation

Probability and Risk

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. 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. The Game Loop • In general: • Handling time • Gathering player input • Networking • Simulation • Collision detection and response • Object updates • Rendering • Other miscellaneous tasks 3

  4. 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. 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. It All Start With Numbers • Hope you remember your APMA classes… • Statisticsis 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. 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. 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. 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. 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. 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. 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. 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. 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. 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 15

  16. Settlers of Catan 16

  17. 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? 17

  18. Chutes and Ladders 18

  19. 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! 19

  20. 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! 20

  21. 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! 21

  22. 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! 22

  23. 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 23

  24. Fog of War - Partial 24

  25. Fog of War - Total 25

  26. 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 26

  27. 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 27

More Related