# Scaling Enemy Levels and Stats Properly

Status
Not open for further replies.

#### Heirukichi

##### Veteran
There are two ways of doing that:
1. the wrong "do what your guts tell you" way;
2. the analytic way.
The main difference between the two methods is that one (the first) is much faster to deploy, but much harder to balance, while the other one (the second) requires a bit of foresight and mathematical knowledge, but needs very few adjustments later on - provided that your calculations were correct.

Keep in mind that, when balancing stats, you have to handle a lot of different equations and inequalities, with many different variables. The variables involved will be so many that you will be completely unable to find a single right solution. What you can find is a whole space of different solutions where each parameter is linked to other parameters.

Once you identify that space of solutions, you can set those parameters according to your taste.

- - - - - - - - - - - - - -​

Let me show you an example
If you are planning to use the default turn based system, you might want to base your enemies hp, mdf and def (from now on effective_hp) on how long your average battle should be. But how long a battle is also depends on how much damage your party deals each turn.

The final result is something like this:
Code:
battle_length = (effective_hp * troop_members) / (average_damage * active_battle_members)
If you deem that the right value for your battle length should be 7 turns (completely random number), then you know that
Code:
effective_hp * troop_members = 7 * average_damage * active_battle_members
From this point on everything is much easier: you know your actor stats so just create troops with the right amount of enemies and enemies with the right amount of effective hp. Anything that goes lower than that result is "easy", anything that goes over that is "hard".
Scaling works in the very same way: you check the average damage of your party at their current level and scale enemies accordingly so that you still obtain the same result.

As you can see you could have 1 enemy that has an amount of effective health equal to 7 times your party total damage, or you could have 7 enemies that have each an amount of hp equal to your party total damage (so that the player can take down one each turn). At the same time, you can balance your troop damage using a similar formula. It does without saying that having one big enemy results in the party being attacked a number of time that is less than the number of attacks it is going to suffer when facing 7 small enemies. On the other hand, when facing 7 enemies and taking them down one by one, your troop damage is reduced each turn, which leads to your party taking less damage in the next turn.

You could even have a bigger boss enemy that has much more effective health than your average troop (and that is something to be expected), so you should balance things out properly.

As you can see, there is not a single right solution. There are many different right solutions, but, as long as you stick to what you planned, everything turns our quite balanced. I am not going to say that this balances everything, making balance updates completely useless, but it really helps reducing the number of times you have to modify your game because of unbalanced battles.

That said, keep in mind that other things like breakpoints also exist, and if you want to take them into account then you need a LOT of calculations.

#### gstv87

##### Veteran
as they'd say in The Simpsons, there's
-The Way
and
-The Way

the way to do it would be to not do it, because relative enemies to an absolute player renders leveling and equipment irrelevant.
basically: it doesn't matter how much the player grows, the enemy will always be stronger.
and, if the player is at the level of a level 99 enemy, what happens to the level 2 enemy if the level 2 enemy is still set to be stronger than the player who is of level 99?
I had a similar experience in Need For Speed Undercover: I bought the same make and model car that the cops had, raced them down the highway at 300km/h, they kept up at every turn (same make and model! duh!). Then I busted all my tires..... I slowed down to 20km/h and the police still chased me..... at 20km/h. With cars capable of 300km/h.

relative speed to an absolute speed -> I raced at whatever speed, they raced at *my* speed -> cars were irrelevant.
irrelevant cars, *in a racing game*

if the enemy turns out to be weak, nerf the gameplay environment, not the enemy.
don't make your gameplay environment's lowest unit of magnitude "1", otherwise you won't be able to tone it down.
try starting from 3 or 4, make up the environment, and then consider a fully leveled hero, with all the bonuses, and make up a matching final boss.
anything else that you make, will have to sit at some point in between the boss' maximum values, and your minimum unit.
if *after that process* you still think the balance needs adjustment, then tone down the environment's units.

your heroes and your enemies don't have to reach level 99... their values don't have to reach 255... their HP doesn't have to reach 9999.
that's the maximum the engine can handle, but not what you must make them.

#### bgillisp

##### Global Moderators
I'd actually suggest balancing it without the level scaling first. Figure out roughly what level a player will be when they get there, make the enemies a static level for that area, and get them and the bosses balanced. Once you have that figured out, if you still want level scaling, figure it out then.

Just make sure they don't scale up more than the player does, else your game will be like Final Fantasy 8...easier if you don't level up.

#### Animebryan

##### Need more resources!
I'm currently using Yanfly's Enemy Levels script in a project. https://github.com/Archeia/YEARepo/blob/master/Gameplay/Enemy_Levels.rb
I'm really struggling with finding a balanced enemy difficulty growth however.

Does anyone have any advice or tips for base enemy stats and growth?

As always, any help is very much appreciated.
Have you been using FlyingDream's Enemy Level Calculator? http://yanfly.moe/tools/enemylevelcalculator/
It shows you what an enemy's stats look like at different levels. In fact, you can play out the damage levels simply by taking an actor's stats at;
Recommended Level for that enemy/troop/area
5 or 10 levels above & below the recommended level

Ex: Rec. Lv 20
Test the actor's stats against the enemy at levels 15, 20 & 25.

If you can remember the damage formula or can calculate it quickly, you can run the ATK & DEF stats of the actors & enemies to estimate how much damage you're giving & taking. Then compare those damage amounts (both ways) against the actors'/enemies' HP & determine if the amounts are too high or too low. When thinking about this, you have to take into consideration the minimal equipment setup a player would have along with how many party members there are & how many enemies are in the average troop.

The most important aspect is to give the player a 'margin of error'. Basically, make the enemies weak enough so that if the player is a bit under-leveled, they still have a decent chance of either winning or escaping & getting to a town or restore point without being slaughtered. While there are RPG fans who like challenging games, far more players get frustrated getting slaughtered without a fighting chance.

#### Ragpuppy87

##### Veteran
Have you been using FlyingDream's Enemy Level Calculator? http://yanfly.moe/tools/enemylevelcalculator/
It shows you what an enemy's stats look like at different levels. In fact, you can play out the damage levels simply by taking an actor's stats at;
Recommended Level for that enemy/troop/area
5 or 10 levels above & below the recommended level

Ex: Rec. Lv 20
Test the actor's stats against the enemy at levels 15, 20 & 25.

If you can remember the damage formula or can calculate it quickly, you can run the ATK & DEF stats of the actors & enemies to estimate how much damage you're giving & taking. Then compare those damage amounts (both ways) against the actors'/enemies' HP & determine if the amounts are too high or too low. When thinking about this, you have to take into consideration the minimal equipment setup a player would have along with how many party members there are & how many enemies are in the average troop.

The most important aspect is to give the player a 'margin of error'. Basically, make the enemies weak enough so that if the player is a bit under-leveled, they still have a decent chance of either winning or escaping & getting to a town or restore point without being slaughtered. While there are RPG fans who like challenging games, far more players get frustrated getting slaughtered without a fighting chance.

Thank you for the link to the Enemy Level Calculator. I was actually looking for something like that.

EDIT: I've discovered an issue that could have been causing the trouble I've been having. It had to do with the enemy
growth formula. I'm currently redoing my enemy stats from the ground up. I have an idea for a stat growth pattern,
using the default enemy stats that the game provides and going from there. My game uses the default class stats , so I figured enemies should be the same.
I've determined about what level I want the player to be at certain points in the game, and am adjusting the difficulty accordingly.

Now I just need to see if this will work better.

Last edited by a moderator:

#### Heirukichi

##### Veteran
the way to do it would be to not do it, because relative enemies to an absolute player renders leveling and equipment irrelevant.
basically: it doesn't matter how much the player grows, the enemy will always be stronger.
This is something I hear very often, and I agree to a certain extent. However, when saying that, people always forget to consider the following situation.

- - - - - - - - - - - - - -​

Explanation
Let us assume that P(x) is the function to determine the player growth. I am going to call E(x) the function to determine a certain enemy scaling; it refers to a random sample enemy, it does not matter which one but it is not the same for every enemy (this is important). For arguments sake I am going to consider equipment growth as part of P(x) to simplify calculations.

The following statement is true:
Code:
P(x) = k * E(x), 0 < x < maxLv, 0 < k >= 1
The reason why k is greater than or equal to 1 is because otherwise leveling up would only hinder the player, which actually happens in a few bad scaled games, but I would rather refrain from considering them a good example here.

Now, it is true that we could consider another function and set it as our player growth function. Since doing something like this is possible
Code:
T(x) = P(x) / E(x) => P(x) = T(x) * E(x)
It means that we can simply eliminate E(x) from the equation. As a matter of fact, we could use T(x) as a growth function for our player, and doing that does not require enemy scaling.
Code:
T(x) * E(x) = k * E(x) => T(x) = k
While this is a mathematical truth, people usually stop analyzing at this point. However, that is completely wrong and greatly limits our possibilities. As I said, E(x) is different for each enemy. This means that
Code:
P(x) = k1 * E1(x) = k2 * E2(x) = ... = kn * En(x), n is the number of different enemies in the game
Considering this, what we did before is no longer possible. In fact, if we pick a random enemy growth function, we obtain something like this:
Code:
T(x) * Ei(x) = kf * Ef(x) => T(x) = kf * Ef(x) / Ei(x)
This gives a different result each time we change the pair of enemies involved. Since our player growth cannot change based on the enemy the player is facing, it goes without saying that it is no longer possible. And, in my opinion, the fact that, with an infinite amount of different possibilities, people always consider the only one that makes this system useless is quite disturbing. I mean, you have INFINITE combinations and you have to pick the ONLY ONE that makes the system useless? Why is intellectual honesty so difficult to find?

However, a formula like that would mean that the player can face any enemy at any level, but what really happens is that enemies do not use the same starting statistics as the player. If we include that into our formula we obtain this:
Code:
P(x) = k * E(x) + s, s > 0
This also means that using different coefficients (k) for different enemies can make certain enemies impossible to beat before a certain level is reached. At the same time the player would still experience the full extend of his or her growth against enemies whose growth rate goes toward 0 for x that goes toward infinity, but, the stronger the enemy, the longer it is going to represent a challenge for the player, even after growing.

Widening the gap between enemies is a way to keep the growth sensation, while making certain enemies represent a challenge for a bigger range of levels. It is also a way to keep challenging the player when he or she is close to the level cap, which is usually something that makes every single game less challenging. All that, without removing the growth sensation, because the number of monsters that have a growth rate comparable to that of the player (and it should still be lower in my opinion) is very limited.

- - - - - - - - - - - - -
That said, provided that I am not a fan of level scaling enemies, the dynamics that scaling enemies have to offer are:
1. providing different level range until the player reaches the breakpoint for a certain enemy;
2. providing a decent challenge when hitting the level cap against enemies that were not encountered too late in the game.
The only question we should ask ourselves when planning things is: do we need those dynamics in our game? If the answer is affirmative, using scaling enemy mechanics is not a bad idea, even if you are not a fan of those. It can really cut the time required to develop your combat system by a big amount since you can use the same enemies for a wider range of levels. Because of that, it also lowers the amount of resources required for your enemies.

My game uses the default class stats , so I figured enemies should be the same.
That might seriously be the wrong way to do it. As I said, if your enemies scale using the same formula as players, growing only hinders the player. Equipment would be much more effective at low levels rather than at high levels.
Code:
x/a > x/(n*a), x > 1, n > 1, a > 1
If you do it like that you make the same mistake they did in FFVIII and Oblivion. Just think about it. Which one is easier: killing a level 100 enemies with level 100 equipment or using the very same equipment to kill level 1 enemies?

Last edited by a moderator:

#### hiddenone

##### Lurker Extraordinaire

@Ragpuppy87 , please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.

#### Ragpuppy87

##### Veteran
as they'd say in The Simpsons, there's
-The Way
and
-The Way

the way to do it would be to not do it, because relative enemies to an absolute player renders leveling and equipment irrelevant.
basically: it doesn't matter how much the player grows, the enemy will always be stronger.
and, if the player is at the level of a level 99 enemy, what happens to the level 2 enemy if the level 2 enemy is still set to be stronger than the player who is of level 99?
I had a similar experience in Need For Speed Undercover: I bought the same make and model car that the cops had, raced them down the highway at 300km/h, they kept up at every turn (same make and model! duh!). Then I busted all my tires..... I slowed down to 20km/h and the police still chased me..... at 20km/h. With cars capable of 300km/h.

relative speed to an absolute speed -> I raced at whatever speed, they raced at *my* speed -> cars were irrelevant.
irrelevant cars, *in a racing game*

if the enemy turns out to be weak, nerf the gameplay environment, not the enemy.
don't make your gameplay environment's lowest unit of magnitude "1", otherwise you won't be able to tone it down.
try starting from 3 or 4, make up the environment, and then consider a fully leveled hero, with all the bonuses, and make up a matching final boss.
anything else that you make, will have to sit at some point in between the boss' maximum values, and your minimum unit.
if *after that process* you still think the balance needs adjustment, then tone down the environment's units.

your heroes and your enemies don't have to reach level 99... their values don't have to reach 255... their HP doesn't have to reach 9999.
that's the maximum the engine can handle, but not what you must make them.
It's a valid point. One I have already considered, but thanks for your input.

Actually I have a doppelganger battle in my game.
The script for that is dependent on the enemy levels script.
Also. I have it currently set up that the enemies will only continue to level up with the player until a certain level is reached.
Example. Enemies in the first area max out at Level 8.

And @hiddenone , Sorry for double posting. I was unsure if the rule applied when replying directly to someone else. Won't happen again.

#### eluukkanen

##### Composer
Enemy levels gives such a long balancing job, but is a worth plugin for larger games that want challenge with their earlygame foes even after a few hours of gameplay

My tip is to keep it simple. I will use it to only give very small stat differences, but noticeable.

#### Heirukichi

##### Veteran
Enemy levels gives such a long balancing job
Well, it is true that you have to balance them, but you have to balance enemies even if you are not scaling them. The amount of work required is the same (and even the process):
• calculate what kind of parameters are good against players of that expected level;
The only difference lies in the fact that with scaling enemies you have to divide the amount you calculated by the original value to obtain the rate at which those parameters increase.

#### Htlaets

##### Villager
I think the simplest way to do it is to determine a few things:
First: What the stats of an average geared average leveled player getting to that area would be. Then determine what an under-geared under-leveled player would have. Then determine what the upper reasonable end would be like. A good way to determine the low end is to determine what level the player would be if they avoided all random encounters to that point and just did bosses and unescapable fights. Then for average, try someone who doesn't avoid fights but doesn't go out of their way for more. Then for high end, you're gonna have to figure out how many fights someone with a grind fetish would stack.

Next: Determine how many turns you want a fight to last. If you're only going to have a few encounters, than a longer drawn out battle is fine, but if you have tons of encounters enemies should go down in 1-3 hits.

If you have 1-3 hit enemies, they should hit hard to make the player use resources and think about the most efficient strategy to take them down is. You'll also have to plan the whole encounter around a 1-3 turn average.

The problem with 1-3 hit enemies: It's difficult to make your stats and skills feel like they matter here (A level difference in stats will likely not make a difference in number of hits to kill the enemy). You'll have to use your party roles and the like to make this more interesting than spamming a damage skill for each. Maybe have an enemy that will occasionally play defensively if you don't take it out first, another enemy that's faster than most, if not all, of the player party but relatively weak, and maybe healer enemies.

You can balance this against defensive taunting party members that can minimize damage, for example, or another party member that can pierce the enemy's defense. So you'll be forcing the player to at least think about target priority and party roles in your encounters.

Also, balance the enemy health so that there's a one hit difference between a low level and average/high level so that the player feels like there's a point to gearing up.

For damage sponge enemies you basically have to design them as mini boss fights. The key to this is to not have many encounters. You'll bore the player out of their skull if they have to fight damage sponge after damage sponge without feeling like they're making progress. So basically I'd limit myself to having 4-5 encounters in the entire dungeon outside of a boss fight or two with this method.

I'd actually suggest balancing it without the level scaling first. Figure out roughly what level a player will be when they get there, make the enemies a static level for that area, and get them and the bosses balanced. Once you have that figured out, if you still want level scaling, figure it out then.

Just make sure they don't scale up more than the player does, else your game will be like Final Fantasy 8...easier if you don't level up.
Agreed.

#### Ragpuppy87

##### Veteran
I think the simplest way to do it is to determine a few things:
First: What the stats of an average geared average leveled player getting to that area would be. Then determine what an under-geared under-leveled player would have. Then determine what the upper reasonable end would be like. A good way to determine the low end is to determine what level the player would be if they avoided all random encounters to that point and just did bosses and unescapable fights. Then for average, try someone who doesn't avoid fights but doesn't go out of their way for more. Then for high end, you're gonna have to figure out how many fights someone with a grind fetish would stack.

Next: Determine how many turns you want a fight to last. If you're only going to have a few encounters, than a longer drawn out battle is fine, but if you have tons of encounters enemies should go down in 1-3 hits.

If you have 1-3 hit enemies, they should hit hard to make the player use resources and think about the most efficient strategy to take them down is. You'll also have to plan the whole encounter around a 1-3 turn average.

The problem with 1-3 hit enemies: It's difficult to make your stats and skills feel like they matter here (A level difference in stats will likely not make a difference in number of hits to kill the enemy). You'll have to use your party roles and the like to make this more interesting than spamming a damage skill for each. Maybe have an enemy that will occasionally play defensively if you don't take it out first, another enemy that's faster than most, if not all, of the player party but relatively weak, and maybe healer enemies.

You can balance this against defensive taunting party members that can minimize damage, for example, or another party member that can pierce the enemy's defense. So you'll be forcing the player to at least think about target priority and party roles in your encounters.

Also, balance the enemy health so that there's a one hit difference between a low level and average/high level so that the player feels like there's a point to gearing up.

For damage sponge enemies you basically have to design them as mini boss fights. The key to this is to not have many encounters. You'll bore the player out of their skull if they have to fight damage sponge after damage sponge without feeling like they're making progress. So basically I'd limit myself to having 4-5 encounters in the entire dungeon outside of a boss fight or two with this method.

Agreed.

Well to begin with I have overworld enemies instead of random encounters. I playtest by battling every single enemy in a dungeon. About 60 enemies.
I see what level that brings me to and I reduce the max level of an enemy to one below my current level as I realize the average player won't go out of their way to defeat every single enemy

Example after defeating all 60 enemies in the first major dungeon my party was at Level 11
I put a max level cap of 9 for standard enemies and make the boss level 10.

I then repeat the process. I start dungeon 2 with enemies set at a minimum level of 9, defeat every single one see what level my party is at and
max the enemy level out at one less then my current level.

Another issue I have is I have a class select system. I don't know what the player will pick. The heavily armored warrior, or the fragile mage etc.
So choosing stats for enemies is difficult. Attack wise I still want the enemy to damage a warrior, but not completely destroy a mage in one hit.
I'm currently searching for a happy medium, but it's very trial and error.
There doesn't seem to be a magic formula for enemy base stats and growth.

EDIT: I know 60 enemies seems excessive. Perhaps it is.
I currently have 10 floor mazes. 50 by 50 in map size... 5 enemies on the first 5 floors, 8 on the next 3, and 10 on floor 9, with a boss on floor 10. The layout is similar to mystery dungeon games, without the mystery aspect.
I think it balances out evenly across 10 floors, but that could just be me. And it isn't required that a player take out every single one to be strong enough to defeat the boss.

Last edited:

#### Heirukichi

##### Veteran
I don't know what the player will pick. The heavily armored warrior, or the fragile mage etc.
So choosing stats for enemies is difficult. Attack wise I still want the enemy to damage a warrior, but not completely destroy a mage in one hit.
That has nothing to with scaling enemies, it plain and simple class balance. It goes without saying that having a magician with 10 HP and 4 DEF is something hard to balance if your warrior is going to have 80 HP and 20 DEF. However, if your magician has 40 HP and 7 DEF, that much is probably going to be easier to balance. It goes without saying that the warrior is going to be more difficult to kill, but you can balance that by giving your magician a higher damage and by lowering your warrior MP pool so that the number of skills the player can cast with a warrior is limited.

In the end everything depends on the formula you want to use. As I said in my previous post, it is not much different from balancing enemies. You have to write down those formulae, no matter what. Before coming up with a generic damage formula (that includes damage reduction) you cannot balance your enemies nor your classes.

#### Ragpuppy87

##### Veteran
Thank you everyone for your input. I have found a somewhat obvious solution to my problem. Although the Doppelganger battle in my game is dependent on the enemy levels script, I can just set all the other enemies to level 1 and set their stats normally as I would without the leveling script.

#### Kes

##### Global Moderators

Status
Not open for further replies.

### Latest Profile Posts

Eh... just the three of us killing mosquitoes and collecting them. Current kill count: 14.
Been watching videos about IRS phone scammers. Some really scummy people in the world.
Is the "2 status updates per 24h" still in effect?
My first attempt at Pixel Art (I have no idea what I'm doing but I'm doing it)
Plugin instructions: *exists*
Plugin: What did he say? *error*