scmJS docs

Running a bot

A bot's file plays in two places: on the play page against you, and from a terminal against the game's computer and other bots.

On the play page#

Under Options, Community bots, Add a bot from a file… takes a JavaScript bot (a .js or .mjs file) or a built BWAPI bot (a .scmbot file); dropping the file on the page does the same. The bot is kept in this browser, needs no account, and is offered in every computer row of the setup screen as "name (your file)", where name is the file's name, beside the bots the page has already. One bot plays in a game.

Options lists the bots you have added, each with Remove. Adding a file of the same name again replaces the one kept, which is how you play a changed bot. In a game between people, the host's page runs the bot and sends its orders, and the other pages see one more player.

From the command line#

scmjs bot run starter.mjs "(2)Jungle Duel.scx" plays the bot against the game's own computer on the same engine as the page, with no page open. A .scmbot file is played the same way. The command needs your own copy of StarCraft. --race, --opponents, --seed, --frames and --mod are described in the command line guide; the same seed, bot and map play the same game, because the command waits for the bot's answer every frame.

The command prints a line every thousand frames with each side's minerals, gas and supply, and the bot's own game.log lines as they come. Starter as protoss against the zerg computer, on a map made by scmjs map generate:

starter on (2)Jungle Duel.scx 128 × 128, jungle · bot protoss vs computer zerg · seed 1 · 1.16.1 files
  BWAPI: Connected to AI Client process
  starter: BWAPI 4.4.0.0 RELEASE is now live using "<Client Connection>".
  frame   1000  P1 bot P 24/0 7/9  |  P2 computer Z 42/0 8/9
  frame   2000  P1 bot P 36/0 10/17  |  P2 computer Z 260/0 9/17
  …
  frame   7000  P1 bot P 226/0 44/49  |  P2 computer Z 96/234 21/26
  Starter: a wave of 12 goes to 3456,3056
  frame   8000  P1 bot P 58/0 56/65  |  P2 computer Z 107/251 28/34
  …
  frame  45000  P1 bot P 12/0 0/0  |  P2 computer Z 167/887 93/94
▲ the bot lost at frame 45029 · 316 KB of orders · 0.27 ms a frame game, 0.27 bot · 25.8 s

The game ran at about 1,700 frames a second, a little over 30 minutes of play in 26 seconds. scmjs bot ladder plays bots against each other and against the game's computer of each race, on every map you name, and keeps a replay of every game:

scmjs bot ladder starter.mjs computer --maps "(2)Jungle Duel.scx" "(4)Crossing.scx" --races tzp

JavaScript bots, BWAPI bots and the game's computer play in one ladder. A ladder run again after you change your bot shows what the change did. A ladder for bots has the options and what the results mean.

Watching what it does#

On the page:

From a terminal:

scmJS 0.18.0 · Generated from the repository. The source is under the MIT license, which does not cover what ATTRIBUTION.md lists. StarCraft and Brood War are trademarks of Blizzard Entertainment; this project ships none of their data.