Skip to navigation


An overview of the driving model

Secrets of the sophisticated driving simulation that powers Revs

When it was released in 1985, Revs boasted a number of features that were pretty unusual for their time, but which are now staples of the racing sim genre. The slick 3D graphics and low-slung cockpit view weren't unique - 1982's Chequered Flag on the ZX Spectrum can claim to have pioneered both of these - but their implementation in Revs was more impressive than most. Then you have the working wing mirrors, which was a very novel feature, and the game's support for analogue input, which was particularly rare in a world dominated by arcade games... though not many home computers of the era had a built-in analogue port like the BBC Micro, so perhaps that's more of a unique platform feature than anything else.

The addition of computer assisted steering in the 1986 Superior Software version was a genuine innovation, introducing a feature that would become a staple of keyboard-controlled racing sims for years to come, but hands-down the most ground-breaking feature of Revs was its sophisticated driving model.

Nobody had modelled the physics of motor racing to the extent that Geoff Crammond managed in Revs, and the access that he had to David Hunt and his racing team through Acorn's Formula 3 sponsorship deal meant he could really knuckle down on the engineering detail. Revs was by far the most realistic racing sim of its day, and its driving model still holds up today; check out this video on YouTube from GPLaps showing how Revs performs when hooked up to a modern driving wheel - the driving model still holds its own.

It's because of this sophisticated physics engine that Revs is regarded as the grandfather of the modern racing sim, so let's take a deeper look at what makes the driving model so special.

Summary of the driving model
----------------------------

In this deep dive and related articles, we're going to explore a detailed breakdown of the driving model, which is implemented in the ApplyDrivingModel routine. The model's calculations are complex and involve a number of stages, all of which are outlined in the table below.

Click on the description links to read more details about each stage, or click on the code links to see the relevant code. The description links will take you to the deep dive on the core driving model, which looks at the main parts of the model in detail. From there you will find links through to the other deep dives into the driving model, which cover driving on grass, skidding, jumps and drops and modelling the engine.

For now, though, here is the Revs driving model, in all its glory.

StageDescriptionCode

1

Calculate the rotation matrix

Calculate the sin and cos of the player's yaw angle

GetRotationMatrix

2

Rotate velocity into car's frame of reference

Apply a rotation matrix with these values to rotate the player's velocity vector into the car's frame of reference

RotateCoordToCar

3

Set speed-related variables

Set the player's speed and moving flag, and store the sideways velocity for later use

ApplyDrivingModel

4

Set spin-related variables

Store the spin velocity for later use

ApplySpinYaw

5

Calculate height of bumpy grass

If we just hit the verge, jump the car, and if we are driving on grass, calculate the height of the bumpy ground

ApplyGrassOrTrack

6

Calculate wing and brake downward forces

Calculate the downward forces due to the wings and the brakes (if applied)

ApplyGrassOrTrack

7

Calculate engine torque

If the engine is not running, process the engine start, otherwise calculate the engine torque and revs, depending on the gear and throttle

ApplyEngine

8

Calculate rear tyre forces

Calculate the forces due to the rear tyres, and whether the tyres are skidding

ApplySpinYaw

9

Apply rear tyre skidding

If the rear tyres are skidding, make the tyres squeal and update the tyre forces

ApplyTyresAndSkids

10

Calculate front tyre forces

Calculate the forces due to the front tyres, and whether the tyres are skidding

ApplyDrivingModel

11

Apply front tyre skidding

If the front tyres are skidding, make the tyres squeal and update the tyre forces

ApplySteeringSpeed

12

Apply resistance due to steering

Add the effect of steering to the forces on the front tyres

ApplySteeringForce

13

Calculate the spin delta

Calculate the amount of spin caused by the difference in the front and rear tyre forces

ScaleTyreForces

14

Scale the forces

Scale the tyre forces and store the results for use in the braking calculations in the next iteration of the main loop

ScaleTyreForces

15

Convert tyre and wing forces into acceleration

Apply Newton's second law of motion to convert the tyre forces into acceleration

ScaleTyreForces

16

Zero acceleration when jumping

If the car is jumping and not touching the ground, zero the acceleration and spin

ApplyDrivingModel

17

Apply drag

Apply drag to the acceleration calculation from the car passing through the air

ApplyWingBalance

18

Rotate velocity into world's frame of reference

Rotate the acceleration vector back into the world's 3D coordinate system, so we can apply it to the car's coordinates and velocity

RotateCarToCoord

19

Update player velocity

Apply the calculated acceleration to the player's velocity in the 3D world

UpdateVelocity

20

Update player coordinates

Apply the updated velocity to the player's coordinates in the 3D world

ApplyDeltas

21

Apply jumps and drops

Calculate the car's height above the ground, set the position of the horizon line, set the car's y-coordinate and pitch angle, and if we are jumping, apply gravity so the car drops and bounces when it hits the ground

ApplyElevation

To continue exploring, check out the deep dive on the core driving model.