🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Weapon reload speed formula

Started by
4 comments, last by EvgenS 5 years ago

Greetings everyone!

 

I'm trying to reverse design one good old game and got stuck on deriving the formula of ranged weapon reload speed (I'm not really good at math yet :) ).

I know :

- crossbowman ballistic skill (BS). The more the skill level the less time it takes to reload a weapon.

- Reload time of crossbow modified by crossbowman skill level  

I do not know :

- Crossbow base reload speed (I assume it is a fixed value)

I attached in-game test data below and my problem is that I can't figure out why reload time differ so much for BS low levels values (1 and 2)? 

The best formula I came up with is:

Reload time = -a*BS + weapon reload speed

But it lacks this exponential reload time decrease for low vs high BS levels. So I wonder how this can be achieved thanks to math? 

 

I would really appreciate your help or ideas where to dig

 

P.S.

Sorry if I post it in wrong thread (I saw there is also a math thread) 

image.png.f78973970aca3d79419878813810ad69.png

Advertisement

Looks mighty close to 30 divided by the skill level.

🙂🙂🙂🙂🙂<←The tone posse, ready for action.

If you are familiar with python, you can use the scipy.optimize package. Use the least squares function to find an optimal set of parameters for some arbitrary formula.

For example, you say that your formula has the form: a * BS + b. The optimizer gives you the best possible values of a and b to match your data. Plot the original data and your function to see how good the agreement is. If it is not good, just modify your function.

Greetings

 

If it's an old game, it probably measures time in frames, not in real time.

Instead of looking for a formula, I'd simply build a table: frames to reload the crossbow vs. crossbowman skill rating, for each possible skill value.

If the delay for the same skill isn't the same every time, there might be some glitch, or a game engine that doesn't work on whole frames after all, or some other factor (e.g. animation state or position of the crossbowman) that affects the result.

Omae Wa Mou Shindeiru

10 hours ago, fleabay said:

Looks mighty close to 30 divided by the skill level.

Yes, and some inaccuracy in my test-data can be due to time frame glitch as LorenzoGatti kindly pointed out below. The game is really old indeed. 

 

9 hours ago, DerTroll said:

If you are familiar with python, you can use the scipy.optimize package. Use the least squares function to find an optimal set of parameters for some arbitrary formula.

For example, you say that your formula has the form: a * BS + b. The optimizer gives you the best possible values of a and b to match your data. Plot the original data and your function to see how good the agreement is. If it is not good, just modify your function.

Greetings

 

I am not familiar with Python just heard that you can do formula simulations there. Probably its time to dig into it.

Many thanks to all of you for such prompt and helpful replies. Much appreciated! 

This topic is closed to new replies.

Advertisement