Friday 2 October 2015

Combat Balancing

In games the combat balance of the player vs the enemies is extremely important, as it defines how the entire experience feels. If done incorrectly it can make the game seem unfair, or simply dull. However if done correctly the game becomes an engaging experience that brings the player back time and time again.

With that in mind, how does one go about balancing your combat?

Well if you search about the subject online you see many sources discussing playtesting, spreadsheets and graphs. These are however tweaking mechanisms, the steps you run through to perfect an already built system. Without that system they are useless, merely introducing a layer of complexity that does not result in a finished product. So with that in mind, how does one build a combat system?

My technique for doing so is to think about the combat in terms of 'hits'. This is an abstracted version of health that refers to the number of times an entity must be hit before its considered dead. This value boils down the complex system of HP, attack, defense into what the player experiences, and allows you balance accordingly.

To figure out how many 'hits' an enemy should take you need to next decide on the flow of the game. Is it a fast paced game, where enemies die after only a few strikes? Or a longer turtling game where combat is a battle of attrition, with enemies requiring tens of strikes to be downed? Once you decide on the flow you can assign hit counts to enemies respectively. For a medium paced game a weak enemy could require 4 hits, and normal enemy 6 and a strong enemy 9.

We can further use the hits system to balance out our attacks. So a basic attack might deal 1 hit, a strong attack 2 hits, a special ability 4 and a ultimate ability 6. Another example using final fantasy attacks:

Basic attack = 1 hit
Fire = 2 hits
Attack, charged up = 3 hits
Fira = 4 hits
Firaga = 6 hits
Limit Break = 8 hits

So this way we figure out the relative power of skills when compared to one another.

So how do we figure out what Hp, Attack and Defense to give our entities so they obey our hit counts? At this point here is how our game entities look:

Weak: Hits=4, Hp=?, Attack=?, Defense=?
Normal: Hits=6, Hp=?, Attack=?, Defense=?
Strong: Hits=9, Hp=?, Attack=?, Defense=?

Now we can make a little formula to figure out relationship between the other stats:

Hp = calculateDamage(Attack, Defense) * Hits.
Which means the Hp will equal the damage formula (taking the attackers attack and defenders defense) times the number of hits that entity strength can take.

So to figure out the correct values for the formulas I like to start from deciding the amount of damage a 'hit' should entail. Lets say I pick a hit to be 10 damage. This makes the hp of our entities easy to figure out, 40, 60 and 90 respectively. We also now have an output value for the damage formula.

calculateDamage(Attack, Defense) = 10

Now the details of how you calculate the damage based on the inputs are entirely up to you. There are tons of examples of formulas floating around the internet to look at as an example, but you can read on to see what I use.

So in my game I determined that I want attack and defense to be a contest against one another. So when attack equals defense it should deal 10 damage (1 hit). If attack exceeds damage it should deal extra hits based on the amount it exceeds the defense by. If attack is less than defense it should deal only part of a hit, based on how far below the defense it is.

So here is my formula:

if (attack == defense)
    damage = 10
if (attack < defense)
    damage = 10 / ((defense - attack) * 0.5)
if (attack > defense)
    damage = 10 + (attack - defense) * 5

The values of attack and defense then only matter when compared to one another. I am basing the attack and defense value off the 'level' of the entity, so higher level things deal more damage and take less damage.

Anyway I hope this helps you plan out your own combat system!