Vehicle movement update

Wheeled vehicles move by applying torque (generated by the engine and effected through the transmission) to the wheels. Torque at the wheels (t_wheels) means that a „torque force” (F_t) is applied at the circumference of the wheel with a given radius (r_wheels), according to the equation:

t_wheels = F_t*r_wheels

Solving for „torque force”:

F_t = t_wheels/r_wheels

In order to make a vehicle move, this „torque force” needs to be larger than the force of friction (F_fr):

F_t > F_fr

This is actually different for trying to start moving and for trying to accelerate a moving vehicle – respectively passive and active friction. While we could go into this, the gameplay benefit would be IMHO marginal, so I’ll assume that passive friction:=active friction.

The force of friction results from the body with a total mass (m_total) pushing against the ground, which has some friction coefficient (coeff_fr) with its weight (W).

Actually, the slope of the land plays an important role in all this, but again, this might be too complicated in regards to its gameplay value, so I’ll skip it.

Weight is the product of mass and the local gravitational acceleration (g):

F_fr = W*coeff_fr

W = m_total*g


F_fr = m_totalgcoeff_fr

Going back to our criteria for sufficient force (F_t > F_fr) and substituting F_fr for the above, while remembering the expression for „torque force” (F_t = t_wheels/r_wheels) we get:

t_wheels/r_wheels > m_totalgcoeff_fr

Or, solving for m_total:

m_total < t_wheels / (r_wheelsgcoeff_fr)

Ok, now we know the maximum mass of a vehicle that can be set in motion with a given torque at the wheels and wheels of a given size on a terrain with a given terrain. If the green criterion is met, the vehicle will move, powered by a non-zero driving force (F_wheels) that is the difference between F_t and F_fr:

F_wheels = F_t – F_fr

Before we use our knowledge of the driving force to calculate the attainable linear acceleration (lin_acc), we need to get the inertia of the wheels (I_wheels). One wheel can be simplified as an uniform hoop of a given mass (m_one_wheel), which has an inertia (I_one_wheel) of:

I_one_wheel = m_one_wheel*(r_wheels^2)

Therefore, for a car that has several wheels (number_of_wheels):

I_wheels = number_of_wheels*I_one_wheel

Substituting the expression for I_one_wheel:

I_wheels = number_of_wheelsm_one_wheel(r_wheels^2)

It is important that I mention that this is based on the assumption that torque is spread evenly to all wheels…

Here we can implement the type of drive – four-wheel /two-wheel / all-wheel drives would be IMHO a lovely (and easy) addition. How about being able to take a larger load in return for lower acceleration ?

…which allows us to calculate the angular acceleration (could be averaged if we incorporate the F_wheels calculation for each wheel separately – we actually should do that, to emulate the drop in performance when driving even partially off the road) for the wheels:

lin_acc = F_wheels / I_wheels

Substituting everything above into the red equation we get:

lin_acc = ((t_wheels/r_wheels) – (m_totalgcoeff_fr)) / (number_of_wheelsm_one_wheel(r_wheels^2))

This could be divided into two separate bits, one related to torque and the other to total mass:

lin_acc = (t_wheels / (number_of_wheelsm_one_wheel(r_wheels^3))) – ((m_totalgcoeff_fr) / (number_of_wheelsm_one_wheel(r_wheels^2)))

That’s all folks ? No way !

The torque at the wheels and the torque generated by the engine are two different things. The torque an engine produces is dependent on its rotations per minute (RPMs). Typically an engine has a range of RPMs at which it produces the maximum amount of torque – its operation is most efficient in that range. If we used a direct transmission, the engine torque would be effected at the wheels (with some loss, of course), however the wheels would rotate at the same RPM as does the engine.
The issue with that is that the wheels would either rotate very slowly with incredible torque or very fast with barely any torque whatsoever. Neither is good, therefore, the transmission uses gears, which can be shifted.

Assumption: All Cata:DDA cars have automatic transmission, making the engine operate in its zone of maximum efficiency, regardless of speed.

The above seems to be in effect already, as we don’t need to change gears / worry about RPMs.

Assumption: Existing gears are not discrete but continuous. Hence, torque*RPM = constant = engine_power.

This is also seemingly true in the current system. However, this has an implication, which can be used to complete the system:

Postulate: Torque at the wheels (t_wheels) is an inverse function of the current speed of the vehicle. Hence, acceleration becomes an inverse function of current speed.


Proposal 1: Give each type of terrain (and seasonal terrain, if winter comes) a parameter called friction coefficient.

Proposal 2: Use the friction coefficient to calculate the attainable acceleration of a vehicle on different types of terrain.

Proposal 3: Scrap the safe / max speed and replace them with (terrain-dependent) acceleration.

Proposal 4: Make acceleration dependent on current speed of the vehicle.

The following proposals are non-core to my concept, but IMHO are worthwhile, so I’ll list them now and flesh them out in successive posts (if you find them interesting).

Proposal 5: Implement different drive system types (2-wheel, 4x4, all-wheel).

Proposal 6: Add axles (for wheels to be placed on – same mechanics as mounting seatbelts on seats), transmission (linking the engine and axles – using the mechanic for pathfinding that is used for checking whether a part can be removed from the vehicle).

Proposal 7: Give some variety to axles / transmission / controls – we could have systems designed for high efficiency (vide sports cars) or for heavy-duty work (vide trucks / APCs). Make matching the parts to the vehicle important – axles break when too much torque is transmitted through them etc.

…sorry for yet another "OMG ! WTF ! wall of text, but we had a nice discussion on Git regarding Road Rollers, which evloved into an idea of tweaking the vehicle speed system a bit. The discussion within motivated me to post this one - basically my viewpoint on what would be a logical and fun system. Please share your opinions - this idea should be corrected and augmented through a collective consensus.

Not a car mechanic simulator. I believe ‘frame’ part abstractly implements anything not visible and highly bothersome the car would need already - frame, axles, transmission, wiring, piping, etc.

Making frames themselves limit maximum torque, though? Sure, why not. If extra complexity is desired, it could spread through adjacent frames of same type, imitating actual axles and transmission - so you for example have front wheels with heavy duty frame and a V12/diesel mounted on them, and the back made of lighter steel frames with electric engine driving back wheels if required.
Also, why can’t we make superalloy frames? Could be useful with the much higher weight factor.

Good points ! Wasn’t sure if I was going too deep with those, but indeed, frames could be made to emulate those parts. This could warrant some more variety of frames.

Not sure if I’m correct, but AFAIR superalloy was suposed to be non-craftable and non-processable. That said, who says that a lab or two didn’t focus on making the stuff and testing it out in some experimental vehicles - allowing superalloy frames to be scavenged, but not crafted IMHO looks reasonable.

‘Winter is coming’ is only different visualization of terrain, depending on actual season. So instead of giving seasonal terrain a parameter, you would instead give 4 (seasonal) parameter values to a terrain. Edit: Or you can use actual weather instead of seasons and having only one coefficient on terrain.

Axles I like, adding turning axle would help with future ‘Turn vehicle correct way’ overhaul.

Yes, but the code you came up with looks like it could jiggle the coefficients in addition to making the tiles look differently. We could go that way, or as you said try a weather-based system (might be tricky though), hence:

Proposal 8: Implement vehicle handling system (based on type of wheels and weather - slippery terrain during rain / snow / freezing temperatures)

Could certainly be used as a framework for the overhaul - what if this made building vehicles too much of a chore (vide Barhandar’s opinion) ? On the other hand, a car is a complex beast… IMHO more input is needed on that one.

Been planning on this, it would apply to pushed or pulled vehicles too.

In practice you’d apply deceleration to the vehicle for each tile it crosses.

That’s just a UI issue right? I’d keep safe/max speed, but redefine it to be the achievable speeds on pavement (the de-facto “best” terrain).

Yes, torque/acceleration should fall off with speed, I think there’s also room for torque converters (transmissions) at some point if someone feels like adding them. Also they would be used to couple engines together.

There’s a steering overhaul I want to make that assigns drive and/or steering properties to different wheels, this would feed into that.

I’m not sure what you mean, if you just mean add an axle part that acts as a mount point for wheels, great, if you mean any kind of manual routing of axles needs to happen, that sounds like busywork for the player.

Yea that’s a good idea, maybe you have to patch in substandard parts, but they keep breaking on you.