I've been lurking about in the AI code for a bit. Though I'd share my $0.02 about my interpretation of the collision detection routines...
From what I understand, as each object is created (cargo, ship, weapons fire, asteriods...) it is added to the global "pairs" list. The Pairs list is itterated through to check for collisions between thos two objects. If it is not on the list, no collision detection is performed.
A new "pair object" is created for each combination of that object with every other object that it can collide with. So, if there are, say, 8 ships, with each ship having 10 "shots" flying about, for a total of 88 objects, the number of "pair" objects would be nCr(88,2) or "88 choose 2" combinations, which comes to 3828 pairs.
Acutally lasers to not collide with lasers so this may not be quite accurate; but close enough!
There are exceptions though. Asteroids do no collide with each other and so, do not form pairs.
So, extending our example, with 8 ships, 10 shots each, and 200 asteroids, we get nCr(88,2)+88*200=21428 pairs. (It's "88*200" since asteroids do no collide with one another; 80 shots in the air + 8 ships). The problem is that MAX_PAIRS is set to 8000.
There was some discussion about pointer overruns and such. I've found that, in general, the code is quite robust. The routine that creates and adds pairs checks the MAX_PAIRS limit. Once the limit is reached, it stops adding to the pairs list and so, all remaing objects are not checked for collision detection. Since ships and asteriods are created first, they are likely to be on the list before it overflows. Weapons fire is added as it is generated. If the list has overflowed, collision with the weapons fire will not be performed and, hence, has effect anywhere. However, the player ship can still collide with the asteroid since they have been added to the list before it overflowed. The rendering of the objects is handled completely separately so is not affected by the list state.
It seems that the simple solution would be to increase MAX_PAIRS to some large number, say what's MAX_INT again? 16- or 32- bit? So, putting maybe 4 ships, each having 10 shots in the air, and 500 asteroids: nCr(44,2)+44*500=22000, which is way under 65535. I can't comment on performance though...
Conclusion? Somone has already tried to increase the MAX_PAIRS define but I suspect that it should be increased by a large amount. I don't have my development environment setup so someone will need to try it and correct me.
In addition, it may be kinda neat of asteroids can collide with one another can explode into smaller pieces. Easy to do, but you can imagine the number of pairs ( nCr(500,2)=124750)...
AI is *much* more fun than collision detection:D