The Top 10 Things I Learned in My First Semester, #4

The physics engines bundled in with modern game development IDEs are incredibly powerful and convenient. However, they’re also expensive in terms of processor cycles, and they tend to lock you into default behaviors. If you don’t need the full capabilities of a physics engine, you’re better off coding your own solution.

It might seem strange not to take advantage of built-in functionality, but most games don’t need true, complete physics simulation. Platformers, for example, are most likely satisfied with simple collision detection. Mario needs to know if he’s touching an enemy, the ground, or a block, and that’s about it. Similarly, FPSes need to know if bullets are occupying the same space as targets; they probably don’t require, or even want, realistic simulation of objects moving in three dimensions. The things these games actually benefit from can be accomplished with very simple code that doesn’t implicate the enormous complexity of a fully-fledged physics engine.

Programming just the physics bits you need has two key advantages. First, it’s easier for the computer. There’s no good in wasting processor cycles on unimportant calculations; that irks people with strong machines, and cuts out those with older computers entirely. Efficiency might not seem like a bit deal in an era when many laptops have discrete GPUs, but there are potential customers out there who will care.

Second, programming your own physics systems lets you control them precisely. Commercial physics engines aren’t appropriate for every project. They come with their own assumptions, defaults, and, well, quirks. Making your own collision detection or gravity allows you to make assumptions, set defaults, and choose quirks that will be ideal for your particular game.

Physics engines are often great–a boon to design. However, that doesn’t mean you should adopt them blindly and use them whenever you’re doing something vaguely physics-y. Building the (probably few) physics elements you need can offer substantial gains in both efficiency and control over your design.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s