Chances are, if you're reading this, you've had a need for some kind of diminishing returns formula from time to time, and found how a lot of the ones that get thrown around don't necessarily work so well for MUD purposes. After, oh, some years of that, I put one together that does very well for me, and now I've published it on the Lost Souls Grimoire. The reason I don't just put it up as a code snippet is that the way it's presented really works best as a web page; there's an explanation of what it does, interactive calculators so you can see it in action, and code for it in six languages. Anyway, hope folks get some use out of it. :)
Ok, it's late, I've finally finished fighting my server to compensate for my slowly dying hard drive after getting home from a week and a half long family road trip, so forgive me if this sounds dimwitted but, can you give an example of where this would be useful in-game?
It is useful when you want something to be less useful the more you do it. For example, doing the same skill over and over again might mean you learn less and less. Or killing the same mobs over and over again. Etc. Basically any time you want to add incentive to vary activity (or, put another way, if you want to 'punish' repetition).
I'd actually though of the idea of applying diminishing returns to certain debuffs placed on players in PvP and possibly even PvE. For instance if you had a spell that lowered an enemies resistance to fire, then if they ontinue to cast it as it wears off, they would lower it less and less until it doesn't work at all.
So, couldn't one conceivably just use that same, existing, code elsewhere too if they wanted to? (Not knocking what Chaos has presented here at all, just saying that if we already have it in place, effectively, couldn't we just use it instead of incorporating another function?)
Sure, if you wanted to. What Chaos has provided is just one way to calculate diminishing returns. Other people use inverse squares, an exponential decrease, linear decrease, and so on. It depends on how quickly you want the returns to diminish. It's a lot easier to understand by comparing different graphs, I think. In any case it's not quite appropriate to say that this formula is the formula for diminishing returns: rather, it's one way among many to scale down a number.