I searched for collision detection topics, but they were all about the detection itself. My question is more about before and after the detection process. I'm writing my first big game and I want to make it as efficient as reasonably possible.
The premise of the game is that you fly a ship around a playing field. In this field are going to be obstacles of varying nature provided by the environment, enemy ships, and projectiles flying and floating around in space. The objects will be able to rotate around their centers and such, if they are required to or want to.
My idea for setting up the test is to have objects load themselves in some manner into a queue and a list. The game would then take whatever is on the front of the queue and test against everything in the list. It would first check to make sure the thing in the list is not itself (which would generate a collision for everything all the time lol). Next, the game would check if there is a collision between the object in the queue and the object in the list. If there is a collision, then it will flag the objects saying they have collided and save a reference or whatever of what the object collided with.
For example, if A collided with B, the game would tell A to run a collision function, B to run collision function, and would store into A a reference to B and B would store a reference to A.
The game will then continue to check collisions for the object in the queue until it runs through the list, doing the above each time to account for an object hitting or getting hit by multiple objects.
For example, if there were three balls, A, B, and C, and A were to be hit by both B and C in the same frame, A would have its velocity modified by B and then by C, and B and C would have their velocities modified by A.
Would this be a smart way to go about doing this? I'm not worried about the actual detection of collisions right now, there are plenty of articles or tutorials available plus my own thinking to solve that problem. I haven't run across anything that talks the before and after. I'm not sure how many things in a queue and list would begin to cause a large load and slow the game down. Right now my objects are all just x,y positions, x,y velocities, what direction they are facing, and a few other things.
Now I think I'm beginning to ramble about unrelated things. Any insight or wisdom would be appreciated.