/sctoolsdata

A collection of StarCraft data used to help interpret replay and map files

Primary LanguageJavaScriptMIT LicenseMIT

MIT license npm version

sctoolsdata

A collection of StarCraft internal data used to help process replay and map files.

Usage

This library is available via npm:

npm i --save sctoolsdata

TODO: explain more about how this is used.

Reference

Function:

framesToMs(frames[, speed])

Parameters:

  • frames number
    number of in-game frames per second
  • speed string (default: "fastest")
    game speed (virtually always "fastest")

Returns:

  • number
    the number of milliseconds representing the duration of the game frames

Used to get timestamps of game events for a given game speed. For example, this can be used to display a timestamp for a chat message, or to show the duration of a game.


Function:

getSwatchFromSlotID(id)

Parameters:

  • id number
    slot ID to return the color for

Returns:

  • string
    swatch name for the color associated with that player slot ID

Every player ID has a default color; for example, player 1 is red, player 2 is blue, etc. This function is used to return the color swatch name associated with a given ID.


Function:

getColorFromSwatch(swatch[, returnType])

Parameters:

  • swatch string
    swatch name to return the color value for
  • returnType string<"hex" | "int"> (default: "hex")
    type of value to return; either a hex string or a number

Returns:

  • string | number
    the color value of the given swatch name

This function can be used to get the actual colors to be displayed for a given swatch (e.g. "paleBlue" will return "#b8b8e8").


TODO.

In-game colors

Colors work quite inconsistently in StarCraft. There are two sets of color codes: one for briefing messages (and map names), and one for in-game chat messages. These each have their quirks that can be different between Brood War (v1.16.1 and below) and Remastered.

Here's a list of all colors:

Briefing text colors
NameHex valueCodeSlug
Pale bluePreview for briefing swatch #0xa4b4f8#a4b4f80x02briefingPaleBlue
GreenPreview for briefing swatch #0x4cc428#4cc4280x03briefingGreen
Light greenPreview for briefing swatch #0xb4fc74#b4fc740x04briefingLightGreen
Gray†Preview for briefing swatch #0x585858#5858580x05briefingGray
WhitePreview for briefing swatch #0xffffff#ffffff0x06briefingWhite
RedPreview for briefing swatch #0xfc0000#fc00000x07briefingRed
In-game text colors
Name/slot ID‡Hex valueCodeSlug
Pale bluePreview for ingame swatch #0xb8b8e8#b8b8e80x02ingamePaleBlue
YellowPreview for ingame swatch #0xdcdc3c#dcdc3c0x03ingameYellow
WhitePreview for ingame swatch #0xffffff#ffffff0x04ingameWhite
RedPreview for ingame swatch #0xc81818#c818180x06ingameRed
GreenPreview for ingame swatch #0x10fc18#10fc180x07ingameGreen
Gray†Preview for ingame swatch #0x847474#8474740x05ingameGray
Red0Preview for ingame swatch #0xf40404#f404040x08playerRed
Blue1Preview for ingame swatch #0x0c48cc#0c48cc0x0eplayerBlue
Teal2Preview for ingame swatch #0x2cb494#2cb4940x0fplayerTeal
Purple3Preview for ingame swatch #0x88409c#88409c0x10playerPurple
Orange4Preview for ingame swatch #0xf88c14#f88c140x11playerOrange
Brown5Preview for ingame swatch #0x703014#7030140x15playerBrown
White6Preview for ingame swatch #0xcce0d0#cce0d00x16playerWhite
Yellow7Preview for ingame swatch #0xfcfc38#fcfc380x17playerYellow
Green8Preview for ingame swatch #0x088008#0880080x18playerGreen
Pale yellow9Preview for ingame swatch #0xfcfc7c#fcfc7c0x19playerPaleYellow
Tan10Preview for ingame swatch #0xecc4b0#ecc4b00x1bplayerTan
Cerulean11Preview for ingame swatch #0x4068d4#4068d40x1cplayerCerulean
Pale green12Preview for ingame swatch #0x74a47c#74a47c0x1dplayerPaleGreen
Bluish gray13Preview for ingame swatch #0x9090b8#9090b80x1eplayerBluishGray
Turquoise15Preview for ingame swatch #0x00e4fc#00e4fc0x1fplayerTurquoise
Pink16Preview for ingame swatch #0xffc4e4#ffc4e4playerPink
Olive17Preview for ingame swatch #0x787800#787800playerOlive
Lime18Preview for ingame swatch #0xd2f53c#d2f53cplayerLime
Navy19Preview for ingame swatch #0x0000e6#0000e6playerNavy
Magenta21Preview for ingame swatch #0xf032e6#f032e6playerMagenta
Gray22Preview for ingame swatch #0x808080#808080playerGray
Black23Preview for ingame swatch #0x3c3c3c#3c3c3cplayerBlack

†: In StarCraft, gray is buggy: when it's used in a map name in Brood War, the rest of the name becomes gray as well—this was fixed in Remastered. In in-game text messages, gray will take over the entire rest of the line, both in Brood War and Remastered. This buggy behavior is not completely implemented in this library, and more research is needed to determine every edge case.

‡: Slot IDs 11, 14, 15 and 20 are not selectable as player colors (the color for 11 is used for the neutral player, however). 11 and 15 are still usable as text color. 14 and 20 are duplicates of Pale Yellow and Cerulean.

A few of the player colors are unavailable on certain tilesets:

Tileset name ID Disallowed colors
Ash World Preview for tileset Ash World 3 Gray, Black
Badlands Preview for tileset Ash World 0
Desert Preview for tileset Ash World 5 Orange
Ice Preview for tileset Ash World 6 White
Installation Preview for tileset Ash World 2 Blue, Navy, Bluish gray
Jungle World Preview for tileset Ash World 4
Space Platform Preview for tileset Ash World 1 Gray, Black
Twilight Preview for tileset Ash World 7 Bluish gray

Game speed

Number of milliseconds per game frame for each game speed.

E.g. for "Fastest", there are approximately 1000 / 42 = ~23.81 frames in a second. This is used to convert the number of game frames into real time.

Name ㎳/frame Frames/second % of "Fastest"
Fastest 42 23.810 100.0%
Faster 48 20.833 87.5%
Fast 56 17.857 75.0%
Normal 67 14.925 62.7%
Slow 83 12.048 50.6%
Slower 111 9.009 37.8%
Slowest 167 5.988 25.1%

By far most replays use "Fastest" as the speed, but this map can be used for the rare case that isn't. In the very old days of StarCraft, the ladder speed setting was "Fast" by default, but this got changed to "Fastest" relatively early on.

License

MIT license