archive by month
Skip to content

Steamhammer’s greatest misses

All bots have bugs, even strong bots. Watching a game Krasi0 vs Iron today, I saw that Iron had built many academies, some in rows like subsidized housing. Sadly, its devotion to education did not help it win. Krasi0, by the way, has a similar bug with turrets. It’s a kind of symmetry.

Here are some of Steamhammer 0.2’s most dramatic bugs.

drone defense aka suicide

Steamhammer loves to defend with drones. You can almost hear it jumping up and down, “Can I send out the drones yet? Can I send out the drones?” When it works, it looks brilliant—how did it kill all those zerglings and only lose 1 drone? When it fails, it looks ridiculous. Here the drones are blocking the bot’s own zerglings and the game is about to be a massacre.

I sent out the drones!

suicide aka drone non-defense

Despite its love of drone defense, Steamhammer sucks at defending its drones from early harassment. Its system of chasing the enemy scout with one drone is adequate against weaker bots, but often loses 1 or more drones against strong opponents. Here Bereaver’s probe already has 2 kills, and the newly-hatched zerglings are speeding past ignoring it. Not their job.

probe victorious

gas > life

Many bots share this play bug. Steamhammer 0.2 believes that vespine gas is more precious than life itself.

If you kill a gas drone, the bot will replace it. If you kill all but a few drones, it will put the survivors on gas and mine no minerals. If you kill a hatchery and leave the extractor, it will send drones to long-distance mine the extractor, and if you kill those, it will send more. Leave a few units in the destroyed base and Steamhammer 0.2 will ship over its entire mineral-mining population 3 at a time to be exterminated. Gas is more precious than life.

This bug is related to strategy, so it is mostly fixed. Steamhammer dev version has skills to start and stop collecting gas at sensible times. Tonight I’ll fix a bug in the interaction between automatically turning off excess gas collection and gas limits specified in the opening book. Later I’ll fix the one last corner case that I know of: If you kill an expansion hatchery while its extractor is still morphing, the bot will still do the extermination train when the extractor finishes.

expand to the enemy base

Some have wondered why, in longer games, Steamhammer sometimes sends a drone or two to the enemy base to die. That’s simple. It wants to expand there. What’s to stop it?

this looks like a good place to build

UAlbertaBot’s native “where’s the next expansion?” routine does not take into account where the enemy is. It only checks whether the spot is blocked by a known building, and I suspect that the check is not correct. The dev version tries to expand away from the enemy, only sets its sights on untaken bases, and is reluctant to take a base in the same region as any known enemy building (but it still will try, in a pinch).

scouting by mistake

But expanding to an enemy base is not so bad if you didn’t realize. After the early game, Steamhammer does not scout again until all known enemy buildings are destroyed. If you build where Steamhammer does not want to attack, there’s a good chance that you won’t be discovered until late game. It usually finds enemy expansions eventually, though, because it likes to expand across the map.

Scouting is high on my list, which means I should get to it sometime in February.

detection? what’s that?

Who would even try a straight dark templar rush against zerg, with no attempt to chase away overlords? Well, MegaBot would. It worked, too. Here the drones are trying to help out in a fight against invisible assassins that can kill them in one blow. Sure, you can send in the drones, stop jumping.

dark templar destroy a base

I’ll take this base twice—no, three times!

If you watch Steamhammer games, sooner or later the camera will move to a new base with a hatchery, one or two idle drones, and nothing else. The nothing else is because the bot does not try to balance its drones among bases; it only transfers as old bases saturate or mine out. The idle drones are because Steamhammer tried to take the same base more than once at the same time. The production queue had 2 or 3 hatcheries in a row, and the building placer decided to put them in the same spot. Often 2 drones arrive simultaneously and repeatedly prevent each other from starting the building—no need for an enemy, Steamhammer can harass itself. Eventually one succeeds, and then the other drones are despondent and go idle.

Nice one, right? It turns out that the building placer was missing a check, “don’t place a hatchery in a spot already reserved for another.” I added the check, but it still behaves the same; either the check is wrong (which I suspect), or else there’s another mistake. Steamhammer dev version at least puts the idle drones back to work.

So little to do, so much time! How will I alleviate the boredom?

Trackbacks

No Trackbacks

Comments

Jay Scott on :

All this and Steamhammer still made the round of 16 in SSCAIT. All these bugs are either nonfatal, or rare, or else usually strike when the bot is already losing.

krasi0 on :

...or the competition hasn't actually gone much further than Steamhammer :)

BTW, did you mean that there was a game between me and Iron which I won? That would be surprising with the version of my bot which has been uploaded to SSCAIT.

Haha! I loved that "Not their job." commend xD

Gas == Spice (on Dune) > life

Jay Scott on :

It’s true, all bots show off some awful blunders. My impression is that Steamhammer has more and more serious bugs than other bots of similar strength, and makes up for them in other ways. And yes, Krasi0 did win a game against Iron.

krasi0 on :

Did you run that game locally or has it been broadcast on SSCAIT? A link to the replay would be nice!

Jay Scott on :

It only took a minute to find: http://sscaitournament.com/Replays/KRASI0/178955-kras_Iron-TvT.rep

Jay Scott on :

Summary: Iron’s runby vultures got confused and didn’t accomplish anything, and that was all it took.

AIL on :

Some of the problems you describe here I have already fixed, partially fixed or workarounded in my bot.

And since your's is built on UAlberta aswell, I can hint you to how.

Some fixes are really easy as suprisingly some stuff is implemented but somehow not used in UAB.

Drone Defense: I could only improve it slightly by limiting the range over which drones are pulled to defend. But it's still possible to exploit them by walking them away and singling them out from the flock. Need to do more here.

gas > life: I only assign drones to extractors as long the amount of gas-workers is below 20% of that of mineral-workers. So early on that often means only 2 drones to gas and minerals are preferred when the drone-count is low. But I, right now, haven't taken drones from gas if mineral-drone-count drops while gas-drones does not. Also I have redone the rebalance-worker thing, so the distribution of workers in my bot in general is much better.

expand to enemy base: Haven't fixed that yet, but allowing min-onlys to be taken aswell delays the issue. ^^ But on "Destination" that causes drones to bug because the mineral-obstacle is not removed.

Detection: For some reason overlords were commented out from being added to squads. If you do that they will automatically be treated by the detectormanager. I slightly modified how they are treated. For example I don't use the other way of scouting, as this tends to suicide overlords and I only add 10% of the overlords (but at least 1) to the army, so that I can have more overlords in bigger battles but also not all incase the army underneath them dies.
However, DTs still bug out the Regrouping, even if they are detected, which is another issue. But Lurkers for example are not so much of problem anymore.
Oh, and sometimes "unitclosesttoenemy" also bugs and gets the wrong unit, having the overlords fly back from the main army somewhere to a unit that's on their way.

Multi-taking of bases:
Still kinda have that problem of several drones going there but my drones won't idle there. For some reason in updateWorkerStatus() idle drones with the job to build something were prevented to get their status set back to idle and thus weren't used for other jobs like going back to mining.

Um... can we maybe talk or chat on Skype or somewhere else sometime? There's some issues I'd like to know how you resolved them. I'm especially interested who to debug crashes. My bot crashes in certain scenarios and I've been spoilt by Unity automatically telling me where it happened, so that I don't know how to find it out here. I built a debug version of the bot and run the debug-BWAPI-plugin but what's the next step? 8[

Jay Scott on :

Sorry, I can’t help with debugging crashes. I tried debug mode once and didn’t get it working. I can get by because I have a cautious coding style and test carefully, so I can always attribute a crash to a recent change.

AIL on :

The problem is my crash happens when my bot loses it's spawning pool.
I initially only tested against the default AI, to which it generally did not lose and thus also did not lose it's pool
But when I switched to testing against UAlberta, this happened a lot.
But as I'm writing this I got a theory. I think it's the combination of wanting to build a building something but not having drones.
So not trying to build any buildings when there's no drones left might fix it...

Jay Scott on :

I have not seen that bug at all, so I imagine it is related to something you’ve changed.

AIL on :

I "fixed" it by returning from BuildingManager::update() when I have no drones.

The real reason is probably somewhere else there. But that won't explain why other UAB-derivates don't have that issue. So I might have broken something there afterall.

Not crashing was the most important as that really sucks for testing to have to start BroodWar again.... Now trying to improve drone-defense.

AIL on :

Nope, that was neither the fix nor the cause.
The actual cause was that I gave an Overlord to the scout-manager in order to save drones.
However, the overlord was returned to the worker-manager, which, when all workers were dead but that overlord still alive, it would try to build something with the overlord.
And this is what crashed the game.

I used Overlord-scout to find the base but now that I want to know whether to defend against some sort of rush the overlord scout is bad anyways, as it won't "meet" enemy rush-units on the way to me.

Jay Scott on :

Oh, a basic problem but hard to diagnose. Now I am tempted to add extra checks to ScoutManager and WorkerManager. I think ScoutManager only truly knows how to scout with workers and in fact only one at a time, even though some of the identifiers in the code are plural.

Ail on :

That was not the cause either, btw. All coincidental evidence. It was a missing check for the return value of GetProducer in Building manager. This time for real.
Btw. I did a series of like 15 games between the Sscait-downloadable version of Steamhammer and my Bot and it was like 12:3 in favor of mine.
Steamhammer dies too easily to early ling-pressure. The times he won was always because of getting more mutas out sooner while not having neglected lings too much. I'd like to test against more other bots than Steamhammer and Uab but most are linked against another version of Bwapi so I don't know how to test vs. Them.

Jay Scott on :

Ooh, the detection tip is useful, thanks! I will find a way to publish my bug fixes for others. I’ve written to Dave Churchill to see if he has time to accept pull requests on UAlbertaBot (he has become a professor and is likely super-busy in his new position). If not, I’ll publish them some other way, a github fork that people can pull from or just blog posts that point out what to do.

Jay Scott on :

OK, I heard back from Dave Churchill and will be posting separately about it!

AIL on :

I think I found the issue with the DT... It was not an issue with the DT but with the Overlord.
And it was not an issue with SparCraft but with a method that checks units before throwing them into SparCraft:
InformationManager::isCombatUnit

This filters Overlords out but not Observers.
And it filters Lurker out, that's why apparently it seemed to work against them.

So SparCraft thought: There's a DT but I have no detection, even if detection was present.

Jay Scott on :

Another excellent tip, thanks! Does SparCraft do the right thing if you alter its filter? When I tried that for spore colonies, I found that SparCraft truly did not support spore colonies (even though it supports turrets). I’m pretty sure it won’t support lurkers, but it may support overlords.

AIL on :

Can confirm that SparCraft does support overlords. They just weren't added.

I managed to find out what the main issue was with the slip-ups in the regrouping where it sometimes would cease to work for a moment and all units died.

But it's not a simple fix, because there's several separate reasons to that and it cost me about the whole day.

There's two main-issues:

1) Sometimes the regroup-point jumps to an overlord, who is behind the enemy-lines. Make sure that BWAPI::Position Squad::calcRegroupPosition() does not return the position of an overlord.

2) Regroup does not work for defender-squads.
Getting it to work was a real hassle. For whether to regroup or not, the unit closest to the the target is checked.
But the target returned by getDefendLocation() is just the base that is being attacked. So I rewrote that method completely to return the enemy-unit closest to the base and not the base itself.
Then I needed a different retreat-location for defense-units. A unit wouldn't work, as that would just cause them to look how their base is destroyed. So I'm looking for sunkens to fall back.
And then I had to change how SparCraft is fed which units partake, because the Lings happyly attacked enemies just outside of sunken-range, thinking the sunken would help. So I halfed the radius in which buildings are added to SparCraft.

In the end I could defend against UAB-Protoss for really long... until it had massive amounts of supply standing before and I had massive amounts of supply in my base. In the end UAB still won but it was not just a rollover of my bot.

Jay Scott on :

Wow, good progress. I’ll try the overlord in SparCraft thing myself and may send it to Dave Churchill as a fix when I get it working. As far as tactics, I really really need to work on it but there’s so much and it’s just not the next thing.... But in any case, thanks for the report, it should be helpful to everyone with a UAlbertaBot fork.

Ail on :

I have run into more very strange things. For some, yet unknown, reason researching overlord-speed blocks off everything else from the queue being done. Getting me to 3k over mines. While searching for that I found more bugs: You cannot research it at all in a hive because it thinks that only the lair can do it. I made a workaround for that but haven't been able to confirm it works as trying to research... Wait a minute. Maybe the two things are intervined.
And I think I also fixed that I can't do several upgrades at once despite having several evo-chambers. But I need to reimplement doing upgrades at all to test into my new approach. When it works, I will post the code.
Yeah, there's so much to do, to get a good bot. It is kinda frustrating to see how hard it is to deal with the cheap default Uab-rushes.

Jay Scott on :

By the way, are you planning to publish your code online? When you get it into some release-ready state, of course, probably after SSCAIT reopens for submissions.

Ail on :

I'll have to look into it. While my code is messy, I wouldn't mind having it online. I am not good with this git hub stuff. I appear to have made a fork but couldn't get to build it in this folder so I made another one where I just extracted the archive and that one works.
I tried to copy the files back to the other folder and push it via source tree but it somehow doesn't recognize any changes.
So I'll probably just upload some kind of zip archive myself or have someone who knows how it works to do it via git hub.

Jay Scott on :

Thanks for the calcRegroupPosition hint. It’s simple, hard to find, and makes quite a difference.

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.