Continuing the discussion from Send me your vehicle data!:

Gearboxes aren’t coming any time soon. (I’m splitting off this topic because I don’t wan’t to lose focus on the vehicle data collection thread on that planned rework, but I do want to talk about this one a bit).

There’s a couple of issues with gearboxes that make them somewhat annoying to model, and then other issues in the game:

- Currently CDDA assumes you can perfectly split engine power into rotations and torque. So torque at the wheel = engine power / rotations. If you want to go faster, you apply excess torque (above the slowing forces of air drag and rolling resistance) and increase your RPMs, which reduces your available torque until you’re using all your torque to maintain your current rotations.
- In a better model that would require/involve gearboxes, engines have a fixed torque, and you calculate their normal power in kW at some rotation rate. At lower rotation rates, you have less power (because power is still and always rotation rate * torque). Gearboxes then trade between available torque at the wheel and wheel rotation rate relative to engine torque and engine rotation rate. ie, a motorcycle with a 155Nm torque engine (~90 kW nominal) moving at 72 kph has the wheels rotating at 760 RPM,

but depending on the exact gearing ratios and the current gear, could have the engine rotating at 6,800 RPM, 4500 RPM, 3400 RPM, 2270 RPM, or 1701 RPM.

(That’s assuming a 3:1 differential and gear ratios of 3, 2, 1.5, 1, and 0.75 for reference). - So now when the vehicle is driving at 72 kph, there’s a couple of different gears it could be in. It’s probably not in 1st because that’s above the redline of 6000 RPM, and probably not in 5th because there’s not enough drive force to maintain speed. The code needs to figure out the best gear based on some criteria I haven’t quite figured out.
- It gets more complicated when the vehicle accelerates. From a standing start in 1st gear, if you open up the throttle to 5400 RPM, it takes a couple of seconds for the wheels to reach that rotation rate. Presumably the clutch handles the difference, but at some loss of efficiency that I don’t fully understand yet. And at some point you redline for your current gear, and need to shift, and I’m still not sure about how long that takes and what should happen when shift from the engine rotating at 4500 RPM in first to drive the wheels at 500 RPM, to 2nd gear where the wheels are still rotating at 500 RPM but the engine wants to be rotating at 3000 RPM.

Long story short, the physics model is complicated. And I’m not even dealing with rotational inertia yet!

Then there’s some practical matters on the game side. CDDA vehicles currently don’t have gearboxes or transmissions. We could just assume that every engine comes with a certain gearbox and/or transmission, but people may want to customize: you use a different gearbox for a v12 in a sports car than you do for that same v12 in a heavy truck. Or an i4 engine in a sedan should have a different gearbox than an i4 in a superbike. So I haven’t quite figured out how to approach any of that.

There’s also the question of mixed engines, which were just not handled by the previous attempt to handle gearboxes. If you’ve got a diesel v6 that you use for long distance travel and a gasoline v12 for emergency speed, what gear should you be in when you engage both of them at 150 kph?