First Game Battle mechanics

Darkfire1408

Novice
Veteran
Joined
Jan 7, 2015
Messages
33
Reaction score
4
First Language
English
Primarily Uses
So, the original battle mechanics are fairly simple, a basic a.atk * 4 - b.def *2. I quickly found that, at higher levels, low level enemies will deal no damage to you. I don't want that to happen, so I made another formula. So the first attack formula I made is a.atk * 4 / b.def + 10 with a low variance. This worked fairly well, but, makes defense and magic defense extremely over powered. One point will do nothing, while two will just about half the damage. So then I upped the attack multiplier to 16. Now the attack stat will be ridiculously high enough when making the attack to somewhat rival the defense. Say, 2 points of attack against 2 points of defense, that 2 becomes 32, it's then divided by 2 and becomes 16. Then ten is added to it to make it 26. Now, here's where it gets interesting, a high defense against attack. 2 and 20, the attack becomes 32, and is divided by 20, rounding up would be two, down would be 1, add 10 and its 11 or 12 even a 50% Variance should only make it as low as 5 right? Or am I misunderstanding how that works? Now, a high attack against a low defense, 20 and 2. 20 becomes 320, it's divided by 2 and becomes 160, 170 with the ten. It's working so far, defense is definitely the more powerful of the two though, but it seems pretty balanced so far. Can't wait to test it on high level enemies.
 

Gothic Lolita

YouTube Starlet
Veteran
Joined
Oct 21, 2014
Messages
1,132
Reaction score
197
First Language
German
Primarily Uses
RMMV
The damage is calculated on the formula itself. ;)
For example Actor x is Level 1 with 10 atk, then it will look like and the enemy has 10 defense:
a. 10 * 4 / b. 10 * 2 = 20 Damage
If the same actor is level 2  with 14 atk and the enemy has still 10 defense:
a. 14 * 4 / b. 10 * 2 = 36 Damage

The same will go the other way, but it will look at some point that way if the enemy has 10 atk and the player has 20 def:
a. 10 * 4 / b. 20 * 2 = 0 Damage. 

That's the problem so far. :D (\s/)
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
The way I handled this in my game was I set up a spreadsheet and plugged in various numbers to multiply attack and def by (and to add or subtract to them if needed), then set it up so I had two entries I could edit, player's attack and enemies defense. This allowed me to find the 'sweet' spot for those numbers (so far), though I do run the risk that a really high level player may do 5 digit damage to a rat late game.
 

Darkfire1408

Novice
Veteran
Joined
Jan 7, 2015
Messages
33
Reaction score
4
First Language
English
Primarily Uses
I just tested it against a test enemy with 999 defense with a character with 8 atk. It does 10 to 12 damage every time, I attached photos of it.

I think you're forgetting how to divide Cheeky Moon, anything divided by itself is 1, with that last formula of yours it would be 1 damage, not counting variance.

 With the formula a.atk * 8 / b.def + 11 with a Variance of 10%, 8 attack * 8 = 64. 64 / 999 Is close enough to 0 that it rounds down. Then the + 11 comes in. So now the total damage is 11 with a Variance of 10%. So it can either go up by 1, or go down by one. I imagine if I kept up the battle I would have eventually gotten a 10 damage attack.

I'll experiment more with the equation and try to find a nice sweet spot where it works brilliantly, for low levels and high ones. 

Bgilisp, there is nothing wrong with dealing 5 digit damage to a rat late game, it probably won't happen in mine though. I like dealing in smaller stats, 25 starting HP for example, I find starting out with the main character's HP in the hundreds to be off putting. I like each individual stat point to matter, 4 defense protects you twice as much as two. In my game, there are some level ups where you don't gain any defense or magic defense. There are some expensive stat boosting items that give you an extra point in the stat (except for HP and MP of course, HP gives 5, MP gives 10). But since each offensive and defensive point matters so much, and level ups give you so little, they're definitely worth the cost.

Sorry for getting off track, the spreadsheet idea sounds great, but I've never worked a spreadsheet program before. 

TEST SLIME BATTLE.PNG

TEST SLIME.PNG
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
You either came up with a bad formula, or you came up with a good formula but forgot order of operations.

"a.atk * 4 / b.def + 10" will multiply a.atk by 4, then divide the result by b.def (which is why 1 point does nothing and 2 halves it.  30 defense would divide it by 30!).  Then it adds a flat 10 points of damage before calculating variance.

If you change it to "a.atk * 4 / (b.def + 10)" (note the parentheses), you will have a much better formula.  Now raising defense from, say, 1 to 2, will reduce damage by a little less than 10%.  Raising it from 30 to 40 will reduce damage by 25%.  You have a lot more flexibility in how you scale stats without throwing the balance too far off.

I use a very similar formula for most skills in my game: "a.atk * s / (b.def + 10)", where s is the Spell Power I've designated for the spell (usually between 10 and 40).  It has worked beautifully and made it easier than most other systems to control battle balance without knowing how powerful a character will be at a given time.  In general, I've found the best balance with relatively low HP numbers (three digits), moderate ATK/MAG numbers (30-80), and low DEF/MDF numbers (5-30).  You can comfortably scale these numbers as high or low as you want since there is no base value to compensate for, but you just need to find the right speed at which to scale each stat.
 

TheRiotInside

Extra Ordinaire
Veteran
Joined
Sep 3, 2012
Messages
270
Reaction score
123
First Language
English
Primarily Uses
I find throwing in some kind of ratio really helps to keep the numbers from getting too messy. I haven't quite figured out the perfect formula for me when there is no base damage (like the Attack stat or Spell Power in RMXP), but with Ace, a fairly friendly starting point I found was this:

a.atk * a.atk / b.def

It's basically your attack squared divided by your target's defense if you simplify the equation, but I left it like that to visualize what's really going on. Your attack stat is multiplied by the ratio of attack to defense. So if you have 20 attack against 20 defense, you'll deal 20 damage. If your attack is double the target's defense, you deal double your attack stat. If your attack is half of the target's defense, you deal half of your attack stat. It's a nice way to make balancing easier, as it's basically impossible to get zeroes (barring some ridiculous stat differences that shouldn't pop up anyway).

Say you're late in the game and fight a weak monster:

a.atk = 500

b.def = 50

500 * 500 / 50 --> 500 * 10 = 5,000

Or the flipside:

a.atk = 50

b.def = 500

50 * 50 / 500 --> 50 * 0.1 = 5

As you can see, even with horrendous stat imbalances, you still deal reasonable damage amounts. I haven't really found anything else that is mathematically as forgiving as this simple formula over such a wide range of numbers.

EDIT: It's basically equal or superior to the popular 2 * a.atk - b.def in every way. I can elaborate if necessary. :)
 
Last edited by a moderator:

Darkfire1408

Novice
Veteran
Joined
Jan 7, 2015
Messages
33
Reaction score
4
First Language
English
Primarily Uses
I find throwing in some kind of ratio really helps to keep the numbers from getting too messy. I haven't quite figured out the perfect formula for me when there is no base damage (like the Attack stat or Spell Power in RMXP), but with Ace, a fairly friendly starting point I found was this:

a.atk * a.atk / b.def

It's basically your attack squared divided by your target's defense if you simplify the equation, but I left it like that to visualize what's really going on. Your attack stat is multiplied by the ratio of attack to defense. So if you have 20 attack against 20 defense, you'll deal 20 damage. If your attack is double the target's defense, you deal double your attack stat. If your attack is half of the target's defense, you deal half of your attack stat. It's a nice way to make balancing easier, as it's basically impossible to get zeroes (barring some ridiculous stat differences that shouldn't pop up anyway).

Say you're late in the game and fight a weak monster:

a.atk = 500

b.def = 50

500 * 500 / 50 --> 500 * 10 = 5,000

Or the flipside:

a.atk = 50

b.def = 500

50 * 50 / 500 --> 50 * 0.1 = 5

As you can see, even with horrendous stat imbalances, you still deal reasonable damage amounts. I haven't really found anything else that is mathematically as forgiving as this simple formula over such a wide range of numbers.

EDIT: It's basically equal or superior to the popular 2 * a.atk - b.def in every way. I can elaborate if necessary. :)
This.

This is, by far, the freaking best basic damage equation I've seen. Ever. It is so adjustable. I can't believe I didn't even think of multiplying attack by itself.

Kudos man, kudos.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c

Forum statistics

Threads
105,857
Messages
1,017,018
Members
137,563
Latest member
MinyakaAeon
Top