Feineigle.com - Game Balance

# Home · Book Reports · 2024 · Game Balance

Published: January 27, 2024 (8 days ago.)
Tags:  Games · Math

• Author :: Ian Schreiber and Brenda Romero

• Publication Year :: 2022

• Source :: Game_Balance_2022.pdf

The book in...
One sentence:
A great exploration of game balance and how one might go about actually implementing it both mathematically and with a sense of 'feel'.

Five sentences:
A long, detailed, and in depth look at every (?) facet of game balance; a one-stop-shop for all your game balance needs! The first half of the book talks about different ways a game can be/feel balance/unbalanced and how each different genre has its own balance requirements. The second half of the book offers up concrete advice on how to actually test and implement balance from a mostly mathematical perspective. At the end of the book there is a good overview of some of the more powerful spreadsheet capabilities that can assist in balancing your game. Overall, this is a great read for anyone wanting to know more about game balance (surprising I know) in general (the first half) and how to crank the numbers to make it happen (the second half).

designates my notes. / designates important. / designates very important.

# Thoughts

Some of the information here seems so basic to me. Not that it shouldn’t be in the book. The authors state up front that they want the book to be deep and definitive. Still, it is interesting to me that someone who plays games (assuming you play games before designing games) wouldn’t understand things like resource economies.

Maybe it is only me, but these days (and for decades really) I see the cogs of board and video games almost right off the bat. To me, a great game uses some other (story) elements to distract me from seeing the gears turning in the background.

They define inflation, per Merriam-Webster, as “a continual increase in the price of goods or services”. Then they go on to talk about gold farmers and players killing monster and gaining loot/gold faster than they spend it. I find it amusing and sad how far the destruction of language has come. Inflation is an increase in the monetary supply. With more units of currency, prices rise to reflect the new levels of (less) scarcity and thus require more units of currency for the same goods/services.

A few pages later he correctly identifies inflation as more gold entering the economy than leaving it, thus pushing prices up. I still don’t think they express clearly that prices going up is an effect of increasing the monetary (gold) supply.

Anchor around one number to balance from.

# Part 1 - Game Balance

## · Chapter 01 - The Foundations of Game Balance

###### page 005:
• seven different elements of game balance
1. Mathematical Balance
2. Balanced Difficulty
• The progression of difficulty over time is referred to as a difficulty curve.
3. Balanced Progression
• Progression is defined as the rate at which the player passes through the power, difficulty, narrative, or gameplay ramp of the game.
• Narrative Progression - writers often follow the three-act structure or the 12-act hero’s journey from Joseph Campbell’s Hero of a Thousand Faces.
4. Balanced Initial Conditions
5. Balance between Multiple Strategies
6. Balance between Game Objects
7. Balance as Fairness
###### page 009:
• The use of the word “feel” here is not accidental. From the player’s perspective, and as noted earlier, balance is something that arises from perception.
###### page 010:
• Target audience: … Targeting for one demographic means you’re ultimately making the level of conflict/play pressure in the game not suitable for another demographic. That doesn’t mean it’s unbalanced though. We’d say that is “as designed.” Family games are designed to be approachable for a wide range of groups. Games designed for hardcore players like Super Hexagon or even the speed-tuned Starcraft one sees in Korea are nearly unapproachable for the non-hardcore.

• Designer’s intent: Once the core demographic is decided, how hard does the designer want to make the game for her desired demographic? Masocore games are designed to be deliberately difficult for even skilled players. Meditative games are designed to produce a continuous series of activities where there’s very little pressure at all.

## · Chapter 02 - Critical Vocabulary

###### page 029:
• Transitive relationships … Said another way, if A is better than B, and B is better than C, then A is always better than C.

• Intransitive relationships … Said another way, just because A is better than B and B is better than C does not necessarily mean that A is better than C.

###### page 030:
• From a literal perspective, and interestingly enough, transitivity has no effect on the actual possibility space of the game. However, intransitivity makes it more challenging to see through that possibility space since it is not entirely clear exactly what the right choice is. Therefore, the perceived possibility space seems greater because there are interesting vs. obvious choices. For instance, imagine ten swords each of which does one more damage than the last. While the possibility space contains ten swords, it’s an obvious choice to select the sword with the most power. However, if we take these same swords and give them unique properties (the one that does 2 damage, say, also has a 50% chance of completely healing you), the choice becomes less obvious. This creates an intransitive relationship between the items and makes the choice less clear. The player must decide which item she values more. So, the realm of reasonable choice, thus the perceived possibility space, is generally larger in games with more intransitive properties.
###### page 036:
• The term difficulty curve is sometimes used synonymously with learning curve, but can be referencing many other things (the monster’s strength relative to the player, the change in competitive level between two PvP arenas, and so on).

• A synonym for a game curve is a function. In mathematics, a function provides a mapping from one set of numbers to another (for example, if you give a particular function a character’s level, it returns the number of experience points required to reach the next level). For this reason, game designers may more precisely refer to a curve by two names, those of the two numbers that are being mapped. In this case, one might call it the “level/XP curve” rather than the “level curve”; the only reason the latter is commonly used is that enough games have one of these that the “XP” part is implied and understood.

## · Chapter 03 - Where to Start - Systems

###### page 051:
• if one wanted to speak of the combat system in a game and how it affects the player’s health, one is referring to a player’s health and all things that affect that health either positively or negatively. So, in this analysis, we could say that the player is taking too much damage or not getting enough health packs or isn’t killing enemies fast enough or has weapons that are too weak or isn’t gaining levels quickly enough. It could be any one or more of these things that’s the issue. In this example, there are many ways to solve the symptom of the player taking too much damage.

• Resource flow diagram for [[Ori and the Blind Forest]]:

## · Chapter 04 - The Components of Progression - Curves

###### page 066:
• As designers, we generally class progression in one of four ways:
1. Character progression: the character in the game grows in some way through player action.

2. Player’s skill progression: the player’s skills in the game grow through repeated practice.

3. Narrative progression: the in-game story progresses through character action or time.

4. Mechanical progression: the more the player plays, the more mechanics get added, making the game deeper, more complex, and more challenging.

###### page 067:
• These relationships between two things (character/time, player/time, narrative/time, mechanics/time), while not always obvious to the player, nonetheless create a recognizable pattern whose timing players can feel (“it’s been forever since I leveled!”), and furthermore, these expectations become deeply embedded affordances that dominate genres.
###### page 073:
• Rule of 2: Designers often use the Rule of 2 (credited to game designer Sid Meier): if you need to change a number and don’t know how much to change it by, double it or cut it in half. By doing this, you get a good sense of that value’s effect on the game. It proves much more effective than cutting by 10% and then 10% again (and again). This may seem counterintuitive, since doubling or halving is drastic, and you won’t think that your numbers are off by all that much. Give it a try, though. You may be surprised at how well it works.

• Triangular curves

###### page 074:
• Mathematically, triangular numbers can be expressed by the function: $$y = \frac{(x^2 - x)}{2}$$
###### page 076:
• One final example is found in the dice game Roll Through the Ages, players roll several dice. One of the possible results is a skull icon on each die. If your entire roll contains no skulls or only one skull, it doesn’t affect you at all. With two skulls, the player loses 2 points, an unfortunate result. With three skulls, the player’s opponents all lose 3 points, a very good result. With four skulls, the player loses 4 points, a very bad result. And with five or more skulls, the player loses some of their other resources, effectively loses their turn, may lose additional points and experiences one of the worst results possible. The relationship between skulls and points looks something like this:
• While this function isn’t strictly increasing or decreasing and fits no obvious pattern, it works well within the context of the game. Since players can reroll their non-skull dice up to twice per turn, this can create dramatic tension during a turn. At just about any point, either players are hoping to not get any more skulls (if they already have one, three, or four) or they are hoping to get one more (at two skulls). This can lead to multiple reversals of fortune within a single turn, causing much anticipation and excitement, brought about through a custom function that was carefully hand-crafted and tuned by the designer.
###### page 078:
• In the case of monsters and items, smooth curves are the rare exception. It is common for designers to hand-edit spreadsheets to include peaks and valleys and adjust the rarity, if need be. Some of the best moments in games are when we get an amazing sword or meet an enemy that poses an unbelievable challenge.

## · Chapter 05 - Finding an Anchor

###### page 085:
• When I’m ready to begin balancing a game, I need to find an anchor - it’s basically the alpha number of the game and all other numbers need to fall in line. It’s often hit points or the game currency. And even in saying that, you can usually buy hit points with currency via a healing spell or health pack, so they are sometimes one and the same. Once I decide that number, though, I can determine everything else.
###### page 086:
• An anchor is a resource that can be related directly to every other resource.

• Most games have an anchor, and it’s usually the very stat that is the win or loss condition. HP is a common anchor in RPGs, for example, while victory points are a common anchor in board games.

## · Chapter 06 - Economic Systems

###### page 111:
• In F2P games, the margin is quite important and, interestingly, sometimes works in this way: the more players have, the more they are willing to pay provided they are close to their goal. If players need 20 units of iron to complete an upgrade, they may be completely willing to work for those units for a while. The closer they get, however, the more likely they are to monetize the few remaining units. Players rationalize that they did most of the work, and in competitive games, urgency to complete the upgrade may be greater.
###### page 123:
• With more total in-game currency in the economy (and especially, more currency per player on average), we see what is called inflation: the demand curve shifts to the right as more players have more in-game money and are thus able (and willing) to pay higher prices for the same goods.

## · Chapter 08 - Transitivity and Cost Curves

###### page 160:
• How are these relationships—weapons, creatures, characters, loot drops, etc.—made meaningful to one another? We can see the relationship using cost curves and the intersections between them.

• To do so, it is first necessary to state both the costs and benefits of any object in terms of numbers. Game designers typically start with a single object that they declare to be balanced. Now, in reality, it’s only balanced because the designer says it is. However, if we shape all other things to it, in fact, we will have achieved a first pass at a balanced game, since these items are about equal in power level relative to each other.

###### page 161:
• Once you make a single character that you consider balanced, figure out what their benefits minus their cost is numerically—maybe it’s 50 points—and then, balance every other character so that they too add up to 50 points.
###### page 163:
• you should absolutely violate the cost curve whenever you want. Cost curves should be your servant, not your master.

## · Chapter 09 - Characters and Character Builds

###### page 201:
• When the player makes choices in the creation of their character build, we can speak of four broad categories that a particular build might fit into, in terms of balance:
1. Optimal (or “min-maxed”): these characters contain the best performance that one can mathematically squeeze out of the game’s systems. A player who has created an optimal character has probably spent a fair amount of time reverse-engineering the game’s systems, comparing numbers, finding ways to stack bonuses or identify broken skill combos… or they’ve found an online guide from someone else who has.

2. Viable: these characters may not be mathematically perfect, but they provide a playable experience throughout the game. A typical player should be able to beat the game at the default difficulty level without major problems, if they’re playing a viable character.

3. Marginally viable: these characters are suboptimal, but can still potentially be used to conquer the game’s content in the hands of a skilled player. Such a build would be nonviable for most players, but expert players might create such a build on purpose as a personal challenge.

4. Nonviable: a nonviable character is completely hopeless and could not be salvaged, even in the hands of an expert.

• How, then, do you balance the game’s difficulty within this range? If you balance the content to be challenging but reasonable for a viable character build, your content will be absolutely trivial to conquer with an optimal build, and expert players will complain that your game is too easy. On the other hand, if you balance to provide a challenge to an optimal build, the game will be way too hard for the majority of players.
###### page 203:
• There are a few potential solutions to this, depending on the game. If your game is very clearly made and marketed for a more casual, less experienced audience (or conversely, if you’re catering to the hardcore powergamer crowd), you can balance toward one extreme or the other. More commonly, to support all player skill levels, games ship with multiple difficulty levels: an easy mode that’s tuned to provide very little resistance for players who want to focus on the story, a normal mode that’s tuned for most typical builds, a hard mode that’s challenging for a typical build, and a hardest mode tuned to be a challenge even to optimal builds, for example.

• Another method that can help is to reduce the power differential between viable and optimal builds, by making most of the character’s power come from things the player doesn’t choose (such as the base damage of weapons that they find in the game) with their attributes and skills providing minor bonuses. If a player in a particular zone is given a weapon that does 80–100 damage and their attribute scores and passive skills can potentially raise that up to the 100–130 range, that is still a noticeable improvement that min-maxers will appreciate, but not such a huge difference that it will invalidate any balance choices you made about how powerful enemies are. If, on the other hand, the player does a base damage of 80–100, a typical player will be at 85–110, and a min-max player can pump it to 300–600, there will be some people complaining about the balance of your game.

###### page 204:
• The presence of anything in your game that’s “god” or “dump” suggests, by definition, a decision that is not meaningful.
###### page 207:
• The way the data is presented can influence player decisions. Consider the difference between these two systems where the player’s Strength stat is in the range of 1–9: in the first system, the player has a base attack damage of 1 and gains +1 attack damage for every point of their Strength stat (so their damage will range from 2 to 10); in the second system, the player has a base attack damage of 6 for a default/average Strength of 5, +1 attack damage for each point above 5, and −1 attack damage for each point below 5. These are exactly the same mathematically, of course, but in the latter case, players will tend to have a stronger aversion to an Attack below 5 since that is presented to them as a penalty.

## · Chapter 10 - Combat

###### page 213:
• Combat is first and foremost a drama, and it’s a drama choreographed with math

• If you ask a group of gamers, or game designers for that matter, to describe the best combat they remember, notice the words they use. The collection below comes from a conversation held with six graduate students • Unforgettable • Hope • Shock • Panic • Closure • Movements • Theatrical • Celebration • Lost • Win • Tension • Funny • Chaos • Anticipation • Memorable • Struggle • Prayer/ritual (“Hail Mary” moves) • Unexpected • Drama • Closeness of shared experience (in a multiplayer game) • Realization of mastery/learning

###### page 215:
• Former Bungie designer Jaime Griesemar, echoing some of the Halo team ethos, referred to it (combat loop) as 30 seconds of fun, suggesting that if you could nail that and repeat it again and again, you could stretch it out into an entire game. While that phrase is often repeated, what’s missing is the deeper context of Griesemar’s quote: you need to vary it. If you take that 30 seconds and put it into different environments, with different weapons and enemies, this com- bat loop becomes incredibly effective.
###### page 220:
• Like design pillars, combat pillars are words that people might use to describe combat in your game. The pillars of combat are • Genre • Time • Pacing • Feel • Participants • Progression • Volume

• These seven core pillars, when evaluated and decided upon, result in the definition of your combat. For instance, in Brenda’s game Empire of Sin, the combat could be described as • Genre: Strategy/Empire Building • Time: turn-based • Pacing: methodical and calculated • Feel: visceral, gritty, tactical • Participants: single-player, squad-based • Progression type: player and character progression • Volume: one-third, with empire and crew management being the other two-thirds.

###### page 224:
• The constraints of combat revolve around three key things: length of game, length of combat, and number of hits.
###### page 226:
• Thinking about the number of combatants as well as the time-to-kill for an average combatant helps us shape a desired length of combat or the number of combatants or both. For more difficult, longer combats, we may choose to scale the type of enemy or the quantity of enemies. These numbers can become our goals, metrics to measure against.
###### page 227:
• A good metric to start is this: for an average monster, average character, and an average weapon, how many times would you expect to hit it before it died?
###### page 230:
• a concept from music composition and from visual design is “repetition with variation”: give the audience enough repeated themes and riffs that they can sense a pattern, with enough surprises and modifications to keep them interested in seeing what happens next.
###### page 238:
• Time in an encounter is as important as the time outside of the encounter in two separate ways, all of which, if implemented improperly, can cause players to accuse a game of being unbalanced. The two purposes of out-of-combat time are anticipation (building up to the next combat) and recovery (release after the previous combat).

• In a discussion of time and space, designers are often focused on filling and then leaving empty both time and space. This empty space is the key to building anticipation for a player. No game does this better than Resident Evil, and outside of games, no genre does this better than horror. Empty space—where something could happen—gives the player the necessary time to build up tension for the delivery.

## · Chapter 11 - Progression in PvE Games

###### page 252:
• It is worth reminding ourselves what “balance” means in this context. Back in Chapter 1, we said that in terms of progression there are three things to consider:
1. Does the difficulty increase over time at a good rate, or does it get harder too quickly or too slowly, leading to frustration or boredom (the difficulty curve)?

2. Does the player’s power in the game increase at a good rate relative to the increase in enemy power—or, does the player gain power too quickly, making the rest of the game trivial after finding some all-powerful weapon… or does the player gain power too slowly, requiring a lot of tedious grinding to compensate (the power curve)?

3. Is the overall difficulty level appropriate for the audience (is the game too hard or too easy)

###### page 253:
• As an example, here is what a simple lock-and-key puzzle might look like:
• The friction in this case is never particularly high, because the process of finding a locked door and searching for the corresponding key isn’t typically a great challenge. The Discovery phase is short: it doesn’t take long for a player encountering a lock to realize they must search for the key. The Mastery phase is also short: once the player has the key, all that remains is to return to the lock and use the key on it. The Learning phase is longer and consists mostly of exploring the area and searching for the key. Note also that the Fluency phase has no friction; once the player owns that key, they can typi- cally bypass all matching locks without taking any further effort.

• By contrast, consider the resistance to mastering an entirely new skill, such as learning to use a specialized unit in an RTS game:

###### page 254:
• If you have studied calculus, you can think of the player’s projected perception of how long it takes to complete the Mastery phase as the first derivative of the curve at the point where they currently are, and the point of inflection on the curve is where the player shifts from spending most of their time figuring out how to proceed, to concentrating primarily on implementing the known solution.
###### page 255:
• By putting more of the challenge in the Discovery and Mastery phases and shortening the Learning phase, this effect can be reduced somewhat. For challenges that allow it, visually showing the player an accurate indicator (such as a progress bar) can also help.

• These four elements that affect perceived difficulty are2 as follows:

1. Note that while some friction can be in the form of time investment (requiring the player to “grind,” using known and mastered skills repetitively in order to progress), this does not increase perceived difficulty. A tedious task is not difficult, merely time-consuming. For that reason, there is not a one-to-one mapping between friction and difficulty.
• Player skill: the level of the player’s actual skill at the game (the player’s ability to make optimal decisions). The more skilled the player is at the game, the easier the challenges seem, other things being equal.

• Virtual skill: the player’s power level in the game (sometimes referred to as virtual skill). Even if the player isn’t very skilled at the game, doubling their health or the amount of damage that they do on a successful attack improves their ability to win.

###### page 256:
• Virtual challenge: there is the virtual difficulty of the game, based purely on power level of enemies or challenges in the game: increasing the health or attack or speed of enemies in the game (or just adding more enemies in an area), without making the enemies any more skilled, still increases the challenge of the game, because the player must execute their strategy for a longer period or at a higher rate of precision.

• Skill challenge: lastly, there is the level of skill-based friction that the game subjects the player to, where the player is not only executing the same tactics and strategies better, but where the player must develop new and novel ways to play in order to succeed. Examples of this type of resistance might be enemies that have more sophisticated AI that make them more challenging to defeat, introducing new types of challenges, or deep puzzles that require multiple skills used together.

• This graph would represent a game that requires a constant (and low) level of skill throughout, but increases its power over time, such as a simple idle game. The player may increase slowly in skill (for example, getting better at clicking the mouse quickly in Cookie Clicker), but mostly the player is gaining power through raw stat increases, and the game’s difficulty curve also involves a linear increase in stat-based challenges.

• If the level of challenge remains constant (not getting harder or easier), and the player’s power is also constant (player does not gain or lose power over time), the perceived challenge still decreases over time, simply because the player is improving in their ability:

###### page 257:
• If a single puzzle or other challenge has a difficulty curve, what does it look like when these are chained together? If an individual “unit of friction” is the microlevel of what is happening in a game’s progression mechanics, then what does the macrolevel look like? Usually, an individual unit of friction does not exist in isolation, but is part of a larger progression system. That system may form a progression arc (one-time progression from one point to another) or a progression loop (repeating cycle of progression).
###### page 258
• The player’s view of the present and future interaction loops in some game might be summarized as (1) Do Something; (2)???; (3) Profit! The first step here is the current loop. The second (unknown) step represents the future (as yet unknown) loops. The third step is the anchoring long-term goal.

• In Metroidvania and Adventure games, the player is motivated by a desire to gain access to new areas and new skills and abilities, which leads to a desire to master the most recently acquired skill or explore the most recently discovered area. This loop is repeated with each successive skill and area throughout the game. The player may not immediately know where all future areas are, but they may see some places they can’t get to right away (giving them some idea of where to return to later), or some objects in the game that they can’t interact with yet (but they know that there will be some future skill or ability that allows them to).

###### page 259:
• In a game with progressive resource management mechanics (this would include idle games like AdVenture Capitalist, deck-building tabletop games like Dominion, and even real-time strategy games like StarCraft), the player has a motivation to acquire more options for resource acquisition, which grants the ability to create an efficient economic engine—in essence, the core game loop in these games is about modifying the core game loop, and player satisfaction comes from meta-progress. In the case of competitive (PvP) games with a clear end condition, this continues until one player’s engine ultimately allows them to dominate the game and triumph over their opponents for the win. For games with no defined endpoint and only a transition to some sort of elder game, this resource loop continues until the player chooses to exit the loop, either out of boredom with the mechanics or frustration with sufficiently diminishing returns for their effort.

• In narrative-driven games (such as Her Story or Life Is Strange), the player is motivated by seeing the story develop and resolve. On successive iterations of the narrative progression loop, the player gains a greater understanding of the plot and world and backstory, and relatedness to the characters.

###### page 262:
• Probability of failure vs penalty for failure:
###### page 264:
• Here are some examples of intrinsic motivators and some types of progression and rewards that naturally follow:

• Agency: control over one’s environment and one’s own fate. Motivates player to seek improved character stats or abilities, which give increased virtual skill as the reward.

• Mastery: greater understanding over how to manipulate a system. Motivates player to increase the difficulty or complexity of the game, which results in increased player skill at the game as a natural reward.

• Curiosity: finding out what happens next. Motivates player to enter a discovery arc, which when completed grants additional knowledge of the game to the player.

• Closure: finishing what one started. Motivates player to enter an accomplishment arc, which ultimately satisfies the player’s completionist desires when the arc finishes.

• Expression: a show of one’s individuality and uniqueness. Motivates player to collect cosmetic content or make character-defining choices in the game, which allows the player to use the game as a form of self-expression. Depending on the context, the player might be putting themselves in the game or else creating a fictional character of their own devising.

• Connection: relatedness to and fellowship with other humans. Motivates a player to enter guilds, which provide the player with a feeling of social inclusion.

• Superiority: showing domination of one’s peers. Motivates a player to climb leaderboards and other ranking systems, which rewards the player with the thrill and recognition of competing and winning.

• Community: showing value to one’s fellow players, be they opponents, allies, or guildmates. Motivates a player to enter an influence loop, performing behaviors that win friends and provide recognition of the player’s value.

• In addition, there are some people who are motivated by negative behaviors, either from the thrill of breaking social taboos within the magic circle of a game, or from the rush of power that comes from causing pain to others (often referred to in games as trolling or griefing). Designers rarely create systems specifically to support griefing. Rather, this behavior arises from systems that (unintentionally) allow or enable it, among those players who feel this as a strong intrinsic motivator.
###### page 274:
• Curiosity → Discovery Arc → Player Knowledge

• There are two main types of discovery arcs: exploration of virtual spaces and advancing the narrative.

• Progression through level transitions (that is, when the player enters a new level or area) is a special kind of reward, because it shows at a visceral level that the player is moving ahead. The speed at which players move to new spaces should be chosen carefully. Too many transitions in a short period of time is disorienting, but too few makes the whole game feel like one giant series of identical levels with no progression. A common model (not the only one) is to have relatively short levels at the start of the game and have each successive level take slightly longer to traverse than the previous one, on average (with some variation to keep things from getting too predictable). This lets the player feel like interesting things are happening at the start of the game when they aren’t yet emotionally invested in the outcome; a player can tolerate longer stretches near the end of the game, especially when leading up to a major plot event.

###### page 277:
• In Sid Meier’s Civilization:

• The active progression loops are constantly open and ongoing. Any loop that a player is currently advancing is not yet complete, but as soon as it is completed, it immediately opens up the next iteration of that same loop. In this way, each of the progression systems in the game (technology, exploration, military, economic, and so on) remains open indefinitely.

• The progression loops overlap. Because the game has so many distinct progression loops active at once, and they are staggered, the player is never more than a turn or two away from completing one or more goals.

###### page 281:
• Progression is strongly related to what is sometimes referred to as the reward schedule or risk/reward cycle. You don’t just want the player to progress automatically. Rather, you want the player to feel like they earned their progression and that they are being rewarded for playing well.

• Another thing we know from psychology is that a random or intermittent reward schedule has more impact than a fixed schedule.

###### page 284:
• One thing a designer can do is to actually attempt to put all of the rewards on a progression chart, showing approximately where in the game each reward is found. While these can’t usually be exact (the game designer can’t control exactly how long a given level takes any player, or what order a player encounters various challenges in a non-linear level), they can at least give a general approximation of where things happen in order to spot any gaps:
###### page 286:
• dynamic difficulty adjustment (DDA), a special type of negative feedback loop where the game tries to figure out how the player is doing and then adjusts the difficulty level during play based on how the player is doing.

• I like this idea, but I also like:

• In both Bastian and Transistor, difficulty isn’t a game option, but rather a game mechanic. In both games, the player is given the opportunity to increase the difficulty in specific ways (such as taking more damage from enemies, or making enemies tougher, or having enemies explode or come back from the dead when killed), and each individual challenge can be turned on or off in between levels.

• Monster Train has a similar way of taking power ups that increases the difficulty.

## · Chapter 12 - Progression in PvP Games

###### page 305:
• Positive sum, negative feedback.
• This is probably, IMHO, the best way to structure your multiplayer game if you can. The back and forth nature creates an interesting game.
###### page 306:
• In fact, real-life stock car racing also has a negative feedback loop, because the driver in the lead is running into a lot of air resistance, so they are burning extra fuel to maintain their high speed. This means they need more pit stops to refuel, which cost precious seconds and allow others to overtake them a great deal. Meanwhile, the drivers who are drafting behind the leader are much more fuel-efficient and can take over the lead later. This negative feedback isn’t arbitrary, like the weapon pickups in a kart-racing video game; it’s a law of physics that affects all drivers equally, and it’s up to each driver how much of a risk they want to take by breaking away from the rest of the pack.

• Interesting comparison of Mario-Kart like games and negative feedback (rubber-banding) to real-life racing.

###### page 308:
• This braiding power struggles is also good. It is basically the same as positive-sum/negative feedback , but it pulls the power level to a constant instead of letting each player get more powerful.

• However, if the negative feedback loop is too strong, this also makes it hard for any player to actually win! The game can easily end in a stalemate where neither player can ever amass enough power to claim a decisive victory, since the further they are in the lead, the more pressure the game puts on them to relinquish that lead. A game like this might have an end condition based on time or number of turns, and whoever happens to be in the lead at a certain point of time is declared the winner.

• Zero-Sum, Positive, and Negative Feedback

• Early in the game, the negative feedback dominates, making it difficult for any player to get solidly in the lead and end the game too quickly. Later in the game, the negative feedback system plays less of a role, and the positive feedback dominates.

###### page 309:
• Again, IMHO, the negative feedback creates the most tension. This is a nice balance to end out the game after a certain amount of time.

## · Chapter 13 - Analytics

###### page 331:
• With big-budget (“AAA”) games, publishers typically want the ROI to be either very high or negative. Games that lose money are tax writeoffs; big “hits” pay for the rest. But a game that makes a small amount of money isn’t worth it—it keeps a bunch of money tied up in development. This is what people mean when they say that games are a “hit-driven” industry: it’s better for a game to succeed or fail spectacularly than to be a modest success.
###### page 332:
• Analytics is meant to answer questions like: what are the players and systems doing, what happens when they do it, and how effective is it?

## · Chapter 15 - Production and Playtesting

###### page 400:
• Since your goal is to get to a playable version of the game quickly (so that you can start playtesting and evaluating if it’s any fun), you won’t be creating all of the content for this game right now up front. If you’re making a MOBA that will ultimately have 100+ playable characters, you shouldn’t be designing that many in the earliest stages of development. Rather, find a small number of characters that are representative of the strategies you want to support. If, for example, you’re designing the game so that most characters will fall into the three traditional roles of DPS, Tank, and Support, all you need up front is three characters to give you a general feel for the play of the game. If you can make a single “vanilla” character that is representative of every character in the game, then just make that one character as a baseline to show the general power level and set of skills that you want to balance against. Basically, create the bare minimum amount of content you can in order to have a game that can be playtested and that will showcase the main mechanics, strategies, and play styles that you intend to support.
###### page 403:
• There is no industry-standard definition of what, exactly, an “alpha” milestone is (it varies by company and by publishing contract), but in general, it’s what we call feature complete, meaning that all of the mechanics are in the game, the basic engine is functional, and you can pretty much play with all the systems. The game is still missing much of its content (this is when the development content grind really goes into full swing) and the software has more bugs than an entomology lab, but at this point, the core design of the game is more or less locked down.
###### page 407:
• There’s an old joke that “alpha” is Ancient Greek for “software is broken” and “beta” is Ancient Greek for “software is still broken.”

• As with alpha, there’s no single industry-accepted metric for when a game goes to beta, but generally at beta, we are what we call content complete as well as feature complete. That is, the entire game can be played end-to-end in its entirety.

###### page 410:
• In general, the kinds of things players can try: (In playtesting)

Try degenerate strategies. This is where the player latches onto one overpowered thing and just does that thing over and over whenever they have the option. If this is a TCG and there are no deck construction limits, take one overpowered card and put 100 copies of it in your deck. If it’s a fighting game, spam one move over and over. If it’s a tower defense game, build one kind of tower and ignore the others. Playing this way tends to be boring for the player and (if the strategy works) intensely frustrating for their opponents, so this is the kind of situation you want to avoid, where players are optimizing the fun out of the game.

Be a total jerk. Stab other players in the back. Make moves that are totally unfair. Refuse to collaborate with anyone, unless doing so gives you a sufficient material advantage. Do everything you can short of cheating to gain even a small advantage, no matter how much fun it sucks out of the room. Ignore all normal rules of decency, and see if you can use this to your advantage. If a player can be rewarded in the game for being mean, they will, so you want to test for this to make sure that players are not incentivized to treat others poorly.

• If you’d like additional strategies on how to play ruthlessly, there’s a wonderful book by designer David Sirlin on the subject that you can read online for free, called Playing to Win (see the “Additional Resources” section). It is, essentially, a retelling of Sun Tzu’s Art of War in the context of competitive games/esports, and shows in depth the competitive mindset.

Additional Resources • Jaime Griesemer, Changing the Time Between Shots for the Sniper Rifle from 0.5 to 0.7 Seconds for Halo 3, GDC 2010, viewable at https://www.youtube.com/watch?v=8YJ53skc-k4.

• Anthony Giovannetti, Slay the Spire: Metrics Driven Design and Balance, GDC 2019, viewable at https://www.gdcvault.com/browse/gdc-19/play/1025731.

• David Sirlin, Playing to Win, available at http://www.sirlin.net/ptw.

## · Chapter 16 - Beyond Balance

###### page 416:
• with games that have multiple strategies and multiple paths to victory, having some of them being very slightly off the cost curve (maybe 10% to 15% deviation) gives players the game-within-a-game of trying to figure out what the exploits are and how to best take advantage of them. If the game were perfectly balanced, any strategy would be as good as any other, so there would be no point in searching.

# Part 2 - The Mathematics of Balance

## · Chapter 17 - Independent Randomness

###### page 443:
• Here is an example from the dice game Farkle. In this game, a player starts their turn by rolling 6d6. If they’re lucky enough to roll one of each result (1-2-3-4-5-6), they get a huge score bonus. What is the probability this happens on the initial roll? As with all probability problems, we answer this by computing the number of ways we can roll one of each result and then divide by the total number of rolls. But there are a lot of ways to roll one of each number; how do we count them?

• Here is one way to look at this:

• One (and only one) of the dice must be showing 1. How many ways are there to do that? Six, because there are six dice, and any of them can be showing the 1.

• One of the remaining five dice must be showing 2. There are five ways to do this.

• Continuing in this way, one of the remaining four dice must show 3, and there are four ways to do that.

• There are three ways on the remaining dice for one die to show 4

• There are two ways for the two remaining dice to show 5

• There is only one die remaining, so it must show 6

• How many possible results are there from a roll of 6d6, regardless of what they roll? Each die can show six sides, so we multiply: 6 * 6 * 6 * 6 * 6 * 6 = 46,656, a pretty large number of possible rolls. How many ways can we roll 1-2-3-4-5-6 on 6d6? In the same way, we multiply, but our numbers are different since we’re restricted in which dice can roll what numbers: 6 * 5 * 4 * 3 * 2 * 1 = 720. Divide the number of successes by the size of the possibility space to get our probability: 720/46,656, or about 1.5%.

###### page 445:
• In his GenCon 2102 lecture Volatility in Game Design, game designer James Ernest constructed a simple game, Kill the Elf (see the “Additional Resources” section at the end of this chapter), to show some principles of probability. In the game, two players are competing to be the first to deal six damage to the titular third-party Elf, though it could just as easily be damaging each other, or even being the first to win a foot race. The warrior is steady and true, doing 1 damage per turn on every turn. The wizard is powerful but chaotic, rolling 1d6, doing no damage on 1–5, but six damage on a roll of 6. Who should win?

• The expected value of both characters is the same: 1 damage per turn. One would expect this to mean that both characters have an equal chance to win, but in fact, they do not, because of what we have been discussing about the differences between shortand long-term rolls. Think of it this way: to win, the wizard must roll at least one 6 in its first five rolls and can tie by rolling a 6 on its sixth roll even if the first five rolls fail. We can easily compute the chance of failing to roll 6 in the first five turns (about 40.1%), meaning that the wizard wins almost 60% of the time. Of the times when the wizard does not just win outright, there is still a probability of 1/6 that the game is a draw, so the warrior only wins slightly more than a third of all games. Even though the expected value of damage is the same between the warrior and the wizard, the game is unbalanced in favor of the wizard.

• How do you balance this to make it more fair? One way is to make it a race to do 4 damage instead of 6. Then, the wizard only gets three rolls to win and then one opportunity to tie. The game is even closer to fair if players are racing to 10 damage and extremely close to a 50/50 probability of winning if players are trying to reach 1,000,000 damage. The greater the amount of damage required, the more that the wizard tends toward its expected value.

## · Chapter 18 - Dependent Randomness

###### page 459:
• the choose operator (also known as combination), which counts the number of ways to choose some number of things among a larger number of things.

$${n\choose k} = \frac{n!}{k!(n-k)!}$$

• For example, the number of ways of drawing five cards from a standard 52-card deck is “52 choose 5” or:

$$\frac{52!}{5!(52-5)!} = \frac{52 * 51 * 50 *\dots * 3 * 2 * 1}{(5 * 4 * 3 * 2 * 1)(47 * 46 * \dots * 2 * 1)} = \frac{52 * 51 * 50 * 49 * 48}{5 * 4 * 3 * 2 * 1}$$

$$= 2,598,960$$

• The choose operator assumes that order doesn’t matter; drawing a Royal Flush in Spades is the same result, no matter whether the Ace was drawn first or last or anywhere in between. But sometimes, ordering does matter: for example, counting the number of ways to have first, second, and third places from an eight-player car race. When choosing k things out of n where each ordering is distinct (known as permutation), the formula is written as:

$$P(n,k) = \frac{n!}{(n-k)!}$$

• Thus, the number of unique ways to choose first, second, and third from an eight-player race is:

$$\frac{8!}{(8-3)!} = \frac{8 * 7 * 6 * 5 * 4 * 3 * 2 * 1}{5 * 4 * 3 * 2 * 1} = 8 * 7 * 6 = 336$$

• Also, the number of ways to order all eight players is $8!/(8 − 8)! = 8! = 40,320$.
###### page 460:
• The number of ways to have a Full House is:

$$13 * 12 * {4\choose3}*{4\choose2} = 13 * 12 * 4 * 6 = 3744$$

• Where do these numbers come from? We have to choose one of 13 ranks to be the three-of-a-kind and one of the remaining 12 ranks to be the pair. Note this is not “13 choose 2” because the order here matters: three Kings and two Aces is distinct from three Aces and two Kings. For the three-of-a-kind, we must choose three cards out of the four in the deck of matching rank (4 choose 3). For the pair, we must choose two cards out of four (4 choose 2). If we wanted the probability of a Full House, we would divide 3744 by the total number of five-card hands, 2,598,960, to get 0.01044, on the order of a tenth of a percent.

## · Chapter 20 - Probability and Human Intuition

###### page 491:
• game balance is all about players perceiving the game as fair
###### page 502:
• If you really want to be evil, you could even become a scam artist, doing things that are illegal but highly effective. One example of a well-known scam involves writing a large number of people offering “investment advice,” telling them to watch a certain penny stock between one day and the next. Half of the messages predict the stock will go up; the other half predict it will go down. Whatever actually happens, the half of the people who got the “correct” message the previous day are then given another prediction, again split into two groups, half of whom are told that a different stock will go up and the other half told it will go down. After repeating the process four or five times, the pool of people for whom you’ve been right every time is fairly small… but they also figure that you’ve been right far more often than would be predicted by random chance, so you must have a working system. Then, they give you a ton of money and you skip town with it.

## · Chapter 22 - Infinite Probability

###### page 529:
• when you have a state machine where all transitions are probabilities, this can be modeled as a matrix.
###### page 530:
• In this state machine, we start in State 1, the initial state. Every turn that it’s in State 1, it transitions to State 2. Once in State 2, it has a 50% probability of going to either of the other states (1 or 3). If it makes it to State 3, it has a 1/3 probability of going to any of the three states, including remaining in State 3. So, it continues to bounce around between these three states indefinitely.

• We can model this as a matrix of possibilities, where each column is the state that it’s currently in, and each row is the state it might transition to at the next state change. Each item in the matrix is the probability of transitioning from the current state (column) to the new state (row):

$$\begin{bmatrix} 0 & \frac{1}{2} & \frac{1}{3} \ 1 & 0 & \frac{1}{3} \ 0 & \frac{1}{2} & \frac{1}{3} \end{bmatrix}$$

• In the leftmost column (current State 1), there is a probability of zero of transitioning to States 1 or 3 and a probability of 1 of transitioning to State 2 (because when in State 1, it always goes to State 2 next). In the center column (currently in State 2), there is a 1/2 (50%) probability of going to State 1 or 3, and a probability of 0 of remaining in State 2. In the third column (current State 3), there is a 1/3 probability of going to any of the three states.

• Notice that if you add up each column, all of the numbers sum to 1. This makes sense: in a state machine, you are always in exactly one state at a time, so there should always be a 200% probability of being in exactly one state after any transition.

• In this example state machine and matrix, you might wonder: where do we most likely end up? Yes, the nature of this particular state machine is that we continue bouncing around between states, but suppose we let this thing go for a really long time such that our position is relatively randomized, and then at some random point, we peeked at the current state. What is the probability that it’s in each of the three states? How much of its total time does it spend in each state, proportionally?

###### page 531:
• To compute this, we start with a column vector that shows our initial state. In this case, State 1 is the initial state, so we have a 200% (or 1) probability of being in State 1, and a 0% probability of starting in States 2 or 3. (If we wanted to start in a random state, we could just use probabilities of $[\frac{1}{3}\space \frac{1}{3}\space \frac{1}{3}]$ as our initial column vector instead.)

$$\begin{bmatrix} 0 & \frac{1}{2} & \frac{1}{3} \\ 1 & 0 & \frac{1}{3} \\ 0 & \frac{1}{2} & \frac{1}{3} \end{bmatrix} \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix}$$

• What do we get if we multiply these together? The matrix tells us the probabilities of state transitions from each state to each other state. The column vector tells us the probability of what state we’re in now. Multiplying these together, then, gives us a column vector of probabilities of where we’ll end up next!

$$\begin{bmatrix} 0 & \frac{1}{2} & \frac{1}{3} \\ 1 & 0 & \frac{1}{3} \\ 0 & \frac{1}{2} & \frac{1}{3} \end{bmatrix} \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix} = \begin{bmatrix} 0 \\ 1 \\ 0 \end{bmatrix}$$

• If we start in State 1, then after the first transition, we know with certainty we end in State 2. This shouldn’t be surprising; it’s how the state machine is designed. And that is exactly the result we get when we multiply it out. What do we do to figure out what happens after the second transition? We multiply the column vector $[0\space 1\space 0]$ (from the first transition) by the transition matrix:

$$\begin{bmatrix} 0 & \frac{1}{2} & \frac{1}{3} \\ 1 & 0 & \frac{1}{3} \\ 0 & \frac{1}{2} & \frac{1}{3} \end{bmatrix} \begin{bmatrix} 0 \\ 1 \\ 0 \end{bmatrix} = \begin{bmatrix} \frac{1}{2} \\ 0 \\ \frac{1}{2} \end{bmatrix}$$

• Again, this is not a surprise. If we know we are in State 2, there should be an equally split probability between going to States 1 or 3 after that transition. But now after two transitions, we are in an uncertain state; we no longer know for sure what state we will be in. What happens after the third transition?
###### page 532:

$$\begin{bmatrix} 0 & \frac{1}{2} & \frac{1}{3} \\ 1 & 0 & \frac{1}{3} \\ 0 & \frac{1}{2} & \frac{1}{3} \end{bmatrix} \begin{bmatrix} \frac{1}{2} \\ 0 \\ \frac{1}{2} \end{bmatrix} = \begin{bmatrix} \frac{1}{6} \\ \frac{4}{6} \\ \frac{1}{6} \end{bmatrix}$$

• Essentially, we are weighting it by taking the probability of transitions from State 1 multiplied by 1/2 (the probability that we are in that state) and the probability of transitions from State 3 also multiplied by 1/2, and add those non-overlapping probabilities together. So there is half of a 1/3 probability (which is 1/6) that we can end up anywhere if we started in State 3, or half of a 200% probability of ending in State 2, if we started in State 1.

• We can continue doing this indefinitely, multiplying one transition’s state probability column vector by the transition matrix to get the next state, then multiply that by the transition matrix to get the state after that, and so on for as long as we care to. Multiplying current probabilities by the same thing to get future probabilities is known as a Markov chain, named after the mathematician who invented the technique.

• It turns out that if you keep doing this enough times, after about 13 iterations you get the column vector $[0.3\space 0.4\space 0.3]$, and if you multiply that by the transition matrix, you get the exact same column vector as the result:

$$\begin{bmatrix} 0 & \frac{1}{2} & \frac{1}{3} \\ 1 & 0 & \frac{1}{3} \\ 0 & \frac{1}{2} & \frac{1}{3} \end{bmatrix} \begin{bmatrix} \frac{3}{20} \\ \frac{4}{20} \\ \frac{3}{20} \end{bmatrix} = \begin{bmatrix} \frac{3}{20} \\ \frac{4}{20} \\ \frac{3}{20} \end{bmatrix}$$

• Since we can now multiply this column vector by the transition matrix and end up with no further changes to the probabilities ever again, this ends up being what we call a steady state: long term, we spend 30% of our time in States 1 and 3, and 40% of our time in State 2. Interesting, and probably not any numbers that you could guess intuitively without doing the math. And if these were the states of a guard in a stealth game, and the transitions were our estimated probabilities of state changes per unit time, we would know about how often the guard would spend in each state… and could then adjust things from there to reach the desired mix of states.

## · Chapter 24 - Statistics

###### page 594:
• These are known as Anscombe’s Quartet, a famous representation of data in the field of statistics. These all obviously represent very different sets of data with different natures. At the top left is a fairly linear relationship with a little bit of error. The top right data is a parabolic (not linear) curve. Bottom left is an extremely strong linear correlation with one outlier. Bottom right is also a linear correlation with one outlier, except this time the line is vertical. What’s the relationship between these four data sets? It turns out that each one has a mean of 9 for x, a mean of 7.5 for y, and the standard deviations of x and y are nearly identical across the four sets. The correlation between x and y is the same in all four cases, as well. The lesson here is that you shouldn’t just look at statistical numbers without also graphing or otherwise visualizing the raw data; looking only at mean, median, and standard deviation can be misleading.

## · Chapter 25 - Intransitive Mechanics and Payoff Matrices

###### page 632:
• In this chapter, we learned a powerful trick for being able to evaluate intransitive mechanics using linear algebra. This is about as complicated as it gets, bringing together elements of cost curves, probability, and statistics, which is why this chapter appears at the end of this book and not at the beginning. The process is the same:

• First, make a payoff table.

• Then, eliminate all dominated choices from both players. Compare all pairs of rows to see if any pair contains one row where each entry is strictly better to or equal than the other. Do the same for the columns. Continue doing this until all remaining choices are viable.

• Find all intransitive “loops” by finding the best opposing response to each player’s initial choice. Eliminate rows or columns that do not contain any elements of any loop.

• After the elimination steps, all remaining rows and columns are viable choices. Using only those, construct a payoff matrix for each player:

• All of the payoffs for a single player are equal to one another.
• In a zero sum game, payoffs for all players sum to zero (one player’s payoff is X, then the opponent’s payoff is −X in a two player game, for example).
• In a symmetric zero-sum game, all payoffs are equal to zero.

• Add one additional equation: if each player must choose exactly one action, then the probabilities of all choices sum to 1. In an asymmetric game, the probabilities of each individual player’s choices sum to 1, so this may be several similar equations in that case.

• Using algebraic substitution, triangular-form matrices, spreadsheets, or any other means you have at your disposal, solve for as many unknowns as you can. If you manage to learn the value of X (the payoff for one player), it tells you the expected gain or loss for that player. Summing all players’ X values tells you if the game is zero sum (if they all add to zero), positive sum (if they add to a number greater than zero), or negative sum (if they add to a number less than zero), and by how much overall… if you didn’t know that information from the start.

• If you can find a unique value for each probability that is between 0 and 1, those are the optimal probabilities with which you should choose each throw. For asymmetric games, the optimal solution may be different for each individual player. This is your solution.

• For games with more than two players, choose one player’s payoffs as the point of reference and treat all other players as a single combined “opponent.” The math gets much harder for each player you add over two: a three-player game gives you a system of quadratic equations, a four-player game provides a set of cubic equations, a five-player game gives quartic equations, and so on.

## · Chapter 31 - Math Functions

###### page 681:
• The bread and butter of pseudorandomness in spreadsheets is the RAND() function. This function takes no parameters at all and gives a floating point (decimal) number between 0 and 1. It can theoretically be 0, but never 1.
###### page 682:

What if you want to generate a number within a range that isn’t 0 to 1? RAND() can be multiplied and/or added to in order to get any range. For example, if you want a number between 150 and 250, that would be =RAND()*200+150. Multiplying 200 by a number between 0 and 1 gives a number between 0*200 and 1*200, so the range is now 0 to 200. Adding 150 to that number increases the range from 0+150 to 200+150, or between 150 and 250.

• For 1d6, the, you would use =FLOOR(RAND()*6+1,1). Likewise, there is a function CEILING() that rounds up to the next higher number, and MROUND() that rounds up or down, whichever is closest.

• =RANDBETWEEN(1,6) is 1d6, and =RANDBETWEEN(0,1) is a “coin flip” that gives either 0 or 1.

• What if you want to roll 2d6? You might be tempted to do =RANDBETWEEN(1,6)*2, but that would not roll 2d6, it would roll 1d6 and multiply the result by 2 (you cannot get a result of 7 this way, for example). Instead, you call the function twice: =RANDBETWEEN(1,6)+RANDB ETWEEN(1,6). Alternatively, put =RANDBETWEEN(1,6) in two separate cells and then add them together in a third cell. (The latter might be easier if you’re rolling a lot of dice: for 200d6, use =RANDBETWEEN(1,6) in one cell, Fill Down for a total of 200 rows, and then SUM() them

###### page 686:
• =COUNTIF(A:A,5) looks at the entire column A and counts the number of cells with the exact numeric value of 5.

• =COUNTIF(A:A,B2) looks at column A and counts the number of cells that match the value of B2.

• =COUNTIF(B3:D5,”x”) examines the nine cells B3, B4, B5, C3, C4, C5, D3, D4, and D5 and counts the number of them that have exactly “x” as text.

• =COUNTIF(C:C,”>=14”) counts the number of cells in column C that have a value greater than or equal to 14.

## · Chapter 32 - Deck Shuffling

###### page 693:
• The choose operator is known in spreadsheets as the COMBIN() function. =COMBIN(60,7) gives the total number of 7-card starting hands drawn from a 60-card Magic: the Gathering deck, assuming all cards are distinct (you would have to take additional steps if some cards are duplicated in the deck, as is typical). The reason for the strange name is that drawing a number of cards from a deck without replacement where order does not matter is sometimes called a combination by mathematicians.

When order does matter, that is called a permutation, and the corresponding spreadsheet function is called PERMUT(). If you want the number of ways to select the top ten players out of a thousand (where the ordering within the top ten matters), you would use =PERMUT(2000,20). These are handy functions when you don’t want to take the time to remember the mathematical formulas.

-Aside from that, there are a few functions which are useful in simulating a random shuffle. We’ve already encountered RAND() which produces a pseudorandom number from 0 to 1. Additionally, there is a function called RANK() which takes two parameters: first, a value; and second, a range of cells. RANK() looks up the value within the range and tells you what position it is in, numerically: 1 if it is the highest number in the list, 2 if it’s the second highest, 3 if it’s the third highest, and so on.

• Try this: in cells C1:C52, simply put =RAND() so that each contains a pseudorandom number. Then in D1, write =RANK(C1,$C$1:$C$52) and then fill down to D52. The D column now has the numbers 1 through 52 in a random order!
###### page 694:
• That’s fine if you have a deck of cards numbered 1 through 52, but what if you have a standard deck of cards instead? It would be nice to create some kind of lookup table that converts the numbers 1 through 52 into a set of actual cards. There is a function that does this, called VLOOKUP(). This function is a bit finicky; what it’s meant to do is take a table (for spreadsheet purposes, a rectangular block of rows and columns), find a value in the leftmost column, and return the corresponding value in one of the other columns. It takes three parameters: first, a value (“key”) to look up; second, the range of cells that comprises the table; and third, which column to return a value from once it finds the key in the first column. This third parameter is a number, where 1 means the leftmost column, 2 means the column just to the right of the leftmost, 3 is two columns to the right of the leftmost, and so on. But it always looks up the key in the leftmost column, so you cannot use VLOOKUP() with data sorted any which way; the data being matched must be on the left.

• To illustrate, let’s extend our card shuffler above that currently just randomizes the numbers 1 through 52. In cells A1:A52, write the numbers 1 through 52 in order. In cells B1:B52, write the names of the 52 cards in a standard deck (you may wish to abbreviate a single number or letter for the rank and suit, e.g., “AS” for Ace of Spades, “TC” for Ten of Clubs, and “5D” for Five of Diamonds).2 This gives you an unshuffled “deck” of cards in column B.

• If typing 52 cards manually seems tedious to you, there is an easier way. Off to the side in cells J1:J13, write the ranks of the cards: A, 2, 3, 4, 5, 6, 7, 8, 9, T, J, Q, K (or however you prefer). Copy and paste that a few times so that you have four sets of ranks from J1:J52. Then, put a suit (C, D, H, or S) in K1 and Fill Down to K13, and repeat the process with the other three suits down to K52. Now, reading columns J and K together, you have a suit and rank. Next, in cell B1, instead of writing the name of the card, combine J1 and K1 as follows: =CONCAT(J1,K1) and then Fill Down. This function takes any number of parameters that are cells, ranges of cells, or data, treats each one as a string (that is, a series of characters) and sticks them together in order as its own string. If you wanted to get fancy, you could write the ranks and suits out as complete words (Queen and Hearts, for example) and then use =CONCAT(J1,” of ”, K1) to have the card show as “Queen of Hearts.”

###### page 695:
• Now, in cell E1, write the following: =VLOOKUP(D1,$A$1:$B$52,2) and then fill down to E52. This takes the value in D1 (one of the randomized numbers from 1 to 52), finds the corresponding sorted number in column A, and then finds the card name right next to that number in column B (the third parameter is 2, meaning look at the second column in the data range, which in this case is column B). Column E now has a shuffled deck of cards!

• If it bugs you that VLOOKUP() requires your keys to all be on the left, there is an alternative, using a pair of other functions. MATCH() is a function that looks up the position of a key within a range of cells that is either a single column or row. Its first parameter is the key that you want to look up, and the second parameter is the cell range. If it finds the key in the topmost or leftmost position, it gives a value of 1; if it’s the one just below or to the right of that, it gives a value of 2; and so on. There is an optional third parameter, which determines what to do if the key is not found. The third parameter can be 1 (the default if it’s omitted), which assumes the list is sorted in ascending order and returns the closest position without going over if the key is not found; or it can be −1 if the list is in descending order and you want the opposite; or it can be 0 if the list is unsorted and you’re looking for an exact match only. Usually, you’ll want to use 0. MATCH() is helpful in looking up a key in an arbitrary position (as opposed to the leftmost position).

• The other function that goes with MATCH() is the INDEX() function, which takes three parameters. First is a range of cells. The second parameter is 1 for the topmost row, 2 for the next to top row, and so on. The third parameter is 1 for the leftmost column, 2 for the column just to the right of that one, and so on. For example, INDEX(A1:D4,2,3) gives the contents in cell C2, because that is the second row from the top and third column from the left in that cell range. INDEX(E3:G5,3,1) gives the contents in cell E5, because that is the third row from the top and the column on the left within the block of E3:G5.

###### page 697:
• INDIRECT(). This function takes a single parameter, a string, and it takes that string and interprets it as if it were a cell reference instead. For example, =INDIRECT(“B3”) is the same as simply writing =B3. In this case, how- ever, we can build our own custom string in order to select one of a random range of cells.

• Try this: create a table of six different pieces of loot, in cells A1:A6. These can be anything you want: 2000 Gold, the Artifact of Untold Awesomeness, a coupon for 20% off at the general store, whatever. Now, in cell B1, we’re going to select one of these items at random. Enter this formula: =INDIRECT(“A”&RANDBETWEEN(1,6)).

• The ampersand (&) in this formula takes two strings and sticks them together (this is called concatenation

###### page 698:
• We can create a random weapon as follows:
=INDIRECT("A"&RANDBETWEEN(1,6))&INDIRECT("B"&RANDBETWEEN(1,6)) &INDIRECT("C"&RANDBETWEEN(1,6))

###### page 699:
• In order to choose a rarity from this weighted table, use the following formula: =VLOOKUP(RAND(), A1:B5,2)

• This generates a number between 0 and 1 and looks it up in the A column, by default choosing the highest number without going over. It then returns the corresponding item in column B.

## · Chapter 33 - Organizational Formatting

###### page 720:
• proper formatting of spreadsheets may serve a similar purpose to using a consistent coding style

• Spreadsheets aren’t just about storing data and calculating formulas; they’re about communicating the results of those calculations back to you (or others on your team)

###### page 706:
• For input cells in particular, it can sometimes be useful to limit the values to something reasonable. One way to do this is through data validation. Select a cell or block of cells, then click the Data menu, and select Data Validation.

• Data validation can also be used to create a dropdown list of values within a cell, useful for input cells where you only have a few options and want to make sure the user doesn’t type the wrong thing. To do this, use “List of Items” as the criteria.

###### page 708:
• Additionally, you can turn on Word Wrap, which forces the column height to be tall enough to support all of the text. To do this, select the relevant cell or cells and then click on the Format menu, and then choose Text Wrapping > Wrap

• Another thing you can do to make your formulas more meaningful is to give them a name. After all, which of these is easier to understand at first glance, for a formula that’s calculating damage: =BaseDamage*Multiplier-TargetArmor or =$D$7*$C$1-$F$7? Well, actually, that depends. The former is certainly more meaningful, but the latter tells you where the data being referenced actually resides, so it is a matter of taste. But you can give names to individual cells, or even entire ranges of cells, and use those names in your formulas. To do this, click the Data menu and select Named Ranges:

## · Chapter 35 - Iterative Calculations

###### page 718:
• If you set maximum iterations at 200 and have cell A1 showing =A1+1, then every time you recalculate cells (by modifying a cell or pressing F9 in Excel, the equivalent of Ctrl+R in Google Sheets), the value in that cell increments by
1. If you set maximum iterations at 1, it only increments by 1, which is generally what you’ll want if you enable this option.
• In Libreoffice => Iterations are enabled with a step of
1 (Tools->Options->Libreoffice Calc->Calculate)

• This functionality can be useful for simulating turn-based or time-based effects in a single playthrough. For example, you can have the “turn” or “time” increment itself by 1 on each iteration and have other variables increment based on the game state (in other cells), also on each iteration. Imagine, for example, making an idle game where each iteration represents 1 second of game time, and the player’s currency increments by their currency-per-second. This could also be used to model player vs. player (PvP) games, such as fighting games, brawling games, MMOs, or MOBAs, to track things like character health and/or growth over time, especially when dealing with attacks that are timed or that have cooldowns. Consider having a global “timer” cell that tracks time elapsed and increments itself by one unit of time (in however much granularity is meaningful in the game). For example, an attack with a cooldown might be implemented as follows:

• Cell A1 represents a powerful attack that should always be spammed as soon as it’s out of cooldown, marked with “X” if it is the next action and blank otherwise: =IF(B1>0,” ”,”X”).

• Cell B1 represents the amount of time left on cooldown, set to 20 when the attack is performed and decremented by 1 for every second elapsed: =IF(B1>0,B1-1,IF(ISBLANK(A1),0,20)).

• If you had multiple attacks with cooldowns, you could have Cell A1 compute some kind of priority for this attack based on its utility, but only if it’s not

under cooldown (and a priority of zero if it is under cooldown, meaning it can’t be selected in that case). Then, in a separate column, each cell would check to see if its own priority was equal to the MAX() of all priorities, and if so, it would trigger (and enter cooldown). You could also keep a global timer that just increments itself by 1 each iteration and then a move history where it would keep track of whichever move was chosen on the current time:

• Cell J1 as the global timer: =J1+1

• Cell K1 is a formula that contains whatever move is being performed this turn

• Cells L1:L20 contain the numbers 1 through 20

• Cell M1: =IF($J$1=L1,$K$1,M1) and then fill down to M20.

## · Chapter 36 - Fancier Graphing

###### page 723:
• Another useful feature is Paste Special/Transposed. Imagine if you’re working on a chart, and after getting a lot of data in there, it occurs to you that you should have organized it so that what you have in rows are in columns (and vice versa). This comes up often when creating charts and graphs, for example, if you realize that everything is sideways. Luckily, this can be easily fixed. You can swap rows and columns while preserving all of the data and formulas by copying a rectangular block of cells and then doing Paste Special/Paste Transpose. If, for example, you copy a 3 × 4 block of cells and paste the transpose, it shows a 4 × 3 block.

## · Appendix - Game Genres

• A list and description of most (all?) of the game genres.