Jump to content
  • Advertisement
Sign in to follow this  

Coming Up With Stat Rations In An RPG

This topic is 4260 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

After completing my tic-tac-toe thingy, I've decided to go back and try to redo my text-based RPG. One of the problems was that I had no idea what I'm doing in regards to stat ratios (what is going to be the starting/max HP? How does leveling up increase each stat? How does experience relate to enemies, and level ups to that matter?) I sat down today and tried to figure something out..but I just don't really know where to start. Do you guys have any tips on that, or maybe some articles or tutorials or something?

Share this post


Link to post
Share on other sites
Advertisement
Also if you guys could help me out with a little issue I'm having with my Player class, where I don't exactly know how the hell I'm going to implement magic and special attacks. The way I have it now is pretty straight forward.


enum playerstatus {normal, venom, beserk, weak};

class Player
{
private:
int HP, MP, str, def, acc, mpow, mdef, level, exp;
playerstatus pstatus;
Player * player2, player3, player4;

public:
~Player();
~Player(char * filename); // TO BE USED LATER

int GetHP() {return HP;}
int GetMP() {return MP;}
int GetStrength() {return str;}
int GetDefense() {return def;}
int GetAccuracy(){return acc;}
int GetMPower() {return mpow;}
int GetMDefense(){return mdef;}
int GetLevel() {return level;}
int GetExp() {return exp;}
playerstatus GetPlayerStatus() {return playerstatus;}
Player * GetPlayer2() {return player2;}
Player * GetPlayer3() {return player3;}
Player * GetPlayer4() {return player4;}

void SetHP(int newHP) {HP = newHP; return void;}
void SetMP(int newMP) {MP = newMP; return void;}
void SetStrength(int newstr) {str = newstr; return void;}
void SetDefense(int newdef) {def = newdef; return void;}
void SetAccuracy(int newacc) {acc = newacc; return void;}
void SetMPower(int newmpower) {mpow = newmpow; return void;}
void SetMDefense(int newmdefense) {mdef= newmdef; return void;}
void SetLevel(int newlevel) {level = newlevel; return void;}
void SetExp(int newexp) {exp = newexp; return void;}
void SetPlayerStatus(playerstatus newpstatus) {pstats = newnewpstatus; return void;}
void SetPlayer2(Player * newplayer2) {player2 = newplayer2; return void;}
void SetPlayer3(Player * newplayer3) {player3= newplayer3; return void;}
void SetPlayer4(Player * newplayer4) {player4 = newplayer4; return void;}

bool Attack(Player & enemy);
void EndBattle(void);
};

Share this post


Link to post
Share on other sites
Most of it is entirely up to you and some tuning. Do you like big numbers or small?

For the magic and special attacks you have to be more specific on how you want it.

Treat MP as magic points, let's say. Now I make a seperate class for Spells that have the values I need to work with such as cost, cooldown, target, value, etc. When a player casts a spell, the cost needs to be compared to the player's MP and if they have enough, subtract it and perform the spell.

Share this post


Link to post
Share on other sites
Quote:
Original post by Crazyfool
Most of it is entirely up to you and some tuning. Do you like big numbers or small?

For the magic and special attacks you have to be more specific on how you want it.

Treat MP as magic points, let's say. Now I make a seperate class for Spells that have the values I need to work with such as cost, cooldown, target, value, etc. When a player casts a spell, the cost needs to be compared to the player's MP and if they have enough, subtract it and perform the spell.


Well I prefer bigger numbers, but it's not the size that's the issue, it's getting all the ratios to work well.

For the magic and special attacks, I guess I could create a struct or class or something then feed it to my player class, but then how would I keep track of which spells a player has?

Share this post


Link to post
Share on other sites
There is no magic ratio, it is up to you to find that for your game.

I am a big fan of classes, so I have many classes representing things.

For instance, I have a Character class that has several classes within it such as Identity (name, race, gender, age, bio, art files), Attributes (the health, armor, mana, resists, etc), Reputation, etc etc etc.

Then I also have a class for Spells. The player itself has an array of, say.. 20 spells.

So.. objSpell SpellList[20]; would be one way to go about.. then let's say you make an option during combat sequence where they can either:

1) Attack
2) Cast a Spell
3) Use Item
4) Flee!

And the choose 2, and they get a list of spells they want to use, and they choose.. let's say.. Fireball. Let's say Fireball is spell #4 for your array so you will have a function that is something like..

bool CastSpell(objSpell _spell)
{
if(myHero.Attributes.Mana >= _spell.cost)
{
myHero.Attributes.Mana -= _spell.cost;
//perform spell stuff

return true;
}

return false;
}

Share this post


Link to post
Share on other sites
Player * player2, player3, player4;

May I ask why you have this in the Player class?

Also I think this line does not do what you think it does, it initiates one Player type pointer and two Player object, not three pointers.

Share this post


Link to post
Share on other sites
Quote:
Original post by kiome
Player * player2, player3, player4;

May I ask why you have this in the Player class?

Also I think this line does not do what you think it does, it initiates one Player type pointer and two Player object, not three pointers.


Well..thanks for pointing that syntax error out. I'm using the pointers to point to the other players in the party for various functions. The first time I attempted this RPG, I used an array, and I think this is more effective.

Share this post


Link to post
Share on other sites
Quote:
Original post by Crazyfool
There is no magic ratio, it is up to you to find that for your game.

I am a big fan of classes, so I have many classes representing things.

For instance, I have a Character class that has several classes within it such as Identity (name, race, gender, age, bio, art files), Attributes (the health, armor, mana, resists, etc), Reputation, etc etc etc.

Then I also have a class for Spells. The player itself has an array of, say.. 20 spells.

So.. objSpell SpellList[20]; would be one way to go about.. then let's say you make an option during combat sequence where they can either:

1) Attack
2) Cast a Spell
3) Use Item
4) Flee!

And the choose 2, and they get a list of spells they want to use, and they choose.. let's say.. Fireball. Let's say Fireball is spell #4 for your array so you will have a function that is something like..

bool CastSpell(objSpell _spell)
{
if(myHero.Attributes.Mana >= _spell.cost)
{
myHero.Attributes.Mana -= _spell.cost;
//perform spell stuff

return true;
}

return false;
}


Hmm...well you'd think there'd be something on this, seeing as (at least for me) it's pretty difficult to figure out. I think I can figure out the spell stuff with what you've given me, but the ratios is what's getting me.

Share this post


Link to post
Share on other sites
Two comments I have.

Quote:
~Player(char * filename); // TO BE USED LATER


I certainly hope you don't intend to use this later. Every class has exactly one destructor. It takes no arguments and returns nothing. This isn't a valid method for any class.

Second, I would recommend making a Party class and make it in control of all of the party members. Each Player shouldn't inherently know about the other members of the party, and besides, you don't want to keep the party size fixed to a certain number. Use std::vector to help take care of that.

Share this post


Link to post
Share on other sites
Just make sure to add the * infront of all three object pointers.

If your game is limited to 4 players and you really need to have object global connection to them, I guess it's ok to do it that way.

But I would still prefer what Rainault mentioned (vector) and try to build every aspect of your game dynamically but without overengineering it.
That way you could reuse parts of the code for later games with minor modifications.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!