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

Dravidian Kayne

Need formula to calculate HP,MP,etc

Recommended Posts

Does anyone have good formulas to calculate max HP, MP, and such for a RPG? Finding Attack and Defense and what-not is easy, and I''m sure I could come up with some super-difficult formula to get a good number, but was just gonna see if anyone else had simple formulas. My game specs: -Max Level will be around 60 or so -Max HP and MP will both be around 10,000. Thanks Dravidian Kayne~

Share this post

Link to post
Share on other sites
I haven't tested this but I think it comes down to how many HP or MP do you expect the player to go through before they can recharge. I've found that in Final Fantasy like RPGs (and a few others) that combat tends to last long enough for the enemy to get about 2 hits in. If you take into account the frequency of random encounters (and boss encounters) a number should be easy enough to figure out.

((average recieved damage * #combat rounds) * #expected encounters not escaped from between safe points) = damage monsters will inflict on a single character between point a and point b.

But it's only a starting point. Other game elements will come into play when others do not. Maybe you expect the player to use half their MP on healing. Maybe the player doesn't know where the next place to go is. What about poison damage or critical hits?

[edited by - kseh on May 20, 2004 4:25:14 AM]

Share this post

Link to post
Share on other sites
If you're talking about deriving HP from stats ala AD&D, you could always just say that HP is an independant attribute, and modify it directly based on character class. Or, if theres no classes, increase it based on a stat, but if the stat itself can increase, that leads to exponential growth.

Anyways, the formula for that type of thing is easy,
HPIncrease = Constitution * X
HPMaxiumum = HPMaxiumum + HPIncrease

The trick of course if finding X. If you have stats between 3 and 18, with a mean average of 10.5, and over the course of 60 levels you want a total growth of 9999HP:
X = 9999HP / 60Levels / 10.5Constitution
X = 15.8714285714285714285714285714286
... 16.

So, At level 1, the player has 168 HP. At level 2 the player has 336 HP. This is, however, dependant on the fact that the base constituion used in this calculation doesn't change over the course of the game.

As for how much HP the player actually needs, thats a matter of figuring out how much damage the player should be taking.

[edited by - inmate2993 on May 20, 2004 12:17:25 PM]

Share this post

Link to post
Share on other sites
CurrentMaxHp = BaseHP + (MaximumPossibleHP - BaseHP) * CurrentLevel / MaximumPossibleLevel

If you want it dependent on constitution, I suggest
BaseHP = A + Con * B;
MaxHP = C + Con * D;

You said simple... those are all linear equations... take it away

Share this post

Link to post
Share on other sites
Well, my guess is that you want this to work like Final Fantasy games, as in you may have a few hundred to nearly a thousand points in a stat like stamina and strength. This isn''t so bad though, you can still compare it to D&D.

You could say something like the following:

Fighter characters get 30hp + .2hp per point of constitution (or stamina, toughness, etc.) on the first level.

Then they get 10hp + .1hp per point of constitution each subsequent level.

The good thing about this is that if they increase their constitution later somehow, their hp will increase to reflect it.

Do the same for mp, except use another stat like intelligence.

Damage is a bit more complex. You could say that unarmed, a character does (3hp + .1hp per point of strength) * (2 * level /3). Different weapons would simply have different damage ratios.

Then you could say that a character can reduce the damage they take by .1hp per point of defense * 2/3 * level.

Then they would have a random chance to hit, having to get over say 50 to hit. This chance would increase at a rate of .1% per point of attack per level, minus the enemy''s defense *.05% * their level.

Bubba lvl1
Str 150
Con 130
Def 110
Atk 130
Int 70
Spd 100

This would translate to:
HP: 56
MP: 4
Damage: 12
Damage reduction: 7
Chance to hit: 63%

Bubba lvl2

Str 155
Con 135
Def 112
Atk 135
Int 71
Spd 102

So now:
HP: 72
MP: 5 (you may want to make it so that stats must go up by at least 1 per level)
Damage: 25
Damage reduction: 15
Chance to hit: 63.5%

And so on. You''ll need to modify the numbers a bit to get the hp and mp you want, but I think this should be a good frame work.

You know, I might as well go ahead and say I can''t fix the problem... because that''s when I figure out how.

Share this post

Link to post
Share on other sites
Looking for suggestions for the new version of Everquest?

In any case, just try starting with D&D or AD&D formula,s thne modify them, add parameters, etc. until things just feel right. This is a complicated but important part of a game; it''ll take a lot of tweaking.

Share this post

Link to post
Share on other sites
In my most recent RPG I finished I increased HP randomly by a base number dependent on character. Every level increase one of the main characters would at least increase between 1 and 5 hitpoints each level. Another character would increase between 1 and 3 each level. Towards the end of the game I found I got up into Final Fantasy type battle stats that way. I believe at lvl 99 my main character had like 7000+ HP, my mian warrior guy was at 9999 or close, and my sorceress had 4000-5000 hp just to name a few. In my newer engine I tried to base it off stats like Vit. and Str., a calculatation like this HP= (Str. + Vit) * 2 with base stats maxed at 255. This means of course a low HP system type game. Useful if you want your HP stat at 999 end game. Increasing HP by a percentage each lvl. is a good way to go too. Or you could always go level less.

The major thing is if you use any random calculations you'll have to sit and play test the game to make sure bosses are difficult enough or easy enough for whatever lvls you think the player should be at any given time.

"Life is a double edged sword, we always hope to strike though adversity with the shining side..."

jkettles16 of Venosoft

[edited by - jkettles16 on May 20, 2004 2:33:39 PM]

Share this post

Link to post
Share on other sites
It is my personal opinion that random numbers are used too often in RPGs. I wouldn''t increase each stat by a random number. If you do, make the range that it is increased by extremely small.

I am the master of stories.....
If only I could just write them down...

Share this post

Link to post
Share on other sites
How about 100?
And it remains constant during the entire game.

"Fate and Destiny only give you the opportunity the rest you have to do on your own."
Current Design project: Ambitions Slave

Share this post

Link to post
Share on other sites
Actually, there is one unique way to go about it. Create a list of what all of the mean HP values should be for a character/race/class for the course of their level progression.

100, 150, 200, 250, 300, 325, 350, 375, 400 and so on.

Then, at level up, MaxHP = MeanHP[Level] * random( 0.95 , 1.05 );

That way, the HP will be right where you want it with only a superficial difference.

99, 151, 197, 254, 301, 321, 349, 377, 399.

Share this post

Link to post
Share on other sites
There are a lot of good ideas here, but the BEST one is the one that you''d tweak to fit with your game. If you have a lot of stats then it would be a good idea to start with something similar to the D&D equations. If your game only has a few stats then you can use a far simpler equations or a methodology similar to what Inmate2993 suggested. The key thing is to get something that just works and then play-test, play-test, play-test, rinse, repeat.

Share this post

Link to post
Share on other sites
It would be great if people applied some sort of basic mathematical knowledge when making mathematically-based games. What constitutes a ''good formula'' is in the hands of the designer, as it''s absolutely central to how the game plays. I don''t think this is something you can just ask about on a forum. For example, many RPGs feature linear improvement on numerous scales, resulting in exponential improvement. But maybe you don''t want that, because this arrangement tends to make low levels very mortal and high levels nearly immortal. You might want to start the characters off at a fairly high score to begin with and make the growth quite slow. You might want to keep the hit points constant constant throughout and only apply increases to other statistics. And the ratio of hit points at a given level to the amount of damage dealt at a certain level will dictate the deadliness of combat. This all affects the gameplay and is too important in my opinion to treat so simply.

[ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]

Share this post

Link to post
Share on other sites