Okay /b/
Game design and mathematical challenge
Your character turns (turn-input * turnModifier) * turnspeed.
turnspeed lets assume is 300
turnModifier defaults at 1.
turn-input floats between -1.0 for left and 1.0 for right.
You can equip your character with items that hold percentages to modify your turning ability.
so if you have some item that gives you plus 40 percent turn
how do we solve?
40 / 100 = .4
turnModifier += .4 = 1.4 or "40 percent more"
But what if you equip multiple items that give you less modifiers? If you had 3 items that each knocked off 40 percent,
then you'd end up with -
(turn-input * -.2) * turnspeed
which may as well be
-(turn-input * .2 ) * turnspeed
so your modifiers may as well have stopped happening after 80.
How to handle this problem mathematically?
If you can't handle this problem mathematically, you are in the wrong class.
>>723080126
Look man. Nobody told me I'd be doing math when I signed up for this.
>jk
>I know I'm dumb and this should be easy
Something like,
store a new float,
make it the modifier float,
and make sure 1 is always added?
so if holdfloat = -.4
then
turn-Input * (holdfloat + 1) * turnspeed?
please go to /sci/
>>723080013
>>723080013
Let em stack. Lets say 40% of 1 is 0.4 less. Another 40% would be calculated with the first offset of 0,4 which means 0.16 then you calculate the second offset which would be 0,16 that one would give you 0,064. That means in total u'd lose 0,624 turnspeed => you have a remaining of turningspeed of 0,376. You could also add a cap where you stop lowering the value or add a deminishing value. Like first item 100% of the 40%, second one only has an effectivness of 80% of a percent value and so on.
You should just force it to be minimum zero.
Accounting for more than 100% reduction in speed doesn't make sense imo, at least not in this case.
An increase of more than 100% may make sense, since there is no upper limit to speed (other than what you decide)
>>723081509
Wait, I take that back.
If you have bonuses to speed that make you, for example, have 140% speed, then it would make sense to have a maximum of 140% reduction in speed. Except that's not how percentage works in some cases, so just do a flat out stacking of percentages and mathf.max(0, yourFinalSpeed) on the final value.
>>723080836
so store a modifier float, newstep,
add 1 to that in the "* turnmod")
and instead of the next 40/100 i need (turnmod *(newStep/100) * (40 / 100)?