Valve Developer Union

GoldSrc Map Decompilers: BSPTwoMap vs. WinBSPC

(September 18, 2017)


Map decompilers sound like absolute voodoo at first. Usually, when you compile something, you turn it from something nice and readable to absolute gibberish that only machines understand. Usually, it's stuck like that too. Being able to take any level and turn it back into something you can edit? Whatever next?

Map decompilers have been around since the Quake days. They work by prying open a BSP and recreating the original editor file it came from through a variety of methods. It'll never be a perfect recreation, and in some cases, it'll be messy, broken, and require a lot of fixing before it'll work again.

For Quake maps and GoldSrc games, you should look at two in particular, BSPTwoMap and WinBSPC. Both will take apart most GoldSrc maps you throw at them, with the notable exception of Half-Life: Blue Shift maps, which WinBSPC won't work on. Settled, then, isn't it? Just use BSPTwoMap for everything?

Not so fast. Unlike Source maps, GoldSrc maps don't store the original brush data inside the compiled level. HLCSG takes a brush and splits it into six faces, before deleting the ones you can't see in the game. (In the case of brushes touching one another, the surviving faces often get split up even further.) As a result, the decompilers have to recreate the brushwork from scratch. There are noticeable differences between the outputs of both. We tested them against four maps:

Test one: Half-Life's c1a0

Here are three stills taken from roughly the same location of the lobby of Sector C. All scripted_sequence entities and triggers have been removed. All entities copied over well and functionally matched the original source. First, the original source as a control:

The original source for c1a0
The original source for c1a0

Now, the decompiles:

BSPTwoMap's attempt at decompiling c1a0 WinBSPC's attempt at decompiling c1a0
Left: BSPTwoMap's attempt at decompiling c1a0
Right: WinBSPC's attempt at decompiling c1a0

BSPTwoMap did a rather poor job recreating the brushwork. You'll notice in all BSPTwoMap decompiles that the brushwork has been chopped up into pieces. Brush entities, rather than being one brush, would become six paper-thin brushes merged together into a box. Note the desk; gaping holes in otherwise solid surfaces are a trademark of BSPTwoMap. Texture axis errors and invalid solid structure errors plagued the brushwork of every BSPTwoMap decompile. Needless to say, these maps would require a lot of work before they became usable again.

WinBSPC's defect is that the level is carved from a box the size of the entire map, which may or may not result in usable brushwork. Here, it at least resembles the original c1a0 better, but still with invalid solids and some texture rotation issues. You'll also notice in that screenshot that it got the texture of the blast doors wrong.

Test two: Half-Life's crossfire

BSPTwoMap's attempt at decompiling crossfire WinBSPC's attempt at decompiling crossfire
Left: BSPTwoMap's attempt at decompiling crossfire
Right: WinBSPC's attempt at decompiling crossfire

BSPTwoMap's brushwork could charitably be described as inaccurate, but is closer to downright unusable. In addition to the split faces, many brushes (including the railings and ceilings) jut out in triangles, completely unlike the original map. Even worse is the sky; a sky brush that did not exist in the original map cut through the top half of the playfield. Note that we had to split that sky brush in half to let you see the ground of the map. BSPTwoMap's razor-thin brushwork is even more apparent here.

WinBSPC's is more accurate and usable, even getting the odd, uneven terrain correct, but note the texture errors on the walkways. Signs, again, were oriented upside down.

Test three: Half-Life: Opposing Force's op4ctf_gunyard

BSPTwoMap's attempt at decompiling op4ctf_gunyard WinBSPC's attempt at decompiling op4ctf_gunyard
Left: BSPTwoMap's attempt at decompiling op4ctf_gunyard
Right: WinBSPC's attempt at decompiling op4ctf_gunyard

BSPTwoMap tripped around any sort of thin brushwork; as you can see from the screenshot, there's more than a few invalid faces from when the railings became concave.

WinBSPC gets it closer, aside from some texturing issues and a few broken solids. Amusingly, the health chargers got flipped upside down.

Test four: Ricochet's rc_arena

Okay, this test was just for fun. Ricochet isn't quite as heavy on stunning level design as other GoldSrc games. At least, we thought it was for fun, when it turns out this one fared the worst out of the lot:

BSPTwoMap's attempt at decompiling rc_arena WinBSPC's attempt at decompiling rc_arena
Left: BSPTwoMap's attempt at decompiling rc_arena
Right: WinBSPC's attempt at decompiling rc_arena

The BSPTwoMap decompile is an actual disaster. Not one of the platforms survived the decompile in any sort of a recognizable shape. We could barely navigate the map in the editor well enough to take a screenshot. The WinBSPC decompile didn't come out so hot either; though its shape is more recognizable, most of the platforms were split into 5-6 brushes each, and the jump arrows were similarly splintered and with texture alignment issues.

Conclusion

So what have we learned today? Neither work miracles. BSPTwoMap ends up with many razor-thin, broken solids, and WinBSPC carves brushwork out of a box and often gets the texture alignment wrong. We leave it up to you to decide which one is more tolerable. (You can download the results of our tests using the download link below.)

↓ Download GoldSrc Decompile Comparison Results ↓