I do not think it should matter all that much. I am assuming that with heavy traffic ~100 units need to be created and/or killed every second. That would make for a lot of mallocs and frees (although they'd be news/deletes in my case... not that it should matter).
I thank you for your response, but it didn't answer the other half of my question:
How do you store the units?
Is it in one massive array?
ex.
class Unit { blah... }
Unit[30000000] units;
Or seperately by type? Or what?
The problem I am having is that I think I should make secondary indexes on units stored by type, but I have no idea if this is necessary or logical.
ex.
class OnePlayer {
blah...
(Unit *)[5000] uOwned;
};
class UnitStore {
blah...
makeOnePlayersUnitsIterator(PlayerID);
makeTypeIterator(TypeID);
randomAccessUnit(UnitID);
makeSuperHoohahIterator(struct SuperHoohah);
private:
UnitType1[1000] ut1;
UnitType2[1000] ut2;
:
:
UnitTypek[1000] utk;
};
class OnePlayersUnitsIterator {
OnePlayersUnitsIterator(PlayerID) {
lookup OnePLayer,
traverse its uOwned array
}
blah...
};
class OneTypeIterator {
OneTypeIterator(TypeID) {
go to UnitStore,
traverse a type's array
}
blah...
};
And that way the various iterators could be optimized and would not have to search the entire list.
This raises the problem of allocating memory for the various types, though. Maybe no one wants to use type4, but everyone uses a lot of type7? Urg.
------------------
Dark Lord Pi