ZFGC

Resources => Coding => Topic started by: King Tetiro on January 14, 2012, 03:08:13 pm

Title: [Maths] Gaining EXP Formula
Post by: King Tetiro on January 14, 2012, 03:08:13 pm
Howdy folks, Tetiro here. I need some help with a maths formula and seeing as this is a Programming and Maths sub-forum, I thought this is the best place to gain help on this.

I've recently been working on the programming side of my team's Turn Based RPG for the Android/iPhone devices. And I've gotten stuck on Experience.

I have this formula for the EXP curve.

Quote
ROUND( 10  * ( 1.1  ^  n  ) )
Red = The Experience required at Level 1
Blue = The Percentage increase every time the player levels up
Green = The Current level

Now the formula works but now I'm working on the formula to determine the amount of EXP the player gains when they defeat an enemy. Now the problem is my formulas are too much of an overkill or they barely give any EXP at all.

I was wondering if I could get some help working out a formula? I'm going to be working on this as well. Here's some things about the gameplay that could affect the EXP formula. I think.

Title: Re: [Maths] Gaining EXP Formula
Post by: Zaeranos on January 14, 2012, 07:14:09 pm
It is a bit difficult without the full details of what is involved in battle. And whether each warrior has its own stats in level and experience or that the level and stats belong to the player.

Assuming that the stat belong to the player:
Code: [Select]
// base_gain: The base value of experience gain from the highest level monster that the player gets.
                 Or it is the sum over all the monsters' base values.
// lev_m:     The level of the highest level monster
// lev_p:     The level of the player
// gain:      The total amount of experience gained by the player

gain = (lev_m / lev_p) * base_gain

This is when assuming that each warrior has its own.
Code: [Select]
*** Calculating total gain
// base_gain: It is the sum over all the monsters' base values for experience gain.
// lev_m:     The sum of levels over all the monsters
// lev_p:     The sum of levels over all the warriors
// gain:      The total amount of experience gained by the player

gain = (lev_m / lev_p) * base_gain

*** Calculating the gain per warrior
// gain_w:    The total gain in experience for the specific warrior
// lev_w:     The level of that specific warrior

gain_w = (1 - (lev_w / lev_p)) * gain

This is some basic math, with the assumption that base_gain is an attribute of the monsters. If other things in battle like class and some classes are weaker than others; or even elements (fire/water/earth/wind) matter, you might want to reconsider how you determine base_gain.


When a character levels up, their current_exp is reset to 0
I would not do this. I would set the experience to the remainder of what was left over aftyer the level gain. But then again it is your game.
Title: Re: [Maths] Gaining EXP Formula
Post by: Miles07 on January 22, 2012, 03:50:08 am
Sounds like a Pokemon engine problem.
In Pokemon, a specific enemy of a specific level (Lv) would give a certain amount of experience points (EXP) if you beat it.
- Same species, higher Lv = higher EXP by a certain unknown factor.
- Different species, same Lv = different EXP gain, different growth factor.

I would define a base EXP requirement for a Lv. 1 enemy of every enemy "species", as well as a unique growth factor to either multiply [base x factor^(Lv-1)] or add [base + factor x (Lv-1)] based on the level of the foe. More data, yes, but this makes the game / project more thought-out than to simply make EXP gain from a foe to be constant. 

Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved