Where to start working on the combat system, as well as what formulas to use, — said Konstantin Sakhnov, founder of the indie studio Vengeance Games and author of the course "Fundamentals of game Design".

*One of the Vengeance Games*

*Konstantin Sakhnov*

## Terminology

First, let's define the terms.

The combat system is a game mechanic for comparing two entities to determine the winner.

The easiest way to compare something is to compare numbers (in our case, the parameters of entities expressed in numbers).

Whoever has the higher number wins.

Let's call this number **power** (or combat power).

**Power** is a single quantity that characterizes the strength of a fighting subject.

But if combat mechanics were reduced solely to comparing two numbers, it would hardly be interesting to play them. Therefore, game designers significantly complicate such systems.

For example, MMORPG developers make it so that when two characters fight, the victory of a stronger hero is not "guaranteed", but "more likely".

The fact is that additional variables are added to the calculation of the outcome of the battle:

- Character characteristics;
- player skills;
- an accident.

Game designers don't just add them. When setting up a combat system (and in general, depending on what type it is), they also determine their degree of influence on the result.

Conventionally, the more important chance is, the closer the game is to gambling entertainment. The more important the player's skills are, the potentially closer the project may be to esports disciplines.

As a result, the combat system of any game can be represented as a point in a conditional triangle, where each of the vertices represents one of the described variables.

The impact and consideration of randomness and player skills on the chance of winning is a separate topic for discussion. Now we will focus on the characteristics.

When there is only one characteristic, it is easy to calculate the power, but usually the combat system takes into account many parameters.

Calculating the power from the characteristics is our main task within the framework of this material.

But, remember that the power gathered from the characteristics does not determine the outcome of the battle by 100%. Rather, we are talking about the fact that in an infinite number of iterations, a player with more power is more likely to defeat other players with less power and different skills.

## The basic formula for calculating combat power

Let's denote the power of the character as P. Then the condition for a greater probability of player 1 winning over player 2 will look like this:

*Formula 1*

This is the base. Those are the two prime numbers that we talked about at the very beginning.

But after all, in games everything is not exhausted by them, in them, at least, the characters have health and what damage they inflict on each other.

So let's introduce two new characteristics:

is the effective health reserve of the character**H**is the effective damage of the character.**D**

We call them effective because all other combat characteristics will be reduced to them in some way that is still unknown to us. They take into account all other parameters, applied effects and modifiers, but do not include the player's skills.

It turns out that since we have two main characteristics and power, which, according to our definition, includes everything except the player's skills, then according to the method of basic characteristics, we can say that:

*Formula 2*

## The simplest model

Consider the case of a battle between two characters whose players have equal skills.

Then player 1 has **H1, D1 > 0**

Then player 2 has **H2, D2 > 0**

The winner is the one who first brings the enemy's health reserve to zero with his damage. That is:

*Formula 3*

Since all values here are positive, the inequality can be rewritten as:

*Formula 4*

And here we recall formula 1. It turns out that in the simplest case, the power of a character is the product of his effective health reserve for effective damage.

*Formula 5*

## Conversion of characteristics

It's time to figure out the effective characteristics and come to something more familiar.

Our task is to determine the list of player characteristics and reduce them all to the basic ones:

- effective
;**H** - effective
**D.**

It is convenient to use conversion tables for this purpose:

*Table 1*

Let's have 4 derived characteristics:

- power;
- dexterity;
- intelligence;
- endurance.

For each, we will indicate which basic characteristic they affect (shown in Table 1).

By the way, the conversion of characteristics is not at all the most tedious thing in combat systems. In my lectures at the WN Academy, I talk about how to calculate the abilities you have invented, a combat strategy system with hundreds of units, and other cool features related not only to combat, but also to all aspects of game design.

So, let's get back to the topic. Please note that I have added * Crit and *Dodge

*. But these parameters do not participate in the formula of power at all. This means that we will also have to reduce them to effective*

**to the table***and*

**H**

**D.**How to calculate how much each characteristic should give?

- Set the scale of units: how much
and**HP**will give 1 characteristic.**DMG** - Set the dynamics of the battle
: how many moves, seconds, strikes, etc. it takes to win.**N**

The greater the * N*, the slower the fight will be.

*Formula 6*

Let N = 5, and the scale of characteristics is k1 = 2. Then we take a characteristic that converts only to HP or DMG, in our case it is endurance:

*Formula 7*

The basic condition for the equivalence of the contribution of all characteristics to power:

*Figure 1*

Then the force can give a total of 2 units of damage or 10 units of health reserve. Let the force give 1.5 damage, then the coefficient for the health reserve will be:

*Formula 8*

So the force can be described as:

*Formula 9*

Then the original table 1 will look like this:

*Table 2*

Let's calculate the other characteristics in a similar way.

Now back to the * Crit* and

*. For example, Crit can be considered as:*

**Dodge***Formula 10*

Where D0 is the initial damage before taking into account the crit, and CritFactor is the coefficient of damage increase during crit. This is usually x2.

## ***

In many ways, the combat system is a story about formulas, about calculating the results of a battle. You can't do without them.

However, it is important to remember that fighting cannot be reduced exclusively to numbers. This is mechanics itself with control, dynamics, tactility, and a variety of entities.

Visualization of battle, animation and VFX is also an action game, as well as much, much more.

*Figure 2*

But the main thing is that the action is a fan. The mechanics of combat are something that the player will have to face in the game many times. And it is absolutely unforgivable if she will be depressing and repulsive with her uselessness.