Car model physics

From Stunts Wiki

This article intends to discuss in depth the parameters affecting how a car behaves in Stunts and, in particular, expand on the descriptions done at Car parameters. The first section consists in an analysis of how performance-related CAR*.RES parameters quantitatively affect in-game behaviour, done through the definition of a consistent measurement unit system. Such an unit system proves to be an useful framework for accurate, realistic tuning, and allows to assess how accurate the original Stunts cars were modelled by the developers. Further sections of the article deal with other, less directly assessable parameters such as grip as well as special effects. As a final observation, the largely experiment-based nature of the topic means this article will be a work-in-progress for quite a while.

Model fundamentals and internal units

This section is organized by the main physical quantities relevant to the behaviour of a Stunts car. For each of them, the essential physical equations tuners need to be aware of will be discussed, alongside with the unit correlations which allow translating real-world data to CAR*.RES byte values. The general treatment will be attributing to each quantity an internal unit which can be read directly from the game or CAR*.RES and then work out the corresponding real-world units.


As it appears to the drivers, time in Stunts is divided in steps of 0.05s, corresponding to the interval between successive updates of the car position. For convenience, a TS (for time step) unit will be defined, so that 1TS = 0.05s . Also, it's worth to remind that 1min = 60s = 1200TS, and 1h = 3600s = 72000TS.


Speed values are readily available, either through digital speedometer readings or evaluation screen top speed/impact speed data. It is important to keep in mind, though, that these values are in miles per hour; and thus they are most likely not used directly by the game in the algorithms (as miles and hours are not convenient internal units). Furthermore, in-game values are rounded down to the nearest integer, so in experiments which require accurate knowledge of speed values the data may not be reliable. Anyway, mph speeds are relevant to the game mechanics and will be employed in much of the following discussions.


There are two main reference systems for defining length units in Stunts:

  • Track tiles are useful as references for further exploration of game physics. Experiments for finding tile lengths consist simply in racing a car down a long straight at a constant and known speed and infer the travelled distance from the speed and the time elapsed. Performing these tests with high accuracy is not trivial, however, and usually requires CarBlaster trickery to lock the car into the desired speed. Repeating such runs under different conditions give a consistent result of 1tl = 205ft (tl = tile length). Converting that result to meters gives the useful fact that one tile length is about 1/16th of a kilometre; since Stunts seems to use Imperial units mostly everywhere, however, we'll stick to the value in feet for now.
  • 3D shape sizes, which can be accessed by stressed, for instance. The graphic size unit in resources such as car1 and all objects at GAME*.3SH will be referred to as point, or pt. It is easy to verify a track tile is made of 1024pt; therefore, 1pt = (205/1024)ft, or, to a very good approximation, 1pt = 0.2ft . These results may be useful to graphic designers; furthermore, points is a more reasonable possibility for unit used in game algorithms than most others (miles, tiles, feet, etc.). Another interesting fact is that trying to convert miles per hour to points per time step yield a surprisingly clean fraction: 1mph = (11/30)(pt/TS)

As a final note, it is useful to have in mind that 1mi = 5280ft = 2^5*5*3*11ft.

Engine revolutions

It is quite evident from mere inspection that the engine speed parameters in CAR*.RES are given directly in rpm. Toying with maximum rpm parameters and the torque curve allows to prove beyond doubt that each byte in the torque curve corresponds to a 128rpm range. There is not much to add in this topic, except for mentioning that the conversion to SI units, 1rpm = (2*pi/60)(rad/s), may occasionally be of some use.

Gear ratios

Gears couple the engine speed and delivered torque to the wheels and, therefore, to actual car movement. The key formulas to be aware of are:

car speed = engine speed / overall gear ratio
car acceleration = engine output torque * overall gear ratio / car mass

The "overall gear ratio" (that is, the gear ratio parameter we're used to) incorporate the effects of all transmission components that would be in a real car (gearbox, final drive, wheel radius...) into a single value.

As the gear ratio couples engine speed to car speed, the internal unit of the gear ratio parameters (from now on the gear Stunts unit, or gsu) must have dimensions of angular (engine) speed per linear (car) speed. Finding the conversion factor requires just finding out what the car speed is at a certain rpm and ratio, something easily achieved by letting the car reach maximum rpm or, for better accuracy, manipulating the torque curve to lock the engine speed at a fixed value. The final result is incredibly simple: 1gsu = (1/256)(rpm/mph). Finding the car speed at some rpm, therefore, just requires dividing the rpm by the gear ratio as read from CAR*.RES and multiplying by 256. Using the relation to figure out the correct gear ratios from the desired maximum speed at a certain gear is just as straightforward. The simplicity of the conversion suggests the game actually uses it at some point of the algorithms.

Torque and mass

Finding out how to convert real torque curve shapes into a Stunts torque curve is probably the most interesting use for the knowledge of Stunts internal units. It is also a more tricky task than the ones presented before, since not only accurate tests for measuring acceleration require careful design but also there's the added complication of having the mass parameter involved as well. To see why, consider the equation:

car acceleration = engine output torque * overall gear ratio / car mass

This is valid as long as there is no aerodynamic resistance (just a question of setting the drag coefficient to zero). Assuming the engine delivers constant torque (and thus acceleration is constant), and using the fact that acceleration = speed change / time elapsed , we can rearrange it into:

engine output torque / car mass = speed change / (time elapsed * overall gear ratio)

Both speed change and time elapsed are known in real-world units (mph and s), and the internal unit for the gear ratio (gsu) is known too. If the internal mass unit (from now on msu) was known as well it would be trivial to substitute everything and find what the internal torque unit (tsu) is. But since both units are not known and it is impossible to find an equation in which they appear uncoupled it becomes impossible to find them both from in-game data only. The best that can be done is to find the ratio tsu/msu. A value of 1(tsu/msu) = (1/330)mph^2/(rpm*TS) was obtained after several carefully-done runs which gave values very close to this simple fraction. The presence of a multiple of 11 in the result is very suggestive, since the conversion from miles to feet (and therefore to the internal length units) also involve a factor of 11.

Substituting units in the above result leads to 1(tsu/msu) = 176/(45*pi)(ft^2/s^2) ~= 1.245(ft^2/s^2). From this point, one needs to make assumptions about either the torque or the mass units in order to find the other one. Starting from the mass, let's consider the following table, which lists the mass of some Stunts cars in-game and in reality. The quoted values come from the database of a cool program, CarTest 4.5, which provides reasonable estimates for car weight including driver and some fuel.

Car Stunts mass (28h) Real mass estimate
Acura NSX 31 3170lb
Lamborghini Countach 33 3450lb
Ferrari GTO 27 2720lb
Porsche Carrera 4 32 3460lb
Corvette ZR1 35 3625lb

The race cars (Indy and IMSA) were excluded due to the lack of reliable data, while Audi, Lancia and LM002 aren't here for they in-game mass is strongly underestimated (far above the average error margin on the table above) in comparison to the other cars. Anyway, from the table it is apparent the 28h values are reasonably consistent, and that an unit byte increase equals roughly 100lb. Now, if we take 1msu = 100lb and substitute back into the previous result we get, after some unit manipulations, 1tsu ~= 3,87 lbf*ft (lbf*ft, usually quoted as just "lb-ft", is the most common Imperial unit for measuring a car's torque). Considering the mass values on the table are always somewhat higher than 100lb*byte_28h and the correspondence between mass values is not extremely accurate anyway, it seems reasonable to round the tsu value to 4lbf*ft for added convenience. That leaves us with the useful relations we had been looking for:

1tsu = 4lbf*ft

1msu ~= 103.375lb

Aerodynamic drag

Air resistance is the main opposing force acting on an accelerating car at relatively high speeds, and thus is an effect of critical importance. Indeed, for a Stunts car speeding through the track, it is reasonable to consider drag as the only significant resistance acting on the car. How the 5Eh/5Fh drag parameter correlates with car behaviour is the last missing piece of information needed to predict from parameters and model from external data straight line car performance with reasonable accuracy.

Aerodynamic drag is most often modelled as a force proportional to the square of car velocity. The simplest way of stating that would be:

drag force = drag constant * (car speed)^2

The "drag constant" referred here actually includes a number of terms mostly related to the car shape (check Physics of Racing for details). While analysing how this speed-dependent force would affect car acceleration in order to estimate the constant value would be very troublesome, an easier approach makes use of a very important effect of drag: it plays a major role in defining the straight line top speed. Admitting the car is only affected by engine propulsion and drag, top speed will be reached when those forces cancel each other, that is:

engine force = drag constant * (car speed)^2 			=>
torque * overall gear ratio = drag constant * (car speed)^2 	=>
(car speed)^2 = torque * overall gear ratio / drag constant 	=>
car speed = square root{torque * overall gear ratio / drag constant}

If our considerations are correct, top speed at a flat straightline should increase proportionally to the square root of engine torque, and decrease in inverse proportion to the drag constant, which in turn can hopefully be identified with the 5Eh/5Fh parameter. Thankfully, that is exactly what happens.

As for finding the internal unit for the constant (dsu), the process is made much simpler by noticing that, at the straightline top speed, the product torque * overall gear ratio is exactly half of drag constant * (car speed)^2. That leads to the unit equation 1dsu = (1/2)*tsu*gsu/(mph^2). This simple relation in internal units, useful enough for most tuning purposes, can be refined further to 1dsu = (1/64)(lbf*ft*rpm/mph^3) ~= 0.00834lb/ft ~= 0.0124kg/m.

Stunts vs. real cars

Note: Some calculations in this section were based on gsu, tsu, msu and dsu values from the old version of this article. The differences are small, though, so the conclusions won't be affected.

So far, so good - we already have the keys to translate a number of CAR*.RES parameters in terms of real physics units. However, in order to do actual modeling from real-world data, we must be sure that the values we calculate indeed have the consistence we expect. The best way to do that is, arguably, contrasting the data on original cars modeled in Stunts with their real counterparts - even if the Stunts models are no standard for accuracy, they apppear to match the real cars reasonably well. As before, the main source of information here will be the CarTest 4.5 database.

Detailed comparisons of gear ratios and torque curve shapes won't be presented here in order to avoid excessive cluttering of the discussion. It can be said, however, that gear ratios are surprisingly accurate for most cars, at least to the extent we can evaluate them - that is, quotients between different ratios for the same car, as opposed to absolute values, analysis of which wouldn't make sense anyway since final drive ratios or tire radius are not in the model. The same can not be said of torque curve shapes, however. Probably the most striking example is LM002: the real car used Countach engines (see Wikipedia on that subject), yet the torque curves for the LM002 and Countach are completely different. Also, maximum rpm, torque and power peak positions normally do not coincide with the real car data, the difference often being in the order of 1000rpm or more. Alongside with the rather wild discrepancies in mass seen for Audi, Lancia and LM002, that suggests quite a bit of improvisation by the guys at DSI during the modeling process... Anyway, some further insight on that matter can be gained by comparing masses, maximum torques and overalll drag coefficients for a few cars. Data will be presented in real units, with corresponding values in Stunts internal units (which as discussed before simply represent byte values for the appropriate parameters) enclosed in brackets. Drag constants were calculated from info available on CarTest as well, but since for some cars frontal section area was missing there is some degree of guessing in them (somewhat less than ~10% in worst cases, hopefully).

Car Real mass (lb, msu) Stunts mass Real max torque (lbft, tsu) Stunts max torque Real drag const. (kg/m, dsu) Stunts drag const.
Acura NSX 3170 (30.8) 3193 (31) 210 (52.7) 183 (46) 0.333 (27.4) 0.328 (27)
Lamborghini Countach 3450 (33.5) 3399 (33) 368 (92.3) 259 (65) 0.467 (38.5) 0.303 (25)
Ferrari GTO 2720 (26.4) 2781 (27) 366 (91.8) 239 (62) 0.354 (29.2) 0.243 (20)
Porsche Carrera 4 3460 (33.6) 3296 (32) 228 (57.2) 183 (46) 0.335 (27.6) 0.303 (25)
Corvette ZR1 3625 (35.2) 3605 (35) 370 (92.8) 287 (72) 0.356 (29.3) 0.400 (33)

Some interesting analysis can be done on the figures presented above. First of all, we see that at least one car, the NSX, both mass and drag are accurate. In fact, even the torque peak (5300rpm on the real car) is correctly positioned! However, even on this very favourable case peak torque is some 13% below the expected value, the understimation getting quite large for other cars (reaching 32.5% for the GTO). However, not all is lost. For all cars but the ZR1, the understimation of torque seems to go hand in hand to a strong understimation of aerodynamical drag (most strikingly for Countach and GTO), as if the developers, while balancing higher gear acceleration versus top speed, tried to compensate one thing with the other... Corvette seems to fail the trend, as its aerodynamics are actually worse than it should. However, the ZR1 torque curve looks very strange even for Stunts standards, as if the low-rpm half got artificially raised for some kind of correction, so it wouldn't be very surprising if the scale was more wrong than usual anyway. But there's still the 13% discrepancy for the NSX... that can be justified, however. The simple model we discussed up to now does not include a number of smaller effects which drain power from the engine output, such as rolling resistance (tire friction against the ground) and energy losses at transmission system. The most consistent way of accounting for these in the limited framework of Stunts car model is scaling down the torque curve, and 13% wouldn't be too bad of an estimate for such a correction.

The bottom line: The unit system adopted works pretty well, and it allows to rationalize for some shortcomings of the original car models of Stunts. If one wishes to convert real values to Stunts, however, scaling down torque curves for about 15%-20% will probably be necessary.

Additional parameters and effects


Brakes in Stunts are a rather straightforward matter. Bytes 2Ah/2Bh define a linear scale of acceleration opposing to the car's movement that determines effectiveness of brakes. With 2Ah = 0 and 2Bh = 1 a car without aero drag will go from 169mph to a full stop in 8.45s. That corresponds to a deceleration of 8.94m/(s^2), or 0.911g (1g = gravity acceleration at sea level); naturally, increments to 2Bh correspond to 1/256 of that amount. The use of acceleration instead of force here is not an oversight: Stunts does not account for mass for braking! Aerodynamic drag will also slow down a car whenever the accelerator is not pushed (at least while the car is planted to the ground), that's why one gets the impression that brakes are more effective at higher speeds. Finally, a curious point is that if both brakes and aero drag are set to zero a car running on straight road will not slow down no matter what you do, due to the complete lack of opposing forces...

Cornering grip

Doing accurate estimates for cornering grip is rather more difficult than for other parameters, since there are variables that are a bit hard to control, the most important of them being test driver precision... The simplest method of measurement is to pick a flat, tarmac large corner and try to find the highest constant speed at which it is possible to complete the corner following the centerline (approximate radius of 93.1m) without sliding/skidding. For CAh = 0 and CBh = 1, that speed is approximately 74mph. That information allows one to find maximum centripetal acceleration available, which is a good enough reflection of maximum grip for our purposes. The equation for centripetal acceleration is:

centripetal acceleration = (cornering speed)^2 / corner radius

Substituting our data gives a centripetal acceleration of 11.758m/(s^2), or 1.198g, for CAh = 0 and CBh = 1. The grip scale is nearly linear, but not exactly, as can be proven by setting zero grip and repeating the test. Cornering without skidding is still possible, even if at 7mph... that may hint on the existence of a very minor secondary factor affecting cornering grip. Notice that again there was no mention of mass - the cornering model does not take it into account to as it was supposed, which is somewhat disappointing... Banked corners of course increase centripetal acceleration, thus allowing higher corner speeds. For the same grip discussed just above, a banked turn can be taken on its centerline at 104mph. That is a 40.5% increase on cornering speed, corresponding to a massive 97.5% increase in centripetal acceleration. Such a large growth in relation to the ~1,2g flat corner grip would require, in reality, a banking of about 50 (!) degrees, obviously much more than in-game graphics display. Of course, this discussion is immaterial, since mass does not affect grip in bankings either, while mechanics tell us the very fact cornering is easier on positive-banked turns is due to a reaction force to the car's weight...

Grass slowdown

The slowdown cars suffer when running on grass resembles aero drag, in that both define limit speeds and, therefore, scale up with car speed. A closer inspection on grass slowdown reveals it differs from drag in that the force is proportional to speed, instead of to the square of the speed (proof is given by verifying limit speeds on grass grow linearly with gear ratio). Moreover, the limit speed is proportional to car mass, indicating yet another effect described in terms of accelerations and not forces. A test car set with 40tsu flat torque curve, 100gsu gear ratio and 12msu mass reaches 63.5mph (that is, a digital speedometer oscillates constantly between 63mph and 64mph). The relevant equation would be:

engine force = grass slowdown force 								=>
engine torque * overalll gear ratio = grass deceleration * car mass 				=>	
engine torque * overalll gear ratio = grass deceleration constant * car speed * car mass 	

Substituting the values gives 0.1444(1/s) value for the deceleration constant. A word of caution, though, that this result is not fully proved to be universal, not at least until someone fully dissects CAR*.RES and proves grass slowdown is not regulated by some odd unknown parameter.

Airborne and ramp behaviour

(in progress)

Power Gear and Anti-Power Gear

There used to be an theory here about PG/Anti-PG effects, but it was clearly wrong. An up-to-date explanation can be found at the forked article Power gear bug.

See Also

  • Car files, a general overview on file structure of a Stunts car.
  • Car parameters, a general-purprose tuning guide with concise descriptions of relevant CAR*.RES parameters.