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 - hd

#31
Yes we can. why would you even post a thread like this?
#32
Quote from: Kernel64 on March 08, 2010, 11:08:11 AM
Nah, I think the AI needs to cheat since it has no memory like humans have. We actually become cheaters when we get the gameplay down like in SCBW.

We always know what to expect, where things are, what things are likely to be, because of experience. The AI doesn't have this, so having it cheat balances things out.

Besides, the AI has very limited micro control.

HD, thanks again. I'll try it all over again. Actually, I had difficulty set for the vision to false. This means the AI should see.

It triggered sometime when I had a significantly larger base than it has: 1 hatch + 6 drones vs my 3 pylons + 14 probes.  ???

You can give an AI memory :X Using your own knowledge, you can give that to the AI. In other words, while we have to experience something or learn from anothers experience, we can literally GIVE that experience to the AI. We can tell it, based on information from early scouting if it should anticipate a rush. We can tell it, based on information from what units it comes across, what is likely going to happen. You can even tell it that if it scouts specific buildings early on, the opponent is rushing something (like nukes).

AI is only limited by the programmers limitations.

As an example, my protoss ai will try to build counter units to whatever units you get. It checks to see if it has the capability of building that particular counter unit. If it can't, it starts building what's needed to build the counter unit and in the mean time, uses a secondary counter unit from tier1.
#33
because the game isn't going to support more than that. Most likely it's only going to support up to 8 or possibly 12 people.

When you call PlayerRace(int player), the function has access to information we don't. Like a const cap of the possible amount of players. So, when you pass a number higher than the cap, it returns an error.
#34
Could probably do something like this:

int howManyPlayers(int player)
{
    int iCount = player;

    while (iCount < 12)
    {
        // echo a msg in game as to the value of PlayerRace() on a null value, then filter out the null value.
        if (PlayerRace(iCount) == "Prot" || PlayerRace(iCount) == "Terr" || PlayerRace(iCount) == "Zerg")
        {
            iCount = iCount + 1;
        }
        else
        {
            TriggerDebugOutput(1, StringToText("Invalid race found @ " + IntToString(iCount)), true);
            return iCount;
        }

    return iCount;
}
#35
AIGrabUnit would work.

Assuming the AI creates units from buildings in the order they were created, you could write a function that would keep track of what buildings are producing by how many of a unit the building type produces are in progress.
#36
Quote from: Kernel64 on March 08, 2010, 04:45:41 AM
I'm confused about OrderSetTargetUnit(). But maybe I'm doing something wrong, somewhere else though.

Also, I was trying this one:

Quote
if ((AIGetTime() > 0) && (AIGetTime() < 340) &&
    ( AIKnownUnitCount(player, AIEvalLargestEnemy(player), c_PU_Probe) >= 1)
    ) {
    TriggerDebugOutput(2, StringToText("Enemy is Toss!"), true);
}

Doesn't seem to work. I hate myself.

If the AI is using normal vision, AIKnownUnitCount will have no idea how many units it's opponents have until they come within line of sight of the ai's units. Thus AIEvalLargestEnemy is useless.

The best way I've found (for 1vs1) to get the opponents race is PlayerRace(3-player) == "Prot" for protoss, "Terr" for Terran and "Zerg" for Zerg.

int player is simple a 1, 2, 3, 4, 5 etc for each player. 0 being neutral things like minerals, gas, rocks blocking a path/expansion.

Thus, if you have 2 people, one of them is 1 and one is 2. 3 - 1 = 2, 3 - 2 = 1. So you'll always get the opponents player # (in 1vs1);
#37
Quote from: 1337 on March 08, 2010, 05:10:15 AM
Quote from: Aeg1s on March 05, 2010, 05:02:17 PMAlso, all variables have to be declared at the top of the function before anything else.
QFE - you will forget this one so many times.


Variables must be declared like this:

int a;
int b;
point p;
unitgroup g;


p = PlayerStartLocation(player);



This code doesn't work:


int a;
int b;
point p = PlayerStartLocation(player);
unitgroup g;





One more gotcha, don't try to assign the value of functions that return fixed to int variables. For example:
int dist;
dist = DistanceBetweenPoints(UnitGetPosition(u2), UnitGetPosition(u1)); //error
dist = FixedToInt(DistanceBetweenPoints(UnitGetPosition(u2), UnitGetPosition(u1))); //works


You will have to look up the function declarations to see which ones return a fixed...

uh... incorrect.

You can declare variables with a value before functions or additional code is added, you just can't declare a variable after it.

void ProtossCheckSupply(int player, int iSafe)
{
    int iMaxSupply = AITechCount(player, c_PB_Nexus, c_techCountInProgressOrBetter) * 10 + AITechCount(player, c_PB_Pylon, c_techCountInProgressOrBetter) * 8;
   
    if (iMaxSupply - PlayerGetPropertyInt(player, c_playerPropSuppliesUsed) < iSafe)
    {
        AISetStock(player, AITechCount(player, c_PB_Pylon, c_techCountQueuedOrBetter) + 1, c_PB_Pylon);
    }
}


The above code works just fine.
#38
AI Development / Re: Galaxy syntax validator Tool
March 07, 2010, 04:45:33 PM
my 7zip won't extract the files :X

nevermind, got it to work.

unfortunately, it's not helping me find the current error ;\
#39
Well, you could use th AINewUnitProt or whatever function which is called the moment a unit is complete or you start building a building.

Then test to see if the order in which it tries to build units from gateways is in the same order in which it indexes the gateways. Basically, if you have 2 gateways and you tell it to build 2 zealots, it should attempt to build one at the gateway in index position 0 / 1. Then it probably checks if any other buildings exist that can build the desired unit and then tries to build one there.

If it holds true, then you could make manual calls in the build order as to when to use chronoboost until we can find a way to know if a unit is being built at a structure.

edit for clarity, you make your own index of the gateways and then chrono boost in order based on the units in production. if 2 zealots are in progress, it would be 1 at each, thus chronoboost index 1 & 2, if only 1 is in production it's probably at index 1 (1 by the way, is normally 0) and thus you can control which ones get chronoboosted.

yeah it's not a sure-fire fix but it's only temporary until we can figure out how to know if something specific is being built at a specific building, which right now we can't.
#40
AI Development / Re: AI Script Editing Tool
March 07, 2010, 09:54:56 AM
Quote from: DarkZeros on March 07, 2010, 07:51:09 AM
The tool seems interesting. But there is an easyer way to edit the galaxy files without opening the MPQ.

I place the files in /SC2_DIR/TriggerLibs/  when the game needs a file, first searcher its main dir. So, no need to put the files inside the MPQ.

Which is fine when you're editing and testing stuff. But for distribution, you want to package it neatly for those who will use it.
#41
Well, if we had access to the AITechCount function to see how it checks if something is queued, or in progress then it would be a simple task of cycling through each building in order of importance, seeing if it has stuff in queue in order of priority and then checking to see if it's already time warped and if not, casting it. :\
#42
AI Development / Re: Idea for AI unit detection...
March 07, 2010, 09:50:49 AM
Well, I'm sure each unit has a unique identifier in the unit variable has. Thus, it would go through each one checking to see if it's seen it.

How it knows when it's killed one I'm not sure. In 1 vs 1, that would be simple... since a unit will most likely only die when it's within the AI's field of vision. Against multiple opponents though, I'm not sure how it keeps track of what has died, if it even keeps track of it at all.
#43
Updated with more accurate reflection of what would need to be done.

Quote from: 1337 on March 06, 2010, 08:32:41 PM
Name says it all, I want to know how to check how many units/upgrades are in the build queue at a particular building. I'm writing a Chrono Boost func that prioritizes based on what units are being built.

void ProtossCastChronoBoost(int player)
{
    if (AITechCount(player, c_PU_Zealot, c_techCountQueuedOrBetter) > 0)
    {
        // cast chrono boost on gateway
        return;
    }
    if (AITechCount(player, c_PU_Stalker, c_techCountQueuedOrBetter) >0)
    {
        // cast chrono boost on gateway
        return;
    }
}

ProtossCastChronoBoost(player);


Essentially, you check what's being built in order of what's important and exit the function once the criteria has been met.

Otherwise, you'd have to grab each building individually (which is harder than it sounds) and probably do a property check on the building to see if it's doing something and then if it meets your criteria, cast chrono boost.

void ProtossChronoBoostCheck(int player)
{
    bool bFound = false;
    int iBuildingCount = 0;
    int iCount = 0;
    string sBuildingList[x];
    unit uChronoBoost;
    order oChronoBoost;

    sBuildingList[0] = c_PB_Gateway;
    sBuildingList[1] = c_PB_RoboticsFacility;
    sBuildingList[2] = c_PB_Nexus;
    iBuildingCount = 3;

    while (iCount < iBuildingCount && !bFound)
    {
        uChronoBoost = AIGrabUnit(player, sBuildingList[iCount], c_prioNone, null);
        iCount = iCount + 1;

        // get unit property and check it
        // maybe try UnitOrderCount(aiUnit) > 0
        if (UnitOrderCount(uChronoBoost) > 0)
        {
            bFound = true;
        }
    }

    if (bFound)
    {
        oChronoBoost = AICreateOrder(player, "TimeWarp", 0);
        OrderSetTargetUnit(oChronoBoost, uChronoBoost);

        if (UnitOrderIsValid(uChronoBoost, oChronoBoost))
        {
            // casting chrono boost
            AICast(uChronoBoost, oChronoBoost, c_noMarker, c_castHold);
        }
    }
}
#44
AI Development / Re: Idea for AI unit detection...
March 06, 2010, 05:55:51 PM
Quote from: Kernel64 on March 06, 2010, 04:05:29 PM
What if we make the script omniscient first, then add in the simulation later? It will check as the script rolls and gets updated of what's on the board all the time.

It should then do what it considers the best set of actions based on some rating.

I'll post the full concept of this later, after some rest.

It would probably be best to have it check known vs all, updating what it knows and comparing it to all units of the enemy. then every 30-45 seconds it wipes what it knows and starts over or when a manual call comes in to wipe what it knows. this would allow for strategy changes.

As for knowing when to retreat and what not, that's already in the game. it has a weight value of its units vs the opposing units. if the enemy units out weigh the ai's units, it retreats. of course, you can turn this feature off i believe.
#45
AI Development / Re: Idea for AI unit detection...
March 06, 2010, 01:45:47 PM
Quote from: Kernel64 on March 06, 2010, 01:32:00 PM
Thanks, Heinermann!

This is brilliant,Hd! So, with the wavethink function, we can use the evalLargestenemy to get the enemyPlayer.

The WaveThink tries to simulate a LoS awareness for the AI. It doesn't remember what he had before, and constantly needs to see units in order to decide, if I'm not mistaken?

Have you tested the WaveThink yet?

I'm trying to discover how the functions involving waves and their strengths and ratios, for the purpose of having the AI evaluate itself, with regards to what it has vs. the enemy atm.

Waves in retreat, in the base, attacking, divert, etc.

Well, theoretically we can keep track of what it sees and make decisions based on what it thinks the enemy has... what would be very useful is figuring out how to subtract an unit from the known enemy units when an unit is killed.