## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

35
CHAPTER 3
MATH AND LOGIC
IN GAMES
Fortunately, the math used in game design is relatively simple: pri-
marily addition and subtraction with occasional multiplication. e
math used by programmers, however, is much more complex and in-
volves calculus, analytic geometry, quaternions, and other advanced
subjects. Even though a designer doesnt need to be procient in
advanced math subjects, it does help to have a basic understand-
ing of them in order to converse knowingly with the programming
team during production. It is also important to have a good sense of
logic, especially Boolean logic, which is used in scripting languages
to change conditions on the playeld during play.
Probability and Statistics
One branch of mathematics a designer would be wise to study is
probability and statistics. Many game functions involve some kind
of random number generation, and a designer should understand
the basics of probability—how likely it is that a given result will hap-
pen. In some games where multiple random outcomes may result
from one game mechanic—for example, determining a critical hit
in a role-playing game—understanding the probabilities for possible
results is important to successfully balancing the game.
Statistics, which can be used to analyze results aer they happen,
is also an important design tool for balancing game play. If testing
reports that a critical hit against enemies happens multiple times per
combat encounter, then the probability for a critical hit is likely to
be too high. During the initial design process a designer can use a
paper prototype to test some of the more important game mechanics
to see if they are within the boundaries he or she imagined. Playing
Math and Logic in Games
36
with the numbers early on in the process can save considerable work
during testing and debugging.
One drawback in taking a class in probability and statistics is
that it usually assumes the student already has a basic understanding
of calculus, which is used to nd many solutions. However, there are
online websites that can oer some basic understanding of probabil-
ity without getting into too much detail.
Coin Flipping
e simplest probability is the ip of a coin, where there are only
two possible results (ignoring the probability of the coin landing on
its edge)—heads or tails. ere is a 50% chance of either result with
a ip. If the coin is ipped twice, there is still a 50% chance that the
result will be heads or tails. However, to see how oen either two
heads or two tails come up, a simple chart can be created with the
possible results (see Table 3.1)
ere is a 25% chance for any of these results. However, the like-
lihood of a coin coming up twice either heads or tails is only half that
of getting one heads and one tails. at is, there is a 50% chance of
tossing a heads and tails and only a 25% chance of tossing either two
As a coin is ipped more oen, it becomes less and less likely
to get all heads or all tails. With three ips, there are eight possible
results, and there is a two-in-eight chance (25%) to get all heads or
all tails, and a 75% chance to get a mixed result. Likewise, with four
ips, there are sixteen possible results, and there is a two-in-sixteen
chance (12.5%) to get all heads or all tails, and an 87.5% chance to
get a mixed result. Each time an extra ip is added, the results are to
First Toss Second Toss
Tails Tails
Table 3.1. Results for two coin ips.

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required