   Question: Create dynamic collision objects
  Hi,I have a question regarding to creating collision objects dynamically. For example, if I have a battleship that fires missiles on player's command, each missile that's been fired is one collision object. My best bet is to use a vector to dynamically store these objects, but is there a better way to do this?Thanks for all the advices,eAGLE.   
  Yes, that's a pretty common and entirely reasonable approach. Since this is a situation where you'll probably need to add and remove collision objects frequently (missiles fired and destroyed) you may be better off using a linked list (std::list if using C++) than a vector, though.   ;  I agree with Windryder; you're on the right track, but I think a linked list is better suited to the task. You don't likely need O(1) access to a missile based on ordering. You will likely need to dynamically remove arbitrary missiles from the container. Sounds like a std:list to me.   ;  Thanks, serratemplar and Windryder. Now I can implement it without hesitation.eAGLE.   ;  I'll go ahead and mention that the performance differences between list and vector (and deque, for that matter) might not be so clear-cut. Factors to consider include:1. Cache coherency (iterating over a vector could be faster than iterating over a list due to locality issues).2. Are you storing the objects by value, or by pointer or smart pointer? If the latter, a lot of the operations that one might consider costly with vector's probably won't be so bad.3. If order is unimportant, you can use the 'swap and pop' trick for fast removal of items from a vector.4. A typical implementation of vector won't decrease its capacity; it will only increase it. (At least that's my understanding.) Although I don't believe this is guaranteed by the standard (I'm not positive about that, but I'm pretty sure it's not), it's something that's often counted on from a practical point of view, and you can always check the implementation you're using if you want to be sure. The implication of this is that once the capacity of your vector has reached a reasonable size, additions and removals (assuming order isn't important) should be pretty inexpensive.Of course there's no way to say for sure without trying it. If this is a reasonably small-scale game, I doubt you'll notice any differences in performance based on what container you use to store your entities, but if you're curious, you can always try it using a few different container types and see what happens. (The containers in question here aren't entirely interchangeable, but if you don't need indexed access, you can probably switch back and forth easily by using iterators and a few typedefs here and there.)   