This article will take you through the initial steps of writing your own API for the StarCraft II client. This is not required at all, community APIs exist in most popular languages. However, the article provides some insights into how a basic SC2 API wrapper works.

The client exposes a request-response style API that accepts _protobuf _messages. I wrote an article on the subject of _protobuf _for readers unfamiliar with the format, but it is essentially just a binary data-interchange format.

Launching the Client

Download the StarCraft II client if you do not already have it installed — it is free to play (since November 14, 2017) and having the full version is not required. We are going to use the default game client but launch it in a special mode. This mode does not feature any in-game menu.

The StarCraft II client creates a new folder when updated (this is presumably mainly to support game replays from older versions) — you might therefore find multiple folders on your computer with a client. Navigate to the one with the highest version number and launch it using localhost and a desired port.


On Windows we also need to specify the working directory which is \Support or \Support64. Failing to do so will result in a ‘iccuc52.dll’ does not exist error.

cd 'C:\Program Files (x84)\StarCraft II\'
start /D .\Support .\Versions\Base{version}\SC2.exe -listen -port 8168


cd 'StarCraft II\Versions\Base{version}\'
SC2_x64 -listen -port 8168 -headlessNoRender

Mac OS:

cd '/Applications/StarCraft II/Versions/Base{version}/'
open --args -listen -port 8168

If this works correctly it will launch the client with a black screen and the iconic StarCraft II mouse — this is the desired behaviour. Everything is good.

The client also supports a few optional arguments that come in handy when running multiple clients at the same time;

  • -displaymode {1/0} … 1 for fullscreen, 0 for window mode
  • -windowwidth {int}_ … width of window in pixels_
  • -windowheight {int}_ … height of window in pixels_
  • -windowx {int}_ … horizontal placement of window in pixels_
  • -windowy {int} … vertical placement of window in pixels

#starcraft-ii #practice #aritificial-intelligence

Guide to StarCraft II Proto API
1.50 GEEK