Game Development Reference
In-Depth Information
A physics engine is just one component of a game engine. The other components include
the graphics engine, audio engine, AI engine, and whatever other engines you may
require or whatever other components of a game you may elevate to the status of engine.
Whatever the case, the physics engine handles the physics. Depending on whom you
talk to, you'll get different ideas on what composes a physics engine. Some will say that
the heart of the physics engine is the collision detection module. Well, what if your game
doesn't require collision detection, yet it still uses physics to simulate certain behaviors
or features? Then collision detection certainly cannot be the heart of your physics en‐
gine. Some programmers will certainly take issue with these statements. To them, a
physics engine simulates rigid-body motion using Newtonian dynamics while taking
care of collision detection and response. To us, a significant component of a physics
engine is the model—that is, the idealization of the thing you're trying to simulate in a
realistic manner. You cannot realistically simulate the flight characteristics of a specific
aircraft by treating it as a generic rigid body. You have to develop a representative model
of that aircraft including very specific features; otherwise, it's a hack (which, by the way,
we recognize as a valid and long-established approach).
Earlier, in Chapter 7 and Chapter 13 , we showed you several example simulations. While
simple, these examples include many of the required components of a generic physics
engine. There are the particle and rigid-body classes that encapsulate generic object
properties and behaviors, physics models that govern object behaviors, collision detec‐
tion and response systems, and a numerical integrator. Additionally, those examples
include interfacing the physics code with user input and visual feedback. These examples
also show the basic flow from user input to physics solver to visual feedback.
In summary, the major components of a generic physics engine include:
• Physics models
• Simulated objects manager
• Collision detection engine or interface thereto
• Collision response module
• Force effectors
• Numerical integrator
• Game engine interface
Physics Models
Physics models are the idealizations of the things you're simulating. If your physics
engine is a generic rigid-body simulator used to simulate an assortment of solid objects
your players can knock around, throw, shoot, and generally interact with in a basic
manner, then the physics model will probably be very generic. It's probably safe to as‐
Search Nedrilad ::




Custom Search