Pokemon-like experience help!

Hello, in my rpg game, I would like for my players to level up based off experience. However, i want the gained experience to be greater if you defeat an enemy greater than your level, and less experience gained when defeating an enemy with a lower level. Also, after leveling up, i wanted the persons max experience to be greater everytime. Pretty much like how pokemon handles their leveling/experience.

Now, i only understand how to do this using a more “flat” formula, such as :

/* EXAMPLE */

void GainXP(int enemyLVL)
{
if(enemyLVL > myLvl)
{
curXp += 10;
}
else if(enemyLVL == myLvl)
{
curXp += 5;
}
else if(enemyLVL < myLvl)
{
curXp += 3;
}

if(curXp >= maxXp)
{
levelUp();
}
}

void levelUp ()
{

    curXp = 0;
    maxXp = maxXp + 50;
    level++;
    maxHealth += 100;
}

But it’s not my goal. So how do I make players earn more XP when defeating enemies with greater levels rather than those with lower levels. Any help would be greatly appreciated!

It looks like it does that already. Do you mean having a L10 enemy grant more than a L3 enemy, regardless of the player’s level?

You could do that either with a formula (XP = LVL * 10, for example), or with a table that you fill in, either in the editor or from a config file.

1 Like

Check out Elo. The formula is pretty nice.

Ok thank you I will try it out and tell you.
Also, how do i deal with increasing the max Xp after leveling up?

Pretty much as @Errorsatz posted, but I’d probably consider how many levels above or below they are and multiply that by a value, then use that to add or subtract from 1f to get an increase based on the number of levels above or below.

Increase would be the same thing. Base exp + level * an amount to add on per level = required exp

Could you please give me an example? I really dont know…

No, id prefer it to be in regards of the player’s level.