Recently, I got back into Pokemon, and decided to take a look at the games’ mathematics, on the basis that the data would be available, and that the world’s most popular RPG series would probably have a fair bit to teach those interested in developing their own. Well, I wasn’t disappointed, and I hope you won’t be either.

### The Setup

First off, it’d be useful to know what Pokemon’s math
engines actually *are*. Big thanks to the people at Bulbapedia and
DragonflyCave for compiling such insanely detailed information on Pokemon,
including its math formulae. This analysis would not have been possible without
them.

Also, just to avoid possible confusion: I will be using capitalized “Pokemon” to refer to the franchise, and uncapitalized “pokemon” to refer to the creatures.

**Health and Other Stats**

Pokemon is an RPG, which means its characters have various statistics (stats), which increase as they level up. In Pokemon, all of a pokemon’s stats *except* health (that is: defense, attack, special defense, special attack, and speed) are calculated thusly:

(1) Stats Value = Floor[ (Floor[ ((2 * (B + I) + E) * (L / 100) ] + 5) * N ]

- B is a pokemon’s “base value”, determined by species (bears are strong, bees are fast, etc.), and serves as the main determinant of Pokemon’s statistics, along with level. For those interested in the nitty-gritty, it can range anywhere from the single digits all the way to 255, but generally 40-60 is standard for a weaker or early-game ‘mon, and 80-120 for a stronger or fully-evolved one. 30 to 150 seems to be the range for most all pokemon that aren’t insanely minmaxed (that is, focusing on a single stat or two to an absurd degree as its shtick, at the expense of several or all others) or otherwise gimmicky.
- I is a pokemon’s “individual value”, which is a random number per stat intended to give every pokemon a bit of unique variation and individuality. It ranges between 0 and 31.
- EV is for “effort values”, which are gained and lost through training, items, and manipulation of circumstances, and act as the means by which a player can customize their pokemon’s stats to better fit a desired role. The sub-formula involved with it may look like a bit of a mess, but previous fan analysis has already shown that it basically shakes out to being another value like B and I (called E in my own rewritten version), which ranges between 0 and 63 (though just as a bit of trivia, no ‘mon can have more than a combined 125 E value across their six stats).
- L is “level”. Anyone familiar with RPGs will know this one, but for those who are new, it’s a marker of power, increased by winning battles and general adventuring. It ranges from 1 to 100, though the early games go to some effort to make sure most Pokemon the player uses will be at least level 5.
- N is a pokemon’s stat modifier based on its “nature”, or personality. It is always one of the values 1.1, 1.0 or 0.9, with 1.1’s and 0.9’s arranged in pairs. I will be ignoring it for the most part, but it is included here for the sake of completeness.
- Floor[…] means the value inside is floored, or in other words rounded to the nearest whole number that is smaller than original value. Eg: Floor(2.736) = 2

Meanwhile health is calculated with a formula that is only very slightly different:

(2) Health Value = Floor[ ((2 * (B + I) + E) * (L / 100) ] + L + 10

Where B, I, E, L, and Floor all mean the same as they did in equation (1).

**Damage**

The core of Pokemon’s gameplay is magical monster beetle battles, and core to that is the damage calculation.

(3) Damage Dealt = ( ((((2 * L / 5) + 2) * P * (A / D)) / 50) + 2 ) * M

- L is “level”, covered earlier.
- P is “power”, which is the base damage of the individual move being used. Generally ranges between 20 and 150, though again there are some special-case outliers, as well as a number of oddball moves whose strength is based on some unique formula of their own, and can vary wildly in power depending on circumstances.
- A is “attack”, the attack or special attack stat (as appropriate) of the attacking pokemon, derived from the first formula I mentioned, above.
- D is “defense”, the defense or special defense stat of the pokemon on the receiving end of the move. Again, derived from the formula described in equation (1).
- M is for “modifiers”, a collection of circumstantial multipliers. These include both core gameplay features like the rock-paper-scissors-esque type matchups, as well as more esoteric effects like weather-affected moves, additional weaknesses or resistances granted by special abilities, or even per-move effects like the “Revenge” move’s vengeance mechanic, or a dug-in pokemon’s weakness to “Earthquake”. I’ll describe the main ones below, though keep in mind even this is a much abbreviated report.

**The Primary Modifiers (plus Stat Stages)**

Modifiers may be a small part of the damage formula, but they are a critical part of the game. While it would be useless and boring to try to cover every modifier in the game, given how situational they are, there are a few that will factor into nearly every battle the player ever engages in. In addition, I’m including here the concept of stat stages, even though they’re technically not a modifier, since conceptually they’re pretty close, and in practice the difference if they were a legitimate modifier comes down to maybe 8 points of damage.

*Type*: Existing half as a taxonomic categorization of the various types of pokemon, and half as a massively expanded form of rock-paper-scissors-lizard-Spock, type is one of the core mechanics of Pokemon, to the point that, to people who know their Pikachu from their Mimikyu, it’s probably *the* core defining feature of the franchise. Depending on the type(s) of the defending pokemon and the type of the attack being used against them, damage might be anywhere from quartered (x¼) to quadrupled (x4) on the attack.

*STAB*: An acronym for “Same Type Attack Bonus”. This is a “free” x1.5 damage multiplier a pokemon gets for using an attack of the same type as they are, to encourage (but not mandate) players to specialize their pokemon into same-type move sets.

*Stat Stages*: Pokemon’s primary way of handling stat changes in combat. Technically handled by a formula “*max(2 +s, 2) / max(2 -s, 2)*” where “*s*” is any number between -6 and 6, but the main takeaways are that a pokemon’s effective value for any given stat can be anywhere from quartered to quadrupled during actual combat, and that building up a big modifier in either direction is normally slow (most moves only shift stat stages by one or two levels, of a total of six in each direction).

*Random Modifier*: Pokemon’s way of adding random variation to the damage dealt by most any given attack, so that the game doesn’t become too deterministic or mechanical-looking. The random modifier is a value randomly chosen (natch) between 0.85 and 1.00, which note means that the number calculated by the damage formula is the maximum damage that the ‘mon can deal, and that on average a pokemon will only be dealing a bit over 90% that value. Largely useless trivia to my mind, but it will come up later.

. . .

### The Analysis

And with that we conclude our whirlwind tour of the basics
of Pokemon’s number systems. For those
already intimately familiar with the games I’m sure that was a bit boring and
frustratingly incomplete (Pokemon is *not*
a simple game, even if it is made up of simple pieces), but I felt it important
to establish the basics. Now we move on
to the fun stuff…

**Observation One: A Multiplier Heavy System, ** **Hidden Multipliers, ** **and the Consequences Thereof**

One of the first thing that struck me, looking at the math, was how heavily multiplication based Pokemon’s systems are. There’s hardly any addition or subtraction going on, and what is there is segregated off (like the B-I-E basal stat calculation) and/or seems to be very small constants, presumably to prevent the numbers ever going to zero.

Let’s take the damage formula, equation (3) again.

(3) Damage Dealt = ( ((((2 * L / 5) + 2) * P * (A / D)) / 50) + 2 ) * M

Rewriting the equation (specifically the bit before the addition and modifier multiplication) into an equivalent form, we get:

(4) Damage Dealt = ( ((0.4*L + 2) * P/50 * A/D) + 2 ) * M

In this form, it becomes obvious that the damage formula has at least two additional “hidden” multiplicative modifiers.

*Stat Ratio*: “A/D” is simply the ratio between the defending pokemon’s defensive stat and the attacking pokemon’s offensive stat. When the two are equal, the ratio will be one, and not affect damage at all. But when they aren’t, the ‘mon will do more or take less damage directly proportional to how much higher their stat is than their opponent’s. Anything that affects stat values multiplicatively (such as say, stat stages, or certain status effects) will directly affect damage in exactly the same way. This is why I mentioned stat values along with the modifiers proper above. In practice they have almost the same effect.

*Power Ratio*: A less obvious modifier, “P/50” indicates that damage is a factor of, not the power of a move directly, but a multiplier based on the move’s power. It seems to suggest that, in designing the system, moves with a power of 50 were considered the baseline. This seems to bare out in practice, since most non-super moves in Pokemon have between 15 and 150 power (that is, approximately one-third to triple the baseline damage value), with “vanilla moves” (that is, moves with no secondary effects or drawbacks) generally having between 40 and 100 power, and all exist within the 10 to 250 range (that is, one fifth to five times the base). Though there does seem to be a bit of a bias towards the upper middle end of the scale.

*40% of Level plus two (?)*: What is up with that first term, “0.4*L + 2”? At first I thought it was another modifier, to account for level, but that had some problems. Why the plus two (perhaps an arbitrarily small additive to prevent the modifier from going to zero accidentally due to rounding)? Why specifically a 0.4 multiplier on level? Since stat values are also based on level, wouldn’t that mean that a pokemon “double dips” on level, making its effects exponential? And perhaps most worryingly: if everything in the damage formula is a multiplier or an arbitrarily small additive to prevent going to zero, *what’s the base damage that’s being multiplied*? It seemed to be “modifiers all the way down”, with no solid base to stand on. And yet it all worked out, clearly. Voodoo. I now have a new hypothesis about this term, but I’ll get to that in a bit.

. . .

This multiplication-based system has some interesting
consequences for the actual gameplay of Pokemon. Stacking multipliers is (literally)
exponential: the more multipliers that a get stacked, the more each subsequent
one adds to the final result, and the combined effects can quickly get
ridiculous (while unlikely to happen in practice, Pokemon’s multipliers can
theoretically push damage into the *hundreds
of millions*, and even a times eight or times twenty combined multiplier is
not implausible). Thus the system
encourages players to stack as many multipliers as they can, with an obvious
end goal of overwhelming the opponent’s defenses and ending the fight in a
single hit. The game manages to avoid
becoming simply a game of rocket tag though, since defensive multipliers are
almost as numerous and absurd. The
symmetrical nature of the offensive and defensive options keeps either from
becoming completely useless.

This situation also explains why type, STAB, and stat stages are so critical to the game. In a multiplication-based system, a times two or especially times four multiplier can act as the perfect catalyst for a snowball effect, which both type matchups and stat stages can easily achieve, though the former relies on good team composition and a bit of luck or prior knowledge in the opponent’s team composition, and the latter will usually take one to three turns of set up, a long time in a system as potentially lethal as Pokemon’s. STAB meanwhile, though a less impressive x1.5 multiplier, is entirely within the player’s control to take advantage of or not, and relies on no external circumstances to proc it. Thus, a player who forgoes STAB is just leaving damage on the table (not just the 50% damage boost from STAB itself, but a potential 25% to 50% damage boost from the next multiplier that does apply as well, and so on).

**Observation Two: The Effects of Level, and Pokemon’s Secret
Tutorial**

The other thing I noticed right off the bat was that the prominence of level. Looking at equation (1) and (2) again, we can see that stat values are calculated as a percentage of their theoretical maximum value “2 (B + I) + E” based on the level the pokemon has reached. That is, simplifying out ancillary effects like nature:

(5) Stats Value = (S * L/100) + 5

Where “S” is the pokemon’s maximum potential stat value:

(6) S = 2 (B + I) + E

Practically speaking, this means that the damage formula contains an additional “hidden modifier”, the ratio of the levels of the attacking and defending pokemon. To oversimplify:

(7) Stats ~ (S * L/100)

(8) Damage ~ A/D

(9) -> Damage ~ (S_{A} * L_{A}/100) / (S_{D} * L_{D}/100) = (S_{A} / S_{D}) * (L_{A} / L_{D})

As has been mentioned before, Pokemon is a game of stacking modifiers, and over-leveling is a simple, if inefficient way to build up those modifiers. In particular, in the early game (before and including the first gym, generally around level 10), it’s relatively simple to achieve a times two or larger modifier on the opposition. Heck, since a player’s starter ‘mon begins the game at level 5, the player might achieve a large modifier entirely accidentally (against wild pokemon at least). As the game progresses, and the level of the opposition naturally increases, the effects of this modifier lessen and lessen, and it becomes harder to exploit it.

At the same time as level is becoming harder to cheese, stats are becoming more differentiated. Recall from equation (1) that attack and defense stats are not quite solely determined by level, but have an extra plus five tacked on at the end. While I believe the primary purpose of this additive is to prevent stats from going to zero, it also has the (likely not-accidental) result of pushing the ratio between them to one.

For instance, a Weedle (a poisonous caterpillar pokemon) has a base special defense of 20, while a Squirtle (a water-spewing turtle) has a base special attack of 50. Thus, nominally a Squirtle attacking a Weedle would get an A/D damage bonus of 2.5, but accounting for that additive, the actual stats ratio becomes, by level:

Lv 1: (100 / 100) + 5 = 6 versus (40 / 100) + 5 = 5 6/5 = 1.2

Lv 5: (100 / 20) + 5 = 10 versus (40 / 20) + 5 = 7 10/7 = 1.43

Lv 10: (100/10) + 5 = 15 versus (40/10) + 5 = 9 15/9 = 1.67

Lv 50: (100/2) + 5 = 55 versus (40/2) + 5 = 25 55/25 = 2.2

Lv 100: (100/1) + 5 = 105 versus (40/1) + 5 = 45 105/45 = 2.33

Note that as level increases, the effects of the flat additive diminishes (though it remains surprisingly strong), and a pokemon’s actual stats become more and more relevant.

In the interest of transparency, note that this was assuming that both ‘mons involved had individual and effort values of 0 in the relevant stats, which is not really realistic, but is simpler, and maximizes the difference between the level 1 and 100 stat ratio. With a more average individual value of 15 in each of the relevant stats, the final ratio at level 100 drops to a “mere” 1.8 multiplier, though ratio at level 1 remains essentially the same.

Additionally, while I did not do any testing on the practical effects of stat values beyond this one example, I suspect that the stats for the various pokemon were chosen such that the practical ratios between them (and thus effective multiplier based on them) would remain about in the x1/4 to x4 range that the game seems to mostly work within, possibly with pokemon within a single evolutionary tier being more limited to a practical x½ to x2 ratio.

. . .

Taken both together, the relative lack of influence of stats at lower levels, and the relatively easy boost in power a player can achieve by over leveling their pokemon at those same levels, creates an interesting situation, where the nature of the game naturally changes and grows more complex over the course of a play-through.

At low levels, a player doesn’t have to concern themselves
with the strategic niche that their ‘mon’s stats align them to, because all
pokemon are more or less on equal footing stat-wise anyway. And players don’t have to concern themselves
with other modifiers either, since if the player gets into trouble and really
becomes stumped, they can just grind some levels to uneven the playing
field. Thus, players don’t really *have* to use strategy, beyond “higher
level is better”. As time goes by,
stats become more prominent, and brute force overleveling becomes more
difficult (and battles just generally become longer and opponents smarter)
players are naturally pushed towards seeking out more deliberate strategies,
likely first involving the ever-present-and-very-effective type matchups and
STAB, and later more involved modifiers like stat stage de/buffs, weather, and
other gimmick moves. I call this
progression, where the game math itself goes from an almost purely level based
system at low levels to a complicated game where every advantage matters at
high levels, “Pokemon’s hidden tutorial”.

**Observation
Three: Damage and HP Scaling, The Five-Round
Knockout**

Back in observation one, I noted an odd maybe-modifier in the damage formula, “40% of level plus two”.

(4) Damage Dealt = ( ((**0.4*L + 2**) * P/50 * A/D) + 2 ) * M

Back then, I noted it seemed like an oddly arbitrary
modifier, and one that, if it was indeed a modifier, would make the whole
damage formula “modifiers all the way down”, and scarily foundationless. In retrospect, it seems obvious: it’s not a
modifier at all, and the damage formula is not foundationless. In fact, “40% of level plus two” *is* the baseline damage for the
formula.

It clicked for me when I took another look at the health formula, and noticed that at its core it is, like the kernel of the damage formula, a fraction of level added to a baseline.

(2) Health Value = Floor[ ((2 * (B + I) + E) * (L / 100) ] + L + 10

If we set Base stat value *B* to 50 (an arbitrary number yes, but one that seems about average
for the stats of low evolution pokemon, including the games’ starters), the
formula becomes:

(10) Health Value = Floor[ (100) * (L / 100) ] + L + 10

= Floor[ L ] + L + 10 = **2L + 10**

Which you will note is exactly five times the mysterious “40% of level plus two” “modifier”.

I believe this is not accidental, and that these baseline numbers were intentionally scaled to each other in this way to ensure that, under nominal conditions (two pokemon with 50’s in the relevant stats, same level, using a 50 power attack, no other modifiers), pokemon battles would last a consistent number of rounds throughout the game, here five. Now, why a five round slug out was chosen as the baseline for the system I cannot say for certain, though I’m guessing that it was down to a tradeoff between making battles so long they’d risk becoming boring (especially early game before players truly understood the game), and long enough that time-saving damage modifiers would actually be useful, as well as making slower tactics like buff-debuff strategies and damage-over-time effects (which generally take between four and eight rounds to take down an opponent, absent any other damage sources) actually viable.

It’s worth noting that the math is not quite as straightforward as I’ve made it out to be. For one thing, there is that extra “+2” at the very end of the damage formula, which like the flat additive to stats, has a surprisingly strong influence on the system, dropping time-to-KO to four rounds or less until about level 15 or 20, a fair ways into the game. However, this as it turns out is largely counterbalanced by the games’ random damage modifier (which recall is a multiplier between 0.85 and 1.00, or an average of 0.925), which when accounted for brings the time-to-KO back over four by level 10. And for another, a baseline of 50 for stats is only a safe assumption for unevolved pokemon, as evolved pokemon naturally enough have higher stats, though again there seems to be a counterweight, since late-game pokemon also have access to higher power moves than their early-game brethren, which more-or-less counterbalances the extra bulk. Still, it looks like that on the whole the five-round battle is more or less the paradigm the game runs by.

### Conclusions

And so there we have it, a fairly comprehensive dissection of the Pokemon damage and stats formulas. Just to summarize and restate some of the key takeaways:

*Pokemon’s formulae are based around a series of modifiers, wrapped around a core of a scaling treadmill between damage and health*: Even beyond the obvious modifiers brought in by type matchups, STAB, stat de/buffs, and move and item gimmicks, the game makes use of a number of “hidden modifiers” based off the pokemon’s relative stats, their levels, and even the power of the move being used compared to a baseline. The multiplicative nature of these modifiers informs the sorts of the strategies the game encourages, since stacking multipliers results in effects greater than the sum of their parts. Because modifiers can be both defensive as well as offensive, and both can scale equally absurdly, defensive strategies and builds are not rendered entirely non-viable.

*Pokemon scales well*: Because the core of the games’ damage system is an even ratio between health and damage, leading to battles taking an even number of turns, and the games’ modifiers are all multiplication-based, and thus independent of the scaling numbers, the game’s battle system remains stable at any level, with individual pokemon, moves and strategies remaining consistently useful throughout the game, even as a separate track of scaling numbers in two areas (evolved pokemon’s stats, and rarer more powerful moves) contribute to a sense of progression and power scaling.

*The game changes fundamentally over time*: Despite the even scaling between damage and HP, the game’s mathematics still contribute to broadening the games’ scope over time, as stats become more defined and brute force over-leveling strategies less viable as the player’s ‘mons increase in level, thus encouraging a closer attention to the game’s systems and more diverse strategies. Whether other RPG games do anything similar, or whether this was intentional at all, I am unsure, but it is nothing short of brilliant, either way.

And there you have it! I hope this write-up was useful, or at least interesting for everyone who read it, and that it gives everyone a greater understanding and appreciation for the series. I know I was surprised at how much I learned!

. . .

…Ok, one more thing.
When I first sat down to write this I was not expecting I was going to
be writing *this*, and I’m sorry I’m
having to write it now. It’s not even
really written for anyone who’s likely to be reading this. But I feel it needs saying: Taking your fan base for granted and
expecting them to buy whatever you put out no matter how many corners are cut
is not cool, Game Freak. Yes, a thousand characters is a metric
frack-ton, and I’m sure after over twenty years, you’re ready to try something
else. But when you cut a significant
fraction of the game’s characters on the basis of improving the animation, and
then show “animations” that look to have been made using the scale and rotation
tools, it just looks bad. And when you
refuse to even tell people who or even how many characters are being cut, even
when it comes time to shell out money for the games, it looks worse. And when you continue shoveling out games
despite a clear lack of interest in the series, and are charging people a
subscription rate to keep their childhood companions from being deleted, with
no guarantee of when or even if they will ever be allowed use again, it looks
downright scummy. It’s not even really
about the cut Pokemon at this point. You are not treating your fans with
respect. My analysis has shown me that
Pokemon’s success was not a fluke, or a meme.
At a fundamental level, it’s a solidly built, thoughtfully constructed
set of systems, even inspired. The
people who made the original game were making the best game they could,
presumably because they thought people would like it, and not just tolerate it
on nostalgia and cultural momentum. I
would like to have that company back, if you wouldn’t mind.

#BringBackNationalDex

I really did not want to have to write that.

Anyway… for next time, I’m thinking of doing a write up on my observations of the level design of the original Spyro games. Hopefully that one comes out sooner than this did!

Take care!