Construct 2 RPG Series # 2: Battle Design

Welcome to the second part of my Construct 2 RPG tutorial. In the last tutorial I said that I would make an enemy, but before that we needed to have a basic grasp of how the battle was gonna go, because that’s what the player’s interaction with the enemy is gonna be. So in this tutorial, I’ll be writing about battle design.

Firstly we’ll look at stats. Stats are very common in RPGs, it’s the basics of characters and enemies/ Although stats in RPGs are pretty common, some RPGs have some specific stats that others don’t have, here I will write about stats that are common in RPGs

        • HP: Health Points, the maximum health of the character/enemy, if the health is healed, it may not exceed this points
        • currentHP: The character’s current health points, if this goes down to zero the character dies
        • SP: Spirit points, needed to use skills/magics, if SP is restored the value cannot exceed this points
        • currentSP: The character’s current SP, cannot be less than zero.
        • ATK: Attack power. Determines the power of physical attack
        • DEF: Defense power. Determines the power of physical defense.
        • ACC: Accuracy. Determines the accuracy of attacks, whether it’s physical or magical.
        • EVA: Evasion. Determines whether the character is able to evade enemy’s attacks.
        • INT: Intelligence. Determines magical attack power.
        • RES: Resistance. Determines magical defense power.
        • LUK: Luck. Determines various things, from critical attack to item drop rate , or something elsa.

Monsters and player characters will have the same stats, only differs in the value. Monsters will more likely have more HP than characters to give more challenge, and most monsters won’t have skills to help them fight (except bosses).

Next is weapon’s stats, because it’s very common in RPGs for weapon to . These stats will add to player’s stats to help them in battle. Here are the weapon’s stats:

        • minAtk: Weapon’s lowest attack
        • maxAtk: Weapon’s highest attack
        • StatsMod: Stats of player character that this weapon modifies. Not all weapons have this stat so this may empty.
        • Element: Weapon’s element, this may empty.

minAtk and maxAtk are bonus attack values for the player character from the weapon, the bonus attack point will be between minAtk and maxAtk, so the final damage dealt will be varying just like the usual RPGs. StatsMod is a spesific bonus for one stats for the equipping character, not all weapons have this so this may empty. An example of  StatsMod is a weapon that has a spiritual property that might increases equipping character’s SP. And then  Element stats is the element of the weapon, this is clear. A weapon may have an element from the start, or added through crafting. This is not all of weapon’s stats, there are more like the description, icon, buying price, and selling price. But for now, I’ll only focus on what the weapon would do in a battle.

Beside weapon’s stats, there is also armor’s stats. Armor stats are the same with weapon’s stats, but they don’t have minAtk and maxAtk, but minDef and maxDef. The function of these two stats are the same with Atk, but used in defending.

Next, I’m gonna write up about the calculations done when players are attacking enemies. Generally, the calculations that happen are: hit probability –> critical probability –> damage count.

Formula for hit probability is:
attacker’s ACC * rand(6) – devender’s EVA * rand(6)

if the result is more than or equal to zero,  it means it hits, other than that the attack misses. The rand(6) function means taking a random number between zero and six.

Formula for critical probability: The game will simply randomly take a random number between 1 and 300, if the value is less than or equal to the character’s LUK, the attack is a critical attack, other than that it’s a normal attack.

And then there’s a physical damage calculation:
(attacker’s ATK + rand(minAtk, maxAtk)) – (defender’s DEF + rand(minDef, maxDef))

if the result is less than or equal to zero, it will be converted to one, to make sure there’s at least a damage dealt. Both random functions take attack values of attacker’s equipped weapon and defender’s equipped armor.

Magical damage calculation:
(attacker’s INT + rand(minMag, maxMag)) – defender’s RES

minMag and maxMag are the same as minAt and MaxAtk, but they are for magical attacks and are stored in each magics (not each weapons). Magical damage calculation is a little different than physical attack calculation because the defender’s RES is not added with any defenses. In exchange for that, magical calculations will use elemental weaknesses calculation, and armor that increases RES will have an elemental defense power that might reduce opponent’s magic attacks.

Table of elements

This is a list of elements and their relations to each other. For now, it is not complete but will be completed later. That 50% value between fire and water means that a fire elemental attack will only deal 50% damage to defender with water elemental property.




This table is still incomplete and I might add more elements if I feel needed. Later in code, after calculating magical damage, we need to calculate the elements of magic attack and defender’s element before reducing defender’s currentHP.

I can still go on to write about battle design, because there are still more I haven’t discussed, like limit breaks for example. But for now this will do. The first code for the battle system will be for next tutorial. See you!