| | |
RPG Battle Algorithms
Please support our Game Development advertiser: Programming Forums - DaniWeb Sister Site
![]() |
@ 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.
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.
Plato forgot the nullahedron..
•
•
Join Date: Feb 2008
Posts: 55
Reputation:
Solved Threads: 4
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.
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.
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.
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.
Plato forgot the nullahedron..
•
•
Join Date: Feb 2008
Posts: 55
Reputation:
Solved Threads: 4
•
•
•
•
Originally Posted by MattEvans
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.
•
•
Join Date: Feb 2008
Posts: 55
Reputation:
Solved Threads: 4
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.
Last edited by Suetan; Feb 6th, 2008 at 10:28 pm. Reason: corrected grammer
hehehe just kidding
f (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();
}
}
f (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();
}
}
╞═══════╣SPYnX███
![]() |
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






