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

#16
I'm looking for ways to select enemy units that are known by the AI and ideally get their location as well.


You can use AIFindUnit() with the enemy player number, but this returns units that the player has not seen yet and would be cheating.


Some of the tactical functions have scangroup enemy passed into them, but I don't know where this comes from.


Other than that AILastAttacker looks like it would return an enemy unit (though just the one), and the UnitGroup function with an appropriate filter looks like it might show some promise.


Has anyone had luck selecting an enemy unit or group?  Has anyone found a way to get a unit's location?


Among other things, I'm looking for a non-cheating way to identify the location of enemy expansions so that they can be directly targeted, and for Zerg and Protoss enemies I'm looking to send an Overlord to spy on them until it's no longer safe to do so.


You could just get the location of towns using the enemy player #, but I don't want the AI to cheat.
#17
AI Development / Re: Evolution of the Overmind
March 19, 2010, 10:19:24 PM
OvermindReadEconomy() will give you your income now.  It's pretty accurate.  The changes happen faster than what shows up in Blizzard's monitor box, but that's because Blizz is showing a running average.


Correct assessment of drone assignment to gas depends on using the OvermindSetPeonGasCount() function to assign them.
#18
These might help:


http://www.sc2mapster.com/api-docs/galaxy-language/arrays/
http://www.sc2mapster.com/api-docs/galaxy-language/structs/


They're not specifically about pointers, but pointers are addressed within them with examples.  The structures one is really good - pay close attention to the example of what not to do.
#19
Is it working for you Kernel64?
#20
Would love to see that.  I'm going AITrain for sure instead of the stock functions - that's one of my next big goals.  My intent is not really to create a queue but to have the AI decide every time what it should be building right now.  Unless conditions change, it should be heading for the same goal during every calculation cycle anyway, and if things have changed then changing directions is appropriate..


The reading from a text file thing: we can parse XML... the only thing is I'm not sure if you can reach XML that is outside of the MPQ.  Even if you couldn't though, a utility could be generated that would edit the AI variables without someone having to really get into code.


Another idea, and one that I'll be doing for testing at least:


I want to build the Overmind AI so that I can co-exist with another Zerg AI.  The idea is to have


1) A constant determining how many of the AI are allowed
2) a static global variables tracking how many are present already
3) code in the ZergInit that looks to see if an Overmind AI slot is available, if not this player gets the default.
4) a player indexed array will store which AI a player is using, and all of the appropriate functions will have to have if statements to shift between them.  This will mean that it will take a significant amount of surgery to install Overmind into a new AI version in this manner.


At the most basic level you would just replace the OpenGnd0 etc. level of code, but if you really wanted to see the full difference then the unit-behavior functions in TacticalZerg and the army behavior in MeleeAI etc. would have to have if statements as well.  This would allow you to see the difference that is made by things like the improved Queen routine we wrote.


It may not be worth the hassle for release, but for testing ZvZ this would be invaluable.  If you did release it like that, then the number of allowable AI's of each type could be one of the XML variables.  Or it could be random selection.  A 2v2 would be more interesting if a mix of completely different AI's was possible - though that would be a nightmare to maintain.
#21
AI Development / Re: Evolution of the Overmind
March 19, 2010, 02:44:31 PM
I've done some thinking about where these algorithms might be headed.  Here are some ideas for the future:


Prediction:


The ability to predict is the heart of intelligence.  As a framework is developed and as the AI becomes capable of dealing with the present, it's true brilliance will come from dealing with what it expects in the near future.


Production/Tech/Expansion


One of our difficulties is how to balance such things.  Here's one take on the matter:


We begin with some assumed capabilities:
1) The AI has an enemy unit composition that it is comparing itself to.  Intially this will be what is known, later it may include assumed production rates, etc.


2) The AI has a system of valuing a unit or mix of units against this enemy force.


3) The AI is capable of calculating it's production into the future given different scenarios.  This is something I'm actively working on.


Then we assign a window of time for when we predict combat will take place.  It might be "Somewhere between 30 seconds from now and 3 minutes from now.  Then we diminish the value of a unit over time, so that producing  100 points of units in 30 seconds is worth more than producing 200 points of units in 3 minutes.  One way to diminish this is just a linear (or other) reduction over time.  Another is to compare the units to an assumed growth rate of enemy forces.  The AI's personality variables may also impact it's perception of how time affects the value of a unit - more aggressive AI's will be more impatient.


To compare two scenarios - let's say either build more zerglings or tech to roaches - the ai will calculate the point value of each over the time window and determine at what point within the window, if any, it becomes more valuable to produce roaches.


Things worth looking at will be:
1) What will the difference in capacity be for the two scenarios?  This is the real goal of teching - to increase the # of points/minute that you can produce against your opponent's army.  What this increased capacity must be weighed against is "Is it safe to tech?"


2) How long till the low tech scenario counters the enemy forces?  How long till the high tech scenario counters them?  What's the difference - how big and how bad is the window of vulnerability?


3) Can short term weakness be held off with defensive structures?  A gas heavy tech like mutas might be a devastating move to make, and building a pile of spine crawlers in the short term might provide the security to do it without having much impact on our capacity once the tech is reached (if we're gas limited)


4) What are the other values of a unit - and this one will be hard to quantify, but roaches are:
     * more re-usable
     * excellent scouts
     * good for worker raids
None of these is really accounted for in the calculation of "how many roaches does it take to defeat X Zealots and Y Stalkers?"


I don't have this fully thought out, but this is the direction I'm headed with it, and it seems like the kind of thing that would balance tech and production.  I often find when I start heading in a direction that things become clearer as I approach the goal.


It could also generate the initial build order - the computer could be operating with a threat of 1 zealot and a time window of 3 minutes (or whatever it is) and be left to calculate a build based on it's personality.  More aggressive build will go 10-pool or something, and more patient ones would go for a fast expo.  (And maybe patient/impatient should be different from aggressive/defensive)


Unit Valuation


I want to try a weighted average against the assumed enemy force composition and see how that goes.  It will be overly simple, but that's appropriate to start with.  Things can always be more sophisticated later; right now they need to be achievable.


Posture

Separate from the personality constants, I'm imagining a posture variable that the AI itself would set.  After losing most of it's forces and having a large enemy army remaining it might "turtle" for a short time.  This kind of thing would affect it's tendency to go for mobile units where it can assert map control or for defensive structues that provide more economical defense at the cost of mobility.


Levels might be things like:
Turtle - seriously not poking our heads out and preparing for the worst.  Consider building crawlers for defense and do something to recover control - tech, rebuilding drones, hidden expansion, whatever.


Cautious - it's time to venture out a little more, but the enemy has a strong presence.  We should not be doing things like transporting drones from one expansion to another or making other unnecessary troop movements. We're less interested in where the enemy is than where they're not because right now we want to be where they're not.


Neutral - starting stance, no particular bias


Aggressive - we have map dominance.  Expanding etc. should be done without concern or escort.  The cost of missing opportunities is higher right now than the cost of losing some units.  We are very interested in knowing where the enemy is so that they can be contained.  This is not a reckless posture, however.


Seek and Destroy - the enemy is full on the run, and what matters most is getting the scouting done to make sure they aren't recovering at a hidden expansion somewhere.  Some recklessness is appropriate - Waves shouldn't even bother to regroup at this stage because no real resistance is expected and time is of the essence.


Something like that. 
#22
I don't know yet myself.
#23
Seems to have trouble with this array declaration.  The code is working.


static int[c_maxPlayers][c_OM_NextMemoryIndex] omOvermindMemory;


both of the size parameters are previously defined constants.

#24
AI Development / Re: AIDefenseThreat
March 18, 2010, 09:25:30 AM
No, but based on watching AI behavior and reading the wave coding in MeleeAI.galaxy I suspect that it comes up true if an enemy unit is within sight of a town.  I believe this is what's happening when the current version of Starcrack chases your scout all over the place, or when an assault wave gets recalled for base defense.
#25
AI Development / Re: Capturing Debug Lines
March 18, 2010, 09:18:50 AM
Very cool.  How do you get the Debug Panel to come up?
#26
AI Discussion / Re: 1v3 at 6.1.1.
March 18, 2010, 03:13:57 AM
There are probably better options, but this one will do it:


http://darkblizz.org/Forum2/sc2-tools/starcrack-launcher-with-color-and-race-selection/
#27
So for example the Military subroutines (Cerebral?) will produce the output:  I want Zerglings and Banelings in this ratio, with no more than X Banelings but as many Zerglings as I can get.


The Overmind will then balance that with everything else.  It doesn't matter if the initial way to reach the decision about unit composition is really poor or even random, because you can make it sophisticated later and the Overmind doesn't know the difference, it's just getting better input.
#28
I'm trying to get to approximately the same place with my Overmind project, just going to take it in small pieces.


Quotea) 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.
I'm shooting mostly for C, with perhaps a tiny bit of B.  It's important to me to have an AI that makes decisions for itself.

I think the resource rate is very doable, and I'm working on that angle now.  We can initially just feed it an order or have it select from them based on map size and personality, but the problem just appears later in game if we don't think about it.

It requires 6 (about 5.5 actually) drones to produce an income that will finance Zerglings as fast as a Hatchery makes larva.

It requires 14 drones to do that if the Hatchery has a queen.  (These values are calculated, not from testing, so the AI can reach these conclusions without help.)

We want some amount of surplus for development unless (and this should be the unusual case) it is tactically worthwhile to spend everything on military at that time, but that cannot be sustained unless we're on the winning side of the exchanges.  Exactly how much surplus could be one of our personality variables.
So you can start with this kind of thing - if you told the AI you wanted to have double the required income it would conclude that an 11-Pool is the thing to do, which would be reasonable initially.  Once it evaluated that it could improve it's production capacity by building a queen, it would conclude that it wanted twice the economy of 14 Drones, which isn't possible with one town.  At this point, it must make do with one town until conditions are ripe for expansion.  Only 24 Drones would be useful so it would stop there, or perhaps even stop for a bit at the point of diminishing returns, 16, to press the military angle based on scout information about the enemy unit count and the recognition that 6 or 12 or whatever Zerglings isn't going to cut it anymore.


Once the military is happier it runs up to the max of 24.  Somewhere in there it starts to wish for Banelings to deal with this Zealot infestation and goes for gas.  At that point the AI needs another Hatch for increased production capacity and it needs an Expansion to make it's economy any better.  It will make a security evaluation and either Expand, Hidden Expand, or just build a 2nd Hatch at home to boost military production and reach a security level that will permit truly expanding.

I don't know that 2x will serve us throughout, but it can always be modified by other routines based on game conditions - most likely this would be data about enemy force sizes.

I think at the strategic level it's worth guessing what the enemy's economy is, but most of the time it will be exactly that.  Our scouts aren't going to get to see their mineral line once the game gets going, so we'll have to make assumptions based on the number of known expansions, etc.

I ran some testing today on economic rates.  These numbers are pretty close:


Quote1st 2 Drones on a mineral pile:  2/3 of one mineral per second (each)
3rd Drone on a mineral pile: 1/3 of one mineral per second
1st 2 Drones on gas: 2/3 of one gas per second (each)
3rd Drone on gas: 1/2 of one gas per second

Hatcheries produce 1/15 larva per second, and a queen hatch pair produces an additional 1/10 larva per second.  The Overmind thread has a link to a function that calculates larva & larval rates, and I'm working on the economic functions right now, to include marginal rates, % of possible economic capacity, payoff times, etc.

I'm also managing gas between certain min and max thresholds so that peons aren't wasted for gas when we're dying for minerals.  Right now it's half-ass, but I'll be wanting to make that sing us a tune before long.

I'm initially making nothing but Zealots and Banelings available to the AI, and asking to defeat Starcrack's full Protoss with that.  This will drive the framework and decision making infrastructure without bogging it down in the endless list of unit possibilities.  Use of subroutines to keep the decision making modular will allow us to increase the sophistication of a particular aspect without upending the whole framework.
#29
AI Discussion / Re: 6.1 AI zerg too easy?
March 17, 2010, 09:11:28 PM

The present version of Starcrack (6.1.1) Zerg is somewhat limited.  Zerg only have one opening build, and as was said above they don't build enough units.


Even if you roll the air-power mid-game build, it shifts back to ground during the Late stage and never develops Brood Lords no matter what.  2 of the late builds are just Zergling/Hydra/Roaches, and the 3rd one adds Ultras.  Pretty basic.

I'm developing an AI for Zerg that I'm calling Overmind that I hope will make this a very fun race to play against.  I <3 Zerg and I want to see the AI making good use of them.  It's going to be a while though as I'm dropping the "randomly selected build order" approach in favor of making an AI that is truly making decisions, and it's going to be a lot of work.
#30
Says "Cannot open process!"