VMEX (valve Map Extractor) is a .bsp to .vmf map decompiler for Half-Life 2 games (HL2, HL2DM, and CS:S).

It requires the Java Runtime Environment 5.0 (aka 1.5.0) which can be downloaded from this page:
http://java.sun.com/j2se/1.5.0/download.jsp
By following the "Download JRE" link.

It is a command-line program. To use, invoke it with:

vmex <mapname.bsp>

or alternately:

java -jar vmex.jar <mapname.bsp>

(For windows 95 and 98, use the command: vmex2 <mapname.bsp> )

For more information, see http://www.geocities.com/cofrdrbob/

Update v0.90 27 Jan 2005

Displacement surfaces are now decompiled. Generally these work very well, but a rare cases some maps show
small gaps between adjacent displacements. Alpha-blending of the surface textures is handled correctly.
Displacement decompiling can be turned off by setting the -h option; by default it is turned on.

This version of VMEX walks the map's BSP tree to determine which brushes are associated with which entities.
This method is much better than the previous guessing algorithm, and so it never needs to fall back to face-
decompiled brushes. 

A few maps give errors from a small number of invalid solids when loading into Hammer. The errors are
not usually fatal and the map can still be loaded.

This version fixes a bug in v0.80 that prevented decompiling maps with large numbers of planes (>32768).

Update v0.80 24 Jan 2005

This version adds a new decompiling mode (-m3) which is now the default. This mode decompiles the
map via brushes and planes, rather than map faces, producing a decompiled map which is much closer
to the original .vmf file. The files produced are also about half the size compared to those
produced using the other modes, making them much easier on Hammer.

The new mode also recovers the map's clip, hint and detail brushes. These are placed in visgroups for ease
of editing. 

Displacements are still not decompiled, and nor are their original brushes, so large gaps can
be found when decompiling maps which use them a lot (e.g. the d2_coast_* maps). Large brushes covered with
the yellow NODRAW texture indicate areas that should be covered with displacement surfaces.

Area portals are decompiled, but their brushes are not yet associated with their corresponding func_areaportal
entities. This will be fixed in future updates.

The new mode cannot always correctly assign brushes used by entities. If necessary, it will fall-back
to face-decompiled brushes for some entities. For some maps, brushes may be assigned to the wrong entity,
or not appear in the map. Check by decompiling using mode -m2 if you suspect something is wrong.

Because the new mode recovers almost all map brushes, it may be possible to recompile the decompiled
.vmf files (although rounding errors may cause leaks, and there may be other, more subtle problems).
For this reason, it is now possible for a map author to prevent decompilation with VMEX by setting
certain map options. See the FAQ (http://www.geocities.com/cofrdrbob/faq.html) for more information.

The locale-specific bug present in the previous version has now been fixed. VMEX will now always write
floating-point numbers in English format, no matter what the user's locale is set to. The workaround
(below) is no longer necessary.


Update v0.75a 19 Jan 2005

Added a temporary workaround for a bug that occurs if the user's locale uses comma-separated decimals.
This means that no decompiled maps will load in Hammer correctly.
The vmex.bat and vmex2.bat batch file now contain a switch to set Java to English when running vmex.
To do it manually, run vmex using the command:

java -Duser.language=en -jar vmex.jar <mapname.bsp>

There'll be a proper fix in the next version of vmex.

Update v0.75 18 Jan 2005

Added a -m<mode> switch to control the decompilation mode
 -m0  decompiles the map by original faces (as in previous versions).
This produces the smallest files, but there are sometimes missing faces that leave gaps.
 -m1 decompiles via split faces. This produces a large numbers of brushes and large files
(approx 60% - 80% bigger than -m0). However, (almost) all faces are present.
 -m2 (default) decompiles via original faces, unless it detects a missing one, in which case
it writes the corresponding split faces. This makes the vmf file somewhat bigger, while preventing
the gaps which occur in -m0 mode. -m2 mode is slower than the other two modes.

There is also now a -v switch which turns off a new vertex-checking method. This method prevents
most of the invalid solid and out-of-memory errors on loading the map in Hammer (not all, however).
If -v is set, the (slightly faster) method used in previous versions is used instead.

Update v0.72 16 Jan 2005

Fixed a bug with envmapped texture names that caused problems with the d2_coast_* maps.

Update v0.71 16 Jan 2005

Tiny bug fix update.

Update v0.7 16 Jan 2005

VMEX can now output env_cubemap entities
There are now a number of options that can be set on the command line, using:
vmex [options] <mapname.bsp>

  -d<value>	The thickness of the brushes created (default 1.0)
  -t<mode>	The texure output on the front face of a brush:
			-t0	white			-t2	orange grid
			-t1	black			-t3	the original face texture (default)
  -s<mode>	The texure output on the back faces of a brush:
			-t0	white		-t2	toolsinvisible (default)
			-t1	black		-t3	same as front face
  -r<value>	The precision (number of decimal places) to write floating-point values
  -o		Don't fixup origins of brush models
  -p		Don't output prop_statics
  -x		Don't fix texture names that refer to envmaps
  -c<value>	Env_cubemap output options
			-c0	no cubemaps		-c1	output cubemap location only
			-c<count>	write list of up to <count> sides tied to cubemap (default 8)

			
Update v0.6 14 Jan 2005

VMEX now supports decompilation of prop_statics


Initial release v0.5 13 Jan 2005



VMEX v0.80 24 Jan 2005  rof@mailinator.com