LetaBot’s wall 2 - the outline
Yesterday LetaBot found the center tile of the location it wanted to wall. Here is the outline of the rest:
- Precalculate some stuff.
- Initialize
useHighGroundtotrue. - Call
RecursiveWall()to calculate a wall or fail. - If it failed, set
useHighGroundtofalseand callRecursiveWall()again. - Do a final check: Is the wall in time?
The precalculation is surprisingly complicated. It looks like the main results are Closest and Furthest tiles in a bounding box that the wall must fit into. Closest is the tile in the bounding box closest to the original command center by ground and Furthest is the farthest reachable tile in the box. Both are required to be walkable and buildable.
If LetaBot can, it builds the wall on high ground. On many competitive maps, the main is on high ground with a ramp down, and the wall definitely belongs on high ground. On some the main is on level ground and the wall can be placed freely. On a few, like Jade, the main is on low ground with a ramp up. In that case, LetaBot will look to build its wall outside the main if it can. I’m not sure whether that’s good or bad; my Brood War knowledge is lacking. Conventional wisdom is that an up ramp means you should expand early so you don’t have to fight up your own ramp, so maybe any wall is a mistake. And I have seen LetaBot lose on Jade when its wall proved easy to attack and hard to defend. Can some terran expert tell us more?
The final check looks to see whether LetaBot has already started to build without waiting for the wall calculation to finish. Wall planning is done in a separate thread because it may take a long time. LetaBot is prepared for the case that wall planning takes too long and the bot has pre-empted the wall by starting to build elsewhere.
//also check if the producmanager isn't already building
//because if this is the case then don't go for a wall
bool StopWall = false;
//check if supply depot already build
BOOST_FOREACH( BWAPI::Unit* building , Broodwar->self()->getUnits() ){
if( building->getType().isBuilding() &&
building->getType() != BWAPI::UnitTypes::Terran_Command_Center ){
StopWall = true;
}
}
if( ProdMan != NULL ){
if( ProdMan->TotalTypeInQueue( BWAPI::UnitTypes::Terran_Supply_Depot ) > 0
|| ProdMan->TotalTypeInQueue( BWAPI::UnitTypes::Terran_Barracks ) > 0){
StopWall = true;
}
}
if( StopWall == true ){
WallSound == false;
WallCalculated = false;
}
The first check looks for any existing building other than a command center, and the second check looks into the production manager’s queue for either a depot or a barracks. If either check finds that it is too late, the bot tells itself that no wall is possible after all.
Next: Starting on the details of RecursiveWall().
Comments
krasi0 on :