scmJS docs

Getting started

You need Node.js 22.18 or newer (the extraction scripts import TypeScript directly through Node's type stripping) and git.

git clone https://github.com/scm-js/scm-js
cd scm-js
npm install
npm run doctor         # what this machine has and lacks, and what to run about it
npm run dev            # http://localhost:5173

The first npm run dev or npm run build needs a network connection: a predev / prebuild hook fetches the default plugins at their pinned versions into the gitignored plugins/ folder, where the build compiles them in (see Defaults and vendoring). After that it works offline. The same hook reports what game data is on disk, and warns rather than fails when there is none.

Game data. The editor draws with StarCraft's own graphics, which are never committed. Without them terrain is flat colours and units are markers, and everything else works. There are two ways to get them into a source build:

game-data.md has the details. No build, container image or hosted site carries the data or an address to fetch it from; ATTRIBUTION.md has the terms.

Query parameters jump straight to a UI state, which is the fastest way to work on a screen or take a screenshot:

/?nosplash                        skip the splash
/?nosplash&layer=units            select a layer: terrain, doodads, units, sprites, locations, fog, clipboard
/?nosplash&dialog=playerSettings  open a dialog by id; repeatable
/?nosplash&dialog=preferences&page=editing   open a dialog at one of its pages
/?nosplash&zoom=0.5&tileset=ice   zoom level and tileset
/?nosplash&mode=tile              terrain palette mode: isom, rect, tile, blend, heal, pin
/?nosplash&layer=fog&fogPlayer=3  view and paint one player's fog

An unknown layer or dialog id is reported in the console with the list of valid ones. React's "Components" performance track is off in development because it slows mounting badly; set VITE_REACT_TRACKS=1 to turn it on when profiling renders.

With the game engine beside it#

Tools ▸ Test in Browser, and the replay analysis other plugins use, come from the scm-sim plugin. The plugin holds no engine: it opens the play page, which has to be on the editor's own origin at /play/, as it is on scmjs.dev. The play page is built from the scm-sim engine repository, which is not public, so without it these features do not work in a local build. With a checkout of it, run both dev servers and put one origin in front of them:

SCMJS_BASE=/editor/ npm run dev -- --port 5173   # this repository
npm run dev:web                                   # in scm-sim, port 5174
npm run dev:site                                  # this repository: http://localhost:5180/editor/

Both dev servers keep their own hot reload. DEV_SITE_PORT, DEV_SITE_EDITOR and DEV_SITE_SIM change the three ports.

An editor served this way counts as being on the site, by the same rule the plugin finds the play page with: the address is scmjs.dev, or it is this machine and the path starts with /editor/. There the menu bar carries the site's items (the mark as a link to /, Play, Replays, the game data box and Library) and the start screen offers the library. This origin has no home page, replay page or library, so those links lead nowhere here; npm run dev on its own, at /, shows the bar as the desktop app has it.

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.