scmJS docs

The container

A scenario is a flat run of sections, with no header of its own. Each section is a four-character name, a 32-bit length, and that many bytes of data:

Offset Type Holds
0 4 characters The name, padded with spaces to four: VER , DIM , STR
4 i32 The length of the data, in bytes
8 the length The data

The next section starts straight after the data. The order of the sections in the file does not matter: the game first lists every section, and then handles them in an order of its own. StarEdit's order, the order of this reference, is only a convention.

All numbers in every section are little-endian. Unsigned unless a layout says i32. Positions are in pixels, and a tile is 32 pixels square. Player slots are numbered from 0 for Player 1 to 11 for Player 12. Text is never stored in a section itself: a section holds a string number, the position of the text in the string table, and 0 means no text.

Odd lengths#

The game finds the sections by reading a header, jumping over the length it gives, and reading the next header there. It does not check the names, and it does not check that a jump goes forward.

How the game walks from one section to the next

Lengths#

Every section the game reads has a length it insists on, and a section of any other length refuses the map. A fixed-size section one byte too long makes the map invalid, and a record section must hold whole records.

The game wants Sections A different length
Exactly this many bytes VER␠ 2, VCOD 1040, OWNR 12, ERA␠ 2, DIM␠ 4, SIDE 12, PUNI 5700, UPGR 1748, PTEC 912, UPRP 1280, MRGN 1280 (VER 59) or 5100, SPRP 4, UNIS 4048, UPGS 598, TECS 216, COLR 8, PUPx 2318, PTEx 1672, UNIx 4168, UPGx 794, TECx 396 Refuses the map
Whole records of this size UNIT 36, THG2 10, TRIG 2400, MBRF 2400 Refuses the map
At most this many bytes MTXM 131072, FORC 20 Longer refuses the map; shorter is taken
Any length MASK, STR␠ Taken

Three sections may be shorter than the map needs. A short MTXM leaves the rest of the map's tiles as the game found them in memory. A short FORC is filled out with zeros. MASK takes any length, and the tiles it does not reach start unexplored. Each section's page gives its rule in the row The game accepts.

Repeated sections#

A section can appear more than once. The game hands every copy, in file order, to the part of its code that reads that section, and what happens then depends on the section. Each section's page says which in its More than one copy row; there are four main ways:

The four ways the game combines a repeated section

A few sections have rules of their own:

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.