Physics in Modern Video Gaming

What we now have today is a glorious amount of simulated physics being integrated into our video games both to simply enhance the realism of environments as well as taking center stage in game play

The Basics

There are many examples of simulated physics being useful in video games, such as a cloak billowing in the breeze as a character walks, items that a character can throw or accidentally knock down, a stream that flows around those objects and carries them away, the ability to fly an aircraft realistically or roll that convertible that the player just stole, and of course everyone's favorite, explosions! The reason that physics calculations in video games become so complicated is usually due to the sheer amount of variables, both dependent and independent The complexity is then compounded by the amount of simple graphical and textural fidelity demanded today:

For example, the video below is from a recent independently developed game entitled Spintires (Oovee Game Studios, 2014), an offroad driving simulator in which players must complete objectives such as rescuing other stuck vehicles or hauling resources such as fuel and lumber through treacherous offroad environments.

(This game, by the way, uses the Havok engine mentioned earlier)

The first point where the physics gets really interesting is at about 0:40. You see the driver (cursing continuously in Russian) get himself stuck in a very muddy section on the side of the road. While this is an easily recognizable, simple scenario to us, it is mathematically incredibly complex:

1) The Mud
The Hero (or villain, if you're the angry driver) of this whole experience is the road (or lack thereof). You see the vehicle displace mud , leaving ruts and ridges very similar to what we would expect to see in real life. Now, because computers can, at their base level, only work with discrete values (they are only binary, after all), at some small resolution that mud must be modeled as a mesh of small particles, each of which is bound to its neighbors and overlayed with a smoothing texture. The mesh can only be moved by objects that are allowed to move mud. When this occurs, the game must calculate how deep the rut is based on the flexibility of the mesh, in what direction the displaced mud moves based on the surrounding terrain and direction of acceleration. The amount of torque transferred to the axles of the vehicle is dependent on the coefficients of static and dynamic friction between the tires and the mesh. The tires are also given the appearance of bulging under the varying forces applied on them, which must be roughly calculated to create an accurate-looking bulge. (which does not actually effect friction etc. Imagine if it did.)

2) More Environment
There are also rocks that can move, trees that can be bumped or knocked over depending on force applied and water that works similarly to mud (with lower viscosity of course)

3) The Vehicle
The vehicle has several restorative forces applied to it in the suspension and the twist occurring on top of that between sections of the vehicle. There is also gravity's effect on any trailers attached to the vehicle, as well as shifting cargo such as logs that can roll and fall out of the trailer.

If you roll all of these situations up into one event (which happens often in the game), and take into account the fact that the meshes are of at least high enough particle resolution to create the appearance of a continuous, realistic surface, the number of calculations required is quite staggering. The position of one of the thousands and thousands of particles of the active mesh section is constantly being calculated to ensure real time changes, on top of all the environmental interactions with the mesh and the vehicle.

This rapidly increasing level of complexity is becoming noticeable in many new games. As you can see, the big issue is simply the massive number of factors to take into account.

When it comes to physics calculations one must keep in mind that computers are, in fact, incapable of performing mathematical integration as we think of it – they must perform some form of numerical integration, which means that at some point, any physics calculation requiring an integral boils down to operations involving sums of very small sections, based on the fundamental sum used to define integrals, the Riemann Sum:

riemann sum definition

This massively compounds the amount of calculations that a processor has to perform and numbers it must store throughout the course of a large physics calculation.These sorts of calculations can often be avoided for games, however, as the final appearance is all that matters – not the accuracy of the values that come out. This should give an idea of how much greater still the power required for actual full scientific simulations is. The example here using Spintires shows that, while there's a lot of factors involved, the game is still not required to fully simulate "physics" per se, only as much as is necessary to be able to (for example) throw a mesh over and make look realistic.

next: The fact that games do not have to simulate physics fully, in tandem with the inherent shortcomings in all computer physics simulation, can lead to some academically telling and extremely hilarious bugs.

next

back