>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.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
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 (^_^)
Suetan
Junior Poster in Training
76 posts since Feb 2008
Reputation Points: 11
Solved Threads: 5
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 (^_^)
Suetan
Junior Poster in Training
76 posts since Feb 2008
Reputation Points: 11
Solved Threads: 5
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.
Suetan
Junior Poster in Training
76 posts since Feb 2008
Reputation Points: 11
Solved Threads: 5
>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. ;)
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
>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.
(^_^)
Suetan
Junior Poster in Training
76 posts since Feb 2008
Reputation Points: 11
Solved Threads: 5
@ 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.
MattEvans
Veteran Poster
1,386 posts since Jul 2006
Reputation Points: 522
Solved Threads: 64
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.
Suetan
Junior Poster in Training
76 posts since Feb 2008
Reputation Points: 11
Solved Threads: 5
>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.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
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.
MattEvans
Veteran Poster
1,386 posts since Jul 2006
Reputation Points: 522
Solved Threads: 64
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.
Suetan
Junior Poster in Training
76 posts since Feb 2008
Reputation Points: 11
Solved Threads: 5
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.
Suetan
Junior Poster in Training
76 posts since Feb 2008
Reputation Points: 11
Solved Threads: 5
>ur wrong my suggestion is ryt
That's nice. Prove it.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401