Vehicle design plans: gearboxes and wheel hubs

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:

  1. 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.
  2. 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).
  3. 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.
  4. 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?

Sounds like gearboxes open a big ole can of worms. Are enough players going to care about the details that it’s worth the trouble?

Fair enough. Until multi-engine designs are not figured out, it’s not worth adding the gearboxes.
But what’s with the wheel hubs?

Well, I don’t know about the efficiency for the clutch, but the torque converter loses roughly about 25% of the power. At least my ride drops the revs from 2000 to 1500 when blocking the TC. But the clutch does not have a constant loss, since the grip can be loosened or tightened. I see your point.

Well, I guess the shifting takes longer if you’re an unskilled driver. It’s probably going to take me about 2 to 4 seconds to change a gear, since I’ve last driven a manual car at the driving school. More experienced drivers change faster.
So it’s like 5 seconds at level 0 -> 0.5 seconds at level whatever max lvl you see fit and drops like (5-0.5=4.5 divided by lvl max, for instance 10, = 0.45 seconds per lvl decrease in gear switching speed).
As for what happens with the engine… nothing, probably? There’s stuff like synchronisers, but I’m not aware how exactly they work and how effective they are.
Well, surely if you step off the gas pedal, then you’ll get sort of a hit and the car will start to engine brake quite nastily. But that’s kind of too complex for the game, so I’d say that the driver just matches the revs and goes on smoothly.

Awesome I’m for making vehicles more realistic.

May it be possible to get an option for manual gears to :slight_smile:

I’m sure if u get auto gears to work allowing the player to change gear ain’t much more work…pleaseeeee.

Right, wheel hubs and axles. I didn’t get to them because I had to other things to do before I got to it.

So there’s been a persistent ask to add wheel hubs and possibly axles to CDDA vehicles. Instead of just having a wheel, you would have an axle, a wheel hub, and a tire. Installing a new axle would be super hard (Mechanics 8+), installing a new wheel hub on an existing axle would be moderately hard (Mechanics 4+), installing a new tire on a wheel hub would be easy (Mechanics 1).

Having actual axles and wheel hubs would make modeling rotational inertia somewhat easier, as well as having a distinction between steering axles, drive axles, and free rotating axles (if that’s something we want to do).

But it’s another one of those changes that would break all existing vehicles, so I’m not sure how to go about enabling it.

How would you handle simple vehicles then? Because mechanics 8+ for axles would make simple carts with wheels impossible until the point where they would be obsolete.

Well carts don’t really need axles or anything (caster wheels). The small wheels (bikes/motorbikes) would probably only need the wheel hub.

There could probably be simple/makeshift axles. For example, a mop handle or a piece of rebar, pushed through some brackets, attached to wheels. They wouldn’t have power going through them, but they can get the job done.

Yeah, a simple wooden axle should be easier to craft and install, but it would probably have a much lower weight limit before it would break.

So clearly there are going to different axle types with different qualities.
Unpowered wood axle: Mechanics 2, can’t be a drive axle (limits you to grabbing and pulling yourself, or towing it via the animal harness mechanics that I haven’t finished yet)
Basic metal axle: Mechanics 3, can only mount a single small wheel hub (good enough for bikes)
Standard metal non-drive axle: Mechanics 4, can’t be a drive axle
Metal drive or steering axle: Mechanics 6
Tread axle: Mechanics 8, required to install tank sprockets (which will be needed for installing caterpillar tread)

You can install a drive axle and and a steering axle without increasing difficulty, but each additional drive or steering axle increases the difficulty by 2. Tread axles keep the property of tank sprockets in that adjacent groups of tread axles count as one axle for installation difficulty.

This all really off-the-cuff and isn’t a formal plan or even intended to be a discussion of a plan.

Again, the real issue isn’t want to do about future vehicles, but what to do about existing vehicles that don’t have axles and wheel hubs and whatnot.

I had figured there would be a plan like that but for the existing vehicles would you not be able to just retroactively add them? It would be tedious but not that hard, unless there’s more to it that I don’t know about.

So you’ve built and rebuilt the Ultimate Survivor RV until it is completely to your liking, with 10x 32" armored wheels, a minireactor, armored solar panels, shredders, turrets, multiple engines, etc. And you’re cruising along a road at 80 mph approaching a horde of zombies when you save for the night.

Before you play again the next day, you update to get access to the new extended CBM features, and oh by the way, you’re getting the axle and wheelhub update. You load your game. The vehicle loader goes through your vehicle, finds a distressing lack of wheelhubs and axles and refuses to mount your 32" armored tires. You suddenly find yourself cruising at 80 mph on a vehicle that has insufficient wheels and hilarity ensues.

I think in this case it’s possible to add some intelligence to the vehicle loader and assume if you had installed tires on a vehicle (as opposed to a vehicle prototype) but no wheels or axles, that’s just a save game incompatibility and the game should add some wheel hubs and axles. But I’m not 100% sure how to do that and people have weird designs.

Making sure that completely new vehicles spawn with the appropriate bits is easy, if tedious. It’s loading existing vehicles that will be tricky. And I’m gunshy on this topic because I removed electronic controls from vehicle controls without having a strategy to make sure every vehicle that needed one had a dashboard, and people are still returning to the game and going “why can’t I turn on my headlights?”. So I’d really prefer to not repeat that, especially when the question is going to be “why did my ultimate RV suddenly crash when I loaded the game!”

Oh! Sorry I didn’t think about what it would do to saves at all. I was just referring to the cars that are in the games library but yes I see how people would be upset by that and how it would cause problems for those people.

Oh yeah, I remember I had to pull over and grab one of these newfangled dashboard thingies from a nearby car after that change.
There ought to be a way to try to auto-add a component to a vehicle when upgrading a save, and if that fails, send a warning message and at least stop the vehicle in its tracks and turn it off so the player won’t crash it.

We can translate “old wheel X” to “axle that can handle wheel X, rim for wheel X, tire for wheel X”.
I’m pretty sure that’ll do it, then the old wheel items stop spawning in favor of the new ones, and we keep the transition code around for a year or so.

Can I offer a thought?

Save the original vehicle coding. We went through a bad design before and we had to revert. I don’t mean that as an insult. I mean it as a reality. Not everything is perfect at the first go and forcing everyone to use a broken system that everyone actually uses should be a test option or something.

Should perhaps be clearly stated when this gets added maybe? Like a new thread stating the new system was added for testing. Stop grabbing the latest if you don’t want to test it.


Speaking of wheel hubs and gear boxes. I want to bring up the topic of electric vehicles. Bicycles now have options in the form of wheel engine kits. Youtube has many do it yourself and prebuilt designs. One super easy design is a Hub Engine. Engine is literally in the wheel hub and you swap either front or rear wheel with the engine one. Add a battery and affix the control box and thumb throttle = Ebike!

Even crappy batteries can let you fly at 15-20mph at a personal weight of 250lbs(no I am not this fat lol) for a few hours before needing a recharge. Bicycle shops are added to the game. So this is really a thing to consider while you make adjustments. Thanks for your time!

  1. some vehicles have no axles. Like bikes :wink: but i saw Cargo bikes, with two wheels on front. They are welded into frame (something like that ). So, I think, there should be code for them, and all wheels from old saves (perhaps old mods too?) can be treated as those. But player can mount only bicycle/bike wheels in that manner. You could think about some drawback, like need to remove wheel for change tyre, or what.

  2. Gears: What features for user would we get with your approach? In some simple racing games you can increase speed for acceleration or vice versa. far me it would be enough :slight_smile: so with default setting we have max speed from your table, and with messing with gearbox we can get better speed or acceleration/offroad.
    Better gearbox could give bonus to acceleration (aka more gears), truck one would be low speed version, high tech electronic could be adjusted from vehicle control panel (after full stop).
    What would be difference between this simple model and your approach?

I know this is not the right thread, but could someone improve the damage logics also? I’ve just ran over a giant worm and like half my car is yellow now with front parts dark red and one military alloy destroyed on impact. This is way too much damage from collisions.

Uhh, wait, why are we even discussing axles? There’s a thing called individual suspension. Modern cars don’t even have axles at the front wheels. They do have them at the rear wheels, for economy, but it’s not necessary. You will, however, need to craft a steering rack to steer the wheels instead of an axle. So if the need arises to add axles and hubs to the game, then already existing cars can get individual suspension for all of the wheels, if there’s no other way.

The same goes for tanks: tanks have no axles. If, of course, they’re not wheeled. The closest thing they have to an axle are torsion bars, and even they are one-sided. Instead of axles, tanks need some heavy suspension like those torsion bars or insanely heavy springs.
Tanks also need only two sprockets - in the front and in the back, a drive sprocket and an idler. Other round rolly things are just double metal wheels, maybe coated with rubber, if one is feeling rich.

If it has a wheel, it has an axle.
(yes even hub-drive wheels, they have bearings which are themselves on axles)

So don’t post it here, nobody is going to trawl through unrelated threads looking for this, and no one is going to see your random complaint and suddenly realize how to fix it, all you’re doing is complaining.

They still have a “thing the wheel turns around”, which is an axle.
Same as tanks, they have wheels (sprocket), and a thing the wheels are mounted on (an axle).

Huh. Seems that I got the idea of the word meaning wrong. But then still, maybe there is a point in distinguishing axles that allow for wheels to be mounted on boths sides from axles that only have one side suitable for that.
Anyway, as for the case of ‘retro-adding’ parts to the existing vehicles, they could just get the basic kit to remaing in the working order.