# Fighting formulas

This topic is 3820 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey, I have no idea what this forums is for and I just happened to google here. I'm here to ask some advice from you: I'm creating a game myself and I've been struggling with the fighting formulas quite for a few days straight and can't figure out anything wise. Here's the details: Accuracy, determines whenever you hit or miss Agility, determines whenever you will get hit or you dodge Defence, determines how many of the damage can you absorb Strength, determines how much damage you infclit Vitality, determines the amount of health Weapon power, the damage output of the weapon Armor, the armor of the armors Then I have willpower and exorcism but I haven't implemented them yet so they don't affect the fighting system. So.. Could any of you point me to a page where I can find a formula for the fighting system or could you post one to me?

##### Share on other sites
Quote:
 Original post by unskaArmor, the armor of the armors

hehe.

But it seems to me like you are very close to having your own formula... you have the stats and you know what you want them to do.

Take a look at some old pen and paper combat systems if you are truly at a lose of what step to take next.

Seems to me like an attack in your system may go like (accuracy check: miss end attack)->(dodge check: dodge happens, end attack)->Damage calculation.

But its really up to you to play around with your equation to get the sort of results you want- some info that might be helpful to us is the range of your stat values and the average number of attacks you want someone to be able to take or average damage you want to happen per attack.

##### Share on other sites
Actually I've figured out this much so far:

if player hits {
.if player2 doesn't dodge {
..calculate rawdamage
..calculate defence
..damage = rawdamage - defence
..reduce player2 health by damage
..print "player hits player2 with a Sword and deals X damage. player2 is down to Y health"
.}
.else {
..print "player 2 managed to dodge"
.}
}
else {
.print "player 1 missed"
}

But I have no idea how do I calculate the damage and defend, I've been struggling with it for too long now and I need some help.

What I want is to balance all 5 attributes so one can have multiple different tactics to fight others.

I don't want everyone to have to train strength only etc. For example one could train some acc, str, vit and def but a lot of agi and still beat a guy who has a lot of str.

##### Share on other sites
Hows this:
attackRoll(agressor, victim){    if(aggressor.getAccuracy() > victim.getAgility())    {        damage = (aggressor.getStrength()*aggressor.getWeaponPower())-victim.getDefence();        if(damage <0){damage = 0;}        victim.setVitality(victim.getVitality()-=damage);        if(victim.getVitality()<0){victim.setVitality(0);}    }    else    {        //victim dodged    }}

I didn't use your 'Armor' value, but I am not sure where this fits into the picture anyway. Also I am not sure what Defence is, but from your description, I thought it worked more like absorbtion ? Or damage negation?

Anyway, just keep it simple. If you end up with some crazy ass calculus equation, then it's too complex. In my opinion.

##### Share on other sites
I usually see "armour" used as a "minimum damage sent to have damage delivered", so that check would be
if (damage <= victim.getArmour()) damage = 0;

You should design your combat calculations to give the balancing trade-offs you want. Set up a number of batch simulations with sample combatants, write down the expected results of each batch, and then run each batch with a few dozen variations on the combat formulæ.

##### Share on other sites
Oh ok, so if the damage is greater than armor, then see how much is absorbed? If it is less than armor, they didn't do enough damage to bypass armor. Thanks for explaining that.

##### Share on other sites
The way I usually see it implemented, it is a minimum, but when surpassed it doesn't reduce the damage by its value. So do your victim.getDefense() after the check against armour.

The idea is, if a templar knight in full plate armour gets hit by a rock thrown by a 7-year-old, it would have dealt 3 damage to an unarmoured man, but the plate armour is good against up to 20 damage. However, if a cave troll comes through and smacks that knight with a mace the size of a horse for 30 damage, the armour fails to stop the damage, and can't possibly keep your knight from taking 30 crushing damage.

I usually see it implemented alongside a matched-pairs or rock-paper-scissors damage system, so each unit has 3+ "Defense" ratings, and uses one of them based on who is attacking him. In Fire Emblem's Sword->Axe->Spear->Sword rotation, this means, say, an Axeman takes -5 damage from spearmen, but only -1 damage from swordsmen. But his armour's strength is constant no matter who attacks.

For those unfamiliar with such systems, axes, hammers, and maces all fall under the same category; they've heavier, slow-swing weapons as compared to swords, but strong against spears, pikes, and halberds. I've never been certain why spears should be strong against swords, though, other than the necessity for a rock-paper-scissors relationship.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 10
• 11
• 13
• 9
• 11
• ### Forum Statistics

• Total Topics
634089
• Total Posts
3015426
×