Showing posts with label rpg maker. Show all posts
Showing posts with label rpg maker. Show all posts

Thursday, June 14, 2018

Alternative RPG Maker Damage Formula

Small Stats Formula
With these formulas, if Atk and Def are equal, the damage is half the attackers attack value. They suit games with small number stats because damage scales and remain low and predictable. The highest damage an attacker can do will be equal to its Attack stat and the lowest damage will be 1.

Formula:
DAMAGE = a.ATK^2/(a.ATK+b.DEF)

Attackers Atk = 10
Defenders Def = 10
10^2/(10+10)
100/20
5

Formula rewritten for RPG Maker (because RPG maker can't do exponents?)
DAMAGE = a.ATK * (a.ATK / (a.ATK+b.DEF) ) or Damage = X * (X/(X+Y))

Attackers Atk = 10
Defenders Def = 10
10 * (10 /(10+10))
10 * (10/20)
10 * ( .5)
5

Examples 
Attackers attack = a
defenders defense = b
damage = d

d = a * (a/(a+b))

1. Attack and Defense are equal
a = 10     b = 10
d=10(10/(10+10))
d=5

2. Attack is twice defense
a = 20    b = 10
d=20(20/(20+10))
d=13

3. Attack is thrice defense
a = 30    b = 10
d=30(30/(30+10))
d=22.5

4. Attack is definitely higher than defense
a = 43    b = 8
d=43(43/(43+8))
d=36

5. Attack is half of defense
a = 5    b = 10
d=5(5/(5+10))
d=1.25

If you haven't noticed, the above formula is based on the idea that if you are equally matched with your enemy, you will dish out damage that is equal to 50% of your attack stat and no matter how much you outclass your enemy, you will do no greater damage than an amount equal to 100% of your attack stat without a critical. You may also notice that your damage asymptotes. By adding a x2, you can change that 50% when you're equally matched to 100%. This brings us to...

SPELLS WITH BASE POWER THAT STILL SCALES

If you add a variable as a multiplier to the beginning of the formula, you can increase the damage you do. This variable could represent the strength of the attack or spell or power or etc. Think of spell levels in Final Fantasy for instance.

d=x*a*(a/(a+b))
X can represent the level of the attack or spell. Example:
Weak = 0.5
Basic = 1
Medium = 1.2
Strong = 1.5
Very Strong = 2

If X = 2, your damage would be equal to your attack stat (if a.atk = b.def). I prefer to make 2 the basic value of an attack or spell. This way, every point of ATK and every point of DEF has more value, making upgrades from equipment and levels more valuable. If 2 is your normal damage, 3 would net 1.5x damage and 4 would net you 2x damage.


FORMULA 2
Found this one here:
https://www.rpgmakercentral.com/topic/27581-how-to-make-damage-calculation-and-leveling-more-like-final-fantasy/
it's: (a.atk / 2)(a.atk / 2) - (b.def / 3)(b.def / 3)
As the OP puts it, damage scales greatly, see below. I think he's very pleased with it, however it makes Defense a less valuable stat compared to attack.
a.atk=10, 25 damage dealt
a.atk=16, 64 damage dealt
a.atk=20, 100 damage dealt
a.atk=30, 225 damage dealt
a.atk=50, 625 damage dealt
a.atk=70, 1225 damage dealt
a.atk=100, 2500 damage dealt
a.atk=150, 5625 damage dealt
a.atk=200, 9999 damage dealt 

if defense is /3 then ^2, this is how much less the base damage will be.
(b.Def / 3)(b.Def / 3)
def    damage
10    11
11    13
12    16
13    18.5
14    21
15    25
16    28
17    32
18    36
19    40
20    44
25    69
30    100
35    136
40    177
45    225
50    277
55    336
60    400
70    544
80    711
90    900
99    1089

125  1736
150  2500 
175  3402
199  4400
255 7225
300 10,000!

In my opinion, this method of having scaling damage is cool, but it means that 1 point to attack is more valuable than 1 point of defense, which is weird to me. Maybe I'm thinking about it too much? If you back track to an earlier point in the game, you'll be one-shoting everything with obscene numbers and the players might start to think too much too.

Let's say you're going for a damage cap of 9,999. Dividing attack by 3 instead of 2 will net you a base damage of 4400 if your attack power is at 200. If your damage doubles when you crit, you'll be approaching 9900 base damage. Factoring in things like elemental weaknesses and resistances and you're pretty much set.

Just for curiosity, let's look at numbers if you divide stat x by 4.
(b.def/ 4)(b.def / 4)
atk   damage    
10    6.25
11    7.5
12    9
13    10.5
14    12
15    14
16    16
17    18
18    20
19    22.5
20    25
25    39
30    56
35    76.5

40    100
45    126.5
50    156
55    189
60    225
70    306
80    400
90    506
99   612

125  976
150 1406
175  1914
199  2475
255  4064
300 5625

I might give a try, but my characters stats will be pretty low so that I can keep make damage around 999. In several Final Fantasy games, 5, 6, and 9 for example, your stats were low. The highest Strength state in FF5 was in the 40s. The formulas scaled because the game had a modifier that was the characters level. You can't assign a level to enemies in RPG maker with scripting, however, which is unfortunate.

Let's see what it would look like to compare high attack to low defense.
70 attack vs 20 def is 519 base damage. 80 attack vs 30 defense is 655 base damage.
Atk VS Def = base damage
70        20         519
70        40         444
70        50         388
70        60         319
80        30         655
100      50         922
100      80         711
100      90         605
100     100        486
80         99         99
70         99        0 or 1
80         110      45
90         110      0 or 1
120       150     194
125       150     330
130       150     471
150       150     1094
Based on this information, if the attack and defense are equal, there will be a damage and you will probably be giving enemies a fuck ton of HP. If your attack is too low, you will probably be no match for the enemy. If your attack is much greater than enemy defense, you'll be doing a lot of damage and it makes the numbers look kind of same-y I guess.

If I was developing a game using this number system, I would have to make a spreadsheet and keep I think I would have to micromanage the distribution of points and fine tune to game a little to much.


How to change critical damage.
Here are the steps:

1 - Open up your game folder

2 - Go to "js"

3 - Open up "rpg_objects" (I personally just used word pad)

4 - Find this line:

Game_Action.prototype.applyCritical = function(damage) {

    return damage * 3;



Change the "3" to whatever critical damage multiplier you want.

Friday, December 21, 2012

RM2K3 Algorithm Fix (Well...)

I can't review the rm2k3 help file because of Windows Vista, but the internet says that the help file says that the skill damage algorithm is:

dmg = base + (atk/20 * Atk Influence) + (def/40 * Int Influence)
NOTE: I believe Magic Defense (MDF) = 1/8*INT. I don't know how it factors in but it does where INT is involved.

Through some experimentation, I have concluded the help file to be mistaken. When I tweaked Character DEF or Enemy DEF there was no difference in skill effect (for magic influenced skills). Therefore, I conclude the actual skill algorithm to be:

dmg = base + (atk/20 * Atk Influence) + (Int/40* Int Influence)

Still not happy with Rm2k3? I recommend upgrading to RPG Maker VX Ace anyhow, but if you can't, here's what else I recommend:
Try to imitate either "Lunar the Silver Star" or the remake "Lunar SSSC."

In the original Lunar on Sega CD, spells always did ~exact damage. The spell list for each character tended to be huge. Later spells are the stronger versions of earlier ones which become obsolete.
To do this, enter the desired damage for a particular spell into the effect rating box and make many more.

For the remake on PSX, the effectiveness of spells was clearly influenced by the characters' growing stats. Nash for instance has only 3 lightning spells instead of 11.
To do this, go into your attributes page and crank up the numbers for Magic attributes only. The C value should be 400% because INT is divided by 4.
A = 800.....the new Double
B = 600.....1.5x
C = 400.....1x or normal
D = 200.....= half
F = 100......= 1/4 (or 0 for 0)
Now, for the Skill. The skill's Effective Rating field works fine at 1. As a result, at the C value, the damage from a spell will now reflect the INT stat +/- variance.

Want some variety? Maybe you want your Fireball spell to be weaker than your Lightning Bolt spell. Create a new Magic Attribute for your Lightning Bolt spell, and set the C value for say, 500 (=1.25x stronger than Fireball!). Now, Lightning Bolt does INT*1.25 damage and Fireball does INT*1 damage. All your spells should have their own individual Attributes.
NOTE: Multiple attributes on 1 skill can get complicated.

I find that it's helpful just to set the ATK/INT influence to 10 because it simplifies the math (Wikipedia commutative property), which now looks like this:
dmg = base + (atk/20 * Atk Influence) + (Int/40* Int Influence)
dmg = base + (atk/20 * 10) + (Int/40 * 10)
dmg = base + (10/20 * atk) + (10/40 * int)
dmg = base + (1/2 * atk) + (1/4 * int)
 *for magic, attack influence is 0, right? So, Dmg = base + 1/4INT.
 Final formula is probably, Dmg = base + 1/4INT - 1/8INT.

Did you follow that? This is why I suggest a 4 base (400%) number system.

*This idea doesn't work for the Normal Attack algorithm (Atk/2 - Def/4 = dmg).
Atk is multiplied by 1/2. You could cancel it out by creating Weapon Attributes where the value for C is 200. Now it's Atk * 1/2 * 2; effectively Atk*1. (NOTE: The damage formula when Characters attack Enemies is now effectively dmg = ATK - DEF/2 instead of DEF/4. Whatever number is in an enemy's DEF field is halved now, not quartered.)
Here's the problem with this. Enemies do not have attributes for their normal attacks, so they will still use the old algorithm when they attack. You could improvise by giving enemies a "dummy skill" as an alternative in place of a basic attack. This means you'll see a lot more of that "SKILL NAME" window in battle. Not pretty. Also, skill accuracy is not affected if the enemy is blinded. If you do this anyway, make do with the original algorithm for enemies and adjust their stats accordingly.
Another problem is characters do not have attributes for their attacks if they are unarmed.

At least you can do some neat stuff with skills!