22 May 2018

Balancing in Terraria - Part 1

Balancing in video games is a delicate topic. I've been playing Terraria lot lately - especially modded. I've also started to create a mod with a friend of mine and we're planning on adding new classes and new end-game progression, which requires balancing as well.

First: What is Terraria?

Before going into details let's inform everyone what Terraria is. I don't want to go deep into detail on this one so let's fill you in this way: Terraria can be considered a 2D version of Minecraft in a limited world with a higher focus on equipment progression, much more underground layers and an adventure type of feel with a few elements of hack and slash sprinkled in. At least that's my definition of Terraria.

Basically you start off in a world with a copper pickaxe, short sword, and axe and you have to get new resources, defeat bosses to get better equipment, like mining utilities, armor, weapons and so forth, which increase your stats like maximum health, mana, damage, critical strike chance, critical strike damage, attack speed, life regeneration and more. Of course, you can build houses and other stuff though more enemies are traveling the world than in games like Minecraft, so your building may be interrupted by a horde of zombies and flying eyes at night or slimes at the day.

The Classes

Classes in Terraria are not chosen at the character creation. Instead, they are determined by the items, armor and other equipment you use. Playing Terraria you may come across three to five classes. These classes are categorized by the damage types and the boost given in the game.
  • Melee Damage
  • Range Damage
  • Magic Damage
  • Summon Damage
  • Thrown Damage
Though, you may find some inconsistency between classes. This is because the summon class was added later in development and the thrown damage class was discontinued or abandoned. The reason for the latter is the similarity to range. The former is noticeable as there are hardly any - if at all - summon items in the early game.

Balancing Procedure

So we have five classes now and the easiest way to balance these would be to make them all equal. Ah, that would be too simple. I said balancing is a delicate thing. If you make every class equal, good job you balanced it mathematically, but it's no fun. Games are all about fun, even if it's in weird ways sometimes. Well, our classes should be different. Going by common logic and our three main classes we have a melee that most likely needs to be near enemies and bosses most of the time a ranger that stays at a distance and has to aim whilst consuming ammunition and last but not least a mage or wizard that uses mid to far distance high damage weapons whilst consuming a rechargeable resource.

Applying the Definition

Step 1: Create a Basic Relationship of Defense

By the definition of our melee class, they'll need a lot of defense as they're near the opponent and most likely to get hit. In comparison, the magic and range classes can avoid any contact with the opponent if their maneuverability is good so they don't need that much defense. So, let's check our current state.

Defense: Melee > Range = Magic
Damage: Melee = Range = Magic

Step 2: Build on the Basic Relationship

Another thing we defined is that magic damage is the highest of all in nearly all games, unfortunately, this comes at a cost. For a mage or wizard to be strong they need to be able to use their spells and mana most efficiently. This requires certain clothing, that is light and can be easily imbued. At least that's a common belief, so, let's go with this! We increase the damage of the magic class, decreasing the defense at the same time to keep it balanced.

Also, we're putting range above melee as range has it harder to hit the enemy, due to aiming.
 Our new state is:

Defense: Melee > Range > Magic
Damage: Magic > Range > Melee

Keep in mind this is just an approximation. Even though balancing via formulas and calculation isn't all, it still helps a lot when balancing details.

Adding the Other Two Classes

Step 3: Adding Our Thrown Class

Don't forget about the thrown and the summon class! These are very specific so we have to go with what is in Terraria to get an idea of how they were planned or implemented. The thrown class uses consumables that can be thrown and ammunition consuming items to throw a gravity affected object. Additionally, there are thrown weapons that have been assigned to the melee class instead like infinite daggers to throw, lances and boomerangs and similar. Something noticeable here is that all thrown items do not allow for a distance that's as far as the range class. This limit plays a huge role. We're dealing with a mid-range class. As such they need either more damage to compensate for damage taken than the range class or more defense. Giving them increased damage instead of defense allows for a hit and run styled gameplay that may match something like a ninja, so let's go with that.

With our relationship updated:

Defense: Melee > Range > Thrown > Magic
Damage: Magic > Thrown > Range > Melee

Step 4: Adding Our Summon Class

The way the summoning class has been introduced into Terraria makes it tedious to balance. A summoner uses the same resource as a mage but only once per summon - on the same note: Summons have no time limit, they age until you die or dispel it by right-clicking. They can summon up to 9 or 11 minions depending on the platform you play on and whether or not you use buffs. The problem here is the balancing of the armor. Let's illustrate the issue mathematically...

Natural Diminish Returns on Summoner Minions
x-Axis: Number of MInions
y-Axis: Damage increase in %
If you have a summon weapon that deals 24 damage and you summon one minion you deal 100% damage. That's the base damage. If you summon another minion you have two that both deal 24 damage so in total 48. That's 200% - your damage has been doubled. Now with the next minion, you deal an additional 24 damage, that's 3 * 24 = 72 damage. This is 300% of the damage compared to one minion but it's only a damage increase of 50% since we had 48 damage with two and got only half, 24 damage, with the third. 

This behavior should be familiar to people who know this or read this blog for a longer time. The behavior is called Natural Diminishing Returns. Basically the more you get the harder it is to keep on doubling the effect. I'm not going into detail on this here, but the graph to the left shows the behavior.

By the way, the point where the increase is half of the 100% damage you should check if you find any damage bonuses that give higher damage increase. For example, if you have four minions your next minion will increase your damage by 6.25%. Some armors give nearly or more than that. 

Another factor is that while the minions do the job the summoner can use other weapons in the meantime. This further increases the damage. At the same time since those minions are taking care of the enemy automatically, the summoner can focus on dodging and avoiding attacks. Thus they don't need as much defense as the magic, melee, ranged and thrown classes need. Additionally, due to the advantages, I mentioned here the damage should be far lower per single minion. The total damage should be lower than the magic class, as they aren't forced to embrace the enemy, but with the low armor, it should be higher than the rangers. Also, the minion attack range plays a role here. From what I've seen in Terraria it is about mid-range.

Phew, so, this gives us this relationship:

Defense: Melee > Range > Thrown > Magic > Summon
Damage: Magic > Summon > Thrown > Range > Melee

Preview

Now we've got the basic relation between defense and damage of the classes done. In the next post, we're going to compare the actual in-game defense and damage to check how the balancing has been done in-game and where breakpoints and power spikes are hidden. Additionally, we're gonna compare and assume where the thrown and beginning of the summon class should be.

Until then, GreenyNeko, out.



Liked the post? Noticed an error? Wanna discuss the content or leave a comment*? You can join or check into the discord to do so! (*Note: Comments are disabled to avoid saving user data on this website.)
>> Join Discord

About Me

My photo
I'm a junior game developer and software developer and I created this blog to share my ideas, thoughts and whatever I'm working on or doing.