Skip to content

spacebeam/starcraft-sif

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

starcraft-sif

This software is a tool for running StarCraft: Brood War

inside a SIF file based container image, auditable, secure, and easy to move using existing paradigms.

It can download and launch C++ and Java bots or any TorchCraft bot with support for BWAPI 4.1.2, 4.2.0, 4.4.0.

It uses a server/client architecture with the host acting as a server and any number of other containers as clients.

All data send and received pass through ZeroMQ sockets, no special network configuration is required.

This repository includes several requirements such as BWAPI.dll files which will automatically be configured and run.

Serverless

When running the software, the host machine acts as a central repository where all bot files (including file I/O) and replays are stored.

The server monitors for new containers, maintaining a current list of instances acting as clients which can have one of the following status:

  • READY, free and ready to start,
  • STARTING, the match has not yet begun,
  • RUNNING, client is running a game,
  • SENDING, results and data back to the server.

Normally a new game can be started only if:

  1. two or more clients are READY, and
  2. no clients are STARTING.

Once these two conditions are met, the server sends the required bot files, map and BWAPI.dll to the clients, specifying one as the host and another as the away machine. Those client's status are then set to STARTING.

Clients

Each client is handled by independent processes, and if the client status is STARTING, RUNNING, or SENDING, it sends periodic updates back for remote monitoring.

When a game finishes the results are sent back along with file I/O data and replay, which are stored on the host.

Getting started

Your system need the latest release of Erlang, LuaJIT (with luarocks) and Singularity installed.

Installation

Then run this command:

luarocks install spacebeam

luna -u starcraft build

Good luck, have fun

Play against Ophelia or any other bot on competitive maps,

$ luna -u starcraft run -x 'play --bots Ophelia'

Host a bot vs bot game.

$ luna -u starcraft run -x 'play --bots Locutus:Ophelia'

Settings

All configuration is done in /etc/luna/units.d/starcraft.yml. This file must exist or the competition will not start.

NameValue
starcraft Type: String

Location of StarCraft: Brood War 1.16.1.
bots Type: List of strings

These bots will play in the competition.

Each directory must contain a valid bot.yml file with the following name/value pairs:

  • name: String name of the bot, matching the bot directory name
  • race: Terran, Zerg, Protoss
  • type: Java, DLL, EXE, Linux
  • bwapi: 4.1.2, 4.2.0, 4.4.0
maps Type: List of strings

Each round will be played on these maps at random order. The value should be the name of the map.
host Type: String

Host server address.
port Type: Number

Port to listen for clients on.
speed Type: String

Allowed values: Slowest, Slower, Slow, Normal, Fast, Faster, Fastest

This changes the speed slider in the lobby it affects the number of latency frames in the game.

Example /etc/luna/units.d/starcraft.yml:

#
# Torch Up: Brood War AI Tournament
# https://torchup.org
#
starcraft: /opt/StarCraft
bots:
    - Locutus
    - PurpleWave
    - Halo
    - Letabot
    - Ecgberht
    - Microwave
    - CUNYBot
    - Crona
    - StyxZ
    - ZZZKBot
    - Ophelia
maps:
    - Circuit Breaker
    - Aztec
    - Blue Storm
    - Gladiator
    - Gold Rush
    - Heartbreak Ridge
    - Fighting Spirit
    - Power Bond
    - Overwatch
host: 127.0.0.1
port: 58008
speed: Normal

Contributing

See Contributing.