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

#16
AI Development / AI Ability Usage xmls
March 08, 2010, 11:18:55 PM
For those of you who weren't aware TargetFindData.xml and ValidatorData.xml in the game data folder contain some of the logic for targeting and using of abilities. For example here is the stimpack section of ValidatorData:




    <!--
    StimPack
   
        if (already buffed)
            return false;
           
        if (!attacking)
            return false;
           
        if (nearby medivac can heal)
            relax next two constraints:
           
        if (recently damaged)
            return false;
           
        if (!hostile targets)
            return false;
           
        return true;
    -->
    <CValidatorCombine id="TacticalStimPack">
        <Type value="And"/>
        <CombineArray value="TacticalStimPackTestBuff"/>
        <CombineArray value="CasterIsAttacking"/>
        <CombineArray value="CasterNotInCombat"/>
        <CombineArray value="TacticalStimPackHostiles"/>
    </CValidatorCombine>
#17
Quote from: Kernel64 on March 08, 2010, 01:44:13 PM
Does Grab include structures currently under construction? How about AIKnownUnitCount?


AIKnownUnitCount counts units under construction too; if you want something more specific use TechTreeUnitCount with one of the following flags:
const int c_techCountQueuedOnly         = 0;const int c_techCountQueuedOrBetter     = 1;const int c_techCountInProgressOnly     = 2;const int c_techCountInProgressOrBetter = 3;const int c_techCountCompleteOnly       = 4;const int c_techCountIncompleteOnly     = 5;
#18
AI Development / Re: Help With Functions
March 07, 2010, 07:36:22 PM
Quote from: SPmac on March 07, 2010, 06:59:14 PM
hd: Sry, Copy/paste error, check out the OP last section that's how it's supposed to look, but thx much for the help..

also... I got things running, turns out my problem was w/ sumthing completely different...

I commented out a block using /* ..... */

I guess it is illegal to use this method of commenting...? I used line by line commenting, and poof it works... But the section about Clearing and Enabling Stock helped tons..

thx again


Yeah no /* */ style comments.
#19
Quote from: 1337 on March 07, 2010, 04:07:24 PM
To use my code, add it to the beginning of Protoss0. I'm not sure but Galaxy may require that prerequisite functions be declared before functions that use them.


Yeah, you need a function prototype above anything that uses it if the function is declared below them.
#20
AI Development / Re: Chrono Boost working
March 07, 2010, 03:59:46 PM
Alright, here's the code for the queue; I meant to modify it so it would work with multiple AI's but have been working on other stuff lately.


http://pastebin.com/VLaeVdBt


I have moved it into its own separate file but it used to sit at the top of the protoss0 file.
#21
From what I've seen I'm almost positive the marker is used to mark targets so another caster won't try to cast something on it too.


u is the caster; if you want to set a target use:
OrderSetTargetUnit(order o, unit target);
#22
Quote from: 1337 on March 07, 2010, 12:32:46 AM
OK so now say I have a point, how do I get the x and y coordinates of that point?


is it point.x or point.X or point.x() or point.X() or point.GetX()


I would very much like to know this too; so far I've tried:


point.x
point.X
point.fx
point.fX
point.mx
point.mX
point.m_x
point.m_X


and none of them work :(
#23
Quote from: Kernel64 on March 07, 2010, 04:04:43 AM
Behavior data are found in BehaviorData.xml Buffs are here too. TimeWarpProduction and TimeWarpResearch are here.

figuring out if this:
        AISetFilterBehaviorCount(filter, c_noBehaviorMin, c_noBehaviorMax, "TimeWarpProduction");

succeeds in filtering out a gateway that already has chrono boost on it.


Nice thanks, I was looking for how to do that too.
#24
AI Development / Re: Idea for AI unit detection...
March 07, 2010, 04:30:22 AM
Quote from: Kernel64 on March 07, 2010, 02:49:34 AM
Quote from: Aeg1s on March 06, 2010, 08:14:47 PM
AIKnownUnitCount(player, enemyPlayer, unitClass); will return the number of enemy units and if you haven't disabled normal vision via: AISetDifficulty(player, c_diffNormalVision, false); then the AI can only see what's in its normal vision range (ie. no cheating and seeing everything on the map).

Does this mean that each time we call AIKnownUnitCount, where seeing everything is off, the AI will only return the count of what it sees?

So, say, the previous second, the ai saw 6 lings. And it retreats. Now, while in the base and no scouts, the AIKnownUnitCount will return 0? This is correct right?


Actually no, it will return 6; it still knows the opponent has 6 lings. It ends up tracking those lings somehow; I'm not sure if it tracks each one individually or just knows there are at least 6 lings (ie. if it kills 6 lings later it will no longer know how many the opponent has). Some testing would be needed to determine this.
#25
AI Development / Re: Idea for AI unit detection...
March 06, 2010, 08:14:47 PM
AIKnownUnitCount(player, enemyPlayer, unitClass); will return the number of enemy units and if you haven't disabled normal vision via: AISetDifficulty(player, c_diffNormalVision, false); then the AI can only see what's in its normal vision range (ie. no cheating and seeing everything on the map).
#26
AI Development / Re: Code Snippets & Functions
March 05, 2010, 05:04:52 PM
Quote from: Kernel64 on March 05, 2010, 01:06:28 AM
Where do I insert these codes? Do I insert them at [race]0.galaxy?


Personally I put them in a seperate file that I just include in the [race]0.galaxy files but they can go directly in the race files if you want.
#27
AI Development / Re: Getting the AI to wallin
March 05, 2010, 05:04:04 PM
Yeah, I've seen (and used) the build flags but they still don't make a wall in. I think that's the best we're going to get though :/
#28
The .galaxy files are written in galaxy  ;) , Blizzard's own custom scripting language for sc2. Its very similar to c as you already noticed but there are some differences. There's no ++ or -- operators, all if functions have to have brackets {} (no one line if statements), there's no for (but you can use while() {}) for just some of the differences. Also, all variables have to be declared at the top of the function before anything else.
#29
AI Development / Re: Variable Arrays...
March 05, 2010, 04:58:04 PM
Quote from: hd on March 05, 2010, 03:46:41 PM
Anyone have a good grasp of how these function in Galaxy?

I've seen a few references to arrays but I'm not sure how to declare them, if you have to explicitly declare the size or if it's dynamic and why they're dotting the ends.

For example: "AreaArray[0].Radius";

Is the . refering to a sub variable of AreaArray[0] or is it calling a function to be run on the value of AreaArray[0]? If it's calling a function, is it array specific?


That section you reference is actually strings for access ability data. You can declare and use arrays just like you would in c (although I don't know if you can initialize them).


For example:

static int playerRace[8];


...


if (playerRace[8] == c_raceProtoss) { ...
#30
AI Development / Re: Chrono Boost working
March 04, 2010, 09:59:39 PM
Quote from: Override Impulse on March 04, 2010, 09:49:19 PM
An easy work around would be to create a double array for the static queue, since you don't have more than eight players, assign each player 0-7 for the starting queue, that way you can also use the queue for other items as well.

IE:
switch(player#)
{
switch(player race)
{
queen enhance larva / protoss chrono boost / other terran mule | scanner sweep | supply upgrade...


Seems like you should get the most out of your code to reduce load and increase efficiency / easier to work with in the long run.


Mmm good point, I hadn't thought about it too much. I did think of using a 2d array but wasn't sure if galaxy would support that; of course I can pack that into a 1d array. As for using it for other abilities I'm not sure if there's anything else that would need a queue like this since queens should just stay by one hatchery and the mule can check mineral counts at expansions for example.