• Advertisement
  • entries
  • comments
  • views

Collision Detection and Messaging

Sign in to follow this  


After a brief rant about Nintendo, wii return to message based game architectures...

After considering how a message passing system would integrate with my game, I can see how it will be immensely useful for areas such as artificial intelligence. In fact, it can solve the problem I was stuck on in the original shmup I was designing; how to get enemies to efficiently communicate with each other for pattern based formations. My main concern at the moment, while I'm working with the high-level architecture decisions, is how low-level do most games take messaging?

I'll pick an example and try to think it out as I type. I'll consider 2D collision detection, which is critical for an action game and probably the trickiest part of the logic for my sample shmup game. In a hardcore shmup, there might be about a couple of dozen ships on the screen, and maybe several hundred projectiles. If everyone of those projectiles sent a message every frame to check which other objects it could be colliding with, that would add up to a lot of CPU processing time.

The way I would usually approach a problem like this is to order all the objects in some fashion, such as by sorting the objects by the upper-left corner positions of their bounding boxes, or by segmenting the game world into sectors to lower the number of objects to be compared. I suppose it is still appropriate, but I guess the messaging would be done via the "collision detector" keeping track of all objects, and then messaging them directly if they collide. But do I need to message everything in that fashion? Maybe this needs a rethink.

I also guess I need to research collision detection a bit more thoroughly. Do most shmups have pixel perfect collision detection, or would a simplified bounding geometry work just as well?
Sign in to follow this  

1 Comment

Recommended Comments

Well, for formations most shooters that I've seen just pre-arrange the units in that shape.

I'd use simple bounding geometry, but instead of a message system for collisions just do your traditional O(n^2) search for bullets and ships. You could speed it dramatically up by using a division system (like octrees/quadtrees) but that's just getting a little bit obsessive compulsive.

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement