title: What type of Container should I use to hold a 2D Tile Based World's Tile Objects?
body: <p>I have a 2D tile based world, which is created using a simple array: World[100][100].</p>
  
  <p>I plan on making the game multiplayer, so I figure it would be good to have the SERVER send the CLIENT all the tiles surrounding the player, and only the information that the CLIENT needs: What texture/sprite to render, and what position to render it.</p>
  
  <p>To do this, I am assuming it would be good to make my own TILE class, which has a tileType (Grass, Sand, Water, etc.) and holds an array of 10 TileObjects.
  TileObject is a class that holds three variables: objectType (Is it a Character? An Item? A tree? A rock?), an int objectID (which is linked to whatever the object actually is, so it knows the Character is "Leeroy Jenkins" and can then send Leeroy's animation &amp; direction to the CLIENT for rendering.) and an objectPosition (X &amp; Y from the Tile. This can extend beyond the Tile if needed.)</p>
  
  <p>Although with this I am not sure how I would handle objects or characters that are larger than a single tile (such as a Dragon whose collision consumes many tiles) but it sounds like the best design.</p>
  
  <p>What type of container should I use to store the TileObjects in the TILE class? Right now I have an array, but I doubt that is good for performance right? Some tiles may have 0 TileObjects, while others may have 5+. I used 10 because I severely doubt anything will ever exceed &lt;10.</p>
  
  <pre><code> class Tile
   {
  private:
      TileObject TileObjects[10]; //up to 10 objects on a single tile
      TileTerrainType tileTerrainType; //GFX to display Grass, Sand, Water, Swamp, etc.
   }
  </code></pre>
  
  <p>I have read many different tutorials and books, who argue completely different container types: Vectors, Maps, Linked Lists, Arrays. I just do not know what is best to store TileObjects (some of which may move constantly, can be destroyed or added like dropping/picking up items, and some which may remain stationary like a tree or rock).</p>