All you need to know about physics in games

The future is for levels to be built not like 3D worlds, with 'a castle' and 'a watch tower' dumped onto a map as a single entity, but for them to be constructed out of pieces like their real world counterparts with each component capable of being affected by the player directly.

In this kind of map, you could deal with a sentry in a tower by either shooting him with a sniper rifle as usual, or grabbing a car and ramming one of the legs to make it topple over. Instead of being a scripted sequence or a set-piece added by the designers, you could solve every situation by thinking out of the box confident that every action really would get the right reaction. Crysis recently took the biggest steps in this direction, but there's still a long way to go.

Soft bodies bend best

The next level up is soft-body physics. These are what you use for more bending objects, squish, be sliced up, or otherwise be flexible. To get a better idea of the difference between these and rigid body calculations, imagine the difference between throwing a rope at a wall, and throwing a cardboard box.

Cloth is one of the most common soft-body effects, and an excellent demonstration of an item that can be torn, twisted, ripped, and take the form of other objects. Due to the incredible amount of maths required, most games still cheat with keyframe-based animation or rigid body physics on things like ponytails.

In future games, characters will be able to wear clothes just like we do, baggy in all the right places, and every bit as subject to the effects of wind, rain. The possibility of doing the same with bladed weapons could make for at least one fantastic Tomb Raider sequel.

The main reason cloth is so difficult to render is that it's incredibly mathematics heavy, especially when it comes to controlling deformations and preventing its own polygons from intersecting. As a result, it's rarely been anything but a gimmick, thrown in every now and again in games like Splinter Cell.

Into the vortex

One of the most vivid demos came with the launch of PhysX, and the CellFactor demo. For a while, this was roundly mocked online after gamers realised that by simply adding 'Enable PhysX=false' to the configuration file, anyone could smash their way through crates and experiment with the impressive vortex effects and insane numbers of polygons on screen at once.

However, as soon as cloth was added to the mix, performance on machines with no hardware support instantly dropped to a single-digit fps, vindicating the hardware… at least, in part.

The final key type of physics engine on offer is the particle engine, used to create everything from explosions and flowing water to flamethrowers, and effects on every level. The designer starts with an emitter, which sprays out particles – think of them as dots, with no mass or other effect. These can be treated like fluid, if channelled and made subject to the laws of gravity, or sprayed up into the air to be caught by virtual wind.

On their own, they're invisible and not even there, but when the designer attaches the right texture or shader, the effects can be mindblowing. In practice, most games cheat considerably here, with particle effects used exclusively for visual feedback, and the actual calculations taking place under the hood.

It's not the fire itself that burns you, but the designer assigning the bit of the ground underneath it to do so. Either that or the game doing some quick mathematics to see if you're standing in range of the flamethrower's arc of fire.