FPS Game Development XP function: finding equation from data points

CDDevelopment

New member
Joined
Feb 3, 2018
Messages
3
Hello, I'm a freelance programmer and a part time game developer. I have been tasked with replicating the XP to Rank function used in some popular First Person Shooter games. I have the necessary data set and I'd like to find a mathematical function to express the correlation, but I can't see one with the given data, but I know it is there.

Here is what we know:
It is obviously exponential.
The function is most likely able to be expressed using addition, subtraction, division, multiplication, exponents, and maybe(unlikely) but maybe radians.
The data IS correlated, (it has to be, otherwise it wouldn't be efficient to just write the entire dataset as an array or table for use in the game)

and of course we know the data:

1=0
2=8
3=19
4=31
5=49
6=71
7=96
8=124
9=156
10=192
11=231
12=275
13=324
14=378
15=437
16=501
17=570
18=644
19=723
20=807
...
75=14644.5

Some of you might take this as a challenge, some might find it really easy, I just need a function...
 
Last edited:
Why does it have to be dynamic? Compared to sizes of other assets (images, sound files) an array like that takes up very little space.
 
Why does it have to be dynamic? Compared to sizes of other assets (images, sound files) an array like that takes up very little space.
It can't be simply an array because it's not efficient in the code. It's a million times easier to express a players rank given their XP through a single line function. It's not that it takes up a lot of memory, but it DOES take up some memory and it takes time to write the array as many times as it might be needed in the code.
 
Done some graphing work and y 2x^2 - 1/3x is ridiculously close.

If you use a spreadsheet, you'll see that 2x2 has an offset that is not monotonic or even of a consistent sign:

xy2*x^2y - 2*x^2
102-2
2880
319181
43132-1
54950-1
67172-1
79698-2
8124128-4
9156162-6
10192200-8
11231242-11
12275288-13
13324338-14
14378392-14
15437450-13
16501512-11
17570578-8
18644648-4
197237221
208078007
7514644.5112503394.5


So the offset is not a linear function of x, and it is certainly not (1/3)x
 
Excel says the equation for best-fit trend line is:

y = 2.8228 x^2 - 17.262 x + 58.129
 
Top