Hammer crashing on compile

Tucky_Monster

L1: Registered
Nov 10, 2019
4
0
when ever i make a map. hammers good. but when i load up mvm_coaltown to make my own thing out of that. it crashes. well. gives you that not responding thing. is the map too big? idk. i started using hammer not too long ago.
 

Werewolf

Probably not a real Werewolf
aa
Apr 12, 2011
873
309
That's actually sort of normal. Hammer was made way back in 1995 when we didn't have multicore processors, so by default it tries to use 100% of your CPU. This makes it look like your computer, or at least Hammer, has frozen.

The way to 'fix' this is to use the expert compiler mode. On the left of the expert window you'll see several checked boxes, and on the right a 'Parameters' window, which has strings of text. This is the one for the '$bsp_exe' command:
Code:
-game $gamedir $path\$file

All you need to do is add '-threads X' at the start of the parameter string, replacing that X with an actual number, like this:
Code:
-threads 10 -game $gamedir $path\$file
MCTVxwT.png


At this point you'll need to know how many threads your CPU has, in order to know what number to put in. If you don't already know, you'll need to find out with a bit of Googling. Open 'My Computer' and look at the Computer properties, it should tell you the name of your CPU. For example, mine is an Intel i7-8700K.
CQ0aSF8.png


Search your CPU make in Google and you'll most likely get the manufacturers website come up as one of the top results. You can use that to find the exact specs for your CPU. A search of my CPU tells me it has 12 threads.
zQN5NRa.png


So in theory the highest number I can enter in my compiler is 12, which will make it use all 12. This would make it use 100% of my CPU which is the exact issue we're working to avoid, so I would suggest entering a value that is 50-75% of your max thread count. If your CPU has only 4 threads, you'll only want to use 2 or 3. If you have 24 threads, you might want to use 20 of them.

Some other things to remember:
  • You will need to add the -threads parameter to all 3 of the main compilers; VBSP, VVIS and VRAD. While you could give each a different number, you might as well give all 3 the same number, as they run one after the other so you don't have to worry about 2 of them running at the same time.
  • The fewer threads you use, the longer your compile times will be. A bit like if you had to drive a 100 mile journey, the slow you go the longer it takes, but you do still get there in the end.
  • Altering your threads settings doesn't save you from an unoptimized or badly optimized map. If your map is a buggy mess, this won't help you.
  • You can easily change the number after each compile, so play around with it till you find the right balance for you. As you can see from my example above I use '10' which is 83% of my CPU. For me and my PC, that is enough for me to compile quickly while also having a little spare CPU power to browse the internet while it compiles.
 
Last edited: