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\$
  • \$\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 Oct 6 '18 at 20:01
  • \$\begingroup\$ @Philipp hopefully that edit will help. My focus is simply the math. \$\endgroup\$ – The Mattbat999 Oct 6 '18 at 20:15
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\$

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.