
国外知名网站sc2armory的工作人员gearvOsh在研究星际争霸2的MPQ文件(一种压缩文件格式)时发现,星际争霸2的地图编辑器语言 以“银河”命名,并且是一种类似C/Java/PHP的程序语言,以下是编辑器代码示例:
unit AIEarlyDefScoutZerg (int player, unitprev){
unit obs;
if (!AIGetFlag(player,e_flagsEarlyDefScout)){
return c_nullUnit;
}
if (UnitGetType(prev) == c_ZU_Overseer) {
return prev;
}
obs = AIGrabUnit(player,c_ZU_Overseer,c_prioScout, null);
if (obs) {
return obs;
}
if (UnitGetType(prev) == c_ZU_Zergling) {
return prev;
}
obs = AIGrabUnit(player,c_ZU_Zergling,c_prioScout, null);
if (obs) {
return obs;
}
if (prev) {
return prev;
}
return AIGrabUnit(player, c_ZU_Drone,c_prioScout,null);
} bool AIWaveNeedClearObsUnits (intplayer){
unit obstruction = null;
wave waveClob = null;
wave waveAtck = null;
int countClob = 0;
int countAtck = 0;
int evalAtck = 0; // Check global option
if (AIGetFlag(player, e_flagsClearObs) ==false){
return false;
} // Dont clear obstructions in the first10minutes (leaves the AI too open to being rushed)
if (AIGetTime() < 600) {
return false;
} // See if there is any obstruction
obstruction = AIGetObstruction(player);
if (obstruction == null) {
return false;
} // See if the clear obstruction waveisalready full
waveClob = AIWaveGet(player, c_waveClearObs);
countClob = AIWaveUnitCount(waveClob);
if (countClob >= 4) {
return false;
} // If the attack wave is getting weak,keepunits available for it instead
waveAtck = AIWaveGet(player, c_waveAttack);
countAtck = AIWaveUnitCount(waveAtck);
evalAtck =AIWaveEvalRatio(waveAtck,c_evalRange);
if (countAtck > 0 && evalAtck <80){
return false;
} // Yes, units are needed for clearobstructionduty
return true;
} void ProtossOpenGnd0 (int player) {
AIClearStock(player); AISetStock( player,1,c_PB_Nexus );
AISetStock( player, 8, c_PU_Probe );
AISetStock( player, 1, c_PB_Pylon );
// around 100 resources in about 2 units
AISetStock( player, 1, c_PU_Zealot );
ProtossTechUp(player, 1);
if (AIEnableVeryEasyStockOpen(player,c_PU_Probe)){
return;
} // around 300 resources in about 3 unit
AIAddStringInt(player, c_PU_Stalker, 1);
AIAddStringInt(player,AIPickFrom2(c_PU_Zealot,c_PU_Disruptor), 1);
}