Archived

This topic is now archived and is closed to further replies.

TheNerd Tk421

A battle "engine"

Recommended Posts

TheNerd Tk421    122
I was trying to make an RPG...an i want to make a battle "engine"(basicly C++ header files) for battle... it calculates HP, weapon damage.. monster HP, monster weapon damage... armor... stuff like that.. how would i do this?

Share this post


Link to post
Share on other sites
guppy    330
[Rant about people who can''t be bothered to learn coding and wants every thing handed to them]

Try somthing like this:
in ActorObject:

ActorObject.Strike( *ActorObject player )
{
die d20 = new die(20);
if ( this->Atack("Long Sword") + d20 >= player->getArmorClass("Slashing") )
{
die d8 = new die(8);
player->doDamage(this->getStrength() + d8);
}
}

or what ever....




/Please excuse my bad spelling - My native language is binary not english
|Visit me
\Take my advice - I don''''t use it...

Share this post


Link to post
Share on other sites
MTT    265
WEll you can see the VERY start of mine in a that post of mine. too bad it doesnt work HAHA burn, but mostly to me What i have is mostly just loading the ascii graphics and letting you move your cursor, i havent even really got to the battle part. Its about 4 lines of actual battle code.

__________________________________________________________________________________________
"yuo have it all wrong. admiralbiunary is me not the other way reorubnd poppet. just becuase hea was here first doesnt meean hes any mopre valid than me yuo rassit pigf." YodaTheCoda

Share this post


Link to post
Share on other sites
PhiberOptic    128
There is a really good solution to this problem!

Look in "AI Game Programming Wisdom" or "Game Programming Gems" for an article by Steve Rabin. It''s called "A robust generic AI engine" or something in "Game Programming Gems".

I don''t think it''s avalible on the net. However, if you can''t find the book at a library or something, search for "finite state machines" or "FSM"..

----------------------------------------------
Petter Nordlander

"There are only 10 kinds of people in the world. The who understand binary and those who don''t"

Share this post


Link to post
Share on other sites
Squalion    122
Well, I''m gonna be doing the same soon, and I can think of a few things it''ll need.

Either ATB or Turn-based combat system (calculates who''s turn it is etc)
Stat system to alter the player/enemy HP/MP etc, depending on things like attacks, spells, poison etc.
Something to manage animation of characters/enemies based on moves etc

Share this post


Link to post
Share on other sites
Penance    190
Discouraging comments:

I''d hold off on anything involding "RPG" or "engine" until you figure out what header files are

A battle system is a pretty complex task. It would involve almost every class related to your player, including his weapon object, armor object, stats. You''d need a timer, the enemy class, the enemy AI, the enemy''s weapon/armor objects, magic classes, death mechanics. And that''s all before you can concentrate on the battle system itself...how battles start and end, determining what enemies are in the battle (if it''s a final fantasy type encounter system), etc etc.

Start small!

Share this post


Link to post
Share on other sites
SoulSkorpion    238
quote:
Original post by TheNerd Tk421
I was trying to make an RPG...an i want to make a battle "engine"(basicly C++ header files) for battle... it calculates HP, weapon damage.. monster HP, monster weapon damage... armor... stuff like that.. how would i do this?


You''re kidding, right? Look, I realise you''re new but... god you''re naive if you believe there''s a short answer to this question.

Share this post


Link to post
Share on other sites
GamerSg    378
Something that i am also currently working on. All i can say is that it''s not something that is going to be done overnight.

I expect it to take atleast 50hrs of programming to reach a playable state. This is after i have done most of the basic game engine which supports static/animated meshes, and other things which need to be reused in the battle engine.

Some pointers though.

You would need some sort of menu to control the choices the user makes.

The menu should have access to the player Object which contains inventory info, spells info, hp, mp and other attributes of the player.

The menu alone should take a considerable amount of time since u would need to get all that info onto the menu space when it is accessed.

Then u would need atleast a monster object. The monster would have a number of attacks which it can perform at random.

You would need to get into math to find out how the character is going to move in the direction of the monster to reach the monster.

Handling animations.
Handling dmg done, char lvl, exp, items, etc..

Probably millions of other things which i cant think of right now. No easy task, and its going to take a considerable amount of planning.

Share this post


Link to post
Share on other sites
TheNerd Tk421    122
Ok... i really dont want to base my stuff of D20 system.. TOO MUCH if i do that.. i can simply set everything the same(1d6) and play from there... it will be my D6 sytem.. i will call it ..Wannabe Wizards..i know this will be very lon to make the system.. and yes it will be turn based.. and i will have a type of initiative system.. i want it to be a very very simple D&D.. ive been playin D&D for a while and wanted to make my own rpg...i dont want(for now) ne graphics.. i just have a character(letter C) that moves around on a simple grid based system..
menu will be :

#include <iostream>
#include <cstdlib>
#include <string>
void run(void)
{
cout<<"you run away"<<endl;
return map;
}

void fight(void)
{
cout<<"you stay and fight"<<endl;
//fight sequence

}

int main(void){
int except;
cout<<"1 = fight, 2 = run"<<endl;
cin>>except

if(except == 1)
{
fight();
}

else if(except == 2)
{
run();
}

else
{
cout<<"I said answer with 1,2"<<endl;
cout<<"1 = fight, 2 = run"<<endl;
cin>>except

if(except == 1)
{
fight();
}

else if(except == 2)
{
run();
}

else
{
cout<<"I said answer with 1,2"<<endl;
}
}

system("PAUSE");
return 0;
}

Very roughly like that




[edited by - TheNerd Tk421 on August 11, 2003 5:43:06 PM]

Share this post


Link to post
Share on other sites
RuntimeFailure    122
quote:
Original post by TheNerd Tk421
Ok... i really dont want to base my stuff of D20 system.. TOO MUCH if i do that.. i can simply set everything the same(1d6) and play from there... it will be my D6 sytem.. i will call it ..Wannabe Wizards..i know this will be very lon to make the system.. and yes it will be turn based.. and i will have a type of initiative system.. i want it to be a very very simple D&D.. ive been playin D&D for a while and wanted to make my own rpg...i dont want(for now) ne graphics.. i just have a character(letter C) that moves around on a simple grid based system..
menu will be :

#include <iostream>
#include <cstdlib>
#include <string>
void run(void)
{
cout<<"you run away"<<endl;
return map;
}

void fight(void)
{
cout<<"you stay and fight"<<endl;
//fight sequence

}

int main(void){
int except;
cout<<"1 = fight, 2 = run"<<endl;
cin>>except

if(except == 1)
{
fight();
}

else if(except == 2)
{
run();
}

else
{
cout<<"I said answer with 1,2"<<endl;
cout<<"1 = fight, 2 = run"<<endl;
cin>>except

if(except == 1)
{
fight();
}

else if(except == 2)
{
run();
}

else
{
cout<<"I said answer with 1,2"<<endl;
}
}

system("PAUSE");
return 0;
}

Very roughly like that




[edited by - TheNerd Tk421 on August 11, 2003 5:43:06 PM]


Share this post


Link to post
Share on other sites