Format:BSP (Quake II)
| Developer | id Software |
|---|---|
| Versions | 38 (Quake II); Quake III uses IBSP 46 |
| Magic | 49 42 53 50 ("IBSP") then int32 38 |
| Extensions | .bsp |
| Endianness | little |
| On this wiki | Facts · Code · Notes · Topics |
Compiled map format of Quake II (IBSP, version 38): an 8-byte header and 19 lumps of (offset, length), with leaves clustered for visibility, brushes for collision and a texinfo table that names the WAL textures.
Identification
Bytes 49 42 53 50 ("IBSP") then int32 version 38. Quake III also starts with "IBSP" but has version 46 and a different lump layout (Format:BSP (Quake III)). Quake 1 maps (Format:BSP (Quake)) have no magic.
Header and lumps
dheader_t { int ident; int version; lump_t lumps[19]; } with lump_t { int fileofs, filelen }: 8 + 19*8 = 160 bytes.
Lump ids: 0 entities, 1 planes, 2 vertexes, 3 visibility, 4 nodes, 5 texinfo, 6 faces, 7 lighting, 8 leafs, 9 leaffaces, 10 leafbrushes, 11 edges, 12 surfedges, 13 models, 14 brushes, 15 brushsides, 16 pop (unused), 17 areas, 18 areaportals.
Records
- plane: float normal[3], float dist, int type (20 bytes)
- vertex: 3 floats
- node: int planenum, int children[2] (negative = -(leaf+1)), short mins[3], short maxs[3], u16 firstface, u16 numfaces (28 bytes)
- texinfo: float vecs[2][4], int flags, int value, char texture[32], int nexttexinfo (76 bytes); the texture name (a .wal under textures/) lives here
- face: u16 planenum, short side, int firstedge, short numedges, short texinfo, byte styles[4], int lightofs (20 bytes)
- leaf: int contents, short cluster, short area, short mins[3], short maxs[3], u16 firstleafface, numleaffaces, firstleafbrush, numleafbrushes (28 bytes)
- edge: u16 v[2]; brush: int firstside, numsides, contents; brushside: u16 planenum, short texinfo; model: mins[3], maxs[3], origin[3] floats then int headnode, firstface, numfaces (48 bytes)
- visibility:
dvis_t { int numclusters; int bitofs[numclusters][2]; }then compressed rows; index 0 is PVS, 1 is PHS - area: int numareaportals, firstareaportal; areaportal: int portalnum, otherarea
Flags
CONTENTS: solid 0x1, window 0x2, aux 0x4, lava 0x8, slime 0x10, water 0x20, mist 0x40, areaportal 0x8000, playerclip 0x10000, monsterclip 0x20000, current 0/90/180/270/up/down 0x40000..0x800000, origin 0x1000000, monster 0x2000000, deadmonster 0x4000000, detail 0x8000000, translucent 0x10000000, ladder 0x20000000. SURF: light 0x1, slick 0x2, sky 0x4, warp 0x8, trans33 0x10, trans66 0x20, flowing 0x40, nodraw 0x80.
Limits: 1024 models, 8192 brushes, 2048 entities, 8192 texinfo, 65536 planes/nodes/leafs/verts/faces, 128000 edges, 256000 surfedges, lighting 0x200000, visibility 0x100000 bytes.
Other structures in the same header
qfiles.h also defines: PAK "PACK" (same as Format:PAK (Quake), at most 4096 files, 64-byte directory entries), WAL texture (char name[32]; u32 width, height; u32 offsets[4]; char animname[32]; int flags, contents, value, 8-bit paletted), PCX images, MD2 models (Format:MD2 (Quake II)) and SP2 sprites ("IDS2", version 2).
Code & repositories
- https://github.com/id-Software/Quake-2 @
372afde46e7defc9dd2d719a1732b8ace1fa096e· license: GPL-2.0-or-later (declared by the contributor; GitHub's detector did not recognize a license file)
GPL release of the Quake II source; qcommon/qfiles.h defines BSP v38, PAK, WAL, PCX, MD2 and SP2 on-disk structures.
Tested on: source read, not run: source read, not built: qcommon/qfiles.h at commit 372afde · checked 2026-10-18; last activity 2023-12-05
Evidence & references
id-Software/Quake-2 qcommon/qfiles.h at commit 372afde (GPL-2.0-or-later).