Friday, August 4, 2017

mathematics - How to balance experience gain in an RPG


I am currently developing an RPG game with a classic experience-points and levelup mechanic. The player kills monsters, gains experience points, levels up when they collect enough and become stronger.


How do I balance the amount of Exp points necessary for reaching each level and the amount of Exp awarded by each monster on each level?



Answer



The best way to come to a conclusion in this regard is - like with most things in game development - to first think about how you want the game to play, and then make up the math which will result in the game playing like that.


How long do you want the player to play on each level?


In a story-focused single-player RPG you likely want to keep levelups as a constant reward stream and have the player level up every few minutes during the whole game. The rate of levelups stays constant, so your minutes-per-level function is a constant (time = c).



On a more achievement-focused game, like an MMORPG, you usually want levelups to be frequent for beginners but become less and less frequent the further the player progresses. In that case your minutes-per-level function would be polynomial (time = Level ^ c) or even exponential (time = c ^ Level). Taking the level-number as-is in an exponential formula is usually much too extreme, however. It can be a good idea to divide it by a constant to make the increase a lot slower while still keeping it exponential (time = c1 ^ (1 + Level / c2)).


I would recommend you to use a spreadsheet to crunch the numbers. Create a table with a column with the numbers from 1 to your expected maximum level, and a second column with the level formula. This easily allows you to experiment with different formulas to find numbers which are to your liking. Maybe you get better results when you combine a polynomial with an exponential component?


Remember that you are seeing net combat time here. The game time the player is actively collecting experience points. It doesn't count the time the player spends talking with NPCs, comparing their equipment and does other tasks which don't directly cause progress.


In my current game (an MMORPG) I came up with the formula seconds(level) = 10 ^ (1 + Level / 20). The first few levels only take seconds of actual combat (very instant gratification during the tutorial phase), the levels 20 - 40 take minutes, in the 50s it becomes hours per level and when near the maximum level of 100 it takes whole weeks to see progress.


How different should the experience reward per enemy be?


Even when your enemies don't have an explicit (or meaningful) level stat, you will want to design them to be a balanced challenge for a certain character level. But how much more experience should an enemy recommended for level 40 reward over one recommended for level 30?


The answer to this question is closely related to how much more powerful the character gets per level and how far you want to allow them to be ahead or behind the current enemies with their character level.


Some game systems, like that of World of Warcraft for example, make it quite pointless to pursue any combat with an enemy just slightly below or above the level of the player character. Anything just a few levels above will annihilate the player, anything a few levels below will be no challenge (and no reward) at all.


A counter-example would be the Disgaea series. In that game you can easily defeat enemies with several times the level of your own characters when you play it smart.


The more restrictive you want to be in the level bracket which is a fair fight for the player, the more you need to make sure that the player doesn't lag behind or get ahead the level of the enemies they are currently fighting. When the player falls behind the enemies, the game will become frustratingly difficult without grinding. When the player gets ahead of the monsters, the game will become too easy and boring.



A good way to keep the player inside the level bracket is to increase the exp reward per level. On the one hand, it will easily allow the player to catch up when they are slightly below recommended level. On the other, it won't allow them to level up efficiently on weak enemies without progressing to a harder area.


A polynomial exp curve (exp = Level ^ c) usually works well. The larger the value of c, the more you force the player into the current level bracket of the monsters they fight.


Keep in mind that enemies which take longer to defeat should also give proportionally more experience. A battle which takes 20 seconds should give twice as much exp as one which only takes 10 seconds. This extends your formula to exp = (Level ^ c) * minutes_per_combat.


The final exp-per-level formula


The final formula can now be derived from the two. The experience per level is the time per level in minutes multiplied with the experience gained per minute. So just take the two formulas you came up with in the last two sections and multiply them. There it is: Your experience-per-level formula.


With a polynomial time-increase per level, the formula would be


exp(level) = (level ^ c1) * (level ^ c2)

where




  • c1 depends on how long you want each level to take

  • c2 depends on how close you want to keep the player to the level of the enemies they fight


What could go wrong?


Even the best thought-out concept can't replace proper playtesting. Should your playtesting turn out that the average players progress much faster or slower than you want, it is usually a sign that you over- or underestimated the recommended levels of your enemies and how long it takes for the average player to kill them. Try analyzing together with your playtesters which enemies are how hard to kill on what character level and adjust their exp value or stats accordingly.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...