TorchCraftAI
  • Tutorials
  • API
  • Blog
  • GitHub

›Recent Posts

Recent Posts

  • Releasing CherryVis: a replay viewer for TorchCraftAI
  • Build Order Switch Retraining Has Arrived
  • Hello, Github!

Releasing CherryVis: a replay viewer for TorchCraftAI

February 20, 2019

Danthe3rd

We're glad to announce today that we are open sourcing CherryVis. Based on OpenBW's replay viewer, CherryVis allows you to to view StarCraft replays alongside information about the bot's state. It's a powerful tool to simultaneously understand, develop and debug agents built with TorchCraftAI, as it gives access to:

  • The blackboard: a place where we store information shared between modules, such as the current build order
  • The logs
  • For any unit: its ID, HP, task - or even unit-specific log messages
  • The tree of UPC tuples issued

Machine learning visualization

In a machine learning context, it is often difficult to interpret a model's outputs, or understand if intermediate results are reasonable. That's why CherryVis includes features useful to researchers:

  • Arbitrary trees visualization. For example for Monte Carlo trees
  • Tensor summaries. Tensor values are displayed in a histogram, dynamically updated as the game progresses
  • Heatmaps game overlay
  • .. and many more

Getting started

If you are curious about this tool, you can try it for yourself after setting up the python dependencies and building OpenBW to Javascript. We also provide a few example replays with data for CherryVis, so you don't need to setup Starcraft or TorchCraftAI to understand how the bot works.

For advanced users who are already using TorchCraftAI, we provide an example script dumping various data to CherryVis.

Note that CherryVis can be used outside of TorchCraftAI as well. A zstd compressed JSON trace file can be provided to benefit from its features and dump logs, tensors trees, ... see CherryVisDumperModule::writeGameSummary for the format. Feel free to file a new GitHub issue if you need help adapting CherryVis to your workflow.

Build Order Switch Retraining Has Arrived

November 28, 2018

Jonas Gehring

Jonas Gehring

For this year's AIIDE competition, we deployed a machine learning model for high-level strategy selection dubbed Build Order Switch (BOS). Our competition model was trained by playing against publicly available bots, e.g. from the SSCAIT ladder. Naturally, we could neither train nor test it against the updated and new bots that we were going to compete against.

Now that the tournament is over, many authors provided new versions of their bots to the public. We added a new opening and simply re-trained our model against newly available and updated opponents. In internal evaluations, our win rate against the AIIDE 2018 winner SAIDA is now at about 55-60% (SSCAIT version from 11/14) , up from 17% with the AIIDE versions.

The new model is available on S3 and can be used as described in the documentation:

curl -o bwapi-data/AI/bos_model.bin https://dl.fbaipublicfiles.com/torchcraftai/models/1.0/bos_model_20181128.bin
cherrypi[.exe] -hostname 127.0.0.1 -port 11111 -bos_model bwapi-data/AI/bos_model.bin -bp_model bwapi-data/AI/bp_model.bin

You can get more details about the Build Order Switch model and the training setup in our recent paper which will be presented at the NeurIPS RL PO workshop in Montréal next week. For the model that we are making available now, we put an emphasis on newer and stronger bots and increased the training time.

Below are a few games and the value outputs of the BOS model for different build orders. Throughout the game, the model estimates the probability of winning when switching to one of the available build orders. If the advantage over the currently active build order is higher than a threshold, CherryPi will transition to the one with the highest estimated value. These transitions are highlighted in the plots with vertical lines. Click on the graphs to view the full-resolution versions.

Game 1 [replay]

Played against SAIDA (SSCAIT version from 11/14). Our confidence in winning the game drops around the 4-minute mark when we become aware of SAIDA's planned expansion and its first military units, but stabilizes again at 5 minute after our Hydras managed to hold off the approaching Vultures. Ten minutes into the game, SAIDA's army is making its way across the map and we focus on increasing our Hydralisk count. The drop at 11 minutes marks the destruction of our natural although our Hydralisks are managing to surround the opponent's army and defeat it. Finally, we transition to a more diverse army composition with the switch to zvt3hatchlurker and are confident to win the game at 17:30.

Game 2 [replay]

This is a game against the AIIDE 2018 version of Locutus. We start the game with 3basepoollings, an economy-heavy opening. As we do not sense an early attack from the opponent, we do not consider switching our build until six minutes into the game. Shortly before the 8-minute mark, we switch to zvtmacro which spurs our Zergling production -- Zealots are just arriving at our natural. They cause significant damage but with numerous Zerglings we are able to hold them off. We finally defeat Locutus with an army made up of Zerglings, Mutalisks and Ultralisks.

Game 3 [replay]

This is another game against SAIDA (SSCAIT version from 11/14) in which CherryPi loses. The switch to zvp10hatch, which is a happens quite early in response to early Vultures. At ten minutes, we successfully held of SAIDA's initial push which results in a higher overall confidence. However, our army becomes too reliant on Zerglings and can't uphold the pressure, allowing SAIDA's army to leave the natural around 16 minutes into the game. Switching to zvtantimech at around 14:30 was not enough to prevent the eventual defeat.

Finally, we are thankful for the fierce competition in AIIDE 2018 – a bigger pool of bots is good for everyone in the research community, and we hope to see more in the future!

Hello, Github!

November 20, 2018

Gabriel Synnaeve

Gabriel Synnaeve

The CherryPi team at Facebook AI Research is very happy to open source TorchCraftAI on github. We benefitted from the StarCraft AI bot community, and we are proud to give back.

TorchCraftAI is a platform that lets you build agents to play (and learn to play) StarCraft: Brood War. TorchCraftAI includes:

  • A modular framework for building StarCraft agents, where modules can be hacked with, replaced by other, or by ML/RL-trained models
  • CherryPi, a bot which plays complete games of StarCraft (1st place SSCAIT 2017-18, 2nd place AIIDE 2018)
  • A reinforcement learning environment for full games, minigames, with models, and training loops
  • TorchCraft support for TCP communication with StarCraft and BWAPI
  • Support for Linux, Windows and OSX
TorchCraftAI
Docs
Getting Started (Linux)Getting Started (Windows)Getting Started (Mac)API Reference
Community
Starcraft AI DiscordStarcraft AI Facebook groupTorchCraftAI on GitHub
More
TorchCraft on GitHubStarData on GitHubBlog
Facebook Open Source
Copyright © 2019 Facebook