Need help to figure out / update this math formula

I’ve taken over some code from a previous developer (@Lauri9 , but he’s been unresponsive so far) and trying to figure out how to update this math formula. The problem is that as it gets to higher savedValues, the result value seems to be sticking around the same point - one of our players has reached a savedValue of 1,000,000, and they’re getting the same result as another player who has a savedValue of 20,000.

value = 50 + math.atan(savedValue/100) * (2 * 950)/math.pi;

I’m trying to change this so that it will have a bigger impact for players who reach large savedValues. The problem is I’m not sure how to update that without just putting in a new formula (which would change all the existing results for players). Could someone better than me at math tell me if there’s some better way of updating that?

I suggest using math.log() or math.log10(). The change between x1 and x2 will be a lot smaller the higher that the digits go

2 Likes

Aight cool, gonna run with that for a while and see how it helps, thanks!

1 Like

This is a problem that can only be solved by changing the formula. (hint: use Desmos to graph the formula and see how it changes with different savedValues)

4 Likes

like @dantheprogram said, make sure to use Desmos to compare the graphs

here’s a comparison of
value = 50 + math.atan(savedValue/100) * (2 * 950)/math.pi;
and
value = 50 + math.log(savedValue/100) * (2 * 950)/math.pi;

zoomed in

zoomed out

as you can see, the function that uses math.log will be negative until x ≈ 80, so make sure to consider that. the difference between savedValue of 20,000 and savedValue of 1,000,000 is only about 1000, up to you to determine whether or not that’s enough difference. if it’s not, just play around in Desmos and you’ll probably be able to make the function you need

1 Like