CreateGroup function

CreateGroup function

Here is where ideas can be collected for the skirmish AI in development

Moderators: hoijui, Moderators

Post Reply
User avatar
tow_dragon
Posts: 45
Joined: 05 May 2006, 13:53

CreateGroup function

Post by tow_dragon »

Does it work? And what should I put as first argument?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post 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.
User avatar
tow_dragon
Posts: 45
Joined: 05 May 2006, 13:53

Post 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....
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post 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.
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Post 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?
User avatar
MadRat
Posts: 532
Joined: 24 Oct 2006, 13:45

Post 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.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post 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
Post Reply

Return to “AI”