Understanding the Map Compilation Process

This article explains what compilation of CS maps is all about.

Contents:


Tools

In order to compile maps you need a set of compilation tools. To my knowledge there are currently 5 different sets of these, each a successor of the last, listed here in chronological order:

You should use the most recent set. I use XP-Cagey's, because amckern's gave me some problems. They may have been solved in the meantime, though.

[ Top ]


The Compilation Process

The compilation process is quite complicated and can be difficult to understand. The compilation tools create a lot of files as they go; you don't necessarily need to know about all of them, but I'm going to try to explain them anyway. If all goes well, you should end up with a bsp file that's playable in Counter-Strike.

Export to Map File:

Hammer works with two different kinds of files, and it's very important to understand the difference. An rmf file is a binary file that contains the map's geometry, entity data, VisGroups, and possibly other information. A map file is a plain-text file that contains only the map's geometry and entity data. The rmf file is the one you should consider the "master" file. Always save your map in this format.

The compilation tools can't read the rmf file, which is why you need to export your map to a map file first. (You only need to do this if you are going to compile via a batch file. If you compile in Hammer it automatically exports to a map file first.) This is how you do it:

  1. Save the map in rmf format first, if you haven't done that already.
  2. Go to the File menu and select Export to .MAP.
  3. In the dialog you can select Save Visible objects only if you don't want any hidden VisGroups to appear in the map file.
  4. Click Save.

When you save or export your map the previous version will be renamed to rmx (for the rmf file) or max (for the map file). However, these backup's aren't very useful if you save your map often, which you should be doing.

The CSG Process:

CSG stands for Constructive Solid Geometry. I'm not sure exactly what this means, but I know that CSG creates a basic bsp file and puts the entities into it. CSG is the only tool that uses the map file; all the others work on the bsp file. CSG also generates 4 so-called hull files, of which two are based on a standing player and a crouching player. I don't know what the other two are for.

Input:

Output:

Subprocesses:

The BSP Process:

BSP stands for Binary Space Partitioning. It's difficult to explain this without pictures, but it basically means that the parts of the map that don't consist of solid geometry are repeatedly cut through in straight lines until there are no concave pieces.

These fragments are called "leaves" because the BSP process is recursive and thus builds a tree structure. The connections between leaves are called "portals".

Input:

Output:

The bsp file can actually be loaded in Counter-Strike at this point, which is useful if you're just going to do a quick test. Be warned that the map will probably be very demanding (performance-wise) because no visibility calculation has been done, so the engine will draw all polygons at all times. The map will also be at full brightness because no light calculation has been done.

The VIS Process:

VIS stands for Visible Information Set. To optimize performance the engine needs to know what's visible from where. This is a long (and probably boring) process that goes through each leaf and builds a list of which other leaves are visible from there. This can take hours on large and complex maps.

Input:

Output:

Subprocesses:

The RAD Process:

RAD is short for Radiosity. It's an algorithm that's used for calculating how much light each surface receives. From every light source it has to go through each surface to determine how much of the light reaches it (if any), both directly and indirectly. It takes about as much time as the VIS process.

Input:

Output:

Subprocesses:

[ Top ]


Recommended Settings

The compilation settings greatly affect how a map is going to look and how well it will perform. I recommend the following settings:

Here's an explanation of each parameter:

If you have any suggestions for better settings, please let me know.

[ Top ]