Page 1 of 1

CreateGroup function

Posted: 15 Oct 2006, 22:03
by tow_dragon
Does it work? And what should I put as first argument?

Posted: 15 Oct 2006, 23:13
by AF
The group management stuff is unused and borked. Instead create a CGroup class with a set<int> units variable, and implement whatever methods you wish to sue.

Reliance on those functions made TAI not work for several months, and thus a lot of time was wasted.

Posted: 16 Oct 2006, 16:36
by tow_dragon
I don't want to waste much time on it. Using CreateGroup function isn't our goal, but it could improve some things till we write something better....

Posted: 16 Oct 2006, 17:05
by AF
Trust me when I say it involves a lot more time, and then at the end your left with something balancing on a very unstable foundation. It's much faster to use a CGroup class or implement a groupAI's functionality in your own AI

Code: Select all

class CGroup{
private:
   set<int> units;
   IAICallback* cb;
public:
   CGroup(IAICallback* cb){
      this->cb = cb;
   }
   void IssueCommand(Command* c){
      for(set<int>::iterator i = untis.begin(); i != units.end(); ++i){
         cb->GiveOrder(c,*i);
      }
   }
   void Add(int unit){
      units.insert(unit);
   }
   void Remove(int unit){
      units.erase(unit);
   }
   bool Empty(){
      return units.empty();
   }
   set<int> GetUnits(){
      return units;
   }
};

map<int,CGroup> groups;

Something I wrote up in a few minutes.. That alone should do what the AI interface does, all it wont do is assign a groupAI and hand over events, but you can derive from that basic class for those things..... And for groupAI's you're better off copy pasting the groupAI's code into your AI.

Posted: 29 Oct 2006, 06:38
by hughperkins
Bandwidth implications of giving individual orders rather than one single group order? Or grouporders are transmitted to other clients as individual orders anyway?

Posted: 29 Oct 2006, 15:52
by MadRat
I can't see rewriting the whole engine for multiplayer over a LAN with bots, unless perhaps all the bots are run host side. Skirmish play with bots should allow for least cpu intensive AI's though.

Posted: 29 Oct 2006, 23:15
by AF
madrat we already have skirmish AI play, and bots that'll run in multiplayer games. Your starting to make me think you've never actually played spring.

Also there are no bandwidth benefits from grouping. Sending a group an order is then translated into an order for each unit, so overall its more cpu intensive than just giving the units their orders straight off. Instead command caching/buffering is a better solution