Skip to content

Latest commit

 

History

16 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BroodMind

broodmind

An AI learning to control the Swarm using reinforcement learning.

Play BroodWar v1.16.1

Blizzard officially made free StarCraft BroodWar, however the remaining challenge is to have it running on a modern computer.

Especially, the whole AI competition ecosystem is built upon the canonical v1.16.1, which is no longer distributed.

A portable version of SCBW v1.16.1 may be found on archive.org. Rename StarCraft ( Click here ).exe to StarCraft.exe.

On a Linux x86 platform, use Chaoslauncher:

wine /path/to/the/game/Starcraft\ Brood\ War/Chaoslauncher.exe

Define the path to StarCraft.exe from the Settings tab, activate W-MODE 1.02 and launch the game.

Having a working SCBW version is especially important to watch replays and follow the progression of the bot.

Set up the work station

Build sc-docker

Clone the sc-docker repository from the Basil-Ladder fork:

git clone https://github.com/basil-ladder/sc-docker

The build script tries to download the game from http://files.theabyss.ru/sc/starcraft.zip, a host that no longer resolves. From the archive.org portable game version, the file should be formatted in the expected form, zipped and positionned in the appropriate folder:

cd /path/to/game/files/starcraft
zip -r /path/to/repo/sc-docker/scbw/local_docker/starcraft.zip .

The archive contains the exact following arborescence:

starcraft.zip
.
├── Ashworld.pal
├── Attack.ani
├── AviDummy.bmp
├── Badlands.pal
├── battle.snp
├── BROODAT.MPQ
├── BroodWar.mpq
├── characters
├── Desert.pal
├── EditLocal.dll
├── Farbpalette.pal
├── Ice.pal
├── Jungle.pal
├── Local.dll
├── maps
├── Menu1.pal
├── Menu2.pal
├── Menu3.pal
├── MenuButtonsPressed.bmp
├── Menu.pal
├── patch_rt.mpq
├── Points.bmp
├── ProLoss.pal
├── ProtossHud.bmp
├── ProWin.pal
├── psapi.dll
├── ReplayHud.bmp
├── Resources.bmp
├── Riched20.dll
├── Select.ani
├── Smackw32.dll
├── Space.pal
├── standard.snp
├── StarCraft.ani
├── StarCraft.exe
├── StarCraft.mpq
├── STARDAT.MPQ
├── StarEdit.exe
├── storm.dll
├── Target1.ani
├── TerLoss.pal
├── TerranHud.bmp
├── TerWin.pal
├── TopMenu.bmp
├── Twilight.pal
├── ZergHud.bmp
├── ZergLoss.pal
└── ZergWin.pal

Build all images using the build_images.sh helper:

cd /path/to/sc-docker/docker
./build_images.sh 2>&1 | tee /tmp/build.log

Finally, create a dedicated docker network:

docker network create sc_net

Install the Python wrapper

Install the Python wrapper in a virtual environment:

conda create -n bw python=3.10 -y
conda activate bw
cd /path/to/sc-docker
python -m pip install .

Fetch all maps and the BWTA caches:

scbw.play --install

This populates ~/.scbw/ with the SSCAI map pack, the 2019 season maps and the BWTA caches. These come from GitHub Releases and are still available.

Running games

Bots are resolved through http://sscaitournament.com/api/bots.php, downloaded on demand into ~/.scbw/bots/, then mounted as volumes. Nothing bot-related lives inside the images, so iterating on a bot never requires a rebuild.

To launch a game:

conda activate bw
scbw.play --bots "Stardust" "PurpleWave" --map "sscai/(2)Benzene.scx" --headless --game_speed 0

Launching Stardust versus PurpleWave in this illustrative example.

Results, logs and replays land in ~/.scbw/games/GAME_XXXXXXXX/. To watch a replay in a native (non-dockerized) StarCraft installation:

mkdir -p "/path/to/StarCraft/maps/replays"
cp ~/.scbw/games/GAME_XXXXXXXX/player_0.rep "/path/to/the/game/Starcraft\ Brood\ War/maps/replays/"

The map used for the game must also be present in /path/to/the/game/Starcraft\ Brood\ War/maps/sscai/

Step 1 - Train the critic

Generate parties between existing bots

First of all an inventory of all available bots and maps must be produced:

cd inventory
python inventorize.py
cd ..

Then, a set of parties can be launched:

cd play
python play.py --cpu 8 --games 32 --seed 42 --elo-min 2300
cd ..

Extract the features from selected frames

The dumper module has to be built:

make win32builder
make dumper
make clean
make bwapi
make install

Step 2 - Train the actor

License

The license is MIT with an added condition that forks may not be submitted to StarCraft AI competitions without written consent of the author.

About

An AI learning BroodWar

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages