collision detection speed

Blitz3D Forums/Blitz3D Programming/collision detection speed

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

For my qoob editor, by using a little tweaking here are there I have managed to get 15,000 plus entities all with collision detection on screen at the same time running at a renderworld/updateworld of 60 FPS on my laptop (which locks the refresh to 60 FPS).

I use a intelligent cull every second. Basically I hide any entity that cannot ever be seen (ie obscured by other entities). I also use fog and hide any entities that are beyond the fog range.

For the game itself where I had originally (sharp intake of breath) 90,000 surfaces I have now managed to get it down to JUST 6 surfaces :-) I also remove all tris that cannot be seen too.

For speed improvements I would strongly suggest reducing the surface count. Then reduce the visible entity count then try and remove tris where possible. You could also try employing a shorter camera range and use camera fog...

I have found that using EntityDistance too often will kill your FPS too so you certainly don't want to call it too often. I keep an array of stuff that is visible and check that instead as its FAR quicker. I am now thinking of also adding a check to only call the cull routine is the player haas moved far enough into the fog to possible see something that is currently hidden.

I certianly would keep at this problem as my game with 15,000 entites was starting to look impossible to do with Blitz till I employed the above techniques.

Sorry for the rant but hope it helps...