Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!

Editing Quake BSP Format

From Quake Wiki

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
 
Quake levels are stored in a BSP file (extension: .bsp). BSP files are typically a result of processing simple text-based MAP format (extension: .map) that most of the Quake level editors support. As such BSPs may be referred to as "compiled maps", in contrast to MAPs.
 
Quake levels are stored in a BSP file (extension: .bsp). BSP files are typically a result of processing simple text-based MAP format (extension: .map) that most of the Quake level editors support. As such BSPs may be referred to as "compiled maps", in contrast to MAPs.
  
Name of the file comes from [http://en.wikipedia.org/wiki/Binary_space_partitioning binary space partitioning], a technique used by Quake to subdivide large spaces into smaller hulls that are later used to speed up rendering geometry of the level.
+
Name of the file comes from [http://en.wikipedia.org/wiki/Binary_space_partitioning binary space partitioning], a technique used by Quake to subdivide large spaces into smaller hulls that are later used to speed up rendering geometry od the level.
  
BSP files are most commonly generated in three steps, with a dedicated tool for each. First qbsp tool produces majority of file contents (vertices, textures, entities, models, etc.). Then vis tool computes visibility data (potentially visible sets). Finally light tool bakes lightmaps used by the renderer.
+
BSP files are most commonly generated in three steps, with a dedicated tool for each. First qbsp tool produces majority of files contents (vertices, textures, entities, models, etc.). Then vis tool computes visibility data (potentially visible sets). Finally light tools bakes lightmaps used by the renderer.
  
===File layout===
+
===File format===
  
Many versions of BSP file are in use by various engines. These engines typically share common ancestry with the original Quake engine (which is true for later id technology as well as most, if not all, Valve games.) BSP version supported by the original engine is sometimes known as BSP29 due to version identifier embedded in the file (29 or 0x1d).
+
Many versions of BSP files are in use by various engines oftentimes derived from the original Quake engine. This is true for later id technology as well as most (if not all) of Valve games. BSP version supported by the original engine is known as sometimes known BSP29 due to version identifier embedded in each file (29 or 0x1d).
  
 
BSP file is composed of header with version number (four bytes: 0x1d, 0x00, 0x00, 0x00), fixed list of lump definitions and variable number of lumps. Lump represents structured data of some kind (e.g. a list of textures). Lump definitions indicate where in the file itself data of a given type is located and how much space it occupies. Number and type of lump definitions is bound to the version number. Layout is thus as follows:
 
BSP file is composed of header with version number (four bytes: 0x1d, 0x00, 0x00, 0x00), fixed list of lump definitions and variable number of lumps. Lump represents structured data of some kind (e.g. a list of textures). Lump definitions indicate where in the file itself data of a given type is located and how much space it occupies. Number and type of lump definitions is bound to the version number. Layout is thus as follows:
Line 18: Line 18:
 
* 2PBS uses 32bit values instead of shorts for most except for bbox sizes (which still use shorts)
 
* 2PBS uses 32bit values instead of shorts for most except for bbox sizes (which still use shorts)
 
* BSP2  uses 32bits for everything and bboxes use floats
 
* BSP2  uses 32bits for everything and bboxes use floats
 
Details on BSP2 history and support across engines can be found in the [[BSP2]] article.
 
  
 
With time engines added support for more data types associated with map (e.g. finer light maps, improved skyboxes, etc.). Due to a rigid nature of the file format (fixed set of lumps/lump definitions) these were shipped alongside the map. With time BSPX file format was introduced which introduces additional optional lump definitions behind the BSP29 ones (with 4 byte alignment). They differ from original lump definitions as they can be present in any order and as such require unique lump type identifier. This identifier is a unique 24 byte string (including terminating null) representing type of data being described.
 
With time engines added support for more data types associated with map (e.g. finer light maps, improved skyboxes, etc.). Due to a rigid nature of the file format (fixed set of lumps/lump definitions) these were shipped alongside the map. With time BSPX file format was introduced which introduces additional optional lump definitions behind the BSP29 ones (with 4 byte alignment). They differ from original lump definitions as they can be present in any order and as such require unique lump type identifier. This identifier is a unique 24 byte string (including terminating null) representing type of data being described.
  
 
Additional information on how the format is structured can be found [http://www.gamers.org/dEngine/quake/spec/quake-spec34/qkspec_4.htm here]. Keep in mind that this is a reverse engineered Quake demo file format which may differ from the final one (demo used BSP28).
 
Additional information on how the format is structured can be found [http://www.gamers.org/dEngine/quake/spec/quake-spec34/qkspec_4.htm here]. Keep in mind that this is a reverse engineered Quake demo file format which may differ from the final one (demo used BSP28).

Please note that all contributions to Quake Wiki are considered to be released under the GNU Free Documentation License 1.3 or later (see Quake Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel | Editing help (opens in new window)