The Physics of Racing Games

Motor vehicles come in a huge variety of shapes
and designs each tailored for a specific purpose. Whether that be simply getting you from A
to B in comfort and safety, travelling around a well paved race track in the shortest time
possible, crossing difficult terrain, or sliding sideways around a corner. Each have been carefully crafted by their
engineers to excel in their disciplines. Last month Ubisoft invited me to the Red Bull
Ring in Austria to drive in 4 incredibly different vehicles. The KTM x-bow, an ultra-lightweight track
car, driven by a professional driver. An 0ff-road buggy, a Land Rover defender,
and a Porsche Cayman S, driven by a complete idiot. All this to get a better idea of how these
vastly different vehicles perform in real life, and to discuss with the programmers
of Ubisoft’s new game, the Crew 2, about their process for programming their vehicles
how to behave in game. “So, my name is Stephane Janjowski and I’m
producer at Ivory Tower, Ubisoft Studio, and the Crew 2 obviously.” Speaking with Stephane, I started to get a
much better idea of the relationship between real world physics and in game physics, and
just how developers programme vastly different vehicles like these to perform like their
real life counterparts. Unlike real life, where boy racers love to
destroy their cars with modifications that negatively affect performance, the in game
engine separates the physics model from the 3D model. “When we do the 3D model that’s one part
of the vehicle and then we have the pure physics model, that is seperate from the 3D.” The physics model creates a model where things
like the wheels are independent physics objects, with their own friction and mass modelled. The separate 3D model allows the developer
to pick and choose what cosmetic changes to the vehicle affect performance, for example
spoilers are not treated as aerodynamic surfaces in the Crew 2, so your inner idiot can apply
spoilers on front wheel drive cars to your heart’s content. One of the few cosmetic features in game,
that does affect the performance of the vehicle, is the suspension. Suspensions are a system of springs, shock
absorbers and linkages that connect the vehicle body to it’s wheels, with a goal of keeping
the tires in contact with the ground while minimising the transfer of that motion to
the vehicle body. This provides provides comfort for the passengers
of the vehicle, not much of a concern for a video game, but they also determine how
the vehicle will handle bumps and corners. Off road vehicles have incredibly soft suspension. This allows them to run over rugged terrain
at high speed without transferring too much force to the body of the vehicle, but with
one significant drawback. While cornering, or driving over slanted ground,
a large amount of weight of the vehicle is shifted onto one side of the car. With suspension this soft the vehicle is extremely
susceptible to roll, as the body is fairly free to tilt upon the wheels, combine that
with a fairly high centre of mass and it’s a disaster waiting to happen, especially when
you put an attention seeking australian vlogger in the driving seat. And while you can’t roll-over your vehicle
in game, as the physics engine applies a torque to car, when it rolls too far, but it does
allows enough roll for the suspension model to behave realistically, which feeds into
traction physics model. Cars designed for tracks will always have
stiff suspensions. This helps them keep their tires in contact
with the ground, ensuring traction is not lost in corners through tilting, while maintaining
a consistent ride height, an important characteristic for vehicles like the x-bow, as it’s undercarriage
forms a significant part of it’s downforce generation though it’s rear diffuser. It’s important to maintain a low centre
of gravity too, as this minimises that rolling effect we saw earlier. The one draw of back stiff suspension like
this is ride comfort. I was in the passenger seat of the cross-bow
for a couple of laps, and boy do you feel every bump. You can see the effect of suspension stiffness
and weight distribution, which is simulated in the physics model accurately, on traction
very well in game with front engined, rear wheel drives like the Ford Mustang GT, that
is particularly easy to drift around a corner. By lifting off the accelerator and hitting
the brake at the apex of a turn, the g-forces of deceleration causes the heavy front end
of the vehicle be pushed downwards, lifting the rear axle and causing the rear tires to
lose grip, thus initiating over-steering. This is a lot of fun, and the penalties on
speed in game are fairly miniscule, but in real life this is something the designers
of racing vehicles want to avoid as you cannot apply full power if your wheels are slipping
and you lose forward velocity by sliding sideways, so most racing cars are mid engined to maintain
grip on the rear tires during braking, and keep the suspension stiff to ensure the balance
between tires is as close to the ideal as possible. Keeping the weight evenly distributed between
the front and rear tires in corners is important because it creates a vehicle which does not
over or understeer. Over steering being drifting, where the back
wheels lose traction, and understeering is where the front tires lose traction, diminishing
the steering tires ability to dictate the direction of the car. Allowing momentum to take over. In a race you want neither, but this is steer
a video game, so you can adjust both your front axle grip and your rear axle grip to
encourage these effects, this slider simply adjusts the coefficient of friction being
applied to the tires in the in game physics engine, which adjusts the traction force the
tires can apply to the ground. Traction is one of the primary tools the developers
will play around with to change the feel of the game, as this is the one that dictates
how the vehicle will interact with the road. More realistic games, like simulators, will
do their best to model traction as realistically as possible, but may give you optional driving
assistance to make the game easier, for example at higher speeds the max steering angle will
be limited to help with overtaking with clumsy thumbstick controls. Leading to many cars behaving like understeering
cars, where if you take corners at too high speed you will end up crashing into the barrier. But without the driving assist the result
would have been pretty similar anyways, you may have just spun a few times instead like
I did when driving the Porsche with the traction control off. You just need to learn to manage your speed
in corners better. Games aiming for an arcade feel may do away
with this mechanic and separate traction from steering mechanics all together, allowing
you to take corners at any speed with no worry. The Crew 2 lands somewhere in the middle,
it’s obviously an arcade game. You can take ridiculous jumps like this in
a Ford F-150 Raptor race truck at 180 km/h and land without destroying your car, and
then take a turn take a turn at 200 km/h on a dirt track without losing lateral traction. The traction here has just been boosted to
make the game easier and more fun to play Next up let’s look at how the power of the
engines are handled. Now obviously the computer programmers do
not simulate an entire engine and transmission system to determine vehicle performance. Take this Porsche 911 GT3 RS, in this clip
it does 0-100 km/h in 3.2 seconds, pretty much identical to it’s real life counterpart,
even with the nitrous boost. The programmers want the relative performance
between vehicles to be relatively accurate, as it would make no sense if a Mazda RX-7
was beating a Porsche 911 GT3 RS in acceleration and top speed. To understand how acceleration and top speed
are programmed, we first need to examine what forces are acting to slow the vehicle down. The top speed of a car is primarily dictated
by the drag force acting on the vehicle, which is something we examined before in my helicopter
versus car top speed video. The equation for drag force is provide by
this equation, and the equation for power is simply force times velocity. By rearranging these variables we get this
equation for top speed, which the physics engine uses to limit the vehicle’s top speed. The programmers can adjust the top speed of
each vehicle simply by adjusting it’s max power, coefficient of drag or frontal area. If they really wanted to they could change
the air density with elevation on the map too. Adjusting the acceleration is slightly more
difficult as the acceleration is determined by several factors which vary with the vehicles
speed. The primary variable that are concerned with
is wheel torque, which varies dramatically for internal combustion engines across different
engine rotation speeds and gear ratios. The force applied by the wheel to the ground,
if there is no tire slip, will vary with the torque applied divided by the wheel radius. The wheel radius is just one part of the internal
gearing system that needs to be considered when calculating the force the wheels will
impart on the ground. The vehicle will have several gears it can
cycle through at different speeds to change the applied wheel torque and will have one
permanent drive ratio that is determined by additional gearing in things like the differential. All these parameters will be programmed into
the in game vehicle, and the final wheel torque will be determined by this equation. Where Te is the engine torque. The engine torque varies across different
revolutions per minute of the engine, and we define that variation with a torque curve,
like this one for a Porsche Cayman S. The programmers will again actually input the
vehicles torque curve into the vehicle parameters to ensure if performs like the real deal. Designing games like this is always a delicate
balance between realism and fun. The developers don’t always go for ultra
realism, programmers will often play around with their world’s physics variables like
the lateral traction to give a more arcadey feel with exaggerated drifting, or simply
to make the car easier to drive around corners at high speed. Or like in this game you can switch from being
a plane to being a boat in mid air. There is no real ad read here, I simply want
to say thank you to Ubisoft of inviting me out to such an exciting event and allowing
me to chat with the programmers of the game. If you are into car video games, The Crew
2 is out now.

Leave a Reply

Your email address will not be published. Required fields are marked *