The Allegro Wiki is migrating to github at

Collision detection

From Allegro Wiki
Revision as of 19:02, March 14, 2008 by CGamesPlay (talk | contribs) (recat)
Jump to: navigation, search
This article is incomplete and needs some revision or has some pending TODOs. Please help Allegro by editing and finishing it. When the article becomes complete, you may remove this tag.


Arguably the most important aspect of incorporating a system for collision detection into a design document or product is choosing the technique that best suits your particular project. Collision detection is a vast and often confusing topic. While one particular method may suit a project perfectly, it can also be entirely illogical for another. After all, a roguelike isn't likely to need a pixel-perfect implementation, while a game incorporating an advanced physics engine may well require something slightly more precise. At the end of the day, choosing a method for collision detection involves considering the key aspects of your projects gameplay and weighing them against your various computational constraints. That is to say, if you are anticipating the need to check collisions against thousands of particles at a fairly frequent rate, you will want to be find a good balance between accuracy and computationally inexpensive routines.

Bounding Box

While not the fastest method of collision detection (and not technically even a method for collision detection), Bounding Box (BB) is often a favourite among many developers. Put simply, this technique involves checking whether an object has intercepted (overlapped) an invisible square boundary that is usually placed over, and often remains relative to, a game object.

Click here for more information on Bounding Boxes and their implementation