# Fire Emblem: Dark Dragon and the Sword of Light

## byDKII

### Part 32: Interlude 2: Leveling System

Interlude 2: Leveling System

Have you ever felt like a unit was getting the same level up stat gains over and over again? It's not a coincidence - let's take a peek behind the curtain....

I briefly talked about growth rates and stat increases when a unit gains a level at the end of the first update, but what you may not know is that growth rates in this game are not actually independent of each other.

There are seven stats that can increase when a character gains a level (eight if you count Resist, but every character has a 0% Resist base and growth so let's ignore that one). Basic math says that there are 128 (2^7) different combinations of stat gains that a given unit might see, with their relative probability varying in accordance with the growth rates.

Now, the simplest way to figure out which stats go up during a level up is to pick a random number for each stat and compare it against that stat's growth rates, and if it's lower than the stat goes up. That requires seven different random numbers, though, so it's not how the game works. Instead, the game picks one random number and matches that to a finite list of level-up patterns (much less than 128, I suspect 10 or 20). Then the stat gains are determined by that pattern. The growth rates are thus actually determined from the pattern list, where the growth rate = number of patterns with a stat gain / total number of patterns. This system also explains why every growth rate is a multiple of 10% if there are only 10 patterns stored per character.

That's not really more efficient, but I suspect that it alleviates a major concern - an untrustworthy RNG. Early NES games were notorious for having bad (not very random) RNGs, so pulling out seven RNGs in quick succession to determine level up stat gains was not a great solution. Pulling one RNG and mapping that to an arbitrary list of level up patterns better obfuscates what's going on under the hood. It also means that high rolls don't necessarily mean better levels.

Now, what does this system mean, in practical terms? For one thing, repeat levels are much more common than they would be in an independently random system. For instance, Sheeda got a level with just WpnLvl-Speed-Luck three times in her first five levels. In a completely independent leveling system, that level has < 5% chance of appearing, but with only 10 fixed patterns it has a 10% chance of appearing, much more common. Two of Navarre's first three levels were Power-Speed-Luck-HP, normally a 3.4% chance each but instead here it's just one of the ten patterns. Same for Abel - three of his first five levels were just Skill-WpnLvl-HP, normally a 3.5% chance but here a full 10% chance. Most astonishingly, four of Gordon's first six levels (and five of his first eight) were just WpnLvl-Speed, a 0.5% chance each normally but a 10% chance here (still pretty unlikely but no longer astronomically so).

Other seemingly relatively likely combinations just never happen, or happen much more infrequently than expected. For instance, Rena should, according to just her growth rates, have a 21.2% chance to get at least two stats in the same level, but it'll never happen since she doesn't have a single pattern with more than one stat gain (as we saw in Chapter 4). However, she also should see about 33.4% empty levels according to her growths, but only one of her patterns is empty so in reality it's only 10% empty. So you never really get too high or too low with Rena's levels.

That side effect doesn't just apply to Rena. In general, you won't see particularly unlikely combinations - most good units will never have an empty level, and no unit will ever have a perfect level. In fact, the A-team units will never have fewer than two stat gains in a single level (Sheeda will actually never have fewer than three stat gains in a level, but they're not well-balanced as we've seen). So to some extent you're protected from the extremes of RNG fickleness.

Another weird effect - rare stat gains will always come paired with common ones. Whenever Sheeda gains Power or Defense, she will also at the same time always gain Speed and Luck (at least). Navarre only has one pattern where he'll gain Defense, so it'll always be a Power-Speed-Luck-Defense-HP level. Marth has three patterns where he'll gain both Power and Defense, and all three also come with Luck.

As a more concrete example, we've seen 9 out of 10 patterns across the 18 level gains for both Marth and Navarre so, given their growth rates, we can conclusively list their 10 patterns (P = Power, S = Skill, W = WpnLvl, A = Speed, L = Luck, D = Defense, H = HP):

Marth's patterns (frequency):
##### pre:
```PSWALDH (#)
*   * (1)
*  * (1)
**   * (2)
**  * (1)
** * (4)
**  **  (2)
**  * * (3)
*  ** * (0)
*   *** (1)
*** * * (3)
5444629```
Navarre's patterns (frequency):
##### pre:
```PSWALDH (#)
**      (1)
*   * (1)
*  * (0)
**  *   (4)
**    * (2)
**   * (2)
** * (1)
***   * (2)
*  ** * (4)
*  **** (1)
6534418```
Well those totals don't exactly match the growth rates I was expecting, meaning either there's more than 10 patterns total and/or each pattern does not actually have equal likelihood of getting selected. Or Serene's Forest is wrong about their growth rates, but I find that unlikely.

Either way it's easy to see why these two are doing so well - they've hit on their better patterns more often than their worse patterns, particularly those 2-stat ones.

Some other neat pattern-analysis tidbits:

The most common level-up so far? Skill-WpnLvl-HP, 18 out of 146 times. Runner-up is just WpnLvl-HP, 12 times. Mostly they're just the most common patterns, present on over half of the units that have gained levels in this LP. WpnLvl-HP is a pretty common pairing overall, actually, present in about 1/3 of the patterns we've seen so far.

On a single unit, the most frequent unique pattern to appear has been WpnLvl-Speed, 5 of 15 times on Gordon.

We've gained a total of 44 Power, 56 Skill, 69 WpnLvl, 55 Speed, 64 Luck, 22 Defense, and 87 HP across all of our units so far.