Hi I am trying to build a experience/level growth system based on the following plot chart, however I can't think of a proper formula or equation to this chart. Can anyone lend me a hand, please? The x-axis grow significant bigger very fast but the y-axis grow very slow after it reaches 200.

I have tried log and power function but can't make it work. What kind of equation should I use to make it conform to this chart?


  • 1
    \$\begingroup\$ I would use Lagrange interpolation to solve this, mathworld.wolfram.com/LagrangeInterpolatingPolynomial.html for the following Yi | 50 | 100 | 150 | 200 | 201 and Xi | 1000 | 5000 | 10000 | 20000 | 25000 accordingly. \$\endgroup\$ Commented Jul 2, 2016 at 9:17
  • \$\begingroup\$ You could also use basic algebra to transform log/exponential functions: faculty.uoit.ca/kay/precalc/pdf/4.3_Explog_transforms.pdf \$\endgroup\$
    – user5665
    Commented Jul 2, 2016 at 9:20
  • 2
    \$\begingroup\$ This is a square root function, or something similar, where f(x) = x ^ (1/2) \$\endgroup\$ Commented Jul 3, 2016 at 6:11
  • \$\begingroup\$ @sneelhorses Thanks I end up using a power function Math.pow(x - 6, 1.93), which works OK for small to medium x. But I am not very satisfied with the result given by the power function because for Y to increase a small number the X has to increase several thousands when X is between 10k and 20k. I just put a cap on X so Y wouldn't go beyond 210 which makes my formula easier to fit my game. \$\endgroup\$
    – newguy
    Commented Jul 3, 2016 at 7:51
  • 1
    \$\begingroup\$ I've thrown a couple quick stabs at this visually, but we can probably come up with better answers if you can give more context about what this formula is intended to model, or what gameplay needs it's serving. How did you arrive at the shape in the plot above? That thinking process may help lead to a more appropriate formula than what I've sketched below - in particular, it might let us use meaningful gameplay metrics as our parameters instead of the magic numbers in there currently. \$\endgroup\$
    – DMGregory
    Commented Jul 12, 2016 at 3:38

2 Answers 2


I can't resist a good formula puzzle. Here's one with a decent fit, though it's less elegant than I'd like...

Graph of the "PowerCurve" function below overlaid with the plot in the question, showing close correspondence

float PowerCurveValueAt(float x)
    // Compute a root function with a steep rise in the low range.
    float low = pow(x, 0.55f);

    // Compute a second root function that's shallower in the high range.
    float high = 5f * pow(y, 0.2f);

    // Compute a blend factor that smoothly transitions between low & high.
    float blend = 1.0f / (x/30000f + 1);

    // Blend the two together, and scale to the desired output range.
    return 1.28f * lerp(high, low, blend);

This formula is a bit neater, though it's slightly steeper at the far end...

Graph of the "LogCurve" function below overlaid with the plot in the question, also showing close correspondence

float LogCurveValueAt(float x)
     return 6.66f * log(pow((x+300f)/500f, 8f));
  • \$\begingroup\$ I am not familiar with the lerp functoin. Does Lerp(a, b, t) mean a*(1-t) + b*t? What's its purpose here? \$\endgroup\$
    – newguy
    Commented Jul 12, 2016 at 14:19
  • \$\begingroup\$ That's exactly correct. Its purpose here is to transition smoothly from a steep curve in the low x values to a shallower curve in the high x values. I couldn't find a single exponent that got both ends correct, so I tuned one exponent for each extreme and blended them. \$\endgroup\$
    – DMGregory
    Commented Jul 12, 2016 at 14:22
  • \$\begingroup\$ Thanks I don't have time to test the formula yet but the lerp function solved another problem that I have had for long time. \$\endgroup\$
    – newguy
    Commented Jul 18, 2016 at 0:31

DMGregory did good work at approximating the curve you posted as closely as possible.

But to provide a more general and more widely applicable answer:

  • When you want fast growth at first which then gets slower but never caps, usey = sqrt(x)
  • When you want to approach a constant cap value c but never reach it, use y = c - c / x
  • When you really want the hard cap, but the latter function has too fast growth in the beginning but then plateaus too fast, you can substitute x with a square-root function (c - c / sqrt(x)) or even logarithmic function (c - c / log(x)).

I personally find a spreadsheet application like Excel very useful in trying out my formulas and quickly plotting them into a diagram. When you want to get really serious about designing and plotting your game formulas, you might want to give Wolfram Mathematica a try.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .