scmJS docs

CHK format reference

Every section of a scenario file: its byte layout, what a repeat does, whether the game needs it, the values its fields take.

This reference gives the byte layout of every section of a StarCraft and Brood War scenario file (scenario.chk), with what each section is for, what the game does when a file repeats it, whether a map can do without it, and the values its fields take.

This page describes the format, not any one editor. What scmJS does with a file as a whole (the archive around the scenario, protected maps, what Save keeps and what it can strip) is in Opening and saving maps. The facts in the table at the top of each page (size, repeats, required, read by) and the value and flag tables come from the code the editor reads and writes maps with. The byte layouts are checked by its tests against the same code, which re-encodes Blizzard's own maps byte for byte. The community's older reference is wiki.staredit.net/wiki/Scenario.chk, which this one agrees with except where a page says otherwise.

The same layouts are also published as a Kaitai Struct description, chk.ksy, generated from the same tables as this page. The Kaitai compiler turns it into a parser for C++, C#, Go, Java, JavaScript, Python and several other languages, and the Kaitai Web IDE opens a scenario.chk with it and shows every section field by field. It reads a file as it is laid out, one section after another, and leaves the rules for repeated sections and odd lengths to the program using it.