Diminishing Returns Formula
3
chaos
A simple, flexible formula for generating diminishing returns out of input numbers. Full explanation and home, with sample calculators and versions of the code in other languages, on the Lost Souls MUD Grimoire.
function diminishing_returns(val, scale) {
if(val < 0)
return -diminishing_returns(-val, scale);
var mult = val / scale;
var trinum = (Math.sqrt(8.0 * mult + 1.0) - 1.0) / 2.0;
return trinum * scale;
}






There are currently no comments for this snippet.