Saturday, August 6, 2022
HomeGame Developmentarithmetic - Tips on how to finest cope with proportion from gear...

arithmetic – Tips on how to finest cope with proportion from gear and abilities when stacking


I’ve a challenge I’m uncertain one of the best ways to go about fixing. Growing a sport I retailer all of the “proportion boosts” a personality may get both from abilities, gear, quest gadgets or whatnot as decimals (lowest being 0.0001 all the way in which to 1.0+).

This may not be the right method in relation to my query however, with out radically altering a sport that is already reside (internet sport), it is the way in which I’ve to work with.

What I usually do is take a look at all of your gear, boons, abilities and so forth that have an effect on this stat and add all of them collectively:

loop
    equipmentBonus += slot->bonus // the place equipBonus = 0.0 to start out.

Do the identical issues for boons, abilities and so forth.

Now now we have this quantity, shall we say its 1.87 (187% to this stat) One would possibly suppose:

Stat * Bonus // (10 * 1.87 = 18.7)

Appears straight ahead. However what if that whole bonus is a flat 1.0; now it is simply 10. In my thoughts it ought to double it, so:

Stat * (1 + Bonus) // (10 * 2.87 = 28.7)

Okay so now if their bonus is above 1 we double it.

New challenge: Bonus is now 3.6 (+1 = 4.6)

That is the place I’m having points, as a result of in my thoughts 3.6 (360%) (identical base stat of 10) is now 36, the place as 4.6 (1 + Bonus) = 46.

The one answer I may consider was to cease the addition of 1 as soon as we attain greater then 2, however once more that poses points as a result of 1 is now 2, 2 is now 3, 3 is now 3 … (hundred %).

Can some one assist me perceive one of the best ways to use these stat bonuses? Would it not be so simple as:

Stat + (Stat * Bonus)// However what if the bonus is greater then 1?

Ideas?

I’m not in search of code, however a greater understanding oh deal with percentages each above and beneath 100%, with out basically altering how they’re saved (i.e., 0.0001 -> 1.0) in a method the place they stack in an additive method (I imagine is above) versus multiplicative method)

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments