Note: It’s always a possibility to just not use softcaps! Softcaps can make formulas harder for players to follow along with, which can have some serious drawbacks. It may be better to fix the inflation by using formulas that don’t grow as fast (asymptotically), rather than effectively making the formula just change at an arbitrary point.
Softcaps are easy to implement, and the way they are implemented can change based on what you’re softcapping.
Also, just to get our terms straight: This post talks about softcaps as a mechanic where some value is nerfed after a certain point, by raising everything above that point to a sub-1 power. For example, if you have a softcap that square roots all gain above 100, then the raw value of 125 would be converted to the softcapped value of 105. We refer to the point where the softcap starts as
softcapStart and the power the value is raised to as
rawValue is the value before being softcapped.
The most common thing to softcap is some layer’s point gain. There’s already convenience properties to set these softcaps! Just set the layer’s
softcapPower properties to their appropriate values. Note that by default, all layers have a softcap starting at 1e7 with power 0.5.
The next most common thing to softcap is the effect of some upgrade/buyable/challenge. Let’s assume you’re currently returning some value inside the effect() function. To softcap it, store that value in a variable and return this instead:
return softcap(rawValue, softcapStart, softcapPower);
Finally if you want to softcap the global points gain, there are no layer properties to manipulate so you’ll have to use the softcap function in
mod.js's getPointGen function, same as above.
Also remember you can have some effects apply multipliers to softcapped values after the softcap, by just having it modify the value after it’s been run through the softcap function.