- Nibbits
- StarCraft 2
- Forums
- Tools
- Green Tea AI
- GT AI Code Wiki
- New Reply
Post Reply
If you were logged in you would gain 3 XP for posting a reply.
You are replying to:
Support Nibbits by linking to us:
If you were logged in you would gain 3 XP for posting a reply.
Support Nibbits by linking to us:
I will explain more clearly how the AI Scripst work.
* When you open the GT AI, there are 3 folder :
- Some main file:
+ RequirementAI.galaxy => This is where you get the string code of the AI.
+ BuildAI.galaxy => Placement of the AI.
+ MeleeAI.galaxy => This is where the AI Script Begin.
+ TactZergAI.galaxy/TactProtossAI.galaxy/TactTerranAI.galaxy
=> These file to control the ability of some units, but not all. Rest of the
ability in the xml file of SC2 but not include in GTAI Scripts.
+ Zerg/Protoss/Terran.galaxy => This is where the AI Scripts of each Race begin.
- 3 folder Green Tea Main , Commander and Gamedata:
+ Gamedata : don't need to look at this folder.
+ Commander : this is where to store the scripst of each commander.
+ Green Tea Main: basic function of GT AI.
* Now in the Green Tea Main folder:
+ GTZInformation.galaxy : This file will give the AI some basic function.
+ GTZCount.galaxy: Count unit, measure the strength of each player.
+ GTZAttack.galaxy : Various attack function.
+ GTZAuto.galaxy : Some common process : build worker, expand, build defense.
+ GTZBuildTrain.galaxy: The build and train functions of the AI
+ GTZCondition : Some criteria of the AI here, when it will attack ? when to retreat ?
+ GTZFunction: Timer / Harvest rate/ Chatting scripts
+ GTZPoint : Most common basic point of GT, include determine nearest units.
* Here are some example of the most common used function in GT AI:
+ GTTrain (player, priority, town, unitype, number );
- player: always be "player";
- priority: from 0 - 10, the higher get more build priority.
- town: 0 : First town, 1 : Next expand town...
- unittype : these value can be found in RequirementAI.galaxy
- number : A number unit should train
+ GTTrainA : Train after the Unittype 2 has that number: Train 2 zealot after 1 gateway build
+ GTTrainI : Train when the unittype 2 is in progress: Train 1 Hightemplar when the Psi-storm in research.
+ GTBuild (player, priority, town, buildtype, number, flags );
- player: always be "player";
- priority: from 0 - 10, the higher get more build priority.
- town: 0 : First town, 1 : Next expand town...
- buildtype : these value can be found in RequirementAI.galaxy
- number : A number building should build
- flags : These are location, can be found in BuildAI.galaxy file.
+ Same at Train function, there is some variant,
...I: when something in progess
...A: after something has build
...T: only build 1 in many town. ( Some tech building need it )
+ GTBuildP(player, buildingtype, number, point)
It is different from the GTBuild method because it make the AI build at specific point.
There are some prepared point from file GTZPoint.galaxy
-GTCenterGroup => Return the center of group.
-GTDO => Target the gather outside point ( near the choke point )
-GTDI => Target the gather inside point.
-GTDI 1,2,3 => Distance variance between the in and out side defense point
+ Some conditional function (bool)
- GTFinishA (player, unittype, number) => Return True if there has enough number of these units on the map.
- GTFinishIA (player, unit, number) => Return True if there has enough number of units, include the units in production.
+ Some counterfuntion :
- GTCounterUnit2(player, build1, unit1, number1, build2, number2, unit2, number3);
When the opponent build build1 building type , the AI will respond with build build2 (number 2 is the number of the building) to produce unit2, number 3 is the ratio between unit1 and unit 2.
* Ex: GTCounterUnit2(player, c_PB_RoboticsBay, c_PU_Colossus, 1, c_ZB_InfestationPit, 1, c_ZU_Infestor, 1.5);
=> When it see the opponent build RoboticsBay, it will give the respond to build Infestation Pit, and produce Infestor 1.5 times the quantity number of Collosus
* Ex2: GTCounterUnit2(player, c_TB_BarracksReactor, c_TU_Marine, 8, c_ZB_BanelingNest, 1, c_ZU_Baneling, 0.3);
=> It see the opponent build BarrackReactor but it won't build any Baneling Nest yet until it see 8 Marine, then this time it will get the signal to build baneling Nest. Product Baneling 0.3 Times Marine.
* In summarize: It need 2 condition: It must have build1 and enough number of unit1 to meet criteria.
Some times, when the number of unit1 too much, we need to build 2 building. Like:
* Ex3: GTCounterUnit2(player, c_ZB_Spire_Alias, c_ZU_Multalisk, 12, c_PB_Stargate, 2, c_PU_Phoenix, 1);
That mean when it see around 12 Multalisk, definitely need to build 2 stargate and generate more phoenix. 1 phoenix vs 1 multalisk.
* In the Commander AI folder:
. The Basic struct of one commander is like this:
Beside the above function, there are some special scripts like:
+ Opening
- GTShowTimer(player) : show the timer.
- GTPreventScout(player) : stop enemy scouting probe/scv/drone.
- techlevel: GTGetTech : assign tech level of the AI.
+ Economy Management
- GTExpand(player) : The AI will automatically expand when it have enough money to build second base.
- GTMineralGas(player): AI will auto balance between Mineral and Gas. The Gas is always has priority, but when it above 300, automatically transfer worker to harvest mineral
- GTSupply(player, tech_level): It will increase build more supply generator when the tech level increase
+ Strategy:
- GTDefend(player): Make AI defend when necessary
- GTRock(player): AI will destroy the rock the the Gold Minerals or the closest rock
- GTAttack(player): AI Attack
- GTRetreat(player): AI Retreat.
+ BuildUnit/Building:
- GTAutoBDefend(player, 0) => Auto build the defend at main and expand
- GTAutoResearch(player) => Will research depend on the units of the AI.
+ Expand:
- GTAutoBExpand(player, i) => Auto build the expand base.
+ Some special function for Zerg:
- GTMoveQueen => Move the First Queen to second base
- GTCreepTumor(player) => Auto generate creep tumor for Queens.
So this is a basic frameworks of the AI. Hope this help :).