scmJS docs

The archive

A .scm or .scx file is an MPQ archive, the container format Blizzard used for its games' data. The scenario is one member of that archive, always named staredit\scenario.chk. Everything else in the archive is extra: custom sounds, custom graphics, files another editor or a plugin put there. The editor keeps those members and writes them back on save, so a map with its own sound files keeps them. A bare .chk file, the scenario with no archive around it, opens too; some tools pass scenarios around that way.

An archive whose file list was removed, as protectors often do, still opens. The editor asks for the members the scenario refers to (its sounds, its script files) by name, so they are still listed and editable. Any member it cannot name is carried across a save exactly as stored, and the Save dialog says how many there are. A bare .chk cannot hold them.

Carrying a member as stored keeps the archive's hash table, the index of its files, at its old size. Protectors often size that table to the files they wrote and fill it with members nothing names, so a save may have no room for its own files. The game opens a member only by a name the scenario carries, so a member that no such name reaches is never opened. When the table is full, the save leaves those members out and writes a new table, and the Save dialog says how many it leaves out. If it still has no room, it drops the archive's file list next, since the game does not read it.

The Save dialog's Archive fold decides how the scenario is stored:

Option What it means
PKWARE The compression StarEdit uses and every Blizzard map is stored with. Every version of the game reads it.
zlib Smaller. Read by Remastered only: 1.16.1 and older builds cannot open the map.
None The largest, readable by anything.
Encrypt StarEdit's light encryption of the members. It hides nothing from a map editor; some tools expect it.

A map is written back the way it was opened: a map that came in as PKWARE goes out as PKWARE. A new map gets StarEdit's layout, PKWARE and encrypted. A member stored with a method the editor can read but not write is kept exactly as it was stored, as long as it is unchanged: a sound StarEdit stored with the game's own sound compression (ADPCM, about a quarter of the size and slightly lossy) stays that size instead of growing about four times as plain PCM. A sound replaced in the Sound Editor is written afresh, with whichever layout the dialog shows. A member stored with zlib or bzip2 is not kept that way in a map written for every version of the game, which could not read it.

A file that holds no scenario at all (not a single section a map has, such as a text file given a map's name) is refused when opened, rather than opened as an empty map that a save would then write over it.

Built maps#

A plugin can put a compiler between the map and the disk; the TrigScript plugin does, for a map with programs. The file then holds two scenarios:

Those two members are always zlib-compressed, since the game never opens them.

Opening such a file gives back the map from scmjs\source.chk, so the trigger list shows your triggers and not the generated ones. That only happens while the built scenario still has the recorded hash. If another editor or a protector has changed it since, the editor cannot tell which of the two you mean, so it opens the file as it stands, says so, and leaves both members where they are. A bare .chk is never built.

What the editor adds to a map#

The editor keeps a few small files of its own in the archive, each written only when the map uses what it is for. The game never opens them.

Member Holds
scmjs\pins.bin Which tiles are pinned (Pin), a bit for each tile.
scmjs\borrowed-<tileset>.bin For terrain painted from another tileset (Terrain from other tilesets): that tileset's isometric record of what was painted. One member for each tileset painted from, such as scmjs\borrowed-install.bin for Installation.
scmjs\borders-<tileset>.bin Beside it: where that brush painted, and the tile each cell had before, so the ground can be given back and its borders laid again.
scmjs\copies.bin Where copied terrain was painted, so a later stroke that cuts into a patch can lay it again.
scmjs\dataset.json The data set the map was made with (A map remembers its data set).

Every save keeps them, Smallest that plays included. All but the last follow undo and Resize, and a change to one reaches everyone on a shared map. The pins and the borrowed record are checked against the map's size when read, and one left at another size is read as absent. An editor that writes the map without these members loses the pins and the record, not the terrain: the tiles are in the scenario like any others.

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.