archive by month
Skip to content

how to beat Stone, according to AIL

I took a little time off from my main goals for Steamhammer 1.1 development to follow AIL’s advice on how to beat Stone. AILien’s implementation is in WorkerManager::handleCombatWorkers(), so I guess AILien’s drones are given combat orders when an enemy is very near. The suggestion was for drones to attack enemies that came within range 50 and were not moving.

My implementation is a little different. I put it in WorkerManager::updateWorkerStatus() and was careful to disrupt mining as little as possible. I tried ranges 48 and 64 and decided that 64 worked better. The else if condition ensures that a worker which has been fighting returns to mining as quickly as possible (idle workers are put back to work within the same frame). A possible disadvantage is that gas miners do not defend themselves (but they never did before, either, and it’s not hard to add).

		// If the worker is busy mining and an enemy comes near, maybe fight it.
		else if (workerData.getWorkerJob(worker) == WorkerData::Minerals)
		{
			BWAPI::Unit target = getClosestEnemyUnit(worker);

			if (target && !target->isMoving() && worker->getDistance(target) <= 64)
			{
				Micro::SmartAttackUnit(worker, target);
			}
			else if (worker->getOrder() != BWAPI::Orders::MoveToMinerals &&
				worker->getOrder() != BWAPI::Orders::WaitForMinerals &&
				worker->getOrder() != BWAPI::Orders::MiningMinerals &&
				worker->getOrder() != BWAPI::Orders::ReturnMinerals)
			{
				workerData.setWorkerJob(worker, WorkerData::Idle, nullptr);
			}
		}

I also had Steamhammer build a sunken when it could. That freed up zerglings from chasing SCVs so that they could pay a visit to Stone’s base. Games became short and decisive. In a test match, Steamhammer beat Stone 15-0. The closest it came to a loss was getting down to 3 drones before the sunken came on line; most games were one-sided.

Steamhammer 1.1 will take that much longer to come out, but it will be that much stronger. The bot should lose fewer drones to harassment by the enemy scout, which will help in many matchups.

Update: The code has a bug! To fix it, change this condition

			else if (worker->getOrder() != BWAPI::Orders::MoveToMinerals &&
				worker->getOrder() != BWAPI::Orders::WaitForMinerals &&
				worker->getOrder() != BWAPI::Orders::MiningMinerals &&
				worker->getOrder() != BWAPI::Orders::ReturnMinerals)

to this, adding one more check:

			else if (worker->getOrder() != BWAPI::Orders::MoveToMinerals &&
				worker->getOrder() != BWAPI::Orders::WaitForMinerals &&
				worker->getOrder() != BWAPI::Orders::MiningMinerals &&
				worker->getOrder() != BWAPI::Orders::ReturnMinerals &&
				worker->getOrder() != BWAPI::Orders::ResetCollision)

Drones (and I presume other workers) go into ResetCollision mode for just one moment as they finish mining minerals. The effects of the bug are subtle but far-reaching. Drones going toward the minerals have the mineral-mining job. Having finished mining, they hit ResetCollision and, since they are carrying minerals, end up with the return-cargo job until they return their minerals to the hatchery, when they go idle again and are reassigned to gather minerals. (Returning cargo is not part of UAlbertaBot. I added it to reduce unnecessary loss of resources.) Mining appears to proceed normally, but behind the scenes drones are switching jobs unpredictably. You can no longer accurately count your mineral drones. Other tasks looking for mineral drones do not accept return cargo drones, which can cause buildings to be constructed slightly later. The effects are small and not immediately noticeable, but harmful.

Sneaky sneaky one!

Trackbacks

No Trackbacks

Comments

MicroDK on :

Sound worker defence. Maybe you should only use a certain number of drones for defence depending on how many workers are attacking. This will disrupt the mineral mining less, however, it might take longer to defeat the workers rushing.

Under which conditions will Steamhammer create a sunken?

Jay Scott on :

Good enough worker defense. :-) Range 64 is a very short range. Only the closest drones fight an intruder. Better would be to shift an isolated drone that comes under attack to a different mineral patch and to gang up more on intruders that venture to the middle of the mineral line. But this is good enough.

Jay Scott on :

Steamhammer starts the creep colony for the sunken as soon as the pool is underway, it has the cash, and no automatic emergency response intervenes (which happens if there are fewer than 3 drones—will probably lose then no matter what). Starting the colony is a major cause of drone losses, because Stone often pounces on a drone that moves a little away from the mineral line. But the sunken provides such a big benefit that it seemed worthwhile anyway.

MicroDK on :

The most important thing is the sunken. I have tried to use the worker defense without a sunken and my bot looses every time against Stone.

Jay Scott on :

Really? I wonder what’s different? Steamhammer wins most games without the sunken, but the process is less reliable and takes longer.

MicroDK on :

Basically, its Steamhammer 1.0 with BOSS bug hotfix and this worker defence using 9PoolSpeed. When I changed to 9Pool, the pool is created a little earlier and the zerglings manage to defend the base and kill the workers.

Jay Scott on :

Yes, creating the pool early enough is key—and not so early that you lose economy. I didn’t mention that, did I? But the rule is simple: To defend any kind of fast cheese, go 9 pool.

MicroDK on :

I jumped to my conclusion a little too soon. On 2-player maps Stone gets the upper hand because it can send three workers to my base and arrive very early. On 3 and 4-player maps it depends on the distance between the main bases. Stone is the perfect rush training partner. ;)

Ail on :

This comment is not really related to the topic at hand, but I want to discuss it anyways.

Yesterday, after another game against IceLab, I have decided that I cannot continue using UABs approach to unit management.

Basically what happens over and over: My bot has awesome macro, can pull ahead or stay on par with its opponent but when armies are spread out or attack it, its unit-control falls apart and becomes a mess.

I have made modifications to it in the past but whatever I do, there's issues that cannot be resolved with it and so I will code my own unit-management from ground up beginning today.

What UAB does is: It puts units in Squads, gives the whole squad a target and does one SparCraft-Simulation per Squad centered on a point (per default the unit closest to the squad-target).

The problem with that approach is: The more that there's going on and the further spread your and your opponents units are, the more likely it is that the SparCraft-simulation-center is useless. Increasing the simulation-radius can help to some extend but comes with other disadvantages. Trying to alter the location of the center can also help to some extend... but comes with other disadvantages once again.

You either keep your units clumped together or the UAB-approach will fail. This is very well demonstrated by the current state of my bot, where I tried things with spreading units out. Doing so costs me roughly 15% Winratio.

A main-problem is that it is not possible to use SparCraft for every individual unit. It is not just a comparison of numbers but a real simulation and as such it simply will become too slow if you do that with higher amounts of units. And for the decisions that UAB uses SparCraft for, such detailed simulation usually is overkill anyways.

What I want to do is make every unit have their own decisionmaking not only for micromanagement but also for "where should I be on the map" based on an analysis of its surroundings (Friends and Foes nearby).

Combat-predictions will initially be based on nothing but added costs but quite likely be further refined later on. They will, of course, never reach the accuracy of SparCraft but I hope it will eventually be good enough.
I also want to look into having different thresholds for engaging and disengaging based on the location of the combat and thus do something against the common UAB-issue of being to indecisive and going in- and out without achieving anything that happens quite frequently.

I see that initial further regression (as in losing even more win%) is very likely with a revamp of the approach but I feel it is a risk I have to take in order to elevate my bot to the playstyle that I envision.

Jay Scott on :

I keep pointing out areas where your plans and mine are similar, but here you’re thinking differently. I approve! Though it will be a while before I get that far, and I may change my mind. :-) By the way, Tscmoo likes to spread out its units and includes a combat simulator, so apparently there is a way to combine the ideas. That’s all the detail I know, though.

AIL on :

Well, it really depends on the complexity of the simulation and how its algorithms work.
From my observations tscmoo oftentimes does questionable things in that regard and seems to miscalculate outcomes and then runs away from fights that looked like they would have gone in it's favor.

I think some refinement to the unit-cost-comparison can get close to real simulation-results.
Of course a Mutalisk shall not think it can beat a Missile-Turret because it costs more and a Zerglings should not be more afraid of a Dragoon than a zealot just because the Dragoon is more expensive. But for now it's more about seeing whether the concept as a whole does work and fix the most important issues with it. Making the predictions more simulationesque will follow shortly after.

MicroDK on :

You could use many smaller squads eg. 10 to 15 with around 10 units in each. In this way you can assign different attack locations and different behaviour for each squad. Your units will not be spread out in the same way and Sparcraft simulations will be much more accurate. The indecisiveness of units still occurs when you only have a small amount of units...

AIL on :

Nope, not gonna go back now.
I have already uploaded the first version of that new approach and it seems to do quite well already.
It has beaten UAB-Protoss in a test-match. Something my old approach has only done about 2 out of 20 times in total.

I've spent a lot of time trying to bend the UAB-approach to do what I want and always had to struggle with side-effects.

Other bots passed mine in strength and I felt powerless to do something about it.

Now I have a working base which I fully understand and thus can easily tweak to do exactly what I want. If my bot makes mistakes now, it is now my fault and it will be easy to know why it happens and what to do about it.

I think about it a bit like infesting Kerrigan:
Kerrigan has worked before and was effective at what she was doing. But in order to best work in symbiosis with the Zerg many parts of her body had to be replaced by Zerg-Parts.
So that's what I'm doing with UAB now: Infesting it into an Ailien.

MicroDK on :

I did not know that you had already uploaded a new version with your new approach. Then it off course does not make sense to go back again. I only tried to think of a solution with UAB style squads. Individuals in squads could have a decision making of their own, even if all units have a common goal. The goal could be to attack enemy units in a radius of a given location and then the individual unit could still make their own decisions within that quad order. Well, that would be an expansion of the current target priority decision mechanism that already exists in UAB.

MicroDK on :

My bot just had an epic match against Stone. The match was about 54 mins and my bot really had trouble catching Stone's workers. Also, my bot was obsessed in killing the workers before finding Stone's base. Link: http://scbw.holdorf.dk/replays/20170214_233148_Microw-Stone_ZvT.rep
This shows three things (and properly more):
1. Stone has exceptionally good micro.
2. My bot needs to do scouting when it has enough units. Actually a drone started scouting, but was recalled because of low worker count so scouting never found Stone's base. Recall of scout was something that I just added.
3. Divide the main attack squad into more squads, so that not all units follow the same target.

Jay Scott on :

I see that Microwave was never in trouble after the early game—certainly not after zergling speed. But it sure was depressing to watch the infinite chase. Besides your ideas, I have a couple more: 1. When you see a lone enemy out in the open and you have enough units, detach 1 unit (or a small number) to chase it, and remove it from the target list of the others. The stray enemy will achieve nothing besides possibly scouting, and the main force will be free. 2. When you have enough units, you could set up a zone defense, which I think should be good for safety against drops, light harassment, and scouts. Divide the area you want to defend into zones and put a small number of units in each zone. The defenders should move to block approaching threats but should stay in or at least close to their zones. Early in the game the defended area might be your mineral line or your base, and late it might be a containment perimeter or the whole center of the map.

Jay Scott on :

Also note: If a mineral mining drone goes into ResetCollision condition at some other time, then this fix could cause another bug! I haven’t seen it happen, but ResetCollision has no useful documentation and I can’t rule it out. Does anybody know?

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.
CAPTCHA

Form options

Submitted comments will be subject to moderation before being displayed.