Efficient collision detection

Paragon
01-10-2004, 05:40 PM
I'm working on an RTS kind of game. When I get lots of multiple units moving at the same time, it runs slow. Right now I have the timer ticking 24 times a seond to move things, and I would like to keep it that fast because it looks better. My collision detection consists of a for loop that checks every other unit and makes sure the current one isn't moving onto it, and I think that's the major thing slowing it down. Is there a more efficient way to do this?
(by the way, I'm actually using .NET but I didn't notice there were separate places to post and I don't know how to move this)

Iceplug
01-10-2004, 06:23 PM
Well, you could probably break your RTS map into sections and then, depending on the sector that they are currently in, check collisions with the other objects in the sector. :)
Or you make a 2D array that stores if there is a unit on a particular square (you can make it Boolean, or BitArray, or anything).

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum