RPG Battle Algorithms

Please support our Game Development advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Feb 2008
Posts: 55
Reputation: Suetan is an unknown quantity at this point 
Solved Threads: 4
Suetan Suetan is offline Offline
Junior Poster in Training

Re: RPG Battle Algorithms

 
0
  #21
Feb 18th, 2008
I've already declared the magic power with M + SPB = ATTACK_POWER;

which is basicly

magic_stat + spell_base_power = ATTACK_POWER

Ok... you guys just like messing with me, since I have a habit of being defensive... I'll have to stop doing that...
Last edited by Suetan; Feb 18th, 2008 at 12:21 am.
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 7
Reputation: SlayingSoul is an unknown quantity at this point 
Solved Threads: 0
SlayingSoul SlayingSoul is offline Offline
Newbie Poster

Re: RPG Battle Algorithms

 
0
  #22
May 18th, 2009
Attack Power:

Assuming that there's a strength value assigned to the currently equipped weapon and a strength value assigned to the character himself, an overall attack power rating should be found once the option to physically attack the target has been confirmed by the player:

overall_strength=weapon_strength+player_strength

The same should be done to deduce the target's overall defense:

enemy_overall_defense=enemy_armor_defense+enemy_defense

So, to get the damage to be dealt by the player's physical attack, the target's overall defense should be taken away from the character's overall strength to get the result. However, this can usually end up with messy values, so adding a certain amount depending on the player's skill with the weapon, or just a small amount of damage by the player's current level makes it more interesting:

damage_dealt=(overall_strength+(accuracy*player_level))-enemy_overall_defense

OR

damage_dealt=(overall_strength+(weapon_skill_level*player_luck<OR PLAYER LEVEL/STRENGTH>))-enemy_overall_defense

Of course, now that damage dealt is deduced, even if you were to run the algorithm again for every hit, it would come up with the same amount of damage being dealt to the target every hit, which can grow boring and predictable. To remedy this, a small, certain amount of damage(how large or small this damage modifier is can be either a random amount between two set values, a small amount multiplied by the player's level or any other method of deduction is up to you, although I prefer to use a small amount multiplied by the player's level as this way it starts out small so as not to give the player a huge attack by mistake and instead allows it to increase bit-by-bit as the player's level increases) is either added or subtracted to the damage dealt.

damage_dealt=damage_dealt+(player_level*random_damage_amount)

Now that the amount of damage to be dealt is worked out, other values come into play, such as the player's accuracy determining how likely he is to hit the target, depending on the target's agility, dexterity etc. working as negative impacts. I'm currently working on my own RPG game, so I won't reveal -all- of my algorithms, but at least there's a small bit of the attack algorithm for you. Enjoy, if you found it at all helpful,

SS
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Game Development Forum
Thread Tools Search this Thread



Tag cloud for Game Development
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC