Coming Up With Stat Rations In An RPG

Started by
10 comments, last by Crazyfool 17 years, 7 months ago
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?
Originality is dead.
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);};
Originality is dead.
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.

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?
Originality is dead.
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;}
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.
My Blog
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.

Originality is dead.
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.
Originality is dead.
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.
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.
My Blog

This topic is closed to new replies.

Advertisement