Jump to content
  • 0

Movement speed formula help


CharmingClyde

Question

I'm working on a formula to calculate 1/4 mile times in my racing game that uses attack (atk) and defense (def) to simulate power-to-weight ratio.

The goal is to create noticeable speed differences between light/heavy and low/high power cars.

 

Currently, my formula is:

 

Milliseconds per tile = 1000 / (140 * int(atk) / int(def))

 

This roughly matches real 1/4 mile times without requiring huge speed stats. However, the speed difference between, say, 182 atk and 1000 atk cars isn’t as distinct as it should be.Before, I used:

 

Milliseconds per tile = 1000 / (1 + ln(speed))

 

with speed representing horsepower, but this required extremely high speed values to get realistic times.

I’m not confident with the math here—any advice on a better formula to scale power-to-weight properly? Also, is there a way to avoid using int() in the source code calculations?

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...