The *100 and /100 in the above formula cancel out, and multiplying a fraction by a.atk is equivalent to multiplying the numerator by a.atk, so the formula can be written more simply as:
(a.atk*a.atk) / (a.atk + b.def)
It's very similar to my formula -- indeed, I first tried out exactly this formula (after seeing it recommended in another thread similar to this one) before deciding that in my low-numbers game, the damage it output was too low, so I multiplied the entire formula by 2. Then, I felt that defence wasn't having enough of an effect, and the early battles were a bit too tough -- which would be mitigated if defence had more impact, since the player had more defence than enemies. So I doubled the defence term, resulting in the formula I mentioned above:
(2*a.atk*a.atk) / (a.atk + 2*b.def)
Of course, I'm just explaining how I arrived at my formula; you might well find that your version is better suited to the needs of your project.
Thanks for that! I’m still new enough to not really know how well decimals work in a damage formula, so that was actually done deliberately on my part. The idea was to make sure I didn’t hit a floor of zero in the middle of calculations, just in case. The rest of the formatting was me wanting to get a percentage to multiply a.atk by. (Beyond that, I’m plenty lazy enough to let the computer do the rest of the math. <.< >.> <.<; )
The fact that it’s been recommended before is encouraging, too. Means I can possibly at least pretend that I have some vague sort of idea what I’m doing. ^.^;
Damage formulas are really interesting to me, because they can impact the game feel on such a fundamental level, and it's really important to understand the implications of your formula.
I also use the simple (base power)*(a.atk)/(b.def) for my game, and that formula has a lot of serious pros and cons.
Pros:
-Increasing your attack by x% increases damage dealt by x% (this is very intuitive).
-Doubling your defence reduces damage taken by 50%. This is easy to remember and somewhat intuitive, but not as much as the atk one, and it doesn't work well for other values (increasing defence by 20% reduces damage taken by 17%, for example). This does introduce diminishing returns to increasing defence that don't exist for increasing attack, which is desirable from a game design standpoint (encourages offence and avoids stalling).
-A skill with twice as much base power compared to another one will always do twice as much damage, making it easy for the player to compare their available options.
Cons (or at least, things to be aware of):
-Differences between character's stats lead to SEVERE differences in battle performance. If your game involves some classes having twice as much defence as others (plate armour vs cloth armour maybe) then you need to be aware that the cloth-wearers will be taking twice as much damage.
-This can actually be a positive feature if you design around it, however. My game uses the classic MMO 'dps/healer/tank' trifecta, which requires a tank that is absorbing way more damage than anyone else. To accomplish this, I have tank classes that are able to equip the best armour, giving them double or even triple the defence of everyone else.
In my case, the desire to have a 'tank' role is what lead me to a multiplicative damage formula, because it allows for very swingy damage amounts from actor to actor.
I often like to use
(a.atk - b.def) * multiplier
It may be simple, but it works, and it's easier for the player to calculate how much damage they would deal. It's also oddly satisfying when you're overleveled for an area and the enemy deals no damage.
a.atk * ( (a.atk/10) * (a.atk/10) ) / ( (b.def/10) * (b.def/10) )
basically damage equals your atk multiplied by the proportion of your atk/the target's def, but it is exponential.
it's designed to scale naturally so abilities are never obsolete and to make small changes to stats very significant.
So for the offensive portion of my formula is currently:
(a.atk ** (1 + a.agi / 1000) + a._weaponDmg) * multiplier
And I was thinking of simplifying it to something like this:
(a.atk + a._weaponDmg) * multiplier + a.agi
However, doing so means I'll lose out on the synergistic effect of ATK & AGI in the 1st formula. In the 2nd formula, AGI simply acts as a "flat" damage bonus. ATK will still generate the majority of the damage, as intended. Which formula do you guys think is better?
Well, it depends on your numbers. In my game, a.atk * (1 + a.agi/1000) would give something like 16 * 1.016 = 16.256 which rounds to just 16, so the agility stat has had no effect at all. Maybe calculate both formulas at level 1, at a high reachable level, and for early-game and late-game enemies to see how they work in practice?
I'm my humble opinion, this really depends on what your vision of these three interactions should look like:
>Low level vs. low level
>High level vs. high level
>High level vs. low level.
How big do you want damage numbers to look at the start of the game, and how big of an impact do you want minor updates to be? If you want small numbers with small changes leading to big impact, this is what the stock RM {a.atk - b.def} gets you. End game stats and equipment have to be adjusted accordingly, to have the right kind of numbers appear in that encounter. One of the downsides of this system is that the third consideration gets blown out the window- low level enemies are a joke, and high level enemies will blow you away without a chance.
How can you get around this? You have to make the damage formulas have more complicated dynamics - instead of being linear (addition and subtraction) they need to be nonlinear (multiplication and division, square roots, etc).
In one example, Pokemon uses {a.atk/b.def} (it's more complicated than this but this is the fundamental step). This means a Pokemon with twice as much attack as your defense will deal twice as much damage, but in the stock system this ratio can mean many different things (ATK = 4, Def = 3, DMG = 1; ATK = 8, def = 3, DMG = 5; five times the damage for a doubling of attack) depending on the exact attack and defense. Is doubling your attack to do twice as much damage more intuitive even though the calculation is less intuitive? Probably. You're less likely to be utterly crushed by higher level differences, but small changes will usually make smaller impacts than stock.
Some games make it even less obvious. Persona 3/4/5 uses (if I recall correctly) something like the square root of what Pokemon does, so small changes make even less of an impact. It does add additional depth though, because multi hit moves, let's say double hit, do more than one hit with twice as much base power (100 a/d, 10 after the square root, 20 when you add both attacks together, versus 200 a/d, 14 after the square root, 20 > 14 damage).
You really need to think about what you want these numbers to look like, and pick the damage formulas that gets the closest to your vision.
(a.atk + 5) - b.def
With the 5 being how much damage the attack always does regardless of the opponent's defensive stats. I like simple stuff, the variety and complexity comes from enemy design instead of an annoying fancy damage formula. An intricate job system, monster families like in Dragon Quest and a quasi-elemental types system like in Pokémon gives my game enough complexity so that the player doesn't need to worry about the math behind whatever attack they want to use.
Yes you're right, that's a typo and should be a.mat.
Admittedly I wrote that while half awake.
I just take the user values, damage calculation is rather dynamic in my game based on the current action of the enemy.
First I use ATK * (A flat value) to determine the base damage.
Then perform damage resistance calculations (User MATK VS target MDEF, different names in game))
Then On projectile hit, if enemy is guarding, perform a calculation based on user ATK VS target DEF.
AGI is used for move speed, LUK for status effects.
It's simple but it works given the combat system I'm going for.
Currently using the FF7 power formula in MZ from the visu battle core. But i Usually use the basic a.atk * 2 - b.def formula.
Though it can get really annoying since there's no command to make magical spells be undeflectable. I'm not a JS math expert either but, Certain hit healing spells still don't heal nearly as much as their magical hit counter part. (Still figuring that out)
Though I'm mildly tempted to revert to standard RM formula and rework the entire skill formulas as the late/end game can get chaotic with dmg numbers on both ends.
I've recently finalized the defensive portion of my damage formulas:
value /= 2 ** (armor * 1.4 / (user.level * 4 + 10))
…where armor is either DEF, MDF, or (DEF+MDF)/2.
But now I'm on the fence on whether or not to redo the offensive portion of my damage formulas. I was thinking of using the formula for Kinetic Energy as a base: K.E. = ½m*v² …in which:
m = mass
v = velocity
So I was thinking of something along the lines of...
damage = 0.5 * weaponDmg * a.atk * a.agi
I basically substituted mass for weaponDmg, which is just a custom attribute I created for in-game weapons and should be fairly representative of a weapon's weight. Then, instead of velocity², I multiplied a.atk (Strength) with a.agi (Dexterity). This seems logically sound enough for me, but it's quite obvious that such a formula would mean ATK and AGI would be equally valuable in terms of raw damage output. I would much rather have ATK be the primary damage modifier while AGI provides various secondary bonuses (HIT, CRI, CNT, etc...).
With that in mind, I could just as easily use a.atk² instead:
damage = 0.5 * weaponDmg * a.atk ** 2
Of course, these formulas are a huge departure from my current formulas. I can easily tell the values given by the Kinetic Energy formula could get to be very large due to the exponential nature of the formula. I would need to have the output divided by another stat/value similar in magnitude to ATK in order to balance this. Or I can simply scrap this idea and start from scratch again, lol...
Edit: Or, I can go back to one of my earlier iterations...
damage = a.atk ** (1 + a.agi / (-900 / 2401 * (a.level - 50) ** 2 + 1000)) + weaponDmg
…which I suppose could also be written as:
damage = Math.pow(a.atk, 1 + (a.agi / (-900 / 2401 * Math.pow(a.level - 50, 2) + 1000))) + weaponDmg
…hmm, did I get all the parenthesis right? Or do I need more for the Math.pow terms? :distrust: