PAL (Dark Reign)

A .pal is a palette format used by the real-time strategy game Dark Reign.

Each of the game's terrains has an associated .pal file. Dark Reign comes with the following terrains:


 * BARREN
 * SNOW
 * JUNGLE
 * ASTEROID1
 * AUSTRALIA1
 * VOLCANIC1
 * ALIEN2


 * 1) These terrains were add-ons released by the developer, Auran, after the game launch.
 * 2) This terrain was included in the expansion Dark Reign: Rise of the Shadowhand but also released separately after the game launch.

= Structure =

Primary and dimmed palettes
The palette entries in the primary and dimmed palettes are store as red, green, and blue planes:


 * The first 256 bytes are the red components in order, the next 256 are the green components, etc.
 * Each component is stored in 6-bits (0-63) and will need to be multiplied by 4 to map to the range 0-255.
 * Index 0 is always transparent.

The index of the colors within the palettes are important:

Unknown chunks (1)

 * The Unknown chunks appears to be 32 (or 33) chunks of 1,024 bytes, representing what appears to be a non-looping animation of 32x32 pixel images.
 * These chunks do not appear to use the palettes.
 * These chunks are different for each palette.

Unknown data (2)
The Unknown data is all of the data from the end of the Unknown chunks up until the start of the Shading tables.


 * The purpose of this data is not known, but might be compressed using the same RLE method used by the game's sprites.

Shading tables
The shading tables comprise 192 chunks each of 768 bytes totaling 14,7456 bytes.

Each chunk appears to be the primary palette mixed 50% with another color, and each byte is an index back to the original palette of a color which most closely matches the color after the blend. It is not know what colors are being blended, or their purpose.