   RTS Question: How to manage all the units
  Ok so I decided I''m going to have a linked list and every object in the world is going to be in that linked list.  Now, there hast o be a better way than this.  It just doesn''t seem very efficient to be traversing a list of what could be hundreds of units every time I click on a unit to see its stats.  The problem is, I don''t seem to see any other way of doing it.  This is where you experienced programmers step in and tell me what I should do Thanks in advance. 
  Hey,    In my RTS, the map is split up into sectors which have thier own list of objects, buffer of verticies/indicies, etc.  This way if a sector is 10 units by 10 units, and you want to draw all of the units from point x1, y1 to x2, y2, just draw units that are in the sectors from x1/10, y1/10 to x2/10, y2/10.  If you want to find a unit that you clicked on, which is at point (x, y), just loop through the list of units/objects in the sector (x/10, y/10).  This way you have a much smaller search space.  The only downside to this method is that every time an object moves, you must test to see if it has changed sectors and then transfer it to the corresponding new sector.Hope that helps...Dwiel   ;  Make an event driven model, have a event queue which an entity needing logic can post its request events which gets processed peroidically.That way only objects which need updates get cpu time. -ddn ;  Traversing a large list just to find one unit during a click isn''t a big deal.  It can really add up if you are performing a lot of those traversals for things like AI and collision detection, though.In any case, I tend to agree with the sector idea, or just split the map into a bunch of quads, and make a linked list of objects attached to each quad record. ;  Tazzel3d, Waverider: I can''t believe I didn''t think of that!  This sounds like a good idea so that is what I''m going to do.Anonymous Poster: This wasn''t really what I was looking for.  And if it was, I wouldn''t really know how to implement that ;  A few RTS favorites:http://www.gamasutra.com/features/20010322/terrano_01.htmhttp://www.milclan.com/hanzo/rts.cfm> ... I wouldn''t really know how to implement thathttp://www.gamasutra.com/features/19990129/implementing_01.htm-cb 