Chapter 13. Physics

The use of physics in games has become quite popular in recent years. It is not as if older games do not use physics engines, but recently many shooter games have complex physics systems that are only possible because of the immense increase in computing power and multi-core systems. Even hardware PPUs (physics processing units) are available today, similar to GPUs that just handle graphics. These processors are just for calculating physics.

The games that use physics the most are first-person shooters, especially if the games permit a lot of freedom and enable the player to walk around freely and interact with the scenery. One of the most popular games, Half-Life 2 (launched in 2004), used a lot of innovative physics techniques and also involved physics in the game play and mission design.

Half-Life 2 uses the commercial physics engine Havok internally, but there are several other physics frameworks, which are discussed in a short while. Sadly none of these frameworks work on the Xbox 360 with the XNA Framework because they all use unmanaged code, which is not allowed on the Xbox 360 when you develop games with XNA. On the PC you can use whatever you like, and this chapter discusses which framework might be the best to use right now. The Racing Game that you are currently developing will not make use of any advanced physics framework for that reason. It is also a lot of work to implement and test such a powerful framework, and most of the physics engines are expensive ...

Get Professional XNA™ Programming: Building Games for Xbox 360™ and Windows® with XNA Game Studio 2.0, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.