Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:Build PALETTE.DAT

From ReverseEngineering.wiki
Format
Magic none
Extensions .dat
Endianness little
On this wiki Facts · Code · Notes · Topics

Palette file of Build engine games: 768 bytes of 6-bit VGA colors, a 16-bit shade table count, the shade tables (256 bytes each) and a 65536-byte translucency table; LOOKUP.DAT adds extra palette remaps.

Layout

File name PALETTE.DAT (looked up inside the GRP or on disk). Layout as read by the ports:

Offset Size Field
0 768 256 RGB triples, each component 0-63 (VGA DAC values)
768 2 numshades (little-endian uint16)
770 256 x numshades shade table 0 (palookup[0]): for shade s and color c, byte s*256 + c is the remapped color index
- 65536 translucency (blend) table, index a*256 + b

Ken's note: to display ART tiles, read the first 768 bytes and write them to the VGA DAC; the values are therefore 6 bits. EDuke32 shifts every byte left by 2 after loading.

Variants

  • jfbuild accepts the layout above when (filelength - 65536 - 2 - 768) % 256 == 0, and an "old format" (no stored shade count, no stored translucency table, tables recomputed) when (filelength - 32640 - 768) % 256 == 0.
  • EDuke32 detects LameDuke's PALETTE.DAT by a file length of exactly 41600 bytes: no numshades word, 32 shades follow the palette directly and the translucency table is stored only as the upper triangle (255 + 254 + ... + 1 = 32640 bytes).
  • EDuke32 then looks for the 12-byte tag MoreBlendTab after the translucency table (extra blend tables follow; the rest was not read).

LOOKUP.DAT

A byte count of lookups, then for each: a pal number byte and a 256-byte remap table; EDuke32 refuses pal numbers at or above 256 - RESERVEDPALS.

Unverified

Unverified: which stock games ship which variant; the shade count of the stock Duke Nukem 3D file; how Blood's PAL files relate.

Code & repositories

  • https://github.com/jonof/jfbuild @ e06cbd005a8e6d5f38b5a7aa27ea597dd233c16e · license: LicenseRef-Build-Source-License (declared by the contributor; GitHub's detector did not recognize COPYING)
    Jonathon Fowler's port of Ken Silverman's Build engine source: src/engine.c (loadboard, loadpics, loadpalette), src/cache1d.c (GRP) and doc/buildinf.txt (Ken's ART, MAP and PALETTE.DAT notes). The Build source license (buildlic.txt) allows free non-commercial redistribution of derivatives over the Internet; cite facts only.
    Tested on: source read, not run: source and BUILDINF.TXT read at the cited commit, not run · checked 2026-10-19; last activity 2026-06-28
  • https://github.com/NBlood/NBlood @ 497385d64b97f4fd13b6efb3929df0f2ab3adc87 · license: none
    NBlood: Blood port that carries the EDuke32 Build engine fork (source/build/src engine.cpp, tiles.cpp, palette.cpp) and Blood's RFF Resource class (source/blood/src/resource.cpp). Used for map version 9, the BUILDART prefix, PALETTE.DAT variants and the RFF format.
    Tested on: source read, not run: source read at the cited commit, not run · checked 2026-10-19; last activity 2026-10-02; Note: the latest release ships binaries; the wiki links only the source, never the binaries; no license: not reusable