This short report describes an automated BWAPI-based script developed for live streams of a StarCraft Brood War bot tournament, SSCAIT. The script controls the in-game camera in order to follow the relevant events and improve the viewer experience. We enumerate its novel features and provide a few implementation notes.READ FULL TEXT VIEW PDF
This technical report describes the implementation of exact and parametr...
This report describes a technical methodology to render the Apache Spark...
This technical report outlines the fundamental workings of the game logi...
Synaesthesia is a condition that enables people to sense information in ...
ANGELINA is an automated game design system which has previously been bu...
Automated game design is a rapidly growing area of research, yet many as...
We are under the illusion that seeing is effortless, but frequently the
Since 2010, multiple competitions for StarCraft: Brood War BWAPI111http://github.com/bwapi/bwapi bots have been founded, including long-term SSCAIT: Student StarCraft AI Tournament222http://sscaitournament.com/ and Brood War Bots Ladder333http://bots-stats.krasi0.com/ as well as short-term events organized as parts of research conferences AIIDE and CIG. The growing community behind StarCraft AI research and increasing interest of the public has lead the organizers of the long-term tournaments to stream the games publicly. The need to stream the bot games 24 hours a day raises two automation-related challenges:
The games need to be started, ended and evaluated automatically.
The in-game camera needs to automatically follow all the interesting events to make the stream attractive for the viewers.
To solve the first challenge, one can simply use the open-source Tournament Manager Software444http://webdocs.cs.ualberta.ca/~cdavid/starcraftaicomp/tm.shtml developed at University of Alberta (SSCAIT tournament uses a modification of this tool). For the second challenge, however, this tool has proven to be insufficient. Even though it comes with an auto-observer module capable of moving the in-game camera around, this module has proven to be too simplistic. After numerous complaints by the stream viewers, we decided to implement a new observer module for SSCAIT tournament.
The SSCAIT observer is implemented in the C++ framework BWAPI and compiled as a part of the “tournament module” DLL (which provides additional, camera-unrelated functionality). It runs an automated spectating behaviour that is based primarily on game events, priorities and timers. It accomplishes this by setting the game screen position to the in-game location that should be shown. For the remainder of the text, this behaviour will be termed as “moving the camera”.
The camera will always try to focus on game events that are deemed important for the viewers (e.g. units attacking each other, the creation of new units, and so on). If several events happen simultaneously, the camera uses a set of predefined priorities to determine which event to focus on. In order to improve the viewing experience, timers are used to make sure that the camera does not move too often.
Two time limits are used by the SSCAIT observer: one defining the minimum time () that must pass before the camera is allowed to focus on a higher prioritized event, and another defining the time () that must pass before the camera will focus on any new event (even one with lower priority).
Let us say that and (the time values are specified in logical game frames). Here is an example of how this mechanism works:
At time , event with priority 1 occurs. camera focuses on event .
At time , event with priority 2 occurs. since less time than has passed since the last event, the camera remains focused on .
At time , event with priority 0 occurs. since has lower priority than the current focus and less time than has passed, the camera remains focused on .
At time , event with priority 0 occurs. more time than has passed since the last focus change, so the camera focuses on event .
At time , event with priority 3 occurs. has higher priority than the current focus and more time than has passed, so the camera focuses on event .
When the camera of the SSCAIT observer focuses on an event, it does not simply “teleport” the camera to the focus position. Instead, it always moves the camera smoothly towards the desired location by the simple update rule:
where is the current position of the camera, is the desired focus position, and is a movement factor between and . A movement factor of would mean that the camera moves of the distance between the current camera position and the focus position. The SSCAIT observer currently uses and updates the camera position on every game frame.
Another feature of the SSCAIT observer is that the camera not only can focus on a position. It can also focus on a unit. This functionality means that the camera can follow units (e.g. an army or a scouting worker) around the map instead of remaining still at a position that the relevant unit might have moved away from.
The types of game events that the camera focuses on and the priorities currently associated with each of them are:
A unit is under attack. Priority: 3
A unit is performing an attack. Priority: 3
A worker is scouting.
If scout worker is close to a potential enemy base, priority: 2
Otherwise, priority: 0
Note: A worker is only counted as a scout if it is not in its own main base and if the frame count is less than 7500 (approximately 8 minutes in terms of in-game time).
A drop is performed. Priority: 2
Note: Here, a drop is counted as a non-empty transport unit that is close to a potential enemy base.
A group of army units are positioned closely together. Priority: 1
Note: A definition of “army unit” can be found below.
A unit is created. Priority: 1
Some of these events are detected by looping over all accessible units and checking if the condition is fulfilled, while others are purely event-based, in the sense that the game notifies the observer module as the event happens.
In order to detect armies in a good way, a definition of “army unit” needed to be formed. Since a group of workers gathering resources should not be classified as an “army”, the observer excludes workers when searching for army units. Other unit types that are not counted as army units are structures, larvae, overlords and spider mines.
The reason to exclude overlords and spider mines might need an explanation: some of the Zerg bots playing in the SSCAIT tournament tend to clump overlords together in a corner of the map, while some Terran bots use the strategy of creating very dense minefields. Most viewers would probably agree that watching a minefield for large parts of a match is not the most thrilling experience.
When StarCraft was originally released in 1998, it used a constant screen resolution of px. Modern displays have much higher resolutions and different aspect ratios. Consequently, StarCraft is only able to make use of a small part of the screen. Fortunatelly, it is possible to use various “resolution hacks” to force the game to run on higher screen resolutions, displaying a larger part of the map. Even though this is considered cheating by human players, bots are not affected by the field of view in any way and gain no advantage from higher resolutions. At the same time, increasing the screen size makes up for more attractive and modern looking streams. The SSCAIT observer is compatible with resolution hacks and provides a support for any screen resolution (specified in the configuration file). Such compatibility is a simple matter of dynamically determining the screen center and showing the events there.
Thanks to the custom observer script described in this text, the SSCAIT tournament currently broadcasts a visually attractive live stream of all its bot games at high-definition, widescreen resolution. It selects the most interesting in-game situations, and transitions between them smoothly to improve the viewer experience. The stream can be watched at the tournament’s website555http://sscaitournament.com/.
We are planning to release the script as an open-source software in the near future. In the meantime, it is available on-demand.