< BACK TO HOME

Starcraft II Win Predictor

2018

TL;DR: What Did You Do?


I Tuned a ResNet-18 Convolutional Neural Network to predict who would win a game of Starcraft II given just a map image in game. To obtain a dataset, I automated data collection using Google DeepMind's Starcraft II API on 410 tournament games by professional players. To test on live games, I utilized Google's Tesseract Optical Character Recognition tool to capture live Starcraft II resources displayed on the screen for the player.

Introduction


This post is a general commentary and explanation of my work. If you want a more formal explanation of the the work I have done, my unpublished white paper can provide that information.


Example of Starcraft II gameplay from a player's perspective.

What is Starcraft II?


Starcraft II is a realtime military strategy video game developed by Blizzard Entertainment. In it's 9 years of being released to the public, it has had a strong esports competitive scene where the best players in the world compete in one versus one matches. The goal of the game is to build a base to develop an army that can destroy the other player. The game ends when player loses all of their buildings. Due to its complexity of strategies, reading your opponent, intensive multitasking, and fast reactions required, this game is considered to be one of the most difficult games to master. It is difficult enough that Google DeepMind choose Starcraft II as their next machine learning challenge after mastering the game of Go.

Cutting Edge Work


There is a lot of work being done currently on machine learning and Starcraft II. In particular, Google Deep Mind has recently released their results on their AI controlled player AlphaStar and its early success versus some professional players. While by far the best AI out there, it is not without flaws. I will not go into the criticism that many have over AlphaStar's super human speed, but instead focus more on how the AI makes macro level decisions. When I say 'macro', I am not referring to the small decisions like moving a particular units out of harms way or taking a different attack path, but rather the larger strategy that is executed over a period of time. For example, choosing to play a more safe strategy that will give you a better economy is a good macro level strategy when you are slightly ahead. Similarly, doing a more risky strategy might be the macro level strategy when you are behind. But to do this requires the AI to have some idea of how well it is doing in the game. I chose to focus my efforts on developing a classifier that could predict who would win a game of Starcraft during the game.

My Implementation and Analysis


For my work, I developed a classifier aimed at predicting who would win in a game of Starcraft II using only the map image. Using a ResNet-18 architecture, I obtained my dataset by collecting images from replays of the professional tournament of players WCS Valencia 2018. Using a basic loss function of binary cross entropy, I achieved a training accuracy of 0.645 over 50 epochs. Additionally, I explored training my classifier on just the last 30 seconds of each game (as opposed to the entire game), in the hopes that I would achieve better accuracy. Intuitively, I assumed that since the game was about to end the map would reflect this notion. But in reality I was not as successful. I obtained a training accuracy of 0.571 which is very bad. I believe these bad results are partially due to the small dataset that I have being even smaller by only taking the last 30 seconds of each game. The other reason I suspect is more to do with the behavior of professional players. Since professional players have a tremendous amount of experience in Starcraft II, many of them leave the game before the win condition is met. Similar to a master chess player, they do not need to play out the rest of the game once they have a big enough losing position, leading to less obvious map images.

Map Images obtained at the same time slice from two different player's perspective.

Conclusion and Future Work


My implementation is far from perfect. Some things I would like to develop/add for the future include: