On the play page
The play page at scmjs.dev/play runs the game in a browser tab from your own copy of StarCraft, which it asks for the first time: the folder the game is installed in. A mod is laid over that copy. A Remastered installation works as well as a 1.16.1 one.
Adding a mod#
Open the Game Menu, then Mods ▸ Add a Mod…, and pick the mod's folder as its makers ship it; Or choose a .mpq, .exe or .zip takes a single file instead. Dropping the mod anywhere on the page does the same. The page says in one line what it found, keeps the files that differ from your copy of the game in your browser, and plays with the mod from then on. Nothing is uploaded. A mod of Cosmonarchy's size takes a few minutes the first time.
The Mods list shows every mod the page keeps, with what each changes. Use plays one, None goes back to the game's own data, and Remove forgets one. Choosing loads the page again, since every table and picture is read again through the mod. A mod the page kept is found again by its hash on later visits.
Its plugins and FireGraft project#
A mod's plugins, and the changes its FireGraft project makes to the game's program, run
inside the game on the live engine. The page loads itself again there when you choose or
add a mod with code under Mods, when scmjs mod play hands one over, and when a replay or
an invitation to a game needs it, so you never type its address. A game with a mod's
plugins needs 2 GB of the browser's memory; close other tabs if the page says it was given
less.
Maps and bots#
The maps the mod carries are offered beside the page's own, and the setup screen shows a map's forces and slots as the game's lobby does. With a mod in use, the game's own computer players are the mod's AI, and their rows say so ("Computer — Cosmonarchy BW's AI"). A community bot's row says whether it was made for the mod, plays vanilla data, or was made for another mod, which plays all the same with a warning. The catalogue's Cosmonarchy Example is a small bot made for Cosmonarchy BW; Options ▸ Community bots ▸ Add a bot from a file… adds one you built. The catalogue's bots need a scmjs.dev account; your own file does not.
Games between people#
A game between people carries the mod. The host's invitation link names the mod, its hash and where its makers publish it, and a page that keeps the mod and follows the link loads itself again on the mod, run the way the host runs it. A joiner without the mod is told which mod it is and where to get it, and plays nothing until it is added under Mods. A replay saved by either player is the same file up to where each stopped.
A mod with a FireGraft project and no plugins is the one case the page cannot settle alone: if you join by typing the invitation on a page opened another way, the page tells you how the host runs the mod rather than switching. Join by the host's link.
Replays#
A replay saved on the page names its mod. Opening it later, from Watch a Replay, a drop, a link or the editor, plays it with that mod: the page switches to the mod when your browser keeps it, and otherwise says which mod it needs and where its makers publish it, with an Add a Mod… button; once you add it, the replay plays. A browser that keeps another version of the mod is refused with both hashes.
A replay of a mod whose plugins run plays at about the game's own pace. Going ahead to a part it has not played yet plays forward to the moment, and the page says how far it has run. Going back is quick: the page keeps a moment about every ten seconds of the game as it plays, returns to the one before the moment asked for, and plays on from there.
The hand-over from the command line#
This is for a tool or a page of your own. scmjs mod play and scmjs map play hand their
files to the play page the same way. The command serves a page on 127.0.0.1, and that page
opens the play page with ?handoff=1. Each time the play page says scmjs.ready or
scmjs.play.ready, the command's page posts it this message:
{
type: "scmjs.play",
dataSet: {
name: "My Mod",
hash: "3f9a0c2e5b7d1146", // 16 hex digits
files: [{ path: "arr/weapons.dat", file: File }, …, { path: "plugins/gptp.qdp", file: File }],
},
map: Uint8Array, // with --map: the map's bytes
name: "(2)Ridge.scx", // and its file name
bot: { key: "cosmonarchy-example", race: 1 }, // with --bot: a key, or { file: File, name, race }
setup: true, // with --bot and without --start: show the setup screen
}
| Field | Holds |
|---|---|
dataSet.files[].path |
The game's path in lower case with forward slashes. Each module of the mod's code that the hash has a line for is under plugins/, and a FireGraft file under firegraft/. Files an operating system leaves in folders are not handed over |
dataSet.hash |
The mod's hash. The page works it out again from the same files and arrives at the same one. A page that already keeps a mod with that hash can skip storing it again |
bot.race |
0 for zerg, 1 terran, 2 protoss and 6 random |
setup |
With a bot, the message also names the kind of game: the map's own settings for a mod with plugins or a FireGraft project, otherwise the page's own guess |
A game file the page would not take as a loose file goes in a small MPQ,
scmjs-members.mpq, which the page opens as it opens a mod's own. That is a file beside
the game's folders, or one under plugins\ or firegraft\, such as the members
plugins\apply and firegraft\reqlist.txt of Cosmonarchy's loader archive.
A mod with plugins or a FireGraft project is handed to the page at ?lift=live, the
address where the page runs them.
The page answers with scmjs.play.started, scmjs.play.shown or scmjs.taken, which end
the wait, or with scmjs.play.error and a message, which the command prints before it
exits with 1. scmjs.waiting and scmjs.play.waiting messages are printed as they come.
With a bot, shown and started carry bot, the bot's row as the setup screen words it.