Powder Game codes are used in Powder Game and Powder Game 2 to save what's on-screen as a code. These codes can be then saved in a file or otherwise stored for later use. To get a code, press the "Get" button. To load a code, paste a code into the box and press "Set."

The following is an example code, which displays some text written with steam:

Powder Game code

Here is the same example, but in the modern Powder Game code format:

Powder Game code

Details for the modern Powder Game code is found below.

Data Structure (Powder Game)

A Powder Game Get-Set code is comprised of an 8-character header optionally followed by an 8-character extension, followed by a sequence of compressed element and object data, and a 3-character checksum at the end.

All data in both games' codes, except where otherwise noted, is encoded in a base 64 numeral system, where each character is a digit representing a value from 0 to 63. The digits, in order, are 0-9, A-Z, a-z, ., and *. Any other characters will be read as zeroes.


The code's header contains global values such as the BG and Speed settings. Unlike most other parts of the code, these values are not stored as base 64, but instead follow ASCII order starting at '0'. This is only noticeable with the BG value however, as the order of digits after '9' starts with ':' and ';' before progressing into capital letters.

Attempting to load a code with any values for header digits other than the ones listed will crash the game.

The structure is as follows:

Offset Name Notes
0 Code type If this is anything other than zero, this code contains the 8-character header extension. Used for backwards compatibility with codes from earlier versions that did not use the extension.
1 Always 0
2 BG The BG setting (see below)
3 Dot The dot limit setting (0 is DOT S, 1 is DOT M, 2 is DOT L)
4 Grid The grid setting (0 to 7)
5 Speed The speed setting (0 is x1, 2 is x2, 3 is x4, 4 is x8)
6 Side The side setting (0 is SIDE-OFF, 1 is SIDE-LOOP)
7 Always 0

The BG values are as follows:

Digit Value Name
1 1 BG-non
2 2 BG-air
3 3 BG-line
4 4 BG-blur
5 5 BG-shade
6 6 BG-aura
7 7 BG-light
8 8 BG-toon
9 9 BG-mesh
 : 10 BG-gray
 ; 11 BG-track
A 12 BG-dark
B 13 BG-TG
C 14 BG-siluet

Header extension

Offset Name Notes
8 Mouseclicks The amount of times the player has clicked on the game canvas, in reverse digit order. Used for quality control of uploads; if this number is less than 50 (o0), the game will reject upload attempts and display the message "Please carefully created." Defaults to 50 when loading a code without the extension. It will stay as '**' upon exceeding 4095 clicks.
10 Always 0

Element and object data

This compressed data comprises the majority of a Get-Set code, and it contains every element and object on the screen.

It uses a simple dictionary-based compression algorithm with repetition compression as well, and consists of a sequence of 3-character-long units. Each unit consists of a 2-digit dictionary reference followed by one digit of literal data. A dictionary reference points to the location of another unit in the sequence, and is recursive, as that unit can in turn can point to another unit with its own dictionary reference, and so on. Dictionary references start at 01; a dictionary reference of 00 is null and is ignored.

To decompress screen data, each unit must be evaluated in sequence. For each unit, its dictionary reference must be evaluated recursively until a null reference is found which ends the reference chain, and then the literal values of every unit in the chain are added to the end of the decompressed output in reverse order. If a literal value x greater than 47 (l) is encountered, it signifies that the literal value directly before it should be repeated x - 48 times. However, if another literal value y also greater than 47 is encountered directly after x, it signifies that x and y together are a reverse-order two-digit number with the value of ((y - 47) * 16) + (x - 47) - 1 and that the value immediately before x should be repeated that many times instead.

The result is a sequence of at least 120000 digits (at least one for each pixel in the game field), each of which specifies an element, an object, an attribute, or empty space. Elements or objects such as Fireworks or Players are followed by a second digit specifying their attribute. Some elements such as Clone might seem to have an attribute while the game is running but do not actually save it; these do not show up in the code.

Attempting to load a code with any non-base-64 element digits will simply result in those values being read as empty space. However, the two remaining empty spaces for elements, k and l, will crash the game when loaded. Additionally, attempting to load a code with more than 2 Players hacked in will also crash the game.

The values corresponding to each element and object are as follows:

Digit Value Name Attribute?
0 0 Air No
1 1 Block No
2 2 Powder No
3 3 Water No
4 4 Fire No
5 5 Seed No
6 6 Wood No
7 7 Gunpowder No
8 8 Fan Yes (wind direction)
9 9 Wheel No
A 10 Ice No
B 11 Snow No
C 12 Steam No
D 13 Superball No
E 14 Clone No
F 15 Fireworks Yes (element)
G 16 Oil No
H 17 C-4 No
I 18 Fighter No
J 19 Stone No
K 20 Magma No
L 21 Virus No
M 22 Box / Create Yes (size; becomes Create if size value is 10)
N 23 Nitro No
O 24 Ant No
P 25 Torch No
Q 26 Gas No
R 27 Soapy No
S 28 Thunder No
T 29 Metal No
U 30 Player (no element) No
V 31 Bomb No
W 32 Player Yes (element)
X 33 Laser No
Y 34 Acid No
Z 35 Vine No
a 36 Salt No
b 37 Seawater No
c 38 Glass No
d 39 Bird No
e 40 Ball Yes (element)
f 41 Mercury No
g 42 Spark No
h 43 Fuse No
i 44 Cloud No
j 45 Pump No


The checksum is an encoded 3-digit number at the end of the code that is intended to prevent any corruption or tampering to the code. It is stored as a hexadecimal number in reverse digit order and does not use base 64 encoding. The first digit is a lowercase letter (a-p), the second is an uppercase letter (A-P), and the third is a numeric digit (0-7). Encoded this way, for instance, the checksum 0x507 would become hA5. The maximum value for the checksum is 0x7FF.

The checksum can be computed by first adding together the ASCII value of each character in the code multiplied by its position in the code modulo 255. (The position is 1-based, so the first character would be multiplied by 1, the second by 2, etc.) The checksum is then obtained by computing that value modulo 0x7FF.

The Get-Set mechanism will reject any code where the computed checksum does not match the checksum value stored in the code.

See also

  • Get-Set, the article about the Get-Set mechanism in general.