0
\$\begingroup\$

I am working on a freeroam, action RPG (before you read further, I am not noobish to programming, plus have friends to help with actual content rather than the base code). Anyway, I am trying in Skills to the game. I decided the movement-based skills and animations should be a priority, so I began integrating it in. The animations work fine, but alas my movement skill Athleticism is making the character move unrealistically fast at a higher skill. The skill ranged from 1 to 100. After realising I should do some calculations to make you go from normal to Sonic the Hedgehog, I am using this formula currently:

(Athleticism / Mathf.Sqrt(Athleticism)) * 0.05f * runMod;

This has helped, but it still looks weird. I need some help to make a formula that makes that the skill doesn't have such of a linear effect on the movement.

EDIT:

Trying to be specific. The player moves, currently about 0.05 walking units per second at Athleticism 10, which is nice. However, the movement rate at Athleticism 100 cranks up to 0.15 units, which is a little too fast. I am aiming for 0.1 instead.

\$\endgroup\$
2
  • \$\begingroup\$ We can not see and play your game, so it is hard to tell what "looks weird" in the context of your game and what doesn't. That makes it hard to give you a helpful answer. Maybe we could give you an answer if you tell us how much faster you want a character with maximum skill to be than a character with minimum skill. And if you don't want a linear increase, you should also tell us how much faster you want the steps in between to be. \$\endgroup\$
    – Philipp
    Commented Oct 6, 2018 at 20:01
  • \$\begingroup\$ @Philipp hopefully that edit will help. My focus is simply the math. \$\endgroup\$ Commented Oct 6, 2018 at 20:15

1 Answer 1

3
\$\begingroup\$

If you want athleticism to improve the movement rate from 0.05 by another 0.05 to a total of 0.1, then there is a very easy formula for that:

speed = 0.05f + 0.05f * (Athleticism / 100.0f);

or more generally expressed:

value = minimum + possibleImprovement * (currentLevel / maximumLevel);

If you want the increase to be some form of non-linear progression, then you might want to toy with the (currentLevel / maximumLevel) part. Just make sure you end up with some function which returns values between 0.0 and 1.0 so the result still hits into the range between your desired minimum and maximum speed.

\$\endgroup\$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .