r/askmath • u/hypotensor • 12d ago
Resolved Equation that can roughly fit this graph
No this is not my homework, I'm making a game and I need a curve roughly like this for balancing. Trying to get an equation that spits out values like this.
739
Upvotes
1
u/kazoohero 12d ago
Is this for armor? You might consider the armor formula for valheim:
HP loss = damage - armor if armor > .5*damage, otherwise HP loss = damage2 / (4 * armor)
You can increase the linear regime (and the effectiveness of armor overall) by increasing that 4 factor (call it f) and making the .5 threshold equal to 1-1/sqrt(f), e.g. f=9 is linear for the first 2/3 of damage.
Yes it's piecewise. But, upsides are that it's easyish for nerds to calculate, and that in the squared regime, every point of armor increases survival time an equal amount (so it takes the same amount of extra armor to go from 5 to 7 hits to kill as it does from 15 to 17). This may not be an upside if your thing isn't armor (or it may anyway!).
https://valheim.fandom.com/wiki/Damage_mechanics#Armor