MATH AND GAME BALANCE
Download
Report
Transcript MATH AND GAME BALANCE
CHAPTER 11
MATH AND GAME BALANCE
1
Topics
The Importance of Math in Game Balance
Using Spreadsheets to Balance Games
The Math of Probability
– Jesse Schell's 10 Rules of Probability
Weighted Distributions
Randomizer Technologies in Paper Games
Permutations
Positive and Negative Feedback Systems
2
The Importance of Math in Game Balance
Balance means different things depending on the
context
– In Multiplayer Games, balance most often means fairness
• Each player should have an equal chance of winning the game
• Most easily accomplished in symmetric games where each player
has the same starting point and abilities
• Balancing an asymmetric game is considerably more difficult
– And requires extensive playtesting
– In Single-Player Games, balance means
• The game is at an appropriate level of difficulty for the player
• The difficulty changes gradually
– If a game has a large jump in difficulty at any point, that point becomes a
place where the game will tend to lose players
3
The Importance of Math in Game Balance
"Change a number, and you change
the experience. Period."
– Chris Swain
Game Designer & Professor
4
The Importance of Math in Game Balance
Because numbers have such a profound effect on
games, you must understand some simple math
concepts to balance games well
In this chapter, you learn about several disparate
aspects of math that are all part of game design and
balance
This includes:
–
–
–
–
–
Understanding probability
An exploration of different randomizers for paper games
Weighted distribution
Permutations
Positive and negative feedback
5
Using Spreadsheets to Balance Games
Spreadsheet programs are often used by game
designers to explore issues of balance
The book chapter uses OpenOffice Calc to explore
math and probability
– Excel, Google Docs Spreadsheets, or LibreOffice Calc could
also be used
– But each program is slightly different
– OpenOffice was chosen because it is free & easily acquired
Spreadsheets are used in game balance because
– They can help you quickly grasp gestalt information
• Which allows you to make decisions based on numbers, not instinct
– Spreadsheet charts can help convince nondesigners of the
validity of game design decisions
6
Using Spreadsheets to Balance Games
Read the chapter to learn about using Calc
7
The Math of Probability
There are 36 different possible rolls of 2d6
8
The Math of Probability
Writing down every roll like this is enumeration
It's also possible to determine the number of possible
rolls with math
–
6
–
x6
– = 36
possible rolls for Die A
possible rolls for Die B
total possible rolls
Probability as a mathematical study was started by
Blaise Pascal and Pierre de Fermat
In The Art of Game Design, Jesse Schell lists 10 rules
of probability that all game designers should know
9
Schell's Ten Rules of Probability
Rule #1 - Fractions = Decimals = Percents
– All three are different ways to represent the same numbers
– The chance of rolling a 1 on 1d20 (a 20-sided die) is
• 1/20 as a Fraction
• 0.05 as a Decimal
• 5% as a Percent
– To convert between them:
•
•
•
•
Fraction to Decimal - Type the fraction into a calculator
Percent to Decimal - Divide by 100 (e.g., 5% = 5/100 = 0.05)
Decimal to Percent - Multiply by 100 (e.g., (0.05 * 100)% = 5%)
Anything to Fraction - Unfortunately, there's no easy way to do so
10
Schell's Ten Rules of Probability
Rule #2 - Probabilities range from 0 to 1
– According to Rule #1
• 0 to 1 and 0/1 to 1/1 and 0% to 100% are the same
– There can never be less than a 0% chance
– There can never me more than a 100% chance
Rule #3 - Probability is Sought Outcomes divided by
Possible Outcomes
– Example: Wanting to roll a 6 on 1d6
• Sought outcomes: 1 (the roll of 6)
• Possible outcomes: 6 (the number of sides of the die)
• Probability: 1/6 (≈1.666666 or ≈17%)
– Example: Wanting to draw a spade from a deck of cards
• Sought outcomes: 13 (the number of spades in the deck)
• Possible outcomes: 52 (total number of cards)
• Probability: 13/52 = 1/4 (0.25 or 25%)
11
Schell's Ten Rules of Probability
Rule #4 - Enumeration can solve simple problems
– If you have a low number of possible outcomes, enumeration
can work
• e.g., the 2d6 example on slide 8
– However, 10d6 has 60,466,176 possible rolls!
• This can only be reasonably enumerated by a computer
• Appendix B, "Useful Concepts" contains a program to do this
12
Schell's Ten Rules of Probability
Rule #5 - When sought outcomes are mutually
exclusive, add their probabilities
– Example: Drawing either an Ace or a Face Card from a deck
• There are no cards that are both an Ace and a Face Card
– So these sought outcomes are mutually exclusive
• Sought outcomes:
–
–
4
12
Aces
Face Cards
• Possible outcomes: 52 total cards in the deck
• Probability: 4/52 + 12/52 = 16/52 = 4/13 (≈0.3077 or ≈31%)
– Example: Rolling 1, 2, or 3 on 1d6
• Sought outcomes: 3 (1, 2, or 3)
• Possible outcomes: 6 (number of sides of the die)
• Probability: 3/6 = 1/2 (0.5 or 50%)
– If you use OR to describe sought outcomes, you can add
them together
13
Schell's Ten Rules of Probability
Rule #6 - When sought outcomes are not mutually
exclusive, multiply their probabilities
– Example: Drawing a card that is a Face Card and a Spade
• These sought outcomes are NOT mutually exclusive
• Probability for each case:
–
12/52 to draw a Face Card AND 13/52 to draw a Spade
• Total Probability: 12/52 x 13/52
= (12 x 13) / (52 x 52)
=
156 / 2704
=
3 / 52 (≈0.0577 or ≈6%)
– Example: Rolling two sixes on 2d6
• Sought outcomes: 1 on Die A and 1 on Die B
• Possible outcomes: 6 on Die A and 6 on Die B
• Probability: 1/6 x 1/6 = 1/36 (≈0.0278 or ≈3%)
– If you use AND to describe sought outcomes, you multiply
them together
14
Schell's Ten Rules of Probability
Rule #7 - One minus "does" = "doesn't"
– The chance of something happening is one minus the chance
of it NOT happening
– Sometimes it's easier to figure the chance of something not
happening and reverse it
– Example: The chance of rolling at least one 6 on 2d6
• Sought outcomes: 6_6 OR 6_x OR x_6 (x means a non-6)
• These are mutually exclusive (with an OR), so add
• Probability: ( 1/6 x 1/6 ) + ( 1/6 x 5/6 ) + ( 1/6 x 5/6 )
= 1/36 + 5/36 + 5/36 = 11/36
– Example: The chance of Die A rolling a non-six AND Die B
rolling a non-six (the opposite of the previous example)
• These sought outcomes are NOT mutually exclusive, so multiply
• Probability: 5/6 x 5/6 = 25/36
– Therefore, the chance of rolling at least one 6 on 2d6 is
• Probability: 1 - 25/36 = 11/36 (≈0.3055 or ≈30.6%)
15
Schell's Ten Rules of Probability
Rule #8 - The sum of multiple dice is not a linear
distribution
– With multiple dice, the probability of sums is a bell curve
– The more dice, the more extreme the bell curve
16
Let's zoom in!
Schell's Ten Rules of Probability
Rule #8 - The sum of multiple dice is not a linear
distribution With 4d6, you're 146 times more likely
tothe
roll probability
a 14 than a 4of
orsums
a 24 is a bell curve
– With multiple dice,
– The more dice, the more extreme the bell curve
With 10d6, you're about 4.4 million times more
likely to roll a 35 than a 10 or a 60!!!
35: 4,395,456 / 60,466,176 ≈ 7%
52: 23,760 / 60,466,176 ≈ 0.04%
17
Schell's Ten Rules of Probability
Rule #9 - Theoretical vs. practical probability
– Results of real rolls will differ from theoretical predictions
– This happens for several reasons
• Many dice are not perfectly balanced
• Probability is only the likelihood that something will happen, not a
guarantee
– For 2d6, you can guarantee theoretical results by printing a
deck of 36 cards (one 2, six 7s, two 11s, etc.)
• Only shuffle the deck once it's been completely exhausted
• This is an option for Settlers of Catan and was implemented in Tetris
– You can also write a computer program to roll dice randomly
several million times – The Monte Carlo approach
• The results will be similar to the theoretical bell curve but not exact
• This could be used to experimentally determine which properties on a
Monopoly board are most likely to be landed on
18
Schell's Ten Rules of Probability
Rule #10 - Phone a friend
– Nearly all college computer science and math students take
classes in probability
• Try asking one of them if you're stuck on a probability problem
– This is how the study of probability began
• The Chevalier de Méré wanted to know why
– He won when he bet someone he would roll one 6 on 4 rolls of 1d6
– He lost when he bet someone he would roll one 12 on 24 rolls of 2d6
– The Chevalier asked his friend Blaise Pascal for help, and
Pascal began corresponding Pierre de Fermat about it
– Probability of one 6 in 4 rolls of 1d6
•
1 - ( 5/6 x 5/6 x 5/6 x 5/6 )
= 1 - ( 625 / 1,296 )
= ( 1,296 - 625 ) / 1,296
= 671 / 1,296 ( ≈ 0.5177 or ≈ 52% )
19
Schell's Ten Rules of Probability
Rule #10 - Phone a friend
– Probability of one 12 in 24 rolls of 2d6
• Probability of one 12 in a roll of 2d6: 1/36
• Probability of NOT rolling a 12 on a roll of 2d6: 35/36
• Probability of NOT rolling a 12 on 24 rolls of 2d6:
( 35/36 )24 ≈ ( 0.97222 )24 ≈ 0.5086 ≈ 50.8%
• Probability of rolling one 12 on 24 rolls of 2d6:
1 - ( 50.8% ) ≈ 49.2%
20
Schell's Ten Rules of Probability
Schell's 10 Rules:
– Rule #1 - Fractions = Decimals = Percents
– Rule #2 - Probabilities range from 0 to 1
– Rule #3 - Probability is Sought Outcomes divided by Possible
Outcomes
– Rule #4 - Enumeration can solve simple problems
– Rule #5 - When sought outcomes are mutually exclusive (OR),
add their probabilities
– Rule #6 - When sought outcomes are not mutually exclusive
(AND), multiply their probabilities
– Rule #7 - One minus "does" = "doesn't"
– Rule #8 - The sum of multiple dice is not a linear distribution
– Rule #9 - Theoretical vs. practical probability
– Rule #10 - Phone a friend
21
Weighted Distributions
A weighted distribution is one in which one result is
more likely than others
– Common example is 2d6 (7 is 6x more likely than 2 or 12)
– Another possibility is having a non-linear distribution of
numbers on the sides of the die
• Example: The attack die from Small World
– 0 occurs 1/2 of the time
– 1, 2, or 3 each occur 1/6 of the time
22
Weighted Distributions
Exercise: Create a specific weighted Die
– Desired probability:
• 0 occurs 1/2 of the time
• 1 is 3x more likely than 3
• 2 is 2x more likely than 3
– Give it a try…
– Resultant die:
• Luckily, d12 is a common die size
• But dice are limited in the way their distributions can be weighted
– Because only certain numbers of sides are easy to manufacture
– Keep these limitations in mind as we look at randomizer technologies
23
Randomizer Technologies in Paper Games
The most common randomizers in paper games are
– Dice
– Spinners
– Decks of Cards
Each have particular traits that make them attractive
for different situations
24
Randomizer Technologies in Paper Games
Dice
– A single die has a linear probability distribution
– The more dice you add together, the more the result is biased
toward the average
– Standard die sizes include: 4, 6, 8, 10, 12, and 20-sided
– Commonly available packs of dice for gaming usually include
1d4, 2d6, 1d8, 2d10, 1d12, and 1d20.
– 2d10 are sometimes called Percentile Dice
• One die is used for the 1s place (marked with the numbers from 0–9)
• The other for the 10s place (marked with the multiples of 10 from 00–
90)
• Rolled together, they give an even distribution of the numbers from 00
to 99 (where a roll of 0 and 00 is usually counted as 100%).
25
Randomizer Technologies in Paper Games
Spinners
– All spinners have a rotating element and a still element
• In the image, the gray element is still, and the black rotates
– Spinners are often used for children's games
• Young children can't roll dice with accuracy
• Spinners are more difficult to swallow than dice
– Spinners also provide some distinct advantages over dice
• Spinners can have any number of slots (it's difficult to make a d7)
• Spinners can have any kind of weighted distribution without the limits
of a die(image C below)
26
Randomizer Technologies in Paper Games
Cards
– A standard deck of playing cards includes
• 13 ranks of 4 different suits ( Ranks: A-10, J, Q, & K )
• Suits are usually Clubs, Diamonds, Hearts, & Spades
• Sometimes two Jokers
Vectorized Playing Cards 1.3 ( http://code.google.com/p/vectorized-playing-cards/ ) ©2011 - Chris Aguilar Licensed under LGPL 3
27
Randomizer Technologies in Paper Games
Cards
– When drawing a single card, you have these probabilities
• Chance of drawing a particular single card: 1/52 (0.0192 ≈ 2%)
• Chance of drawing a specific suit: 13/52 = 1/4 (0.25 = 25%)
• Chance of drawing a face card: 12/52 = 3/13 (0.2308 ≈ 23%)
– Custom Card Decks
• Very easy to make!
• Easily reconfigurable!
– When to shuffle?
• Shuffle the deck before each draw to have it act like a die roll
– An equal chance of drawing any single card
• Shuffle the deck after it's exhausted to enforce theoretical probability
– Each card will be seen once before any are seen a second time
– However, this can allow card counting
• For a standard 52-card deck, according to mathematician and
magician Persi Diaconis, seven good riffle shuffles should be sufficient
to create a truly random distribution
28
Permutations and Combinations
Bulls and Cows (Traditional Game)
– The basis for Mastermind (1970 by Mordecai Meirowitz)
– Players take turns trying to guess their opponent's code
– The code is a series of 4 digits (0-9)
• Each digit must be different from the others
– For each guess, the guesser receives a number of bulls and
cows
• Bull: For each number that is in the correct place
• Cow: For each number that is in the code but in the wrong position
29
Permutations and Combinations
Bulls and Cows (Traditional Game)
– Try playing the game with a partner now
– …
30
Permutations and Combinations
Permutations
– In math, a selection of elements where the order matters
– The code in Bulls & Cows is a permutation without repetition
Permutations With Repeating Elements
– A bit easier to calculate than those without repetition
– To find the number of possible permutations, multiply the
number of choices per slot by the number of slots
– For a selection of four digits (0-9)
• 10 x 10 x 10 x 10 = 10,000 possible permutation
Permutations Without Repeating Elements
– Subtract 1 from possible choices for each subsequent slot
– For Bulls & Cows
• 10 x 9 x 8 x 7 = 5,040 possible permutations without repetition
31
Permutations and Combinations
Combinations
– In math, a selection of elements where order doesn't matter
– 1234, 1423, 4231, and 2431 are all the same combination
Example Combination
– How many possible combinations of three scoops of ice
cream are there if there are 8 flavors?
• For each scoop, there are 8 possible flavors
• But, the order of the scoops don't matter, so 123 is the same as 213
– Written 8C3 in math (from 8 possibilities, choose 3)
– Formula: n is the number of possibilities, k the # of choices
• nCk = n! / ( k! * (n-k)! )
• 8C3 = 8! / (3! * (8-3)! )
= 8*7*6*5*4*3*2*1 / ( 3*2*1 * ( 5*4*3*2*1) )
= 8*7*6*5*4*3*2*1 / ( 3*2*1 * ( 5*4*3*2*1) )
= 8*7*6 / 3*2*1 = 336 / 6 = 56 combinations
32
Permutations and Combinations
Combinations
– This can also be solved using Pascal's Triangle
1
1
1
1
1
1
1
2
3
4
1
3
6
1
4
1
5
10 10 5 1
1 6 15 20 15 6 1
1 7 21 35 35 21 7 1
1 8 28 56 70 56 28 8 1
1 9 36 84 126 126 84 36 9 1
33
Permutations and Combinations
Combinations
– This can also be solved using Pascal's Triangle
Choices
0
1
Possibilities
2
3
4
5
6
7
8
9
0
1
2
3
1
1
1
1
1
1
1
1
1
1
1
2
3
4
5
6
7
8
9
1
3
6
10
15
21
28
36
1
4
10
20
35
56
84
4
5
1
5 1
15 6
35 21
70 56
126 126
6
7
1
7 1
28 8
84 36
8
9
1
9
1
34
Positive and Negative Feedback Systems
Audio feedback occurs when a microphone is placed
in front of a speaker
– The sound from the speaker keeps being re-amplified
– You may have experienced this in multi-person voice chat
All games have feedback systems
– Actions and results in one turn affect subsequent turns
Game feedback can either be positive or negative
– Positive - If someone starts winning, their chances of winning
get better and better
• "Positive" in this case does NOT always mean "good"
– Negative - If someone starts winning the game, negative
feedback slows them down and helps other people catch up
35
Positive and Negative Feedback Systems
Features of Positive Feedback Games
–
–
–
–
–
The winner keeps winning
An early lead often determines the winner
Generally frowned upon in multiplayer games
But, it can keep games short!
Single-player games often have positive feedback to help the
player feel more powerful
Examples of Positive Feedback Games
– Poker
• Once a player has more chips than everyone else, it's easier for her to
bluff and force others to fold
– Monopoly
• Once a player has more money than everyone else, she will continue
to acquire more property and thereby more rent
36
Positive and Negative Feedback Systems
Features of Negative Feedback Games
–
–
–
–
–
The winner is slowed
An early lead often does not determine the winner
The last-place player is given bonuses to help her
Tends to make multiplayer games take longer
Rarely used in single-player games
Examples of Negative Feedback Games
– Mario Kart
• Players in the worst places get speed boosts
• Players in the worst places "randomly" get much better weapons
– Last place players get items like the Lightning Bolt, which slows down
every other player in the race
– First place players will only get bananas (a defensive weapon), a set of
three bananas, or green shells (the weakest attack)
37
Positive and Negative Feedback Systems
Adding Positive or Negative Feedback to Basketball
– Positive Feedback
• If a team is ahead by 10 points, they get an extra player on the court
– Negative Feedback
• If a team is behind by 10 points, they get an extra player on the court
Discussion:
– What are some positive or negative feedback mechanisms in
your favorite multiplayer games (or board games)?
– How could you alter the rules of your favorite game to
introduce more positive or negative feedback?
38
Chapter 11 – Summary
Games must be balanced to be enjoyable
– Fair for multiple players
– Of appropriate difficulty for single players
An understanding of math is essential for game
designers to be able to balance games well
An understanding of spreadsheets helps as well
– The book has a lot more information about spreadsheet use
– The book also includes information about how a spreadsheet
was used to balance the guns in Chapter 9
Next Chapter: Puzzle Design
– Puzzles feature prominently in single-player games
– Learning to design them can make you a better game
designer
39