Case against removing the opponentID

This post will be about the opponentID in StarCraft 2 AI. The opponentID is a number that a bot can use to recognize the bot it plays against. By recording information about your opponent you can adjust your play in subsequent matches. If you don’t win the first time, you will be able to try something different next time and hopefully win. The opponentID was introduced at the start of season 6 of the ladder, but some people don’t like it and it is now up for discussion whether it will be removed for season 7. You can watch this podcast for the original discussion. I like the opponentID a lot and I think it wil actually benefit the Starcraft 2 AI community as a whole. Below I will set out why I think the opponentID should remain.

The main reason why I think it should remain is because it encourages varied play styles. I believe these varied play styles are crucial to a healthy meta. Consider tournaments for the top Starcraft 2 players. During these tournaments, players will almost always switch up their build orders at least somewhat. If anyone becomes too predictable then the opponent will figure out how to counter their strategies. Cheeses, for the most part are used rarely, but occasionally you will see a player play some cheese build. This is mostly to keep the opponent in check. They can’t play too greedy without risking losing to some early rush. For bots, if they do not have opponentIDs, they will be unable to even tell they are playing the same opponent. This makes it impossible to throw in the odd cheese at a tactical moment in a series. This eventually leads to ever greedier play styles; if you can’t punish your opponents greedy play with a cheese, then you must become greedier yourself to keep up. Ultimately I fear that this will stifle variety in play styles for high level bots.

So what arguments are there against opponentIDs? During the podcast, Hjax brings up the following:

“[Suppose] I make a bot that does two things really well, and someone else makes a bot that does 100 crappy things. [Say] four of those crappy things can beat the things my bot does well, it will switch between them to find the things that beats it.”

Is it unfair that a bot with 100 simple strategies beats a bot that does two things really well? Does this allow low-effort bots to beat high effort bots? I would argue that a bot that does 100 different things is itself a high effort bot, even if those are not all very refined.

I have a different concern, namely what happens to a bot that does 100 different strategies really well? Imagine a bot that can switch between a well executed one base all-in to an incredible macro style from one game to the next. It also can do pretty much anything in between. Now this bot does not just switch between those 100 strategies randomly looking for one that happens to beat the opponent. No. It plays a single game against the opponent, analyses the game and if it sees a greedy opponent it will prefer some punishing timing attack. If it recognizes some cheese, it will know a counter to it. You might now object: “But Tyr, such an advanced bot is way beyond what anyone can build right now. You are talking about some imaginary, all-powerful bot!”. Not at all. The bot I am describing is called Steamhammer and it plays brood war. Its main race is Zerg, which knows 90 different opening build orders. It can also play random and knows another 32 openings for the other two races. The reason it can execute all of these builds well, is that it only needs to specify the opening build order. The details are executed by a more general system. Mind you, the strategy selection is not advanced enough to recognize all opponent builds and so far it still relies a lot on experimenting with its different builds to see what works. It is getting ever closer to that ideal though. If we want to have a Starcraft 2 AI that can play with such a variety of builds we need the opponentID.

Another Brood War bot I want to mention is SAIDA. This was a bot that was developed by a team of South Korean researchers at Samsung. It was released fairly recently and quickly climed up the ladder. Among other thing, it is capable of changing its build order dynamically between games. If you play a Dark Templar rush you might catch it off guard, but try that a second game and you may find that it has built some turrets just in time to hold it off. If you want to read more about this bot, here is a blog post on it by Jay Scott, the author of Steamhammer himself! This sort of dynamic reaction to an opponents build certainly is not possible without the opponentID. It only works if you have already coded when to scout for whatever sort of attack an opponent may throw at you.

There will most likely be a vote on the matter of disabling the opponentID (or not). In the end, the question of whether you choose for or against it comes down to deciding what you find more important: If we keep the opponentID, we will be rewarding a bot with 100 low effort strategies over a bot with one highly polished strategy. However if we remove the opponentID, then we will reward a bot that does one standard strategy well over a bot with 100 highly polished and varied strategies. I will certainly be voting for the variety.

Playing against Tyr as a human

I have been working on a setup that allows you to play against my bot. It is basically a compiled version of the ladder manager which includes ’empty’ bots. By setting an empty bot as the first player you can take control and play against Tyr. Here are instructions for setting it up, so you can play against it yourself:

  1. Download the TyrLauncher zip file.
  2. Extract the contents of the zip file to your pc.
  3. Copy the Maps folder to your Starcraft install directory.MapsFolder
  4. Start LadderGUI.exe
  5. Select a map to play on.
  6. For the first player, select one of the HumanPlayerX options, depending on what race you want to play.
  7. For the second player, select one of the TyrX options, depending on what race you want Tyr to play.

Edit: As AiSee has mentioned on discord, there is a hotkey for going full screen, so with these new instructions you don’t even have to navigate those menus! The bots still start with a delay, so you have to be a bit patient in the new setup.

  1. Make sure you find the Starcraft 2 instance for the red player (this is you).
  2. Press alt-enter.
  3. Start playing!

When the game starts, it will freeze for twenty seconds. This gives you time to switch to fullscreen mode:

  1. Bring up the menu using F10.
  2. Go to Options (hotkey O).
  3. In the Graphics tab, switch from Windowed to Fullscreen.
  4. Click Accept.
  5. Click Back to game (G).

Some notes: The empty bot that allows you to take control is not fully empty. It actually slows down the game, allowing you to play at a more normal speed. I have had some trouble getting the speed quite right. If you try it and the game stutters, or you think it goes too slow or too fast, please leave a message here and I will look into it.

Also note that this setup simply uses the regular LadderManager, so if you want to play against another bot, you can add it to the list of bots as you would in the ladder manager and pick that as the second player.

Have fun playing my bot and let me know how it goes!

Probots season 2 finals

Today I will cover the Probots season two finals. The finals were played between SarsaBot and dmytrobot. dmytrobot is mostly known for its worker rush strategy, but also showed in the semi finals that it could do a zealot rush. SarsaBot uses more macro style play. The finals will be best of 7.

Game 1

The first game, dmytrobot goes for its zealot rush. SarsaBot scouts it and puts five spine crawlers up in its natural as well as going for roaches. The large number of zealots do manage to take out three of the spine crawlers, but they do die in the process.

Countered.png

After this first attack, dmytrobot keeps sending in three zealots at a time. SarsaBot has spent so many drones building it defenses and even taking a third that it now has only thirteen left. SarsaBot decides to drone up, despite a constant influx of zealots. The remaing spines and queens hold for quite a while. SarsaBot manages to get back up to 50 drones against the 23 drones of dmytrobot, but in the meantime it has completely neglected its defenses. Its last spine crawlers fall. Only a single queen remains as defense. SarsaBot goes into a panic trying to rebuild the spine crawlers, but the only thing it accomplishes is sending a lot of drones to their deaths. The zealots take out the natural and main of SarsaBot. Only the third and fourth base remain. The zealots of dmytrobot don’t know to attack those bases though, instead they dance around under an overlord in the ruins of SarsaBots main. A single zealot does a good job at taking out the fourth base of SarsaBot. Then SarsaBot ggs and leaves the game.

This game is most remarkable for a number of shortcomings on both sides:

  1. After a perfect defense, SarsaBot decides to only make drones and allows itself to be defeated by the small groups of zealots, despite having a huge lead in economy.
  2. After basically defeating SarsaBot, dmytrobot is unable to find the remaining bases, allowing SarsaBot a chance to get back into the game.
  3. SarsaBot ggs in a situation that may be dire, but certainly not unwinnable.

These are all issues that should be easy to fix, but for this tournament such mistakes will mean the difference between winning it all or settling for second place.

Game 2

This game, SarsaBot switches things up and goes for a proxy hatchery at the natural of dmytrobot. When the hatchery finishes, SarsaBot starts some spine crawlers, a queen and some zerglings. The zealots of dmytrobot attack as soon as they come out of the gateways and they are easily defeated. Soon SarsaBot has three spines and two queens up. It also starts putting creep tumors inside the actual base of dmytrobot, limiting where it can place its buildings.

Proxy.png

SarsaBot pulls back the queens and lets up to pressure. dmytrobot finally gets the chance to get a decent amout of zealots. As soon as there are ten zealots they all move out. The three spines and two queens are not enough to hold. The proxy hatch gets taken out. SarsaBot builds five spines in its main against the mass of zealots that is approaching. dmytrobot barely manages to break through though. dmytrobot takes it second win.

Game 3

Game three looks a lot like game one. SarsaBot goes for three bases quickly, while making five spine crawlers and a decent number of roaches to defend. Two spines get taken out in the first wave of zealots, but all in all it is a good hold. The zealots start trickling in again. There is only a small number of roaches and they do not kite the zealots or fight near the spine crawlers, so quite of few of them die needlessly. SarsaBot starts making queens instead of roaches. It goes up to as many is five queens, while it still has only ten drones. Luckily the queens micro a bit better than the roaches. They actually move back when under attack, so they get help from the spine crawlers. They manage to stay alive a lot better. Finally SarsaBot starts adding on more drones. As its economy gets back up it also adds roaches again. eventually it goes up to five bases before taking out dmytrobot, who is still on one base.

Game 4

This game, dmytrobot goes for its probe rush. The probes micro back when their shields are down, similar to the probe rush strategy my own bot has. This allows it to keep its probes alive and defeat opponents, even if it has fewer workers.

WorkerrushChampion.png

For a while it seems as though SarsaBot will be able to hold on, but dmytrobot keeps a single probe mining at home, creating reinforcements for the attack. The reinforcements overwhelm SarsaBot and dmytrobot wins another game.

Game 5

Another probe rush, similar to last game. SarsaBot tries to take an expand,  even after seeing the probe rush. The game is very one sided. If only SarsaBot had spent those minerals on a pool, or even just more drones it might have ended very differently.

dmytrobot wins the finals 4-1. I find it remarkable how such a simple bot could win the tournament. When I first used the probe rush in my own bot, I had expected it to only be strong for a short while. I had expected other bots to adept quickly. Bots are indeed learning to hold it off, but it is a slow process, with lots of mistakes in the meantime. I do hope (and expect) that simple rush bots like dmytrobot will eventually be dealt with and we can move on to more solid play. In the meantime, congratulations are still in order for dmytrobot. The strategies may be simple, but it did manage to take out a lot of strong bots.

Tyr is now open source!

I have made my Starcraft 2 bot Tyr open source! It is available in GitHub under an MIT licesnse. The MIT license allows you to use it for any purpose, including commercially, so long as the license is distributed together with the original parts of the code. Please feel free to take parts of the code, or even use it as a base to build your own bot. If you have any problems setting it up, or if you would like some help figuring our how the codebase is set up you can leave a comment. Have fun!

Probots season 2 Semi finals

The second season of Probots has finished and it is time to take a look at the games. For the semi finals we have MicroMachine vs SarsaBot and HjaxAI vs dmytrobot. The semi finals are best of 5, while te finals are best of 7.

MicroMachine vs SarsaBot

MicroMachine is currently first on the ladder, with some awesome reaper micro into banshee harassment. SarsaBot goes for a more macro oriented style.

Game 1

SarsaBot does a nice job keeping out the reapers from MicroMachine, using just lings and queens.

LingsVsReapers.png

SarsaBot goes for a ling counter attack, but MicroMachine has hellions ready and defends with ease.

HellionsVsLings.png

But SarsaBot has a trick up its sleeves. A handful of zerglings manage to take out the tech lab on the starport.

DeadReactor.png

Normally, this should not be a big deal, MicroMachine doesn’t need the tech lab on the starport; the hellions are doing a fine job of cleaning up the lings even without the banshees. At any rate it could rebuild the tech lab without much issue. However, there is a bug in the code for MicroMachine. It doesn’t know to rebuild the tech lab and gets stuck in its build. It does make some more hellions, but it quickly starts floating resources. SarsaBot takes it time, but eventually it techs up to roaches. It keeps sending in small attacks and finally ovewhelms MicroMachine, which can’t keep up with its limited production.

Game 2

The second game, sadly shows another bug of MicroMachine. This game is played on the map ParaSite. Now this map breaks the python bots and was taken out of rotation on the bot ladder. MicroMachine isn’t python, but it also has a bug on this map. Sadly the author never found out, since it didn’t face this map on the ladder. MicroMachine for some reason refuses to mine from the main base. It immediately starts long distance mining from its natural expand.  The result is a rather short game as MicroMachine can’t get anything up in time to defend against SarsaBots lings.

GoingTheDistance.png

Game 3

The final game is very similar to game one. SarsaBot manages to snipe the tech lab and MicroMachine doesn’t know how to handle it. It does make some hellions. The hellions don’t dare to engage the spine crawlers from SarsaBot though. They have some trouble staying out of range though, and they keep taking hits.SuicideHellions.png

SarsaBot doesn’t manage to finish the game quickly, however MicroMachine doesn’t manage to take its natural base. Eventually it runs out of minerals. By this point the scvs from MicroMachine decide to start mining minerals from a base at SarsaBots side of the map.

GoingTheDistance2.png

Most of the SVCs get killed, and SarsaBot finally ends the game.

SarsaBot goes on to the finals. Sadly MicroMachine mostly lost to bugs. SarsaBot cleverly managed to exploit those errors in the code. I think its a very important lesson: Making a solid bot doesn’t just require strong play. Your bot also needs to be able to cope with various situations. If your bot breaks down in certain situations you can be sure that other bot authors will find out about it and exploit it.

HjaxAI vs dmytrobot

The next series is between HjaxAI and dmytrobot. dmytrobot is best know for its probe rush. However it is also capable of other strategies and the authors of the bots get the chance to make some adjustments to their bots between rounds, so it could have some completely new strategies. HjaxAI is traditionally a macro zerg. Hjax, the author of the bot has created a new version of its bot in java. However, it is not allowed to participate as it was not ready in time for this tournament. HjaxAI always used to lose to probe rushes, however Hjax has improved his old bot so that it should now hold those rushes as well. Lets see how this turns out!

Game 1

dmytrobot has left its probe rush behind and now goes for a zealot rush instead. HjaxAI puts three spine crawlers up in its natural. during the round of 8, HjaxAI went up against a different zealot rush bot and beat him.

ZealotsVsSpines.png

This time there are too many zealots though. They overwhelm the spine crawlers and quickly take out the base for HjaxAI.

Game 2

This time HjaxAI goes for a quick spawning pool and sends his first six lings to attack. dmytrobot already has zealots out, but they don’t know to defend, so at first only one zealot engages. Finally the lings get too close to the remaining zealots and pull more of them into the fight. The lings get cleaned up, but they do manage to take out a zealot and a gateway, slowing the attack for dmytrobot. HjaxAI builds the three spine crawlers in its main this time. Together with the queens and zerglings it manages to hold the zealot attacks.

ZealotsVsSpines2.png

HjaxAI has trouble getting up its natural though. Each time it tries, the zealots get on top of it and take it out. HjaxAI doesn’t even cancel it and loses a lot of minerals. In the end, both bots end up mining out in their main base. dmytrobot knows to do long distance mine, whereas HjaxAI doesn’t dmytrobot eventually takes out the defenses of HjaxAI as it can’t replenish the lost units.

Game 3

This game, HjaxAI loses its natural ealy on to the zealots, but it decides to make roaches, which could turn the tide. The past two games we only saw spines, queens and zerglings to hold off the zealots.

ClutchRoaches.png

The roaches come out just in time to defend the main of HjaxAI from the zealots. The next wave of zealots manages to take out the roach warren though. With only a limited number of roaches to defend, HjaxAI does not manage to hold off the zealots and the series ends 3-0 for dmytrobot.

The finals will be dmytrobot vs SarsaBot. As I am writing this the finals have already been played, so expect another blog post on that soon. Other than that, there is also the end of season tournament for the ladder, so make sure to watch that tonight at 21:00 UTC!

Probots 2 Round of 8 part 2

Yesterday, the final two matches of the Probots round of 8 were played. The first match was between SeeBot and DmytroBot. The second match was played between HjaxAI and YoBot. Again, these are best of three. Let’s see what these bots can do!

SeeBot(P) vs dmytrobot(P)

SeeBot is a protoss bot that makes heavy use of stalkers. It tends to put on constant pressure while getting a good number of bases and macro up. dmytrobot has a number of different strategies. His signature strategy is a probe rush, similar to the probe rush from Tyr. It micros back the damaged probes to conserve them and regenerate its shields.

Match 1

In the first game, dmytrobot uses its probe rush. This version of SeeBot doesn’t have any defense against worker rushes, so its probes just keep mining while they are all killed.

ProbeRush.png

dmytrobot wins a very uneventful game one. Interestingly, the version of SeeBot currently on the ladder does have worker rush defense, and would not have fallen so easily. The bots for Probots are quite a bit outdated by now though.

Match 2

This time dmytrobot goes for a more standard build. It gets up two stalkers and goes for the attack. SeeBot has more units though and he easily kills the stalkers. For the rest of the game, SeeBot builds up its army. When it goes for the attack dmytrobot only has a single Immortal.

HeroImmortal.png

The biggest problem with dmytrobot seems that it doesn’t know how to spend its resources. By the end of the game it has 1200 minerals, 400 gas, 4 Gateways and a Robo, but it has managed to produce only two stalkers and one Immortal during the entire game.

Match 3

Match 3 is a repeat of game 1. dmytrobot does the worker rush and simply steamrolls SeeBot. dmytrobot wins 2-1.

HjaxAI(Z) vs YoBot(P)

HjaxAI is a solid macro zerg bot. It won the first season of Probots. Its author has made  a rewrite of his bot in Java, however this was not ready for the tournament, so this is still his old bot playing. YoBot is much the opposite of HjaxAI. It builds proxy gateways and goes for a Zealot rush.

Match 1

HjaxAI scouts the proxy from YoBot. It responds appropriately by building three Spine Crawlers at its natural. They are enough to hold the first wave of Zealots, only losing one Spine Crawler in the proces.

SpineCrawlersHold.png

For the next wave of Zealots, HjaxAI has more Zerglings up. It loses a lot of Zerglings, but no Spine Crawler goes down this time. Each wave of Zealots HjaxAI holds a bit better and has a bigger army left. By this point HjaxAI has two bases while YoBot is still on one. HjaxAI doesn’t actually mine from its expand though. Finally HjaxAI takes a third and also transfers some drones to its natural. YoBot doesn’t know to take another base and stays on the single base for the entire game. Finally HjaxAI moves out and takes out YoBot.

KillingTheProxy.png

Match 2

The second match, HjaxAI doesn’t manage to get its natural up. He is contained in his main by the proxy from YoBot. HjaxAI holds off the attacks from YoBot easily. He steadily builds up his force. For some reason however, he never moves out with his army. Eventually he mines out, while YoBot starts long distance mining. The Zealots from YoBot are however, unable to do anything against the mass of Roaches from HjaxAI. The second game is declared a draw.

Match 3

Game three has more back and forth. HjaxAI does try to get up its natural base, but YoBot manages to take it down multiple times.

TakingDownTheBase.png

Eventually HjaxAI gets it up. Once the base is established and the defenses are up for HjaxAI there is nothing the Zealots from YoBot can do. HjaxAI builds up his army and eventually moves out to kill YoBot.

We have dmytrobot and HjaxAI going on the the round of 4. What is interesting is that HjaxAI, like SeeBot, doesn’t have any worker rush defense. The author, Hjax, does have a Java version of his bot that does have worker defense, but he is not allowed to use it, as it is technically a different bot. If he wants to win the next round, he will have to modify his old bot so that it can defend against the worker rushes as well.

Probots 2 Round of 8

It is an exciting time for Starcraft 2 AI. There are currently two tournaments on the way. The AI ladder is about to have an end of season tournament and for Probots the group stages have finished and the Round of 8 is under way. In this blog post I will cover the first two matches of the round of 8 that were played yesterday.

SarsaBot(Z) vs Spacemen5428(Z)

Game 1

The first match of the day was SarsaBot vs Spacemen5428. The matches in the round of 8 will all be best of three. Both SarsaBot and Spacemen like to macro up and they each take four bases before any real action happens. Spacemen does try to build a proxy hatch, but SarsaBot is having none of it:SpacemenProxyHatch.png

Despite what little success Spacemen has with its proxy, it still keeps sending drone after drone to try and get the proxy up. Even though no Hatchery actually gets started this does cost him a lot of workers. The first attack by Sarsa involves a large amount of Speedlings. The base only has a single Queen for defense and quickly gets overrun.

SarsaBotFirstAttack.png

The Speedlings continue on to attack the third. Spacemen barely holds off the attack with a number of Roaches, but takes heavy losses in the progress. All drones at his third are dead. SarsaBot is now in a dominating lead. It still sticks to Speedlings against the Roaches from Spacemen, but its economy is so far ahead that it doesn’t matter. The final attack from SarsaBot hits at multiple places at once. The Roaches get surrounded, while at the same time the Lings enter the natural and third.

SarsaDominating.png

The economy for Spacemen gets destroyed at the same time as his Roaches get cleaned up. SarsaBot wins game one. On the plus side for Spacemen, it does finally get of a proxy Hatch at SarsaBots tenth base.

 

ProxyFinally.png

Game 2

Game two starts out much the same, with Spacemen trying and failing to build a proxy Hatch. SarsaBot goes for a fairly early Ling attack at the natural, but some lings and queens from Spacemen chase them away.

SuccesfulDefense.png

A second attack a bit later takes out a Queen and some lings, but doesn’t do any serious damage.

SuccesfulDefense2.png

After this both bots macro up for a while. Sarsa does a better job at it though, both taking more bases and getting more workers. Eventually it attacks. Again we get Speedlings against Roaches, and again the better economy from SarsaBot gives it an edge, despite the fact that Roaches should counter Lings. The Roaches do manage to get in a good position on the ramp, but they eventually get overrun by the large numbers of lings.

UnsuccesfulDefense.png

SarsaBot wins the series 2-0.

Tyr(Z) vs MicroMachine(T)

The next match is between MicroMachine and my own bot Tyr. MicroMachine is a terran bot that goes for early reaper harass and follows up with banshees. For this tournament I created a Zerg version of my bot. Tyr knows a number of different strategies. In this tournament it mainly uses a 12 pool drone pull cheese build. It also has a number of more standard strategies it can use. Against Terran it can also do a Hydra Lurker build.

Game 1

In game one my bot chooses the Hydra Lurker build. However, it correctly identifies that MicroMachine is going for some form of rush (a reaper rush in this case) and decides to make some early Roaches to hold. My bot holds the reapers fairly well, only taking small losses and keeping the reaper count low.

RoachesDefendingReapers.png

Then, however, the Banshees come in. With only two Queens for anti air, my bot doesn’t stand a chance. My Roaches and Zerglings also do not realise that they cannot attack air units, so they just stand around under the Banshee to get killed.

RoachesDontShootUp.png

The current ladder version of my bot actually only gets a few Roaches when defending aggressive Terran builds and then goes for Hydras, so it does a little better against MicroMachine, but it still loses most games. This game at least is a win for MicroMachine.

Game 2

For the second game, my bot uses the 12 pool build. The drones sadly get pulled quite early and they arrive before the Zerglings, making the attack much weaker than it could be. MicroMachine already has his first Reaper out and his micro allows the Reaper to stay alive against my units. My bot does manage to take out all of the workers from MicroMachine.

DronesKillingSCVs.png

At this point, however, MicroMachine has four Reapers left alive and they kill my remaining units without trouble. Since my bot doesn’t have any units left it GGs and leaves the game. MicroMachine moves on to the next round.

 

I am a bit dissapointed with the overall performance of my bot in this tournament. It was an early version of my Zerg bot that wasn’t too polished, but it also didn’t get to show all it can do. My newer version already does better overall on the ladder, but it also isn’t nearly as good as my Protoss bot. I hope I will be able to make my Zerg bot stronger in the future.