Writing a batch file
Valve Hammer Editor (and all other versions of Worldcraft) do the equivalent of a batch file when you press the compile button. All it does is copy your .map file to the compile tools directory, run the tools, and then run Half-Life if you told it to.
However, the editor is taking up memory!! So don't use it when you need all the memory you can get. Also, you'll notice that the compile window isn't updated much, if at all. This is because it is not updated as frequently as DOS is, which is another reason to use the beloved batch file. That is why worldcraft appears to crash when this happens.
Using a batch file is beneficial because the compile process isn't using virtual memory. This is why we're trying to free up more real memory. Virtual memory is much slower than real memory, which means that your compile will be a lot slower. Basically, when the compile tools run out of real memory, they use virtual memory. Which is slower, because this memory exists on your hard drive. Which is fast, but no where near the speed of RAM.
Example Batch File
This example assumes that you have got all the necassary compile tools and WADS in the same directory.
Make a batch file called "compile.bat" in any text editor (I recommend EditPlus2), and put this in it:
hlcsg mymap
hlbsp mymap
hlvis mymap
hlrad mymap
That is about as bare bones as a compile.bat can get. If you have any extra options, like -bounce 5 or -wadinclude, you will already know where to put them. I'll write another tutorial on this another day.
HOWEVER... some command lines on some of those applications will make your compile go a lot faster. So I'll explain about these.
Please observe this
Very Important Note: These command lines are tried and tested with Merl's latest build of ZHLT. So don't use it with anything else. They are so much better than the ones that Valve made. These command lines will work with older versions of Zoner's Half-Life tools, but it's a good idea to use the ones that Merl made.
Here are some amazing commands:
The basic ones
hlbsp.exe mapname -leakonly
This will do an extremely fast check just to see if your map has any problems with leaks. So if you know you've got a leak, use this to test for one.
hlvis.exe mapname -fast
Please, please, for the love of God only use this if you're not doing your final build, otherwise it will make everyone moan. Obviously the -fast tag makes it go faster, but at an expense to the quality of the lighting and visibility determination.
hlvis.exe mapname -full
Essentially, this increases the quality of the VIS calculations. This takes a little longer but is worth it. (the ZHLT manual says that the compiles may be up to 30% longer)
hlrad.exe mapname -extra
No matter how bad your computer is, you need to run this for final builds of your maps. It doesn't do much for speeding up your compile, infact it will add a few extra seconds onto the end, but your map will look beautiful. Trust me.
<any zhlt compile tool>.exe mapname -estimate
This will not slow down your compile at all. It just gives you an estimation on how much time is remaining before your compile finishes. Note that
hlbsp
will not be affected by
-estimate, since it can not display its progress in the first place.