How do levels/maps work in the game development world? Counter strike, which is a popular FPS that uses OpenGL as it's graphics library, has it's levels/maps created as *.bsp files. How do you create files like this, and use OpenGL to load them?


  • 1
    \$\begingroup\$ see here gamedev.stackexchange.com/questions/56963/… \$\endgroup\$
    – BeanBag
    Jun 16, 2013 at 0:19
  • \$\begingroup\$ Your question is very open. Look at the link posted by @BeanBag. Your first question: "How do you create files like this" is answered there. However "How do you use OpenGL to load them" is not. The answer is: You don't use OpenGL to load them. OpenGL is a graphics rendering library. What you are looking for is a game engine that loads some level format. When you find one, use it and get into trouble, come back and ask for solutions. \$\endgroup\$ Jun 16, 2013 at 1:34

1 Answer 1


This will depend a lot on your game.

Counter-Strike, or any source engine game or any Quake derivative, and most other FPSs will have custom editing tools for the actual act of crating a level. That tool will bake the specified static meshes into the format by applying some algorithm. That format will be a spacial index. In the example case, BSP stands for binary space partition. You will basically be separating (and in some cases splitting) polygons into groups based on their location so it will be quick to query what polygons are visible from a location in a direction. Now days there will be various BSP implementations of with different optimizations since the initial BSP design from Quake.

Now days you can probably scrap custom editing tools for a general purpose 3D editor and just parse the file it outputs.

In addition to that you will have dynamic objects that can move about that won't work in a BSP (the structure just doesn't support making alterations at runtime with any decent levels of efficiency). The objects will just link their position to their object informations (such as the 3D mesh to draw at the location).

BSPs date back to the original Quake engine. Now days it might be a better idea to use an object based approach rather than a giant polygon mesh. For example Skyrim uses a modular level design. Basically rather than keeping everything as a giant mesh of polygons, you will just have a list of objects and their positions, the actual mesh will be stored separately.

BSP isn't the only spacial index around. It's good for indoor environments such as FPS shooters. For an outdoor game like GTA you might do better with an Octree (or Quadtree for flatter game worlds). Those 2 are able to be used for both lowlevel polygon level storage or higher level object level storage (off hand I'm not sure if BSP would be useful for objects).

In addition to the raw mesh data, there are extra things you can bake in. For example if you know your mesh is static and your lights are static then you can prerender the lights into a lightmap. Basically it's an extra texture that is applied to the polygons of the level for light the lights brightness so you don't have to do it at runtime. You increase your memory but save runtime processing. You could even look at hooking up a whole raytracer so you get raytrace quality lighting (although the generation would be very slow, but the resulting quality would be great).


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .