Hiya! I’m making a platformer and don’t have any CURRENT problems. I’m a bit afraid of the performance of collision checking in the future, though. In my current game engine, there are collision objects, and moving objects that are affected by collision objects. There is only one player, so each collision object only needs to make one comparison at the moment. The total number of comparisons before each update is equal to the number of collision objects. This is going to change, though, as I’m going to create enemies and possibly npcs. If there are 2 enemies and 1 player, then the number of comparisons that need to be made triples. If I made 50 enemies on a map at once, it could be a disaster depending on how big the map is.
I’m thinking of developing a quadrant based system in which collision comparisons are done independently within each quadrant. Problem is, I don’t really know how to implement something like this. I was thinking that I would make a quadrant class where each instance would hold a set of collision objects. The quadrant itself would make a comparison with the moving objects, and if the comparison passes (the moving object is touching the quadrant…), each collision object within the quadrant would make its comparison. Each quadrant would have to make a comparison with each moving object first after every update.
Would this be a good system to develop? Are there other performance techniques that you can point out? I can’t continue to use the system I have now because I fear that it will take exponentially longer to do collision comparisons in the future.