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

#76
It just blinks, and then my PC starts to act funny.

What am I doing wrong?
#77
Couple of questions:

How do you manage waves and initiate attacks, diverts, drops?

What does a divert wave do?

Scouting with combat units?

The only way I can order an attack wave to attack atm is to loop a function with these:
            AIAddStringInt(player, c_ZU_Zergling, 4);
            AIWaveMerge(player, c_waveMain, c_waveAttack);
           AISetAttackState(player, e_attackState_Attack);

and the attack force is broken into groups of 2 lings spaced at mathematically precise distances.

It's funny watching the AI waste precious AMP on that parade, but hey, it's my fault.  :jig:

Have you got a function that you group certain units into a wave and send them to attack?

I mean, I have totally no idea how all of these works.
#78
AI Development / Re: Evolution of the Overmind
March 18, 2010, 01:59:14 AM
This is awesome!
#79
Here are some development notes that might be useful to anyone interested. The idea is to make a process for ai command execution and adding/modifying the OrderList -- the main list that the AI will process line by line.

Quote
Ultimate Goal:
        AI can decide the best course of action. But to do that, it must be able
        to filter through a collection of data.
       
        - it can get the numbers of what is. True, but it considers everything
        equal. How does it evaluate so that it will decide to make 4 drones in
        the beginning of a game?
            a) it is the most immediate thing it can buy.
            b) it is told to do so.
            c) it can see it will be needing the resource rate to make it happen.
           
        Option C is probably something very hard to pull of. There's just too
        much equation involved when you can simply feed it with information
        you know -- option B.
       
        Option A means that other decision factors must come into play whenever
        resources are high. Even so, a smart human will still spawn drones if
        it forsees a long match -- that it is going to need to gather resource
        to match the opponent's resource when the time comes what is in the bank
        has been depleted.
       
        note: AI can choose to go ECON, and choose DRONES if a function exists
        where the resource rate of its opponent is measured. It can then:
            a) WANT TO MATCH THAT RESOURCING RATE,
            b) BEAT IT by a degree,
           
        How I think:
            I chose to make all larva into drones because:
                a) there was no immediate threat, or
                b) the immediate threat is no longer a threat because
                    i) I have military to:
                        1.) Match it, or
                        2.) Hold it for enough time where the second
                            batch of larva and the production of units
                            is already possible.
            I did not think of:
                a) What if the opponent used that time to spawn units, and
                thereby pose a greater threat so that at the next turn,
                even if I produced all larva, I wouldn't be able to match it?
               
        AI Proposal:
            1) Check if opponent is producing ECON,
                a) yes:
                    i) Produce your own if you can
                    ii) Produce military and attack
                   
            note on ii: This would be very strong if the ratio after producing
                units is, Mine > Opponent
           
            therefore, we choose ECON only if we have equal military, we have
            no plans of attacking, we want econ.
           
            We WANT econ if:
                a) Enemy is going econ
                b) Military status quo is at a neutral level
                c) We do not wish to increase our rating Military wise
                d) We have free resource and larva,
               
            Two types of Econ building:
                a) Greed - we want more, because we can.
                b) Need - we have to, because we do not have.
               
            NEED
                - econ becomes the highest of priorities, even if we can
                do anything else;
                - we do not do this if military is not neutral, or minimal
               
                Military Status Quo reads enemy data of alive and in progress.
                Response to these must be immediate.
               
            GREED
                - everything else in the current status quo of demands have
                been met,
                - we have surplus larva, and minerals,
               
HOW TO DETERMINE THE STATUS QUO

    a) By feeding a list of what needs to be there at a certain phase
    b) By reading presently existing and changing data and responding:
   
    ECONOMIC STATUS QUO (B)
        1) We are greater, lesser, or equal to the enemy's economy
       
        How it works:
            1) READ ENEMY ECON STATUS
            2) CHECK IF WE NEED MILITARY
                a) No
                -Check if we are higher or lower or equal...
                    i) Lower
                        -check how many we can morph
                        -check how many we need
                        ()we can morph LESS THAN WE NEED TO:
                            -add them to queue
                        ()we can morph MORE THAN WE NEED TO:
                            -queue needed only
                        ()we can morph EXACTLY AS NEEDED:
                            -queue them
                   
                    ii) Higher (or Equal)
                        >> CHECK IF THERE IS A TECH NEEDED/WANTED...
                        yes:
                            *check if we have spare money after spending
                            on tech...
                                yes:
                                    -check how much we can spend on drones,
                                    -check how many larva are free
                                    -make accordingly (add to queue)
                        no:
                            {proceed to PRODUCTION check}
                           
                        >> CHECK IF THERE IS A PRODUCTION NEEDED/WANTED...
                        yes:
                            *check if we have spare money after spending
                            on Production
                                yes:
                                    -check how much we can spend on drones,
                                    -check how many larva are free
                                    -make accordingly
                        no:
                            *check if our money is good for expand
                                yes:
                                    -add expand 1 to queue
                   
                b) Yes
                    >> SATISFY MILITARY STATUS QUO
               

TECH-ING
    I want to tech because:
        a) I need to respond to a threat
            This is common. Human players choose a tech path based on what they want to produce
            in military. Upgrades are not considered tech.
           
        b) I can
        c) having this tech will allow me to counter threat better
        d) this tech is a prerequisite
       
    I tech even without a threat and way before a threat can be read because:
        a) I can
            -Everything else is satisfied
            -There is free resource
       
        b) It is a prerequisite to what I want/need now in Production queue
            -This is a call from other Directives. Directives such as Military
            and production can add a tech to the queue. But only if they
            absolutely need them.
           
    Why choose a baneling nest over roach warren and vice-versa?
        a) Enemy race factor
        b) Enemy forces factor
       
        I choose baneling nest if I'm looking to make banelings; R.Warren if
        roaches. Simple.
       
Issue: If the AI only builds tech if Threat data is already there, it will be
        too late when the threat arrives?
       
        Solution:
            We gather TECH data from the enemy and respond accordingly.
       
        How do you choose between two tech types available given enemy tech
        data without feeding the AI what's the best course?
       
            We can't. We have to have a list that the AI will use to evaluate
            what tech to respond with against a specific tech.
           
        We NEED Baneling nest tech if we see three gateways, and no Cybernetics
        core. (vs Toss)
        We NEED Roach Warren tech if we see two gateways, and no Cybernetics core..

Experience:

        (Vs. Toss with Early Immortal attack)
       
        When I saw gateway and cybernetics core, I was double minded between
        facing a stalker army/air/or immortals.
       
        When there was 3 zealots, I made lings. Harrassed, lost the lings, did
        not replenish, as they were not within range of attacking.
       
        I had to choose between mass lings/Muta/Muta:
            -Chose to expand early since I am capable of dealing with
            stalkers with lings, and there were no stalkers yet. (tech is ignored)
            -Chose to add gas/lair when RoboBay was in progess, and no
            stalkers were there. (lair was chosen as tech vs robobay. 2 gas was required by Lair)
           

    Therefore, we must have a list that the AI can use to counter tech choices of the enemy.
        ex.
            Tech to counter: Robotics Facility
            Tech Threat Count: 2
            Tech Counter: Lair, Spire

When do we Queue in a tech?

        a) When we need it for a Queen
        b) When we need it for a military response
        c) When it is a prereq to a desired tech
       

//==================================================================================================       
TECH MANAGER
        >>Check demand list which is queued by MILITARY, ECON, PRODUCTION, and self
        *do we have an item?
            yes:
                add this to the queue, and remove from our demand list
            no:
                (proceed)
        (since we have nothing demanded from other managers, let's see if we can slip in a tech)   
        (we always want to get to Hive. So we want prereqs done so we can get to hive)
        >>Check if we have Hive tech...
            no:
                >>Check if we have Lair tech...
                    no:
                        Check if we have Spawning Pool...
                            no:
                                add Spawning Pool to our demand list..
                                (proceed)
                            yes:
                                add Lair Tech to our demand list..
                                (proceed)
                    yes:
                        Check if we have Infestation Pit
                            no:
                                add Infestation Pit to our demand list...
                                (proceed)
                            yes:
                                add Hive tech to our demand list...
                                (proceed)
            yes:
                (proceed)
        (Let's see if we can slip in an Evo Chamber)
        >>Parse the Main Order List, and count the total cost...
        >>Get our current money and deduct the total cost of Order List items...
            *do we have spare money?
                yes:
                    >> Check if we can buy 1 evo chamber...
                        yes:
                            add evo chamber to our demand list.
                        no:
                            (proceed)
                no:
                    (proceed)
       
        (let's see if we can morph previos techs that was not called by Military, Prod, and Econ)
        >>Check if we have Hive tech...
            yes:
                >>Check what tech we don't have...
                    no Spire:
                        >>Check if we have spare money for this...
                            yes:
                                add to demand list.
                            no:
                                (proceed)
                   
                    no Hydra Den
                        >>Check if we have spare money for this...
                            yes:
                                add to demand list...
                            no:
                                (proceed)
                   
                    no GreaterSpire:
                        >>Check if we have spire...
                            yes:
                                >>Check if we have money for this...
                                    yes:
                                        add to demand list..
                                    no:
                                        (proceed)
                            no:
                                (proceed)
                   
                    no Nydus Network:
                        >>Check if we have money for this...
                            yes:
                                add to demand list...
                            no:
                                (proceed)
                   
                    (etc...)
            no (hive):
                >> Check if we have lair...
                    (do same yes and no here)
   
       
Note:    Our Military, Econ, and Production managers must always add what they need to the demand list,
        otherwise, the Tech Manager will choose a tech based on what it wants: TO GO HIVE and FULFILL
        EVERY MISSING TECH.
       
        the order of Fulfilling missing tech is from Hive down to Hatchery tech.
       
//======================================================================================================

Checking if we need Military...

    This function evaluates the Military Status Quo, and responds respectively.
   
MILITARY MANAGER

    what this does atm:
        1. Checks current enemy military force, and responds by adding unit orders to the OrderList.
        2. Updates the order list when we have what we want to produce in there.
        3. Demands tech if tech for Best Counter does not exists, also with secondary counter.
       
        -------------------------------------------------------------------------------
        ex.
            We see: Marauders, 10 units.
            Our Feed says:
                Best Counter Unit: Mutalisk
                Best Count: 40 percent
                Secondary Counter Unit: Hydralisk
                Best COunt: 100 percent
           
            We check if we have these units. If no:   
                We check if we can produce, if no:
                    We Demand Spire, because of Mutalisk
                    We check if we can produce secondary:
                        no:
                            We Demand Hydra Den because of Hydra
               
                our Tech Demand List becomes:
                    0 - Spire
                    1 - HydraDen
                    Tech List will process Tech demands like this:
                        Spire will be checked if it can be morphed, if not:
                            Pool will be checked, if not exists:
                                Lair is put first into the TechList.
                                Then Pool is put first into the techlist.
                            Tech list becomes:
                                0 - Pool
                                1 - Lair
                                2 - Spire
                                3 - HydraDen
        -------------------------------------------------------------------------------

    >> Gather current Enemy Military Data
        - list every enemy military unit by type and count, All in queue + progress + done. Most powerful
            comes first.
        - parse the list each line and: (repeat until the list is done)
            >>Get info on the best counter to this unit..
            >>Check if we have that unit include: ready, in queue, and in production...
           
            NO: Check if we can produce that unit..
                no:
                    >>Demand required tech, add to TechDemand list..
                    >>get info on the second best counter to that unit..
                    >>Check if we can produce that unit..
                        no:
                            >>Demand tech, add to TechDemand List..
                            >>Is this unit a Ground based unit?
                                yes:
                                    determine how many we can produce
                                    queue to our templist the default response unit to Ground Threats.
                                no:
                                    determine how many we can produce
                                    queue to out templist the default response unit to AIR threats.
                        yes:
                            determine how many we can produce
                            Queue that unit to our templist...
                yes:
                    determine how many we can produce..
                    Queue that unit to our templist...
           
            YES: Check if what we have in total is in the appropriate count...
                no:
                    add more..
                yes:   
                    (proceed)
        (continue parsing the list until done...)
           
    (we now have a templist)
    (we need to check the main OrderList, if we have these items listed)
    >> (Check OrderList if we have it there, update if necessary, add if not there)
        - Parse Orderlist by line
            - Parse ours each line until list is done..
                *Do we have it there?
                    yes:
                        *Is the count updated?
                            no:
                                change count to current count..
                            yes:
                                (proceed)
                                remove this line from templist
               
                    no:
                        add this line to the OrderList
                        remove this line from the templist
            (Continue until we've checked the entire templist)
        (continue until we've checked the entire OrderList)
#80
We can count alive or dead units, but is there a way so that the AI would count units that are in production , even in queue, or under construction owned by a human enemy player?

AITechCount works only for itself.
AIKnownUnitCount works for alive.

int DronesCount = TechTreeUnitCount(3-player, c_ZU_Drone, c_techCountQueuedOrBetter);

I know this works too. But I'm thinking region, point circle specific. Too complicated but I'm looking to grab certain structures and see if they're done. Like add-ons, etc. then go back a few seconds to see if they've been canceled, or does not exist anymore, or has been completed.

Edit:

Some traces of filters show filtering of buffs, ability effects (maybe same as buff), and checking of abilities. Maybe, just maybe, each structure's production queue is an ability. And if that ability is in use, we might be able to use this to check if a structure is working on something.

It may also be possible to create a group, and an order much like "follow" but this time, an "attack-move" order. This way, we can create a custom function that holds multiple groups of units, and order them to attack-move to certain location.
#81
This is great man. Haven't mentioned that yet, but this is much appreciated.
#82
Yeah, I know hd. Actually, what you said before always keeps me a bit grounded. For the sake of modesty, that is. And it's a good thing you said those words.

But yeah, as Astazha says, I love to think of the what ifs. But hey, if

"If (AITechCount( player, c_zu_Spawningpool, 3) != 1) works, maybe, just maybe, if we consider number of gateways and pylons as a single unit, we could do something like

HyperCounterUnit(data_struct_Gatewatys);

???
#83
Go for banelings.

10 drones,
2nd overlord
13drones, pool, 1 extractor. keep pumping drones until you reach 16/18 food. have 2 drones mining gas. You can expand here to your natural expansion.
Once the pool pops:
  queen, then 3rd overlord. Then baneling nest when you reach 50 gas.
keep pumping zerglings, and morph them to banelings asap.

after they're dead, morph the next batch of larva to drones. Lair tech, and make 2 more extractors for a total of 3 running.

Remember to keep spawn larva using queen.
then use the next batch for lings. overlord, then spire.

Mutalisks, maintain at least 24 zerglings while you keep pumping mutalisk. add more lings or expand to 2nd expo. Then when you have enough muta at about 9mins, win the game!

Hope that helps.
#84
So it's like making a chess engine of the sort. Making an AI that can generate it's own list of to-do's and choose between lists of what it can do at certain degree of effectiveness, is something.

I suggest a far simpler approach. An ai that doesn't problem solve, but still solve problems. It will become predictable overtime, in terms of how it responds, when, how much, etc. Eventually people will be able to trick it to doing something by triggering it to do just the thing, and smash it down, depending on how well the AI can shift between blocks of commands, and how fast it checks and rechecks if it should take another block.

This involves creating a database of the sort. These said blocks, or list of commands. These commands may be small, like, Train 6 lings more, tech to hydra, add more drones, add two more ovies.

It won't be as intuitive as what you mentioned, but it can serve, just as you said, to provide some level of responsiveness. It's not as close to an actual thinking engine, but more like a scenario randomizer that allows players to at least develop some skills until they face an actual human opponent.

I sure hope that idea of yours is doable. But if we can make an AI (or most accurately script) that does respond even if not at that level of precision you described, then I believe it would still be worth it.

Your insight is worth noting, and I think those capable should get a crack at it.
#85
Done some testing. Here are the results.

I used the list thing that I posted to automatically queue in units depending on the number of enemy lings it has seen.

Quote
    if( AIGetTime() < 2) {
        AIResetCounterUnits (player);
    }
    CBlockStatus = ProcessOrder(player);
    if((AIGetTime() < 2) && (CBlockStatus != "InProgress")){
        CBlockStatus = BlockOne(player);
    }

        AICounterUnit(player, c_ZU_Zergling, 1.00, c_ZU_Zergling);
        test = AICounterUnits (player, (3 - player), c_ZU_Zergling);
        test = test / 100;
        SQU = IntToString(test);
        UIDisplayMessage(PlayerGroupAll(), 1, StringToText(SQU));
        if (test > 0) {
            if ( InjectItem(c_ZU_Zergling,
                        "Unit",
                        test,     
                        c_townOne,
                        c_nearCloseDropoff,
                        test,
                        c_techCountInProgressOrBetter,
                        player) == "Success") {
                       
                CBlockStatus = ProcessOrder(player);               
            }       
       
        }
   
    else {
    CBlockStatus = ProcessOrder(player);
    }

What I noticed was:
- the variable test was in hundreds. So divided it by 100 to yield 1 for 100.
- the processorder() has a bug. fixed it just now. (this is the custom thing a few posts up)
- counter unit functions returns 100 per 2 lings, but my processorder func since using AItechcount counts 1 ling as one. So AI makes half of the unit countering it should be doing. multiplying this either through the counter unit, from 1.00 to 2.00 will fix this for lings.

So far, I'm pretty excited of the potentials. I'm going to test structures later on.
#86
Cool.

Does calling AICounterUnit() actually make the player make the MakeWhat?
#87
Ooze-some!

I've updated the ProcessOrder thing in the previous post. It includes expansion. Meaning, you can inject an expansion into the list, and have the AI run it without interfering with other items in the list.

The issue with expansions previously is the conditions waited that a hatch be in progress for the next line to fire. This time, using AIExpand, as it returns the number of queued expansion orders, everything is fine.

edit: Post updated. Anyone can use it or modify it to make it better. The idea is the AI will have multiple lists and switch between them per direction.
#88
Thanks guys. I'm getting all confused at the moment with pointers.
#89
Those are brilliant thoughts, man. As for the decision making, I'm largely inclined to using personality. Personality in the sense that certain variables makes the AI be inclined to say make a bigger army, should it's stockpile be at the level you mentioned.

There are only these objectives the AI must choose from:
Military
Economy
Tech
Production

Military being the level of its military strength in comparison to its target.
Economy, number of workers, number of expansions.
Tech, level of technological capabilities, research, unit type it can produce.
Production, the potential it can wield a certain type of unit. Or in the case of the Zerg, larva, which includes queen, hatcheries.

I don't know if we can control the AI to position its units at a certain location on the map, and have it value that area higher. If so, map dominance/control could be one of what the AI would strive for.

As of now, what I'm thinking is how the AI would choose to pump military instead of econ, say, Triple-Rax+reactor marine pump from 5-7mins, then make a push.

So it's like, once the AI has chosen Military, and in that sense not in defense or response, but rather pump a certain military unit, it will automatically have values in its Aggression increased, but with variation in the amount that aggression calms down.

It will calm down, and retreat if it is losing, fast or sees the enemy has units its own is weak against. How to determine that, is just using a function that makes the AI evaluate what it sees and reduce everything to numbers and put itself in comparison by point value. Haven't coded this yet, but it can prove useful.

Anyway, that's how I would do it.
#90
I want.