# Car acceleration with gear shifting

I'm making a web game that requires a player to change gears at the proper RPM zone to win the race.

If the player misses the prime RPM zone he will be slowed down by a factor relative to the distance he was away from the prime RPM zone.

The 'prime' RPM zone is the exact time the player must shift the car in order to receive the highest speed output.

So basically here is the problem:

The car needs to accelerate on its own at an exponential rate. If the car reaches a set max speed in a certain gear than it will not go any faster until the gear is changed. The RPM zone is from $1-10$ Changing the gear at $8$ would be a perfect shift, hence maximum speed outcome.

Now here's where I get stuck:

If the player changes gear at prime RPM zone of $8$, I need the car to accelerate as normal. If the player misses $8$, I need it to take the difference from the prime RPM zone and use that to factor in a new speed for the car, being slower the further away he was from $8$ - keep in mind after the new speed is calculated the car still must accelerate at an exponential rate until it reaches the max speed for the gear.

Basically the cars acceleration needs to be realistic and manual - I can't figure out the mathematical formulas needed to achieve this goal effectively and realistically.

I cant really put it in to words too good, and I don't need exact answers just tips or advice to help me achieve this. I'm not asking for any code I know this is a mathematics only website.

Any help/advice is greatly appreciated! Thanks