archive by month
Skip to content

UAlbertaBot fixes #9 and #10

And these are the last of the batch.

#9 tracking mineral patches—or not

WorkerData has two maps of worker unit -> mineral patch.

  std::map<BWAPI::Unit, enum WorkerJob>         workerJobMap;
  std::map<BWAPI::Unit, BWAPI::Unit>  workerMineralMap;
  std::map<BWAPI::Unit, BWAPI::Unit>  workerDepotMap;
  std::map<BWAPI::Unit, BWAPI::Unit>  workerRefineryMap;
  std::map<BWAPI::Unit, BWAPI::Unit>  workerRepairMap;
  std::map<BWAPI::Unit, WorkerMoveData>         workerMoveMap;
  std::map<BWAPI::Unit, BWAPI::UnitType>        workerBuildingTypeMap;

  std::map<BWAPI::Unit, int>                    depotWorkerCount;
  std::map<BWAPI::Unit, int>                    refineryWorkerCount;

  std::map<BWAPI::Unit, int>                    workersOnMineralPatch;
  std::map<BWAPI::Unit, BWAPI::Unit>  workerMineralAssignment;

They are workerMineralMap and workerMineralAssignment. workerMineralAssignment is the “real” one that is updated. workerMineralMap is not updated and is referred to only in WorkerData::getWorkerResource(), which in UAlbertaBot happens to be called only to get the refinery and never the mineral patch.

I deleted workerMineralMap and replaced its 2 occurrences with workerMineralAssignment. The bug has no practical effect without other code changes, but it was lying in wait.

#10 no overlords in combat

This one is not mine--AIL reported it in a blog comment. If a zerg bot includes overlords in a combat squad as detectors (which you have to write code to do), then the bot does not pass the overlords in to SparCraft and ends up fleeing from dark templar without trying to fight because there is “no detection”.

I rewrote InformationManager::isCombatUnit() like this. The original has a redundant check to exclude lurkers and doesn’t include overlords.

bool InformationManager::isCombatUnit(BWAPI::UnitType type) const
		type.canAttack() ||
		type == BWAPI::UnitTypes::Terran_Medic ||
		type == BWAPI::UnitTypes::Terran_Bunker ||
		type == BWAPI::UnitTypes::Protoss_Observer ||
		type == BWAPI::UnitTypes::Zerg_Overlord;

Thanks, AIL!


No Trackbacks


Ail on :

Could that first one be the reason why my Bot often uses gas workers for things that it should only use mineral-workers for?
Like I periodically call rebalanceMineralWorkers to see if it maybe should go to an expo but despite saying to only consider mineral-workers it often happens that a gas worker gets reassigned to mining and loses the gas it is carrying.

One thing I tried yesterday unfortunately reduced the performance of my Bot. I wanted it to dynamically calculate scores for units to build based on enemy unit composition and remaining cost to tech to them. While it worked as intended, the effect just wasn't very good. Manually picked pro-active choices just seemed better. So not sure how much of that I am going to keep.

Another thing I did was making it save minerals and larvae when the spire was on it's way. This resolved one of the remaining weaknesses in ZvZ. My Bot looks as if it could beat almost all other Z bots with relative ease now. That mu is really well suited for different highly aggressive openings.

It's ZvP and ZvT is still very lackluster.

Jay Scott on :

In ZvZ I’m expecting the new Steamhammer to stand about even with a couple of the current top zerg bots and ahead of the others. But if your description is good, I think it will be behind your bot. It sounds like you’ve made improvements to tactics and reactivity that are critical to good play but are not on, erm, my critical path to get to the stuff I want to do. Also, if you’re judging your ZvT play by how you do against Iron and your ZvP by how you do against UAlbertaBot protoss, then I suspect you may be in for a pleasant surprise. :-) It sounds like you’ve been working hard and making very fast progress.

Jay Scott on :

For reacting to the enemy unit composition, my take is that it’s necessary but not sufficient. Ideally you want to react to the future and be ready to defeat what the enemy is going to do next. Another way to say it is: Get inside the enemy’s decision loop and force the enemy to react to you instead.

Add Comment

E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.

Form options

Submitted comments will be subject to moderation before being displayed.