Thousents of bullets logic/performance logic

I was playing some old retro games and started wondering how did they do it back then. There where shootemups games where you literally had hundreds of bullets flying around the screen. And any of them could kill you.
I have been reading some cocos books (old but still valid I guess), and it seems that the logic is to store all the bulllets on screen in a ccArray and in the update method you do a CCARRAY_FOREACH (which i guess in cocos3dx 4.0 is now CCARRAYDATA_FOREACH).
So if you have say, 200 bullets, and the game is 60 fps, it means that the update method is checking 12000 intersections per second!! + everything else in your game logic.

I come from a CGI background where you move meshes with thousents of vertices per second ar 24 fps, which is kind of normal. So I wonder, being new into game development, if 12000 intersection checks per seconds is crazy or is doable.


ok, I’ve been reading abit on the topic and it seems that the best way to do it is to use a pool and sphere colliders (apparently faster than box colliders). So insteand of instanciating and destroying all the bullets,
they are created all at once off screen, and then just move around and reposition out of screen when not needed.

1 Like