Author Topic: RPG Battle formulas  (Read 2861 times)

Offline Hark0

  • Prof. Inline
  • *****
  • Posts: 1020
  • Geek Developer
    • View Profile
    • LitioPixel - Desarrollo de videojuegos con GLBasic | Videogame development with GLBasic
RPG Battle formulas
« on: 2013-Jun-01 »
Hi!

Any have worked on RPG Battle formulas?

Im currently testing some equilibrated formulas using only this kind of variables:

Attack: value 0-99
Defense: value 0-99
Speed: value 0/1. hero/enemy first attack
Luck: random % for hero win

Any help are welcome... ;D
http://litiopixel.blogspot.com
litiopixel.blogspot.com - Desarrollo videojuegos Indie · Pixel-Art · Retroinformática · Electrónica Development Indie Videogames · Pixel-Art · Retrocomputing · Electronic

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4159
  • On the shoulders of giants.
    • View Profile
    • My Apps
Re: RPG Battle formulas
« Reply #1 on: 2013-Jun-01 »
Remember attack and defense values are affected by the current (graded?) weapon and armour types being used by the player/enemy, as well as their own personal skills.

Eg an attack with a dagger may score a hit of 5HP, but an attack with a SuperUltraMegaPolishedSwordOfDoom v3.5 could cause 95HP damage (to enemies with the same defense values). It's not just the attack value of the player.

There are other attributes that you've not taken into account too, including fortitude, intellect, magic etc.

I really look forward to seeing the results of this  :good:
I came. I saw. I played.

Offline Hark0

  • Prof. Inline
  • *****
  • Posts: 1020
  • Geek Developer
    • View Profile
    • LitioPixel - Desarrollo de videojuegos con GLBasic | Videogame development with GLBasic
Re: RPG Battle formulas
« Reply #2 on: 2013-Jun-01 »
Well, I don't want to add any LEVELING system... the idea are an Hero with some variables like:

Atk=a
Def=d
Speed=s
Luck=l

If you have "poor dagger", set Atk+1
If you have "SuperUltraMegaPolishedSwordOfDoom", set Atk+95
If you have "wood shield", set Def+1
If you have "iron shield", set Def+10

Speed are for first strike order...

0- Hero attacks first
1- Enemy attacks first
(maybe I change this with a % value, not 0/1)

Luck= random variable for increase/reduce chance of win.

I think to add some variables for modify Luck, speed (ex. "mega shoes" set Speed +10%).
Another example for modify Luck value, object poison -> set Luck=-20%.


I find some formula for calculate chance of win combat... using SAME values of vars in Hero and Enemy...

...........
Some formulas founded in forums:

Formula dragonquest rpg

I'd use a basic mathematical formula. In Dragonquest for instance, the formula for calculating damage is (the character's attack rating/2) - (the monster's defense rating/4). (Attack/2)-(Defense/4)=damage. As you can see, it's a very rudimentary formula. But if you want to calculate variance and all that into the equation you'd have to come up with something more for yourself.

This is something I came up with for myself a while back. It is an equation using variables.

10 ((AW-D)+(SV)) / 3 = damage
for one-handed weapons, damage x 1.1
for two-handed weapons, damage x 1.5

Where:

A is the Attack Rating of the equipped weapon
W is a variable that is unique to each weapon depending on it's class. Lower class weapons have a 1.1 rating, middle class weapons have a 1.2 rating, and high class weapons have a 1.3 rating
D is the enemy's Defense Rating
S is the character's Strength Rating
V is a variable that rolls between 1 and 1.1 where 1 is the lowest base damage a character can deal and 1.1 is the highest base damage a character can deal.

Of course, with a formula like this, statistics need to have a very low cap for monsters in order to deal significant damage or characters must have a very high growth rate. These things must also be considered when creating an algorithm.

When it comes to accuracy, one must use percentages ALWAYS. Even if they're nonsensical numbers at first, they must be calculated into a percentage at the end of everything. Final Fantasy is one of those games where they use a weird number for accuracy, falling between 1 and 250. What does that have to do with anything? Well it makes sense if they calculate that number against enemy evasion and come up with a percentage at the end.

So try this:

BEFORE you even use damage calculation, after the character in question has just picked the Attack command, something must calculate accuracy to determine whether or not they will even hit their opponent. Keep in mind that the higher the accuracy rating compared to the evasion, the better the chance of hitting. This is crucial when coming up with a formula: you must know what you want before you do so.

In this situation, I would create two equations. One for if the enemy had a higher Evasion Rating than the character's Accuracy Rating and another for if the character's Accuracy Rating is higher than the enemy's Evasion Rating.

If Acc>Eva then:

(A-E)/10 = percentage of a connected strike. If A-E>10 then percentage is capped at 100%

If Eva>Acc then:

|2A-E|/10 = percentage of a connected strike. The | | bars mean absolute value, which is a math term that you can look up but basically, it makes it so that there will never be a negative number in the numerator.

Anyway, I hope this helps you. You can use these formulas if they suit you or even build on them or take away from them. I don't really care.

-----------------formula 2

chance_to_hit = 100 * Base_atk / (base_atk + defender_def) * 2 * Attacker_lvl / (attacker_lvl + defender_lvl)
hit = rand(1,100)
if chance_to_hit>hit then do_that_whole_crazy_check_damage_thing

-----------------formula 3
Damage = (AttackerStreght / DefenderProtection) * (AttackerHP / AttackerMaxHP)
« Last Edit: 2013-Jun-01 by Hark0 »
http://litiopixel.blogspot.com
litiopixel.blogspot.com - Desarrollo videojuegos Indie · Pixel-Art · Retroinformática · Electrónica Development Indie Videogames · Pixel-Art · Retrocomputing · Electronic

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4159
  • On the shoulders of giants.
    • View Profile
    • My Apps
Re: RPG Battle formulas
« Reply #3 on: 2013-Jun-01 »
Of course, that works too :P

It all depends on how complex you want your game to be. :)
I came. I saw. I played.

Offline spicypixel

  • Prof. Inline
  • *****
  • Posts: 646
  • Pixel Artist
    • View Profile
    • SpicyPixel.net
Re: RPG Battle formulas
« Reply #4 on: 2013-Jun-01 »
Another thing to consider is if you're being attacked by two or more people for example a successful attack from one may be 3 and logically from two people would be 6 but realistically, if two people attacked you the damage would be greater the same as the ability to defend would be weaker than just adding two together also, but again it depends on how intricate you want it to be, like Ian said I'd be interested to see what works for you variable-wise when you get to test the logic and see the results even if just numerical.

PS: What is HP? Hit Points?
« Last Edit: 2013-Jun-01 by spicypixel »
http://www.spicypixel.net | http://www.facebook.com/SpicyPixel.NET

Comps Owned - ZX.81, ZX.48K, ZX.128K+2, Vic20, C64, Atari-ST, A500.600.1200, PC, Apple Mini-Mac.