1. ## Creating an equation

Hey,

I'm creating a game whereby a user reaches different levels. Starting at level 1 and working up as they gain "experience".

I'm using graph software to work out a good equation that increases the users level at a steady rate.

what i currently have is pretty bad "(x+10)^4 - 500" x being the users level. and using the graph software i can predict what y (their experience) needs to be in order for that user to level up.

The current equation is far too steep, i need something that starts off easy and gets slightly harder after each level up..

Any suggestions, help, links as to how i can achieve this would be greatly appreciated.

2. ## Re: Creating an equation

You could use a geometric series, for example say that to get from level $\displaystyle n$ to level $\displaystyle n+1$ will be $\displaystyle r$ times more than it takes to get from level $\displaystyle n-1$ to $\displaystyle n$.

In equation form it would be $\displaystyle u_n = ar^{n-1}$. You can pick a suitable value for a (the starting value) and for r.

For example if a = 100 and r=1.2 you'd need $\displaystyle u_3 = 100 \cdot 1.2^2 = 144$ (total) experience points to reach level 3 and $\displaystyle u_{10} = 100 \cdot 1.2^{10} \approx 620$ (total) experience points to reach level 10.

To get from level 1 to level 2 would require $\displaystyle u_2 - u_1 = 120 - 100 = 20$ exp but to go from level 8 to 9 would need $\displaystyle u_9-u_8 = 515 - 430 = 85$ exp points. Increase $\displaystyle r$ to require more experience points to level up.

3. ## Re: Creating an equation

Hi e^(i*pi)

I thank you for your detailed solution to my problem, however my poor math ability means i don't actually understand what you have written.

If possible can you explain what each letter represents? and break the equation down so i can reproduce it in php code.

4. ## Re: Creating an equation

$\displaystyle a$ is the first term of your equation. In terms of your experience points this is the amount required to get from level 0 to level 1.
$\displaystyle r$ is the common ratio. For your purposes this is akin to the growth rate between levels
$\displaystyle n$ is the number of levels
$\displaystyle u_n$ is the amount of experience needed to get to level $\displaystyle n$

For the purposes of your game $\displaystyle a$ and $\displaystyle r$ can be arbitrarily defined by you depending on how you want the results to pan out.

The equation to give the total amount of experience from level 1 to level n is $\displaystyle u_n = a \times r^{n-1}$ with the definitions above.

If you want to find out the experience needed between two levels (let's call them p and q) then you have $\displaystyle u_q - u_p = ar^{q-1} - ar^{p-1} = a(r^{q-1} - r^{p-1})$

Spoiler:
You can use exponent laws to simplify that to $\displaystyle ar^{-1}(r^q - r^p)$ but it's probably unnecessary

------------------------------------------------------------------------------------------------------------

Another way to approach the question is to use an exponential relationship.

$\displaystyle y = Ae^{kx}$

Where y is the experience needed, A is the initial experience needed, k is your growth constant and x the level required. In this example you can modify A and k.
If this is too strong you can change the base of your exponent by making it something other than e - for example $\displaystyle y = A \cdot 2^{kx}$ where the symbols are the same as above

5. ## Re: Creating an equation

I cant seem to reproduce your examples in my graph software, using your example to go from level 1 to 3 i get the value 52.8383 not 144.

6. ## Re: Creating an equation

What equations did you use?