Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Kernel64

#91
New functions. These functions allow you to add to a list of what to   train/build. Research has not been added yet. Can accept Expansion orders.

  Declarations:
Quote
//for main blocks
string[20] UnitName;      //the unit to make                                    Expo -- for   expand
string[20] UnitType;    //build or struct?                                      hatchery
int[20] MakeTotal;        //how many use:   TotalUnit + desired addition        number of expos
int[20]   MakeWhere;        //c_townOne, etc.                                      where to start searching for expo
int[20] BuildFlag;        //build   flags for buildings                            the expanddefault
int[20]   DoNextCount;    //the count to watch for us to do next in line          same
int[20] DoNextCond;        //the condition to watch regarding   the count above    same
//for expo
int[20] MinInBank;
int[20]   GasInBank;


//for emergency blocks
string[20] EUnitName;      //the unit to make
string[20] EUnitType;    //build or struct?
int[20]   EMakeTotal;        //how many use: TotalUnit + desired addition
int[20]   EMakeWhere;        //c_townOne, etc.
int[20] EBuildFlag;          //build flags for buildings
int[20] EDoNextCount;    //the count to   watch for us to do next in line
int[20] EDoNextCond;        //the   condition to watch regarding the count above

string   ProcessOrder(int player); //returns InProgress or ListEmpty FOR MAIN   BLOCKS
string EProcessOrder(int player); //returns InProgress or   ListEmpty FOR EMERGECY BLOCKS

void InjectOrder(int player);   //just a prototype

//for main list
string InjectItem(string   UName, string UType, int Total, int TownWhere, int BFlag, int NextCount,   int Cond, int player);
//forExpo
string InjectItemExpo(string   UName, string UType, int Total, int TownWhere, int BankMin, int BankGas,   int player);
//for emergency list
string EInjectItem(string   UName, string UType, int Total, int TownWhere, int BFlag, int NextCount,   int Cond, int player);

Uses:
Quote
//--------------------------------------------------------------------------------------------------
//    Counts the specified unit all including in progress and queued
//--------------------------------------------------------------------------------------------------
int   TotalUnit(string UCheck, int Tplayer){
    int a = 0;
    a =   (AITechCount(Tplayer, UCheck, c_techCountInProgressOnly) +
                  AITechCount(Tplayer, UCheck, c_techCountQueuedOnly) +
                  AITechCount(Tplayer, UCheck, c_techCountCompleteOnly));
      return a;
}

The functions:
Quote
//---------------------------------
//   Main List Processor
string   ProcessOrder(int player){
    int i;
    int j;
    int   CurrNumOrders;
    int WantMore;
   
    point MainTownLoc1; 
      int NearTown1; 
    point NewTownLoc1;
    int ExpoCount;   

      i = 0;
    j = 0;
    CurrNumOrders = 0;
    WantMore = 0;
      // check if there's something to process
    while (   (UnitName[CurrNumOrders] != "") && (CurrNumOrders < 20) ) {
          CurrNumOrders = CurrNumOrders + 1;
    }
   
    if   (CurrNumOrders != 0) { //we have something
   
        if   (UnitType[0] != "Expo") { //this is not an expansion directive
              //check if TotalUnit of the said unit is less than what we   specified
            if ( TotalUnit(UnitName[0], player) <   MakeTotal[0] ) {
                //we have less and we want more...
                  //get how much more we want:
                WantMore =    MakeTotal[0] - TotalUnit(UnitName[0], player);
                  //check if it's a building or not...
                if ( UnitType[0]   == "Unit") { //we have a unit, use train
                    AITrain   (player, 10, MakeWhere[0], UnitName[0], WantMore);
                }
                  else if (UnitType[0] == "Struct") { //we have a   structure, use build
                    AIBuild (player, 10,   MakeWhere[0], UnitName[0], WantMore, BuildFlag[0]);
                }
                  else {
                    //do for tech here
                  }
            }
            else if (   TotalUnit(UnitName[0], player) >= MakeTotal[0] ) {
                  //we have all we wanted, they're queued or in progress, or better.
                  //now we check if we can discard this order
                  if ( AITechCount(player, UnitName[0], DoNextCond[0]) ==   DoNextCount[0] ){
                    //our limit has arrived, and in   the condition we specified
                    //it's time to take   this out of the list, and move the rest up...
                      //get the maximum number of orders. you'll know it because it's not ""
                      CurrNumOrders = 0;
                    while (   (UnitName[CurrNumOrders] != "") && (CurrNumOrders < 20) ) {
                          CurrNumOrders = CurrNumOrders + 1;
                      }
                    if ((CurrNumOrders != 20) &&   (CurrNumOrders > 0)) { //we dont have full list but not empty
                          while( j < CurrNumOrders ) {

                              if (UnitType[j+1] == "Expo") { //if the next item is an   expo
                                GasInBank[j] = GasInBank[j+1];
                                  MinInBank[j] = MinInBank[j+1];
                                  UnitName[j] = UnitName[j + 1];
                                  UnitType[j] = UnitType[j + 1];
                                  MakeTotal[j] = MakeTotal[j + 1];         
                                  MakeWhere[j] = MakeWhere[j + 1];         
                              }
                            else {
                                  UnitName[j] = UnitName[j + 1];
                                  UnitType[j] = UnitType[j + 1];
                                  MakeTotal[j] = MakeTotal[j + 1];         
                                  MakeWhere[j] = MakeWhere[j + 1];         
                                  BuildFlag[j] = BuildFlag[j + 1];     
                                  DoNextCount[j] = DoNextCount[j + 1];     
                                  DoNextCond[j] = DoNextCond[j + 1];
                              }
                            j = j + 1;
                     
                        }
                    }
                      else {//we have full list
                        while(   j < CurrNumOrders - 1) {
                            if   (UnitType[j] == "Expo") { //if the next item is still an expo
                                  GasInBank[j] = GasInBank[j+1];
                                  MinInBank[j] = MinInBank[j+1];
                                  UnitName[j] = UnitName[j + 1];
                                  UnitType[j] = UnitType[j + 1];
                                  MakeTotal[j] = MakeTotal[j + 1];         
                                  MakeWhere[j] = MakeWhere[j + 1];         
                              }
                            else {
                                  UnitName[j] = UnitName[j + 1];
                                  UnitType[j] = UnitType[j + 1];
                                  MakeTotal[j] = MakeTotal[j + 1];         
                                  MakeWhere[j] = MakeWhere[j + 1];         
                                  BuildFlag[j] = BuildFlag[j + 1];     
                                  DoNextCount[j] = DoNextCount[j + 1];     
                                  DoNextCond[j] = DoNextCond[j + 1];
                              }
                            j = j + 1;
                          }
                        UnitName[j] = "";
                      }
                }
                else {
                }
              }
            else {
            }
        }
          else { //this is an expo directive
            MainTownLoc1 =   AIGetTownLocation (player, MakeWhere[0]);
            NearTown1 =   AIGetClosestTown (player, MainTownLoc1);
            NewTownLoc1 =   AIGetTownLocation (player, NearTown1);
            if (   AIHasRes(player, MinInBank[0], GasInBank[0]) ) { //we have res
                  ExpoCount = AIExpand (player, NewTownLoc1, UnitName[0]);
                  if (ExpoCount >= MakeTotal[0]) { // the number of expo   is set and is equal to what we want to make
                    //    proceed to the next in list, take this out
                      CurrNumOrders = 0;
                    while (   (UnitName[CurrNumOrders] != "") && (CurrNumOrders < 20) ) {
                          CurrNumOrders = CurrNumOrders + 1;
                      }
                    if ((CurrNumOrders != 20) &&   (CurrNumOrders > 0)) { //we dont have full list but not empty
                          while( j < CurrNumOrders ) {

                              if (UnitType[j+1] == "Expo") { //if the next item is an   expo
                                GasInBank[j] = GasInBank[j+1];
                                  MinInBank[j] = MinInBank[j+1];
                                  UnitName[j] = UnitName[j + 1];
                                  UnitType[j] = UnitType[j + 1];
                                  MakeTotal[j] = MakeTotal[j + 1];         
                                  MakeWhere[j] = MakeWhere[j + 1];         
                              }
                            else {
                                  UnitName[j] = UnitName[j + 1];
                                  UnitType[j] = UnitType[j + 1];
                                  MakeTotal[j] = MakeTotal[j + 1];         
                                  MakeWhere[j] = MakeWhere[j + 1];         
                                  BuildFlag[j] = BuildFlag[j + 1];     
                                  DoNextCount[j] = DoNextCount[j + 1];     
                                  DoNextCond[j] = DoNextCond[j + 1];
                              }
                            j = j + 1;
                     
                        }
                    }
                      else {//we have full list
                        while(   j < CurrNumOrders - 1) {
                            if   (UnitType[j] == "Expo") { //if the next item is still an expo
                                  GasInBank[j] = GasInBank[j+1];
                                  MinInBank[j] = MinInBank[j+1];
                                  UnitName[j] = UnitName[j + 1];
                                  UnitType[j] = UnitType[j + 1];
                                  MakeTotal[j] = MakeTotal[j + 1];         
                                  MakeWhere[j] = MakeWhere[j + 1];         
                              }
                            else {
                                  UnitName[j] = UnitName[j + 1];
                                  UnitType[j] = UnitType[j + 1];
                                  MakeTotal[j] = MakeTotal[j + 1];         
                                  MakeWhere[j] = MakeWhere[j + 1];         
                                  BuildFlag[j] = BuildFlag[j + 1];     
                                  DoNextCount[j] = DoNextCount[j + 1];     
                                  DoNextCond[j] = DoNextCond[j + 1];
                              }
                            j = j + 1;
                          }
                        UnitName[j] = "";
                      }                   
                }
                else{//   number of expos not in yet.
                }
            }
              else { // we don't have res
            }
       
          }
       
    return "InProgress";
    }
    else {
     
    return "ListEmpty";
    }
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Emergency   List Processor

string   EProcessOrder(int player){
    int i;
    int j;
    int   CurrNumOrders;
    int WantMore;

    i = 0;
    j = 0;
      CurrNumOrders = 0;
    WantMore = 0;
    // check if there's   something to process
    while ( (EUnitName[CurrNumOrders] != "")   && (CurrNumOrders < 20) ) {
        CurrNumOrders =   CurrNumOrders + 1;
    }
   
    if (CurrNumOrders != 0) {   //we have something
        //check if TotalUnit of the said unit is   less than what we specified
        if ( TotalUnit(EUnitName[0],   player) < EMakeTotal[0] ) {
            //we have less and we want   more...
            //get how much more we want:
              WantMore =  EMakeTotal[0] - TotalUnit(EUnitName[0], player);
              //check if it's a building or not...
            if ( EUnitType[0]   == "Unit") { //we have a unit, use train
                AITrain   (player, 10, EMakeWhere[0], EUnitName[0], WantMore);
            }
              else if (EUnitType[0] == "Struct") { //we have a structure,   use build
                AIBuild (player, 10, EMakeWhere[0],   EUnitName[0], WantMore, EBuildFlag[0]);
            }
              else {
                //do for tech here
            }
          }
        else if ( TotalUnit(EUnitName[0], player) >=   EMakeTotal[0] ) {
            //we have all we wanted, they're queued   or in progress, or better.
            //now we check if we can   discard this order
            if ( AITechCount(player, EUnitName[0],   EDoNextCond[0]) == EDoNextCount[0] ){
                //our limit   has arrived, and in the condition we specified
                //it's   time to take this out of the list, and move the rest up...
                  //get the maximum number of orders. you'll know it because it's   not ""
                CurrNumOrders = 0;
                while (   (EUnitName[CurrNumOrders] != "") && (CurrNumOrders < 20) ) {
                      CurrNumOrders = CurrNumOrders + 1;
                  }
                if ((CurrNumOrders != 20) &&   (CurrNumOrders > 0)) { //we dont have full list but not empty
                      while( j < CurrNumOrders ) {
                          EUnitName[j] = EUnitName[j + 1];
                          EUnitType[j] = EUnitType[j + 1];
                          EMakeTotal[j] = EMakeTotal[j + 1];         
                          EMakeWhere[j] = EMakeWhere[j + 1];         
                          EBuildFlag[j] = EBuildFlag[j + 1];     
                          EDoNextCount[j] = EDoNextCount[j + 1];     
                          EDoNextCond[j] = EDoNextCond[j + 1];
                        j = j +   1;
                    }
                }
                else   {//we have full list
                    while( j < CurrNumOrders   - 1) {
                        EUnitName[j] = EUnitName[j + 1];
                          EUnitType[j] = EUnitType[j + 1];
                          EMakeTotal[j] = EMakeTotal[j + 1];         
                          EMakeWhere[j] = EMakeWhere[j + 1];         
                          EBuildFlag[j] = EBuildFlag[j + 1];     
                          EDoNextCount[j] = EDoNextCount[j + 1];     
                          EDoNextCond[j] = EDoNextCond[j + 1];
                        j = j +   1;
                    }
                    EUnitName[j] = "";
                  }
            }
            else {
            }
          }
        else {
        }
       
    return   "InProgress";
    }
    else {
   
    return "ListEmpty";
      }
}


Inject Functions. Adds items to   list when called.

Quote
//   Main List Injector
//-------------------------------------------------------
string   InjectItem(string UName, string UType, int Total, int TownWhere, int   BFlag, int NextCount, int Cond, int player){
int CurrNumOrders=0;
int   i=0;

    // check if the list is full
    while (   (UnitName[CurrNumOrders] != "") && (CurrNumOrders < 20) ) {
          CurrNumOrders = CurrNumOrders + 1;
    }
   
    if   (CurrNumOrders == 20) {
   
    return "ListFull";
    }
      else {
        //add item at the last spot
        i =   CurrNumOrders;
        UnitName = UName;   
        UnitType =   UType;   
        MakeTotal = Total;       
        MakeWhere =   TownWhere;       
        BuildFlag = BFlag;
        DoNextCount =   NextCount;   
        DoNextCond = Cond;
       
    return   "Success";
    }
}

string InjectItemExpo(string UName,   string UType, int Total, int TownWhere, int BankMin, int BankGas, int   player){
int CurrNumOrders=0;
int i=0;

    // check if the   list is full
    while ( (UnitName[CurrNumOrders] != "") &&   (CurrNumOrders < 20) ) {
        CurrNumOrders = CurrNumOrders +   1;
    }
   
    if (CurrNumOrders == 20) {
   
      return "ListFull";
    }
    else {
        //add item at the   last spot
        i = CurrNumOrders;
        UnitName = UName;   
          UnitType = UType;   
        MakeTotal = Total;       
          MakeWhere = TownWhere;       
        MinInBank = BankMin;
          GasInBank = BankGas;
       
    return "Success";
    }
}


//   Emergency List Injector
//-------------------------------------------------------
string   EInjectItem(string UName, string UType, int Total, int TownWhere, int   BFlag, int NextCount, int Cond, int player){
int CurrNumOrders=0;
int   i=0;

    // check if the list is full
    while (   (EUnitName[CurrNumOrders] != "") && (CurrNumOrders < 20) ) {
          CurrNumOrders = CurrNumOrders + 1;
    }
   
    if   (CurrNumOrders == 20) {
   
    return "ListFull";
    }
      else {
        //add item at the last spot
        i =   CurrNumOrders;
        EUnitName = UName;   
        EUnitType =   UType;   
        EMakeTotal = Total;       
        EMakeWhere =   TownWhere;       
        EBuildFlag = BFlag;
          EDoNextCount = NextCount;   
        EDoNextCond = Cond;
       
      return "Success";
    }
}


Example   usage. BlockOneSubA -- Injects drones ovie and expo then drones.
Quote
string   BlockOneSubA(int player) {
int b;
b= (TotalUnit(c_ZU_Drone,   player) + 4);
if ( InjectItem(c_ZU_Drone,
                "Unit",   
                b,
                c_townOne,
                  c_nearCloseDropoff,
                b,
                  c_techCountInProgressOrBetter,
                player) != "Success")   { return "ListFull"; }

if ( InjectItem(c_ZU_Overlord,
                  "Unit",
                2,     
                  c_townOne,
                c_nearCloseDropoff,
                  2,
                c_techCountInProgressOrBetter,
                  player) != "Success") { return "ListFull"; }
               
if (   InjectItem(c_ZU_Drone,
                "Unit",
                  13,
                c_townOne,
                  c_nearCloseDropoff,
                13,
                  c_techCountInProgressOrBetter,
                player) != "Success")   {return "ListFull"; }               

if (   InjectItemExpo(c_ZB_Hatchery,
                "Expo",
                  1,
                0,
                250,
                  0,
                player) != "Success") {return "ListFull"; }
                 
if ( InjectItem(c_ZU_Drone,
                "Unit",   
                18,
                c_townOne,
                  c_nearCloseDropoff,
                18,
                  c_techCountInProgressOrBetter,
                player) != "Success")   {return "ListFull"; }           

               
else {
      return "Success";
}

}


Running   it under Zerg0.galaxy
Quote
    CBlockStatus =   ProcessOrder(player);
    if((AIGetTime() < 2) &&   (CBlockStatus != "InProgress")){
        CBlockStatus =   BlockOneSubA(player);
    }

    if( CBlockStatus ==   "ListEmpty"){

    }
   
    else {
    CBlockStatus =   ProcessOrder(player);
    UIDisplayMessage(PlayerGroupAll(), 1,   StringToText(CBlockStatus));
    }


CBlockStatus   is a string. It is used for checking the list status, and later moving   through lists, etc.
#92
itWorks = true;

if (itWorks == true){
  AstazhaRep = AstazhaRep + 100000000000000000000000000000000000;
  UIDisplayMessage(PlayerGroupAll(), 1, StringToText("It's Beautiful."));
}
#93
Oh, nice.

So if, say, I have a function:

void ShuffleOrders(string *Orderlist, int *OrderCount)

and I pass: string[25] Orders, int Count[25]...

then access them in the function and swap things around,

I can use something in the function like:
OrderlistTemp = Orderlist[0];
Orderlist[0] = Orderlist[1];
Orderlist[1] = OrderlistTemp;

and have the values actually swap when I access string[25] Orderlist in another function.

Is this correct?

Aeg1s, I'm trying to see if I can make running orders exactly as I lay them out within the blocks. Say, I want:
+4 Drones,
+1 Ovie,
+1 Pool

I want to have them in a queue, and get the first one executed, then the next, then the next without keeping an eye on them so closely like what is happening now.

Even so, I'm still not sure if this will be applicable for every order, since some train or build orders can be queued in another building and the other in another and so forth.
#94
How do I change a variable that's been passed as a parameter? Say, I have:

void func (string OrderList, int OrderCount[j], int OrderPrio[k]);

how do I actually change the values of those arrays? I don't know how to make them change in that function and have the changes happen after the function is called.

Also, is that a valid function? Assigning arrays as arguments like that? Is that how to do it?

Thanks in advance.
#95
AI Help Section / Re: c_stockIdle vs c_stockAlways
March 14, 2010, 07:44:12 PM
This is why I add conditions before setstocks. From what I've seen, the engine chooses the cheapest in its stock and buys that instead. Or it's that buildings are not prioritized.

I believe setstock should be used only to give the AI what to maintain if it loses something. I don't think the engine works through its stock in a first in, first out, basis.
#96
Also, here's the Zerg0.galaxy

just rename the attachment from .doc to .galaxy

What it does is first choose at random which block to run. And when that block is done, it goes to SubA. No other options are available, so both goes to SubA.

If you want to try it, you might want to keep the AI at Opening longer.

What I find a bit tedious is the condition checker. At this point it needs to be precise, just as HD had foretold. Things are so small that the level of precision may not be worth the small difference.

However, this might prove useful in the later stages of the game. And since the RCountUnit can be given ranges of values, at those times, ranges may become applicable, thus, much more comfortable to define.

edit: Aeg1s, what I've experienced from AISetStock() is that it always buys the cheapest thing. Say I SetStock: 1 barracks, then 3 scvs, it will always buy those scvs then the barracks.

So if I have 1 barracks, 3 scvs, 2 barracks, 6 scvs, none of the barracks will be built until the 6scvs are either in production or finished.
#97
Here's some. It's a template of the sorts on how things work:

This is what goes in the Zerg0.galaxy
Quote
    ZEnsureWorker(10, 10, c_townOne, player);
    if ((RCountUnit(c_ZU_Drone, 8, 9, 0, 1, 0, 1, player) == true) && (CBlockStatus != "InProgress")){
        //randomize for next block here
        NextBlock = RandomInt(1,100);
        if (NextBlock <=50) {
            CBlock = "Block1";
            CBlockStatus = "NotStarted";
            EmergencyState = "Inactive";
        }
        else {
            CBlock = "Block2";
            CBlockStatus = "NotStarted";
            EmergencyState = "Inactive";
        }
    }

    if(CBlockStatus == "NotStarted") { //we've not started the Block
        //check if there are emergencies
        //check if we need to change block, if not:
        CBlockStatus = "InProgress";
   
    }//end not started
   
    if(CBlockStatus == "InProgress") { //we're currently in progress
   
        //we don't have an emergency,
        if ( EmergencyState == "Inactive") {

            //and CBlock is not Done (it could be in progress)
            if (CBlockStatus != "Done") {
                //...enter the specified block and call it
                if (CBlock == "Block1") {
                    CBlockStatus = BlockOne(player);
                }
   
                if (CBlock == "Block2") {
                    CBlockStatus =     BlockTwo(player);
                }
            }
        //Q: Do we need to check if there's an emergency here?
        //Q: Do we need to check if we need to change block here?
        }
       
        //we have an emergency
        if ( EmergencyState == "Active") {
            //do the same as above here
        }
       
       
    }// end InProgress

these are the blocks:
Quote
string BlockOne(int player) {
if (RCountUnit(c_ZU_Overlord, 0, 1, 0, 0, 0, 0, player) == true) {    //we have 1 ovie, 0 inprogres, 0 queued
    ZEnsureFood(18, 9, c_townOne, player);                            //queue 1 ovie, or compensate if ovie is dead
    return "InProgress";
    }
if (RCountUnit(c_ZU_Overlord, 1, 2, 1, 1, 0, 0, player) == true) {  //we have 1 done, 1 in progress, 0 in queue
    ZEnsureUnit(13, 3, c_ZU_Drone, 10, c_townOne, player);                        //this will not be true when the ovie is done already
    return "InProgress";
    }
if (RCountUnit(c_ZU_Drone, 10, 13, 2, 3, 0, 0, player) == true) {  //we have drones: 10-13 done, 3 in progres, 0 in queue
    ZEnsureTech(1, 1, c_ZB_SpawningPool, 10, c_townOne, c_nearCloseDropoff, player);  //all these looks like while now: we queue, while...
    return "InProgress";
    }
if (RCountUnit(c_ZB_SpawningPool, 0, 1, 1, 1, 0, 0, player) == true) {
    ZEnsureUnit(13, 1, c_ZU_Drone, 10, c_townOne, player);
    return "InProgress";
    }
if (RCountUnit(c_ZU_Overlord, 1, 2, 0, 0, 0, 1, player) == true) {
    return "InProgress";
}
if ((TotalUnit(c_ZB_SpawningPool, player) == 1)&&
    (TotalUnit(c_ZU_Drone, player) == 13) &&
    (TotalUnit(c_ZU_Overlord, player) == 2)  &&
    (TotalUnit(c_ZB_Hatchery, player) == 1)    ){
        return "Done";
    }
else {
    return "NotDone";
    }
}

string BlockTwo(int player) { //pool, ovie, +3drones
if (RCountUnit(c_ZB_SpawningPool, 0, 0, 0, 0, 0, 0, player) == true) {
    ZEnsureTech(1, 1, c_ZB_SpawningPool, 10, c_townOne, c_nearCloseDropoff, player);  //all these looks like while now: we queue, while...
    ZEnsureUnit(10, 1, c_ZU_Drone, 10, c_townOne, player);   
    return "InProgress";
    }
if ((RCountUnit(c_ZB_SpawningPool, 0, 1, 0, 0, 1, 1, player) == true) &&
    (RCountUnit(c_ZU_Overlord, 1, 2, 0, 0, 0, 1, player) == true)) {
    return "InProgress";
    }
if ((RCountUnit(c_ZB_SpawningPool, 0, 0, 1, 1, 0, 0, player) == true) &&
    (RCountUnit(c_ZU_Overlord, 1, 1, 0, 0, 0, 1, player) == true)){
    ZEnsureFood(18, 9, c_townOne, player);   
    return "InProgress";
    }
   
//for block 2, this +3drone is not automatic. Threat must be checked first.
if (RCountUnit(c_ZU_Overlord, 1, 2, 1, 1, 0, 0, player) == true) {  //we have 1 done, 1 in progress, 0 in queue
    ZEnsureUnit(13, 3, c_ZU_Drone, 10, c_townOne, player);            //this will not be true when the ovie is done already
        return "InProgress";
    }
if ((TotalUnit(c_ZB_SpawningPool, player) == 1)&&
    (TotalUnit(c_ZU_Drone, player) == 13) &&
    (TotalUnit(c_ZU_Overlord, player) == 2)  &&
    (TotalUnit(c_ZB_Hatchery, player) == 1)    ){
        return "Done";
    }
else {
    return "NotDone";
    }
}

As you can notice, queuing of the items are broken into conditions. The engine will parse lines one at a time, so these lines get noticed every pass.

As things become more diverse, changes to the return strings in those blocks might be necessary, or not.

The first code shows how an emergency can put things on hold, or a certain change in a string make another block execute.

In this example, randomization is used. I've not gotten to doing the personality just yet. The personality attributes will also be set by randomization.
#98
Quote from: Astazha on March 13, 2010, 09:07:51 PM
I think initially HD's approach is going to provide fast improvement for the next version of the AI.  I think ultimately a truly good AI will take Kernel64's approach, and I'm very interested in thinking about that framework.  Having the AI continue with a build when it's being countered hard isn't the kind of thing player would do - a player will turtle and change tech, or try to get an economic advantage, expand to an island, something.  Anything other than throwing more of the same units to their deaths.


A really simple reactive change is the anti-air one that's in the current version.  Another would be to escort troops with detection when the AI is getting mauled by Dark Templars.  A further more complex iteration of that is that if your detection is overlords then you need to be able to protect them from anti-air.  Is it complicated?  Sure.  And I think reactive AI is going to be really bad at first, but writing true artificial intelligence is what excites me about this project, and it will get better over time.



Kernel64 please post stuff as you work on it if you are willing because that stimulates ideas.

I will be posting them. Maybe tomorrow. I'm trying to make the zerg shift to expand first instead of preparing for banelings, which can be done after the Queen and third ovie are in queue, if the conditions say so.
#99
Quote from: T1ND3R on March 13, 2010, 09:43:37 AM
I didn't intend to make it sound as if I was the one who was providing the mirrored patches, since that would be the farthest from the truth.


I simply found a thread where this link was being displayed.


And to answer your question; the guy who is providing the mirrors did, in fact, confirm that he will be posting all new updates as he receives them. Reason being that even those with legit beta keys are even having problems downloading the updates.

Thanks again. I owe you one.
#100
Thank you, thank you, thank you!

I hope you wouldn't mind keep updating them as new patches arrive? Or is there anyway I could access them personally so as to save you some trouble later on?
#101
In the editor, this might look like "Events"?
#102
AI Development / Re: Improved combat AI
March 13, 2010, 08:57:27 AM
Okay, thanks guys.
#103
Having your replay parser would be of great help though. It takes a while to write things down on paper.

Where can I find one of those parsers?
#104
Mind coding one? This is a big task really. And I'm working on feeding the Zerg strats and making it use them wisely.

Also, who's doing terran? Has there been progress on making it wall-in? There's a ton of beautiful strats born from having walled yourself in. It would be awesome to have the Terran AI wall in and go double factory with reactor and burn through with hellions.
#105
Hd, it gets really complicated once you've tried a lot. But you're right, there should be a way to reduce the lines and have the variations isolated somewhere and all other similar ones kept.

But then again, different cases proved that certain sets of ordered lines are necessary. You're example is where it all starts. Once variations are discovered, I began to notice that blocks of the such as your example shows are called for.

For example,

after the exact order: 2nd ovie, +3drones, pool... you can go:

a) +4 drones (16/18 food)
   i.) fast expo followed by:
      1. Queen (17/18), Ovie3,... then choose:
           I. +2 lings
           II. +1 drone (16 drones total)
      2. (...more lings)
b) +2 drones, extractor1, +2 drones
   i.) Ovie3 (16/18 food), queen 1 (18/18)
      1. R.Warren1 (17/18)
            I. +2lings and drone (20/26)
            II. +drones
            III. +4 lings
      2. Ovie 4, +spam Roaches to 8
   
etc.

Now, this may seem trivial, but imagine in the mid-game? If the AI is not coached to maintain a certain block, or discard, or put it on hold for an emergency, it will go All-in. And that's a bad strat.

I'm looking to make the AI respond to apparent changes in the opponent's strat, unit compo, base, and respond properly that it can even make the enemy say, "I was rolled over because I had no robo for immortals. Those roaches burn."

And for example, the AI will discard that and go tech to Hydra instead, if it discovers, while it was morphing lair, that the Protoss had not started 2nd assimilator and instead had 3 gates and etc etc.

But, yes, I'd love it if someone can implement these concepts properly and much more efficiently. I'm taking the route that I know now. I will post them up when it's playable.

As of the moment, I'm working on a function that turns on and off processing of a block, suspending it to activate another block for execution, or discarding the current block altogether for a new one.