| | |
RPG Battle Algorithms
Please support our Game Development advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: May 2009
Posts: 7
Reputation:
Solved Threads: 0
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
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
![]() |
Other Threads in the Game Development Forum
- Previous Thread: OpenGL - Transformation matrix
- Next Thread: OpenGL - Problems with zoom in/zoom out
| Thread Tools | Search this Thread |
Tag cloud for Game Development
3d advertising ai algorithm ban c++ cambridge camera censorship china competition console development engine fov fpx game gamedevelopment gameprogramming gamer games gaming gauntanamo government graphics idaho in-gameadvertisement intel intellectualproperty l-systems laracroft larrabee lindenmayer live manhunt math mathematics matrix mercenaries microsoft mmorpg modded msn multicore naked news nintendo obama opengl palin physics pirate playstation politics processor projection ps3 rpg search selection software sony stephenhawking stocks studio technology terrorism tombraider uk videogame web wii world-of-warcraft xbox xbox-live xbox360





