I've gotten many simple games up and running, and now I'm in the process of making a bigger one. In my smaller games, I would simply check if 2 objects were colliding in the game loop, for example, in Pong:
if(paddle.collides(ball)) {
ball.bounce();
}
But now that I'm starting to upscale, it seems that I need a better, more flexible solution. I assumed this would be a common problem, but when I looked up “Collision engine”, I mostly got results on how to implement real life physics. The problem with this is that some objects colliding will have no effect, but the collision engines check all the objects against each other.
For example, one method that I've seen is to add every entity to a Quadtree. Then when the collision system detects a collision, it sends an event to another system to handle it. However, if you have 1000 bullets which can't collide with each other, the collision system checking in between them seems like a waste of cycles.
Another thing that I'm confused about is how the collision system should handle the collisions themselves. I'm using an Entity Component System structure, so right now I'm using a system that loops through all entities with a BoundsComponent, and checking them against all the other ones. But there are many different types of entities, some that do damage (bullets), some that have health (player), and some that are static (rocks). How should the collision system handle this?
Also, just another side question: If I'm using a Quadtree, should there be one for each type of entity, or one for all of them?
Sorry if I'm missing something here, I'm just really confused on how most games handle this.
Thanks!