# Looking for some math formula help

I’m not sure where else to post this. My games almost finished and I’m doing rigorous testing of the system. It’s a coin collection game and I need help with some math formula. The game bases the new rebirth costs on the number of rebirths a player has. My issue is it’s too easy at higher levels but I don’t wish to make it too hard for new players. Here is some of the values involved.

rebirthBaseCost = 10,000 coins
#rebirths = 0 to infinity

zone dividers (between zones)
Gate 1 - 10K (no rebirths needed to get through)
Gate 2 - 500K (2-3 rebirths needed to get through)
Gate 3 - 10Mill (10 - 15 rebirths needed to get through)
Gate 4 - 5Bil ( 45 - 50 rebirths needed to get through)
Gate 5 2.5Tril ( 100+ rebirths needed to get through)

I want to make the start easier but the finish harder but I’m not really sure about the math.
This is my current formula but I’ve been increasing values based around my character which now has 46 rebirths.

``````-- newRebirthCost = BASECOST * (#REBIRTHS * 2.2) * (Increasing value making the game harder over time)
newRebirthCost = rebirthBaseCost * ((rebirth.Value * 2.2) * (2.4 + (rebirth.Value / 2)))
``````

The games too easy and I’m able to rebirth about every 30 secs. This isn’t what I had in mind (granted I have the 2x gamepass but I want to make it so the rebirth costs are approx what it would to open the gates (if that makes any sense) but not so high that starter players will get discouraged due to excessively high costs.

So someone with 10 rebirths should be around gate 3 (10 million cost) and therefore the rebirths should cost about the same but it’s not even close at 1,628,000

When I was first testing the game at rebirth = 0 I got about 10000 coins in about 15 mins (and the game increases the coins value each rebirth)

1 Like

For this sorta thing, you may want to look at including an exponential in your equation!

``````newRebirthCost = (rebirthBaseCost ^ ((rebirth.Value+1) /100)) * ((rebirth.Value * 2.2) * (2.4 + (rebirth.Value / 2)))
``````

I have included it near the start there. Mess around with what you divide the power by / where in the equation you want the exponential, and it should work nicely!

3 Likes

Using an exponential equation is a great solution for this problem. However, you should have some kind of limit for that also. Exponential equation makes your game also hard for elite players but at some points, it will be nearly impossible for them to do another rebirth, or the reward for rebirthing is not worth doing so. To test your equation out, you can use Desmos to calculate a rebirth amount and requirements for that rebirth. Many incremental games use different rebirth layers (ie. Rebirth, Prestige, Ascend, Reincarnation ; that use different equation to calculate requirements) to solve this problem to keep your game also ‘entertaining’ for elite players.

1 Like

You con do this in one of two ways, using interest equations.

1. Simple interest which increases at a “steady” constant rate, the formula goes like this: `PRT / 100`, or, in Roblox, `(P * R * T) / 100` pretty simple, P is the starting (default) amount, R is the rate of increasing, as a percentage, and T is time, you can replace that with the number of rebirths! Keep in mind, this will return the increase so, to get the new value do `P + interest` where, as said before, P is the starting value (cost of rebirth).
2. Compound interest, exponential growth meaning that the numbers increase by larger as time goes by, here’s the formula:
`P(1 + R/100)^T` or, in Roblox: `P * (1 + R / 100)^T`. All the symbols are the same for both equations.
2 Likes

You hit the nail on the head. I’m started using exponentiation in the equation this morning and it’s much better and as such my formula now reads,

``````local newRebirthAmount = rebirthBaseCost * 1.4 ^ rebirth.Value
``````

This will make rebirths as such…
base cost (10000)
next rebirth (14000)
after that (19600)

rebirth 25 (44.9M)
rebirth 50 (202.4B)
rebirth 100 (4.1…e + 18)

So it goes up fast at the end creating a kind of ceiling.
I’m guessing only the most elite players will get there and since the final zone is e + 12 they may never get there but for now I think that idea was the best. It’s my first game anyway so I’m bound to learn something from this. Oh I also dropped the base cost to 5000 so there will be twice as many rebirths to get there.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.