I hope this is the right place for this but I have a problem with calculating velocity for my car game. The higher the gear, and therefore lower the gear ratio, the lower the top speed.

Given that

Acceleration = Forward Force - Drag - Rolling Resistance

Velocity += Acceleration * dt


Wheel Torque = Engine torque * Gearbox ratio * Differential ratio

Forward Force = Wheel Torque/Wheel Radius

I feel like I am missing something because if we decrease the gear ratio we decrease the torque and therefore the forward force causing lower acceleration so the car cannot gain additional velocity, and actually loses it due to resistive forces.

  • \$\begingroup\$ It looks like you might be missing a representation of the engine's revolutions per minute. A high gear lets me get more turns of the wheel from the same number of engine revs, travelling further in the same window of time, if the engine keeps turning at the same rate. Is that accounted for elsewhere in your system? \$\endgroup\$
    – DMGregory
    Mar 10, 2021 at 17:59
  • \$\begingroup\$ I calculate engine torque from a torque curve with the use of RPM but that just gives me specific torque regardless of the gear I'm in. > Engine torque = torque_curve[engine_rpm] * throttle. \$\endgroup\$
    – biner1999
    Mar 10, 2021 at 18:14
  • \$\begingroup\$ Consider the relationship between speed and engine RPM at a given gear. That's going to impact whether a low gear can sustain a high top speed, because it's going to be on the downward slope of its torque curve at that RPM. \$\endgroup\$
    – DMGregory
    Mar 10, 2021 at 18:20
  • \$\begingroup\$ I understand the relationship but I am not sure as to how to implement it along with torque for acceleration. I calculate speed from Speed = (Engine RPM * Wheel Radius)/(Gear ratio * Differential Ratio) * pi/30 \$\endgroup\$
    – biner1999
    Mar 10, 2021 at 18:26

1 Answer 1


Let's assume your vehicle is travelling along at a given speed \$v\$ in metres per second - it may or may not be able to sustain this speed on its own, but we'll ignore that for now and use this as a stepping stone to determine the speed it can sustain.

In one second, the car moves forward \$d = v \times 1 \text{s}\$ metres.

That's \$\frac d {2 \pi r}\$ turns of a wheel with radius \$r\$, so the wheel is turning at a rate of \$\frac {v \times 1 \text{s}} {2 \pi r} \text Hz\$

For a combined gearing and differential ratio \$g\$, that means your engine is turning at: \$g \frac {v \times 1 \text{s}} {2 \pi r} \text Hz = \frac {g v \times 1 \text{s}}{120 \pi r} \text{RPM}\$

We can use this RPM rate to sample your engine's torque curve and compute the Forward Force as described in your question.

For very high initial values of the speed \$v\$, this force will be negative. At such high RPM, your engine offers too little torque to overcome the high drag at that speed.

So then you try a lower value of \$v\$ - maybe the one corresponding to the RPM where your engine achieves its peak torque. At this lower speed, you get a positive value of Forward Force - your engine has enough surplus torque to not just maintain this speed, but accelerate beyond it.

So now we have two speed values, one that gives us a positive force, one that gives us a negative force. At some speed value between those two points, the force value must cross zero. At that specific speed, the torque our engine puts out and the resistance the car faces are exactly in balance, and we can maintain the speed but not accelerate above it. That's our maximum speed for this gear.

We can find this maximum speed by binary search: try the speed halfway between the two speed we've tried so far.

  • If this new halfway speed yields a positive force, replace the previous speed that gave us a positive force by this one - we have a new lower bound.

  • If this new halfway speed yields a negative force, replace the previous speed that gave us a negative force by this one - we have a new upper bound.

Each time we do one of these replacements, we reduce our uncertainty about the maximum speed by a half. Repeat until the lower and upper bounds converge to your desired precision.


You must log in to answer this question.

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