Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm working on a relatively generic 2D AABB collision detection system for a game engine, and I've re-written it more times than I'd like to admit due to not calculating/recording specific details of each collision. Right now this is what I'm collecting:

  • Collsion Time (the fraction of an update cycle in the game loop)
  • Location of the collision
  • ID of the colliding object

Each object has a Set that holds this data for each collision (I'm working with a Component/Entity System) so other Systems can use the data recorded. The problem I just ran into was I needed to know which side of the object the collision takes place on.

Now, my question isn't how to determine this, but rather what other values/points of interest should I calculate/record per collision? Or, what do you look for in a standard collision detection system?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

It depends.

What factors into the collision resolution? Depending on how sophisticated you want the engine to be, you may want to know the velocity at time-of-impact, which objects were involved in the collision, as well as many other factors. This is where I would give you the advice to write games, not game engines.

If you write a game, you can know what you need to support. If you write a game-engine, you have to make decisions like these, on what you're going to support and what you're not going to support.

If you're creating a game like Braid, where you can manipulate time, you might need to know everything you did, in order to undo the collision.

share|improve this answer
1  
Great answer and blog post. The advice, I feel, has a lot of crossover value to framework design in all fields of programming. +1 –  Jonathan Wilson Jul 30 '12 at 5:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.