0

I would really like for this thread to discuss all aspects of "RPG math" i.e.(Attack, Magic, Defense, Magic Defense, Agility, etc...)

So lets start off with Attacking. I am going to dismiss what the targets defense stats are and just think about raw attack power. So what are the elements of an attack? The elements I can think of would be strength, weapon, accuracy and skill. I believe the better your skill is with a particular weapon the more accurate you can be. So that is where it gets tricky for me. I've been able to come up with this:

(STRENGTH + WEAPON) * ACCURACY = ATTACK_POWER

To shorten things

(s + w) * a = x

But when you throw in skill to the mix I can't figure out where to add it in the algorithm.

6
Contributors
21
Replies
24
Views
9 Years
Discussion Span
Last Post by SlayingSoul
0

>The elements I can think of would be strength, weapon, accuracy and skill.
I would split those up. Instead of lumping accuracy and skill into an attack, accuracy and skill would apply to a chance-to-hit calculation that gives you a percentage. If your random roll falls within that percentage, then you can move on to damage calculations using strength and weapon. That results in less work on a miss or block, and also saves you from overcomplicated single formulas.

0

That does make since for accuracy calculations to be executed first before damage is even considered.

0

I would really like for this thread to discuss all aspects of "RPG math" i.e.(Attack, Magic, Defense, Magic Defense, Agility, etc...)

So lets start off with Attacking. I am going to dismiss what the targets defense stats are and just think about raw attack power. So what are the elements of an attack? The elements I can think of would be strength, weapon, accuracy and skill. I believe the better your skill is with a particular weapon the more accurate you can be. So that is where it gets tricky for me. I've been able to come up with this:

(STRENGTH + WEAPON) * ACCURACY = ATTACK_POWER

To shorten things

(s + w) * a = x

But when you throw in skill to the mix I can't figure out where to add it in the algorithm.

Since you're working with on a veido game, I would put it something like this.

if (ATTACK_TYPE != ATTACK)
{
     if (ATTACK_TYPE == MAGIC)
     {
          M + SBP = ATTACK_POWER;
          ATTACK_POWER - MAGIC_DEFENSE = DAMAGE;
          echo (DAMAGE);
          return();
     }
     else if (ATTACK_TYPE == SKILL)
     {
          S + SKBP = ATTACK_POWER;
          ATTACK_POWER - DEFENSE = DAMAGE;
          echo(DAMAGE);
          return();
     }
     else if (ATTACK_TYPE == ITEM)
     {
          IDMG - RESISTANCE = DAMAGE;
          echo(DAMAGE);
          return();
     }
}
else
{
     if (ACCURACY > TARGET_EVADE)
     {
          S + WBP = ATTACK_POWER;
          ATTACK_POWER - DEFENSE = DAMAGE;
          echo(DAMAGE);
          return();
     }
     else
     {
          echo('Miss');
          return();
     }
}

##NOTES##
M = Magic stat
SBP = Spell base power
S = Strength stat
SKBP = Skill base power
IDMG = Item damage
##END NOTES##


Of course, you'll have to figure out everything else out on your own. I was just hoping to help you get a basic idea.

Good luck, man (^_^)

0

can i have some sample of that game when u finish to create that

I'm sorry man, but using other people's work in something that you're creating isn't cool. Granted, if you use something like phpBB in a CMS as a module, that's open source software and you can do that. I personally wouldn't use someone else's algorithms in something that I'm working on.

I think that you can create something entirely original and have it be awesome in your own way. Remember that the game that you're creating is yours to do what you want with. That's why you should come up with it all on your own.

If you want any help with it, then that's fine. But I don't think that asking to use someone else's work is a very good decision.

That's just my opinion, but I think that every video game programmer has it in them to create everything on their own (even the graphics if you have that knowledge).

I hope for the best in what you're working on. If you need any help, just ask and I or any of the other members will do what we can to help you out.

Good luck on what you're making (^_^)

0

ok ok ok but im a game fanatic and i don't have any
idea on making a game espcially rpg.. and can i ask what is your job???

anyone who what to give me a game just a simple so i will study that tnx

0

ok ok ok but im a game fanatic and i don't have any
idea on making a game espcially rpg.. and can i ask what is your job???

anyone who what to give me a game just a simple so i will study that tnx

I'm a freelance web designer that's majoring in game and simulation programming at DeVry University. I'll be starting college on March 3rd.

I had previously went to college at Utica School of Commerce (located in NY state) where I majored in computer programming and networking. I dropped out of USC because I was working at Turning Stone Casino & Resort as a cage cashier, seven days a week, up to 16 hours a day. I got injured at work, and while I was on worker's compensation, Turning Stone replaced me and is not willing to give me back my job. I didn't have the time to go to class... so I dropped out in my third semester.

0

>I'm sorry man, but using other people's work in something that you're creating isn't cool.
Good programmers write good code; great programmers steal great code. ;)

0

>I'm sorry man, but using other people's work in something that you're creating isn't cool.
Good programmers write good code; great programmers steal great code. ;)

Everyone's entitled to their own opinion, I don't think that stealing code makes you a great programmer. Being great takes effort, and stealing code doesn't show effort. It shows that you're lazy.

That's my opinion, and just as you're entitled to yours, I'm entitled to mine. That is all that I have to say on that subject.

(^_^)

0

@ Suetan: it really depends what you call 'stealing', there are some great algorithms out there that exist in or out of code, implementing a given algorithm isn't 'stealing' it, unless it's patented, or otherwise legally restricted; linking against a library of 'great algorithms' is something that many programmers do once or twice an hour. Everytime you use multiplication, you're kinda 'stealing' the algorithm for fast floating-point multiplication in binary.. unless, you do infact rewrite that yourself... that's a silly example, of course, and I guess, it depends on the complexity of what you're doing - but personally, I'll happily at the very least study prior work before jumping in with the long guns.. Everyone ( and thus every programmer ) has their own strong area(s), and you can certainly get more work done if you allow other people to help you in those weaker areas, via algorithms and code examples.

With regard to actually copy-pasting the ( e.g. C++ ) code for a given algorithm.. hey, it certainly takes 'effort' and knowledge to integrate that with an existing codebase, sometimes more effort and knowledge than reading a non-code formal description of the same algorithm and implementing it from scratch. IMHO, you can't make a good ( non-trivial ) program by 'glueing' bits of other people's unrelated programs together, unless you really know what you're doing in the first place.

0

You bring up a good point. People do use code that's already written to learn. I can understand that fully.

It's like me using phpBB to learn how to do PHP scripting. I'm not saying that it's bad to go and use code to learn. However; if you already know the language, have experience working with it, and you still take code from others and implement it into your code, that part is still not your creation.

You can use it as an example and base your work off of it, but don't go and take what someone else did and put it in your work and take the credit.

That's all I'm saying. It's morals, pure and simple.

Perhaps the word "stealing" shouldn't be used so loosely.

0

>Perhaps the word "stealing" shouldn't be used so loosely.
Perhaps you should chill out a bit. That tongue-in-cheek quote hardly means what you seem to have gotten out of it.

0

PHP itself is a classic example - everytime you write a PHP 'program', you're relying on many developers prior effort to create that big, unsightly ( but admitadly useful ) bag-of-functions that is PHP. Way off topic for the games forum anyway.

Nearly every commercial game these days uses a mega library / engine for all but the highest level areas of code.. As a more appropriate e.g.: very few people try to pass off the OpenGL library as their own work ( except the developers of a given implementation of OpenGL ), but that doesn't mean you can't write a program that uses OpenGL and call that program 'your own', and using OpenGL doesn't make a program, or a programmer less 'good'. At least I hope it doesn't, because personally, I'm glad that I don't have to write a renderer everytime I need to do some 3D work.

Still.. I guess it's subjective.. but in this case, I don't even get the impression that technogeek_42 wants to rip off anyone's code as his/her own. If people are willing to offer technogeek_42 some libraries and/or code, that's their prerogative, if technogeek_42 then goes off and makes 'the best game ever' with what he/she is given - good for him/her.

0

Still.. I guess it's subjective.. but in this case, I don't even get the impression that technogeek_42 wants to rip off anyone's code as his/her own. If people are willing to offer technogeek_42 some libraries and/or code, that's their prerogative, if technogeek_42 then goes off and makes 'the best game ever' with what he/she is given - good for him/her.

Agreed. Now let's get back on topic. I'm not going to follow up on the stealing code thing any more. If it helps you out, it helps you out.

0

ATTACK_POWER - DEFENSE = DAMAGE;
(^_^)

i think ur wrong here i have isuggestiong why don't diz attack power will be magic power coz man is for woman and dog is for dog and magic attack is for magic defense

0
if (ATTACK_TYPE != ATTACK)
{
     if (ATTACK_TYPE == MAGIC)
     {
          M + SBP = ATTACK_POWER;
          ATTACK_POWER - MAGIC_DEFENSE = DAMAGE;
          echo (DAMAGE);
          return();
     }
     else if (ATTACK_TYPE == SKILL)
     {
          S + SKBP = ATTACK_POWER;
          ATTACK_POWER - DEFENSE = DAMAGE;
          echo(DAMAGE);
          return();
     }
     else if (ATTACK_TYPE == ITEM)
     {
          IDMG - RESISTANCE = DAMAGE;
          echo(DAMAGE);
          return();
     }
}
else
{
     if (ACCURACY > TARGET_EVADE)
     {
          S + WBP = ATTACK_POWER;
          ATTACK_POWER - DEFENSE = DAMAGE;
          echo(DAMAGE);
          return();
     }
     else
     {
          echo('Miss');
          return();
     }
}

If you look at the code example, the part that you quoted is for a standard attack.

If then Else statements help for determining what type of attack you're doing. A more notable method might be to do a switch statement. I just came up with something quick and simple.

0

hehehe just kidding

if (ATTACK_TYPE != ATTACK)
{
     if (ATTACK_TYPE == MAGIC)
     {
          M + SBP = ATTACK_POWER;
         magic_POWER - MAGIC_DEFENSE = DAMAGE;
          echo (DAMAGE);
          return();
     }
     else if (ATTACK_TYPE == SKILL)
     {
          S + SKBP = ATTACK_POWER;
          ATTACK_POWER - DEFENSE = DAMAGE;
          echo(DAMAGE);
          return();
     }
     else if (ATTACK_TYPE == ITEM)
     {
          IDMG - RESISTANCE = DAMAGE;
          echo(DAMAGE);
          return();
     }
}
else
{
     if (ACCURACY > TARGET_EVADE)
     {
          S + WBP = ATTACK_POWER;
          ATTACK_POWER - DEFENSE = DAMAGE;
          echo(DAMAGE);
          return();
     }
     else
     {
          echo('Miss');
          return();
     }
}

Edited by Nick Evan: Fixed formatting

0

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... :P

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.