Decompiling Maps

From Valve Developer Community
(Redirected from Decompiling)
Jump to: navigation, search
English (en)한국어 (ko)Русский (ru)中文 (zh)Translate (Translate)

Decompiling is the process of taking a compiled map file and generating a file that Hammer can open. Decompiled maps are not perfect recreations, because of format differences[Clarify], loss of data (such as missing Func viscluster, and imprecise vertex position on complex brushes. This makes them useful for learning, measurement, and inspection, but not direct recompilation. The original source is ideal for reproductions or modifications.

Releasing reproductions, modifications, or approximations of another's work without permission nor credit may be considered rude to the author, is largely frowned upon, and is in fact copyright infringement, which may have legal consequences depending on the source of the map. There are methods of preventing maps from being fully decompiled (obfuscating textures, keeping entities or VScript server-side, etc.), but these are rarely used because most people who decompile maps are doing so to learn from them rather than to steal.

Decompilers

Source 2 Source 2

  • Source 2 Viewer Source 2 Viewer (used to view the entities and other lumps on a map, decompiling to vmap, and exporting to glTF)

Source Source

  • EntSpy (used to view and edit the entities of a BSP without recompiling)
  • BSPSource (open source map decompiler for Source engine maps, based on VMEX)
  • VMEX (decompiler for Source engine maps)
  • MapFool (helps porting HL1 maps to Source)
  • xwad (command-line tool to convert texture formats)

GoldSrc GoldSrc

  • BSP Viewer BSP Viewer requires .NET Framework v1.1. (not recommended)
Warning.pngWarning:In Crafty Crafty the function of bsp decompilation was cut out.
Warning.pngWarning:BSP2MAP, MBSPC, 005 and WinBSPC are unstable and may not compile correctly in the end; Half-Life Unified SDK Map Decompiler instead. It will still require manual cleanup, but is significantly more accurate.

Files

Most maps do not need to be extracted, as they are located in the file system rather than VPK. The map files are normally located in a maps folder, for example common\Team Fortress 2\tf\maps\ holds all the official Team Fortress 2 maps.

Note.pngNote:A few games may have extra maps sectioned into other mod folders, for example Portal 2\portal2_dlc1\maps\.
Note.pngNote:A few games use lump file edits to edit existing entities, and comment files to add new entities without recompiling maps. for example: Left 4 Dead 2 adds info_remarkable entities and env_player_blocker entities this way.
BSPSource is capable of reading the .lmp files and incorporate its data, but it will not load entities from the commentary files. Luckily you can convert commentary files back to VMF files by following these steps. and merging those entities into the decompiled map.

Before you go

Before you take this jump to run off and decompile a map take a second or two to think, "What am I trying to learn/do?". Read the included TXT files, you may just find the creator's e-mail, and that could be more helpful than you imagine.

Some mappers will offer help and advice, they may even go so far as to provide examples of what you wanted to borrow from the map.

Porting newer maps to older Source games

Decompiled maps from Left 4 Dead 2, Portal 2, Counter-Strike: Global Offensive, and Alien Swarm will crash when loaded in the Hammer for Half-Life 2, Team Fortress 2, Counter-Strike: Source, Day of Defeat: Source and other Source 2013 Source 2013 games. Opening the map in Left 4 Dead Hammer and re-saving it will automatically convert it to be compatible.


Todo: Document how to fix this manually. It's caused by L4D2 changing the character used to separate output values, but I'm not sure what character it changed to.
Todo: This doesn't seem to be the case for Garry's Mod Garry's Mod (which is Source 2013 Source 2013) as it can load these map files without issues, maybe its due to Source 2013 Source 2013 not supporting BSP Version 21, since Garry's Mod Garry's Mod does support it natively.

See also