When to use an Array vs When to use a Vector, when dealing with GameObjects?
- by user32465
I understand that from other answers, Arrays and Vectors are the best choices. Many on SE claim that Linked Lists and Maps are bad for video game programming.
I understand that for the most part, I can use Arrays. However, I don't really understand exactly when to use Vectors over Arrays.
Why even use Vectors? Wouldn't it be best if I simply always used an Array, that way I know how much memory my game needs?
Specifically my game would only ever load a single "Map" area of tiles, such as Map[100][100], so I could very easily have an array of GameObjectContainer GameObjects[100][100], which would reserve an entire map's worth of possible gameobjects, correct?
So why use a Vector instead? Memory is quite large on modern hardware.