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.
Calculate the sin and cos of the player's yaw angle
Apply a rotation matrix with these values to rotate the player's velocity vector into the car's frame of reference
Set the player's speed and moving flag, and store the sideways velocity for later use
Store the spin velocity for later use
If we just hit the verge, jump the car, and if we are driving on grass, calculate the height of the bumpy ground
Calculate the downward forces due to the wings and the brakes (if applied)
If the engine is not running, process the engine start, otherwise calculate the engine torque and revs, depending on the gear and throttle
Calculate the forces due to the rear tyres, and whether the tyres are skidding
If the rear tyres are skidding, make the tyres squeal and update the tyre forces
Calculate the forces due to the front tyres, and whether the tyres are skidding
If the front tyres are skidding, make the tyres squeal and update the tyre forces
Add the effect of steering to the forces on the front tyres
Calculate the amount of spin caused by the difference in the front and rear tyre forces
Scale the tyre forces and store the results for use in the braking calculations in the next iteration of the main loop
Apply Newton's second law of motion to convert the tyre forces into acceleration
If the car is jumping and not touching the ground, zero the acceleration and spin
Apply drag to the acceleration calculation from the car passing through the air
Rotate the acceleration vector back into the world's 3D coordinate system, so we can apply it to the car's coordinates and velocity
Apply the calculated acceleration to the player's velocity in the 3D world
Apply the updated velocity to the player's coordinates in the 3D world
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
To continue exploring, check out the deep dive on the core driving model.