Designing damage and hit formulas

It’s time for us to think about damage formulas so our battlers can start hitting one another for real. That’s also an opportunity to talk about how to choose numbers and calculations.

Calculations regarding how stats interact are part of a game designer’s job. You can work with small or big numbers; that’s up to you. For this project, I’ve chosen small numbers, with a damage cap at 999. I want the numbers not to scale too fast to encourage the player to use strategy over grinding levels. Scaling stats and values linearly throughout the game is a way to achieve that.

Using exponential numbers

Games in the Final Fantasy or Disgaea series use polynomial functions of degree two or more to scale numbers throughout the adventure. A second-degree polynomial is an expression of the form ax^2 + bx + c, with a, b, and c being constants.

For example, in Final Fantasy X, base physical damage follows a formula similar to the following: (((strength) ^ 3 ÷ 32) + 32) x damage_multiplier.

The damage_multiplier depends on the command and allowed designers to balance attacks.

Here’s the graph of the damage inflicted for a character strength of 0 to 100. The exponential curve is in red. I included a linear function for reference; it’s the light purple line.

With this formula, a strength of 50 gives you 4000 base damage while with a value of 100, you deal over 31000. Those kinds of exponential numbers have two interesting characteristics to me:

  1. They push the player to move forward in a linear game. Because the numbers scale so fast, a few levels of difference make an area’s foes a joke both in terms of risks and rewards.
  2. They force players to be within an expected level range to explore a given zone. This applies to MMORPGs as well as many JRPGs.

In older Final Fantasy games, you were supposed to move forward with the story. The games were paced for you to be neither too fast nor too slow.

Using linear calculations

In comparison, games like Mario RPGs use numbers that scale slowly. This makes it so character levels don’t matter as much as the abilities and strategies you apply in combat.

You get numbers that scale slowly with linear functions, where calculated values are proportional to a battler’s stats. In this JRPG, I went for the following damage formula:

(attacker_attack * damage_multiplier - defender_defense) * weakness_multiplier

The multipliers make it so using a powerful attack against which your opponent is weak will deal a lot of damage. The formula is simple enough so players can develop an intuitive understanding of the damage they’ll inflict.

This is a design decision. The way you set your formulas’ terms impacts how the game feels and favor certain strategies. It is all about the tools you give to the players.

There are other formulas we will work with like one to calculate the hit chance. It looks like so.

attacker_hit - defender_evasion * action_hit_rate + affinity_bonus + element_bonus

In the above formula, the element_bonus can be a positive or a negative value.

That hit chance allows you to design attacks that have a high risk and reward ratio. It also pushes you to target enemies that are weak to your character’s element.

The elemental triad

We can associate an element with an action: fire, water, lightning, or anything you can imagine. In this project, I’ve decided to go with a rock-paper-scissors approach and elements named “code”, “art”, and “design”. The idea is to have a game that takes place in the world of game development.

Code is strong against art, art is strong against design, and design is strong against code.

You can find that triangle in many games like the base weapon types in the Fire Emblem series: swords beat axes that beat spears. As enemy units retaliate when you attack them and the bonuses are so big, you must pay attention to which unit attacks which.

In our case, taking advantage of an enemy’s weakness is going to give you a 10 point increase in your hit rating and multiply the damage by 1.5.

On the flip side, if you are weak against the opponent’s element, you have a 10 point hit penalty, and your damage is reduced by 25 percent.

In this project, there is no separation between physical and magical damage, weapon affinity, or weapons. There is no percentage-based resistance to specific statuses, either. These will be yours to design if you so desire. I’m here to show you the foundations and some principles upon which you can build.