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

#181
AI Development / Where to Find AI Queen Management
March 04, 2010, 07:58:19 AM
I'd like to see the codes related to the AI's control of the queen. It seems that the AI cannot handle two queens and use them on two different towns each.

Does anyone know where to find these or how to override them? Like, manually ordering a queen to cast an ability at a certain point, for example.
#182
AI Development / Re: Chrono Boost working
March 04, 2010, 03:32:55 AM
I'll definitely buy you a drink. You're awesome!

We should have a compilation or the sort of everything galaxy AI. That would be great.

edit:

I've edited the function to Boolean, should return false if the cast failed, and true if it has been cast. Also, added a town variable, so that we can use this as a called function for multiple nexus:

Quote
static bool ChronoBoost(int player, int CTown) {
    unit u = AIGrabUnit(player, c_PB_Nexus, c_prioScriptControlled, AIGetTownLocation (player, CTown));
    order o;
    if (u) {
        o = AICreateOrder(player, "TimeWarp", 0);
        OrderSetTargetUnit(o, u);
        if (UnitOrderIsValid(u, o)) {
            //DebugOutput("TimeWarp", false);           
            AICast(u, o, c_noMarker, c_castHold);
       return true;
        }
        else {return false;}
    }
}

I don't know what's missing though, or which file to put this in. Where did you place this function, Aeg1s?

edit 2:
Another modification: (not tested. please correct)

Quote
static bool ChronoBoost(int player, int CTownNexLoc, string aliasUnitType, int TTownTarLoc) {
    unit castunit = AIGrabUnit(player, c_PB_Nexus, c_prioScriptControlled, AIGetTownLocation (player, CTownNexLoc));
    unit tgtunit = AIGrabUnit(player, aliasUnitType, c_prioScriptControlled, AIGetTownLocation (player, TTownTarLoc));
    order ord;
    if (castunit) {
       if (tgtunit) {
          ord = AICreateOrder(player, "TimeWarp", 0);
          OrderSetTargetUnit(ord, tgtunit);
       
          if (UnitOrderIsValid(castunit, ord)) {
            //DebugOutput("TimeWarp", false);           
            AICast(castunit, ord, c_noMarker, c_castHold);
       return true;
          }
          else {return false;}
       }
       else {return false;} //target error
    }
    else {return false;} //caster error
}

-- Returns true if successful cast.
-- false if: target error, caster error, cast failed
-- requires CasterUnit, and which town (for multiple nexus)
-- requires Target Unit (must be structure?)
Overall idea is to make a function that will allow us to utilize a Nexus' Chrono boost on buildings such as Forges, Cybernetics core, Gateway, etc.

This isn't working though. Some help? I don't know where to put this, or if there's error in the code.
#183
Thanks Yuna_Q! Much appreciated.
#184
AI Development / Re: AI Editing and Information
March 04, 2010, 02:54:27 AM
Maybe the app will debug only simple things like ";" "{}", or "(())" things. I don't know, but I'm hoping he knows of the code and this app would provide the functions and what they're for, etc.
#185
AI Development / Re: Chrono Boost working
March 04, 2010, 02:51:08 AM
Wow! awesome, Aeg1s! Maybe I can add and change this to a function that returns bool. If an error occurs, this means the ability cannot be cast for some reason like lack of energy.

I've got a lot of people to add into the credits section now.
#186
Quote from: hd on March 03, 2010, 08:50:55 PM
my ai already takes opponents race into account, though i wasn't aware of PlayerRace(int player) and as a result built bloated and convoluted functions to find the enemy race ;\

I'd love to know more of these functions as well. The guy who released that Protoss AI clearly knows something. I wish he/she would document some of the functions.
#187
Quote from: r3ddrag0nx on March 03, 2010, 10:44:24 PM
Any decent players here tested this yet? If you can win in 15mins or less, it's still marginal in real gains at least for ladder training, but any gain is a good gain.

It's much more showing an SCBW AI behavior, (not BWAI Gold). Perhaps the code can be improved to check conditions and execute commads respectively.

Say, for example, the AI will only build the 7 zealots if the opponent is ZERG and etc,etc.

Overall, what I like about this AI is how it's been done and structured.
#188
Create a TriggerLibs folder within your StarcraftII folder and extract there.

This is awesome! I'll play with it in a sec.  ???
#189
AI Development / Re: Could use some help...
March 03, 2010, 09:59:10 AM
Quote from: hd on March 03, 2010, 07:36:36 AM
Quote from: Kernel64 on March 03, 2010, 07:09:18 AM
have you tried techcount?

Actually, was just about to update the thread saying that AITechCount returns an integer of the amount of the passed unit type.

AITechCount(int player, unit type, int flag)

The only flags that seem to be available are c_techCountInProgressOrBetter and c_techCountCompleteOnly where InProgressOrBetter counts those currently being built + those finished being built and CompleteOnly will only count those built but not in progress.

InProgressOrBetter returns true in an IF() statement even if there is zero of the unit type.

I'm testing c_techCountQueuedOrBetter.

edit:
"c_techCountQueuedOrBetter" seems to mean items in the AI's build queue or ordered to be produced already.
#190
AI Development / Re: Could use some help...
March 03, 2010, 07:09:18 AM
have you tried techcount?
#191
Quote from: 1337 on March 03, 2010, 04:28:45 AM
Turns out I was wrong... High Templars will cast Psi Storm. Most AIs just don't research it early enough. I just tested a game with 5 Goose v4 Protoss in it. Of the 5 AIs, only 1 (the winning AI) researched Psi Storm, despite the fact that they all followed the same build order otherwise. I assume the other AI Stock requirements were not met, so it never moved on to upgrading Psi Storm. Only the winner actually had enough units in stock, so the AI continued to upgrade.

Awesome. I'll try to check this out as soon as I'm done with the Attacking section.

The Psi Storm AI data is definitely stored in the XML. By editing the Psi Storm entry in TargetFindData.xml, I think I can change the behavior of the Templars with regards to when they choose to cast Psi Storm. I am going to try modifying the "MinCount" and "MinScore" values to see if it changes the Templars discretion.

Here's some progress on the Attacking function. It kinda works.

Quote
//--------------------------------------------------------------------------------------------------
//  AIWaveAttack
//--------------------------------------------------------------------------------------------------
void AIWaveAttack (int player, wave w) {
    int state = AIState(player, e_attackState);
    int eval;
    int time;
    int count;

    //--- DEFEND ---

    if (AIWaveAttackDefend(player, w, state)) {
        AIDefendTown(player, w);
        return;
    }

    //--- ATTACK ---

    if (state == e_attackState_Attack) {
        time = AIWaveGetTimeInCombat(w);
        eval = AIWaveEvalRatio(w, c_evalRange);
        if (eval >= 96 && eval <= 99 && time <= 60) { // when not fighting and only a little weak   from 3  70 85
            if (AIGetFlag(player, e_flagsRunScared)) { // need to add check for ranges & max eval
                AISetAttackState(player, e_attackState_Scared);
            }
            else {
                AISetAttackState(player, e_attackState_Retreat);
            }
        }
        else if (eval < 96) { // need to add check for faster/retreat blocked
            AISetAttackState(player, e_attackState_Retreat);
        }
        else if (AIWaveState(w) != c_waveStateAttack) {
DebugAIPlayerWave(player, "attack1 merge main -> attack; set attack = attack vs. melee target");
           
            if (time <= 20) { //Kernel64: added time debug only
            AIWaveMerge(player, c_waveMain, c_waveAttack);
            AIWaveSetType(w, c_waveStateAttack, AIWaveTargetMelee(player));
            }
        }
    }

    //--- DROP-ATTACK ---

    if (state == e_attackState_DropAttack) {       
        eval = AIWaveEvalRatio(w, c_evalRange);
        if (eval < 80) { // need to add check for can we retreat successfully
            AISetAttackState(player, e_attackState_DropRetreat);
        }
        if (AIWaveState(w) != c_waveStateDropAttack) {
DebugAIPlayerWave(player, "attack1a In drop attack state, but not drop attack wave state?");
            AISetAttackState(player, e_attackState_DropRetreat);
        }
    }

    //--- SCARED ---

    else if (state == e_attackState_Scared) {
        eval = AIWaveEvalRatio(w, c_evalRange);
        if (eval > 99) { // turn and fight when strong
            AISetAttackState(player, e_attackState_Attack);
        }
        else if (eval < 30) { // retreat entirely if getting picked off        kernel64: from 70
            AISetAttackState(player, e_attackState_Retreat);
        }
        else if (AIWaveState(w) != c_waveStateRetreat) {
DebugAIPlayerWave(player, "attack2 merge main -> attack; set attack = retreat to gather offense");
            AIWaveMerge(player, c_waveMain, c_waveAttack);
            AIWaveSetType(w, c_waveStateRetreat, AIWaveTargetGatherO(player, c_townMain));
        }
    }

    //--- RETREAT ---

    else if (state == e_attackState_Retreat) {       
DebugAIPlayerWave(player, "attack3 set attack = retreat to gather offense");
        AIWaveSetType(w, c_waveStateRetreat, AIWaveTargetGatherO(player, c_townMain));
        AISetAttackState(player, e_attackState_InRetreat);
    }

    //--- DROP RETREAT ---

    else if (state == e_attackState_DropRetreat) {       
DebugAIPlayerWave(player, "attack3drop set attack = drop retreat to gather offense");
        AIWaveSetType(w, c_waveStateDropRetreat, AIWaveTargetGatherO(player, c_townMain));
        AISetAttackState(player, e_attackState_InRetreat);
    }

    //--- IN RETREAT ---

    else if (state == e_attackState_InRetreat) {
        if (AIWaveState(w) != c_waveStateRetreat && AIWaveState(w) != c_waveStateDropRetreat) {
DebugAIPlayerWave(player, "attack4 merge main -> attack");
            AIWaveMerge(player, c_waveMain, c_waveAttack);
            AISetAttackState(player, e_attackState_Idle);
        }
    }
   
    //--- IDLE ---

    else if (state == e_attackState_Idle) {
        count = AIWaveUnitCount(w) + AIWaveUnitCount(AIWaveGet(player, c_waveMain));

        // wait 30 seonds at least after retreating before attacking again
        if (AIWaveGetTimeSinceRetreat(w) > 60) {   // kernel64: from 30
            // always support allies attacking
            if (AIAnyAllyAttacking(player)) {
                AISetAttackState(player, e_attackState_Attack);
            }
            if (PlayerDifficulty(player) >= c_skirVeryHard) {
                if (AIWaveState(w) == c_waveStateIdle) {
                    // wait until the wave is idle before considering attacking again
                    AdvancedIdleAttackLogic(player, w, count);
                }
            }
            else {
                // base logic attack any time we have more than 30 units or it's been a while
                if (count >= 30) {
                    AISetAttackState(player, e_attackState_Attack);
                }
                else if (AIGetFlag(player, e_flagsTimeout) && AIWaveGetTimeSinceCombat(w) >= 300-10*count) {
                    AISetAttackState(player, e_attackState_Attack);
                }
            }
        }
       
        if (AIState(player, e_attackState) == e_attackState_Idle) {
            if (AIWaveState(w) != c_waveStateIdle) {
                DebugAIPlayerWave(player, "attack5 set attack = idle at gather offense");
                AIWaveSetType(w, c_waveStateIdle, AIWaveTargetGatherO(player, c_townMax));
            }
        }
    }
}


What I did was change some numbers and added a time delay to where the AI is forced to attack again after the two if, and else if conditions.

edit: apologies. I have no idea how to put these into a code box.

details:

Quote
    //--- ATTACK ---

    if (state == e_attackState_Attack) {
        time = AIWaveGetTimeInCombat(w);
        eval = AIWaveEvalRatio(w, c_evalRange);
        if (eval >= 96 && eval <= 99 && time <= 60) { // when not fighting and only a little weak   from 3  70 85
            if (AIGetFlag(player, e_flagsRunScared)) { // need to add check for ranges & max eval
                AISetAttackState(player, e_attackState_Scared);
            }
            else {
                AISetAttackState(player, e_attackState_Retreat);
            }
        }
        else if (eval < 96) { // need to add check for faster/retreat blocked
            AISetAttackState(player, e_attackState_Retreat);
        }
        else if (AIWaveState(w) != c_waveStateAttack) {
DebugAIPlayerWave(player, "attack1 merge main -> attack; set attack = attack vs. melee target");
           
            if (time <= 20) { //Kernel64: added time debug only
            AIWaveMerge(player, c_waveMain, c_waveAttack);
            AIWaveSetType(w, c_waveStateAttack, AIWaveTargetMelee(player));
            }
        }
    }

Changed eval values higher for attack and lower for retreat. Also added a time condition to when to attack again: if(time <=20)

Quote
//--- SCARED ---

    else if (state == e_attackState_Scared) {
        eval = AIWaveEvalRatio(w, c_evalRange);
        if (eval > 99) { // turn and fight when strong
            AISetAttackState(player, e_attackState_Attack);
        }
        else if (eval < 30) { // retreat entirely if getting picked off        kernel64: from 70
            AISetAttackState(player, e_attackState_Retreat);
        }
        else if (AIWaveState(w) != c_waveStateRetreat) {
DebugAIPlayerWave(player, "attack2 merge main -> attack; set attack = retreat to gather offense");
            AIWaveMerge(player, c_waveMain, c_waveAttack);
            AIWaveSetType(w, c_waveStateRetreat, AIWaveTargetGatherO(player, c_townMain));
        }
    }

This makes the AI retreat only when eval <30. Forces it to stay in combat longer even if outmatched.
#192
Thanks Aeg1s.

Kblood it's in meleeAI.galaxy. Currently tweaking times and eval values.
#193
Quote from: Aeg1s on March 03, 2010, 02:07:41 AM
Uhm, I just saw the AI use storm; did you tell it to research it first?

Cool. Which AI did you use? I want to see this too. And, did it use Chrono boost? Warpgates?
#194
AI Development / Re: AI Strategy
March 03, 2010, 01:46:05 AM
Well, I edit the AI to at least do things that  I would. This allows me to check things like BOs and econ stats timings, etc.
#195
Also, have you looked at Chrono Boost?

I'm guessing these are run much like how the race0.galaxy are.

edit:

Other Units have their Think. Have you tried using this with your code? <-- this is crazy. Your code is about the Think. Sorry.