Just A Quick Stupid Question.
Gimpy_Doodly_Doo
Join Date: 2003-03-15 Member: 14521Members
<div class="IPBDescription">Why do we have to compile</div> As the topic description describes I want to know the reason we have to compile maps. Why can we not just work straight with the bsb files. Also the topic says it is a stupid question but i still want to know. Please dont respond if your just going to flame.
Comments
The main reason is the way bsp files are constructed -- the entire level is viewed as a shell, which is recursively divided into halves to form a Binary Space Partition tree (that's where the file extension comes from).
Imagine cutting the entire level in half, and then storing the halves to the left and right side of the cut as two groups of information. Now cut the halves on the left in half again, and store those separately. The file format does this down to the smallest spacial units of the maps (leaves), and once the cuts have been made any change to map geometry would mean having to recalculate the divisions again to make sure that all of the faces are being cut properly.
BSP structures have some properties that allow rendering engines to make major optimizations--there are other ways of making an engine run quickly (like using portals), but this is the path that id Software chose to explore with Quake. Since HL is Quake-based, it uses the same technology in its renderer.
The BSP model doesn't work well for dynamic structures, and when you're making changes to a map you want to be able to make changes without having to wait for a lengthy recalculation. It's techically possible to use a BSP file to load and save map information while you're editing in a different format, but the .map format is very straightforward, can be read in a text editor, and provides the information in roughly the format that an editor needs, making it efficient to work with.
BSP format allows Half-Life to run more quickly, but is a difficult format to edit items in--once you've finalized your design, compiling the map puts it in a format that is more friendly for the game engine than the editor. Hope that makes sense <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif'><!--endemo-->
EDIT: I should also note that the editor has different priorities than the game... storing light data in the BSP takes the majority of the compile time, and the editor doesn't need to use that data.