History Edit

The Half-Life engine was mostly Quake World code which was an improved Quake 1 engine. But it also had some Quake 2 code in it as well. Valve also added some proprietary code.

The BSP Version used in this engine, although very similar to Quake 1 is infact a slightly different. Namely in the area of light maps.

Tools Edit

The tools to create content for this format are almost second to none in ease of use and flexibility.

3D Map Creation:Edit

Valve Hammer Editor - Started out as World Craft but was bought by Valve and renamed. Still one of the best level editors.

Format Description Edit

Directory Structure Edit

BSP Tree Edit

Many people incorrectly associate the BSP tree with the visibility algorithm used by Quake and similar engines. As described above, the visible surface determination is done using a precomputed PVS. The BSP tree is primarily used to divide the map into regions and to quickly determine which region the camera is in. As a result, it isn't that fundamental to any of the rendering algorithms used in Quake and any data structure giving a spatial subdivision (like an octree or a k-D tree) could be used instead. BSP trees are very simple however, and they are useful for some of the other non-rendering tasks in the Quake engine.

Traditionally when discussing BSP trees a distinction is made between those BSP trees that store the faces in the leaves (leaf-based BSP trees) and those that store them in the internal nodes (node-based BSP trees). The variation of BSP tree Quake uses is actually both; the reason for this is the dual use of the BSP tree in both rendering and in collision detection. For the purpose of rendering, it is useful to have the faces stored in the leaves because of the way the PVS is used. If you're not interested in performing collision detection, the faces in the nodes can be completely ignored.

Visibility Lump Edit

The visibility lump contains the Potentially Visible Sets (PVS) for each leaf. Each PVS contains exactly n-1 elements. The first element of the PVS representing the second leaf, or leaf[1]. Every visible leaf for a given Leaf's PVS is represented by a 1 in the bit vector, including the given leaf it's self.

Implementation Details Edit

Here's a few important details for working with this format. In the Leaf array, element 0 is essentially a dummy leaf. It's bounding box is min(0,0,0) max(0,0,0). It's only purpose is for dead ending paths in the BSP Tree. So if a certain node has no child for a certain branch, it's child for that branch will be leaf[0]. This is especially important to remember when dealing with the Potentially Visible Sets (PVS) for each leaf because each PVS will have exactly n-1 leaves.

Sources Edit

Quake 2 BSP File Format
v30 BSP Loader & Renderer
Bart Sekura's Half-Life BSP viewer (Full Source)