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:BSP (GoldSrc)

From ReverseEngineering.wiki
Format
Developer Valve
Versions 30 (BSPVERSION in the Half-Life SDK)
Magic none; int32 version 30 at offset 0
Extensions .bsp
Endianness little
On this wiki Facts · Code · Notes · Topics

Compiled map format of Half-Life 1 and other GoldSrc games: BSP version 30, no magic, a 124-byte header of 15 (offset, length) lumps in the Quake layout, with textures stored as a miptex lump that may refer to external WAD3 files.

Identification

There is no magic: the file starts with the int32 version, BSPVERSION 30 in the Half-Life 1 SDK (utils/common/bspfile.h). Quake maps use version 29 (Format:BSP (Quake)) with the same 15-lump layout; Source maps start with VBSP (Format:BSP (Source)).

Header

dheader_t is int version; lump_t lumps[15]; = 4 + 15*8 = 124 bytes, and lump_t is only int fileofs, filelen (no lump version and no compression, unlike Source).

Lump ids

0 entities (text), 1 planes, 2 textures, 3 vertexes, 4 visibility, 5 nodes, 6 texinfo, 7 faces, 8 lighting, 9 clipnodes, 10 leafs, 11 marksurfaces, 12 edges, 13 surfedges, 14 models.

Structures

  • dmodel_t: float mins[3], maxs[3], origin[3]; int headnode[4]; int visleafs; int firstface, numfaces (4 hulls: MAX_MAP_HULLS).
  • Textures lump: dmiptexlump_t { int nummiptex; int dataofs[]; } then miptex_t { char name[16]; unsigned width, height; unsigned offsets[4]; } (four mip levels).
  • dplane_t { float normal[3]; float dist; int type; }, dnode_t and dclipnode_t use int plane numbers and 16-bit children (negative = leaf or contents), texinfo_t { float vecs[2][4]; int miptex; int flags; }.
  • Contents values: -1 empty, -2 solid, -3 water, -4 slime, -5 lava, -6 sky, -7 origin, -8 clip, -9..-14 currents, -15 translucent.
  • Limits in the tools: 400 models, 4096 brushes, 1024 entities, 32767 planes/nodes/clipnodes, 8192 leafs, 65535 vertexes/faces, 8192 texinfo, 512 textures, 0x200000 bytes of lighting and visibility.

Code & repositories

  • https://github.com/ValveSoftware/halflife @ b1b5cf5892918535619b2937bb927e46cb097ba1 · license: LicenseRef-Valve-Half-Life-SDK (declared by the contributor; GitHub's detector did not recognize LICENSE)
    Half-Life 1 SDK: utils/common/bspfile.h and wadlib.h/.c (BSP v30, WAD2/WAD3), engine/studio.h and utils/studiomdl/studiomdl.h (MDL v10). Valve SDK license, not open source.
    Tested on: source read, not run · checked 2026-10-18; last activity 2024-10-02

Pitfalls

  • Unverified: a miptex whose offsets[0] is 0 carries no pixels and refers to a texture of the same name in a WAD3 file listed by the worldspawn wad key (see Format:WAD3 (GoldSrc)); read the entity lump to find the WAD list. Check by loading a stock map and comparing the lump sizes.
  • Unverified: embedded miptex pixel data is 8-bit indexed with a 256-entry RGB palette after the last mip (community documentation).

Evidence & references

ValveSoftware/halflife utils/common/bspfile.h at commit b1b5cf5892918535619b2937bb927e46cb097ba1.