Configuring Hammer for Half-Life

From Valve Developer Community
Revision as of 19:03, 7 April 2015 by Muskrat4000000 (talk | contribs) (added the section running your map without hammer)
Jump to navigation Jump to search

Template:Otherlang2


Hammer Editor 3.4 Splash Screen.png

Half-Life

Half-Life maps are designed using Hammer Editors 3.3 through 3.5, and are powered by the GoldSource Engine, the predecessor to the current Hammer 4.X series, AKA the Source SDK. Half-Life maps can only be developed and compiled using the GoldSource Engine. This tutorial assumes you have already downloaded some form of the GoldSource Hammer Editor, so finding and installing it will not be covered on this page.


  • Note: Once you have successfully configured the Hammer Editor to your liking, click Apply, OK, and restart Hammer for your changes to take full effect.


Configuring Hammer for Half-Life

In order for the Hammer Editor to make maps for Half-Life, it needs access to certain files and programs, such as compilers, entity files, and so-on. This page will give you a quick run through on how to set everything up, and get on your way to map making.


Launch the Hammer Editor, and open the Tools menubar at the top of screen, and click on Options at the bottom of the bar. The In-Game Configurations console will open, where you can set new configuration settings.


Game Configurations

Hammer 3.4 Edit Game Configuration Screen.png
In the Configurations Console click on the tab labeled Game Configurations and complete the following steps.


Configuration:

Hammer allows you to setup multiple configurations, so if you want to make maps for more than one GoldSource game, you can make maps for each on the same editor. This section allows you to add, remove, or edit different configurations. We're going to add a new one, and name it Half-Life (it doesn't matter what you name it, as long as it helps you remember which game configuration it is). To create a new configuration first click the Edit button, this will open a dialog box with the options to Add, Remove, or Copy a Game Configuration, we're going to Add one, and name it Half-Life.

Game Data Files:

The Game Data files are the FGD files you want to use to build your map. An FGD file provide the entities for use in your editor, each game has it's own FGD. We're going to use the Half-Life FGD file, which if you're using the Half-Life SDK variant of Hammer available on Steam, is located in C:/ProgramFiles(X86)/Steam/SteamApps/Common/Half-Life SDK/Hammer Editor/fgd/half-life/halflife.fgd. If you're using another version, then you'll have to manually download the FGD file somewhere off the internet. To add the FGD, click Add, and locate the file on your computer. You can use multiple FGD files in a single configuration, just know that many entities(primarily NPCs) won't appear in the game other than the one they're from, so any NPCs from Opposing Force will not appear in a Blue-Shift map, and vice versa.

Game Executable Directory:

The Game Executable Directy is where the game executable(playable game file) is located, not the executable itself. The exe directory for Half-Life is C:/ProgramFiles(X86)/Steam/Steamapps/Common/Half-Life.

Mod Directory:

The Mod Directory is similar to the Game Executable Directory, it's the directory location for a Half-Life modification, such as Team Fortress Classic, or Counter-Strike, and is located inside the Half-Life file location listed earlier. Because we are configuring Half-Life itself, and not a Half-Life mod, this field can be left completely blank.

Game Directory:

(This may not be completely accurate, so if i'm wrong please correct this, if i'm right, then just delete this message and let me know in your edit summary) The Game Directory is the location of the game's files, such as models, animations, textures, etc. For Half-Life, this is located at C:/ProgramFiles(X86)/Steam/Steamapps/Common/Half-Life/Valve.

RMF Directory:

This is where Hammer will save your' maps RMF(compiled map) files every time you compile your level. All RMF files must be saved in C:/ProgramFiles(X86)/Steam/Steamapps/Common/Half-Life/Valve/maps, this is where the game looks when launching maps.

Build Programs

The Build Programs for your configuration are the files and programs that compile your map, primarily the BSP geometry, lighting, and VisLeafs. Many GoldSource map makers nowadays use Zoner's Half-Life Tools, a fan made modification of the original BSP, VIS, RAD, and CSG build programs developed for Half-Life, if you'd like to use Zoner's tools and don't have them you can download them here(add link later).


In the Configuration Console, click the tab labeled Build Programs and complete the following steps.


Game executable:

The actual executable file of the game you want to map for, this allows Hammer to run the game whenever you compile your map, allowing you to test your map in the game itself. This field is not mandatory for level creation, but it is highly recommended for quicker and easier map testing. For the Steam version of Half-Life, this file is located at C:/ProgramFiles(X86)/Steam/Steamapps/Common/Half-Life/hl.exe

CSG executable:

CSG generates the map file's brush geometry. If you are using the Half-Life SDK provided by Steam, this file is located at (coming soon). If you are using Zoner's Tools, or any non Steam version of GoldSource, the file is located in whatever file you saved it to.

BSP executable:

The BSP compiler generates raw visleaf data and entities If you are using the Half-Life SDK provided by Steam, this file is located at Hammer Editor\tools\qbsp2.exe. If you are using Zoner's Tools, or any non Steam version of GoldSource, the file is located in whatever file you saved it to.

VIS executable:

The VIS compiler generates and compiles a map's VisLeaf properties, calculating what are being rendered when the player is in a specific spot to make sure no more resources then needed are used on your computer's processor. If you are using the Half-Life SDK provided by Steam, this file is located at Hammer Editor\tools\vis.exe. If you are using Zoner's Tools, or any non Steam version of GoldSource, the file is located in whatever file you saved it to.

RAD executable:

The RAD compiler calculates static radiosity lighting, as well as switchable world lights. Dynamic entity lights are not calculated during this step, but in real time. If you are using the Half-Life SDK provided by Steam, this file is located at Hammer Editor\tools\qrad.exe. If you are using Zoner's Tools, or any non Steam version of GoldSource, the file is located in whatever file you saved it to.

  • Place compiled maps in this directory before running the game:

This step is very similar to the RMF Directory from the Game Configuration settings. Set this location to C:/ProgramFiles(X86)/Steam/Steamapps/Common/Half-Life/Valve/maps.


Textures

Textures are the images used to make your squares and cylinders look like crates and barrels. GoldSource textures are stored inside of large image library files known as WAD3 files. You can insert any WAD files you wish, whether they come from other GoldSource games, the internet, or if you make them yourself. It's highly recommended however that you do not edit any of the default WAD files that come with your game, especially if your game is not a Steam purchased copy.


In the Configuration Console, click the tab labeled Textures and add the following default Half-Life WAD files.


Half-Life SDK: /Half-Life SDK/Texture Wad Files/halflife.wad

Half-Life: C:/ProgramFiles(X86)/Steam/Steamapps/Common/Half-Life/Valve/halflife.wad

Half-Life SDK: /Half-Life SDK/Texture Wad Files/liquids.wad

Half-Life: C:/ProgramFiles(X86)/Steam/Steamapps/Common/Half-Life/Valve/liquids.wad

Half-Life SDK: /Half-Life SDK/Texture Wad Files/xeno.wad

Half-Life: C:/ProgramFiles(X86)/Steam/Steamapps/Common/Half-Life/Valve/xeno.wad

Half-Life SDK: /Half-Life SDK/Texture Wad Files/decals.wad

Half-Life: C:/ProgramFiles(X86)/Steam/Steamapps/Common/Half-Life/Valve/decals.wad


Saving and Compiling

When you've successfully configured your Hammer Editor to your liking, click OK/Apply, restart Hammer, and test to make sure you've configured Hammer correctly. If you've created more than one configuration, a selection box will pop up every time you start Hammer for you to specify which configuration you want to use in that session.

Quickly create a small box in Hammer, go to the Tools menubar at the top of the screen, and click Make Hollow, then click OK. This will hollow out your box, making it a quick makeshift room to place an info_player_start, and a light.

Configuring which game runs after compilation

Once your' level is ready, save it, and click the File menubar at the top of the screen and click on Run from the drop down menu, or press F9 to instantly bring up the Run Map Menu. The Run Map Menu allows you to run your Hammer map in the game it's made for, featuring several features for you to adjust, or turn off when testing your map. The Run Map Menu also allows you to specify the game you want to run and test your map in, to choose which one click on the Expert button at the bottom left of the Run Map Menu to bring up the Advanced Settings. The Advanced Run Map Menu features several additional and more specific settings for compiling your map, we can create custom configurations in the Configurations: drop down menu at the top left of the menu. This Configuarations menu allows you to create custom compilation commands that affect how your map is compiled and run, but all we're concerned with right now is using it to choose which game launches when you run your map. If you use the Half-Life SDK available from Steam, you are automatically given four pre-built configurations, for running the original Half-Life, or it's 3 Steam supported mods and expansions, Half-Life: Opposing Force, Team Fortress Classic, and Counter-Strike, of course you must own the game on Steam for it to launch. If you are using another version of Hammer, you will have to create each configuration yourself, similarly to the way we did earlier.

Level creation for Half-Life doesn't require any custom compile configurations to run Half-Life in the editor, however custom configurations allow for better compiling. To create a new compile configuration for Half-Life, click Edit next to the Configurations drop down menu and name it Half-Life (full) (just like before, this name is not important and you can name it whatever you prefer). Once you've named the configuration, click close and the configuration will be saved.

Once you have officially created the configuration, you must create each custom command for your configuration. To create a command you must click the New button below the Configuration drop down menu, you can then enter a command name and a list of parameters for that command in the textboxes to the right. There are a total of 8 custom configuration commands in the Half-Life SDK variant of GoldSource, if you're not using this version and would like the benefits of these commands, copy them below and edit your configuration as explained above.

Enter each new command with it's parameters as follows into your configuration.
  • Command: Change Directory Parameters: $exedir
  • Command: $csg_exe Parameters: $path\$file
  • Command: $bsp_exe Parameters: $path\$file
  • Command: $vis_exe Parameters: $path\$file
  • Command: $light_exe Parameters: $path\$file
  • Command: Copy File Parameters: $path\$file.bsp $bspdir\$file.bsp
  • Command: Copy File Parameters: $path\$file.pts $bspdir\$file.pts
  • Command: $game_exe Parameters: +map $file -dev -console

Each command is a checkbox, so you will have to check/select each one before compiling for them to work. Once your' fully configured, click run, and make sure your map compiles correctly.


Running your Map without Hammer

If you are unable to configure Hammer to run your map after compiltion then you can just as easily run your map in the game itself as an alternative. To do this you still have to run your map in the editor, or compile it to a .map or .rmf file (it's recommended that you run your map, because this compiles it to various formats simultaneously). Compiling your map saves your maps' current state into a file readable by the game, compiling your map each time you run it simply keeps it up to date, if you edit your map and then run it without compiling it will run the previous compiled file that is not the same as the maps' current state. To run your map manually in Half-Life open the Developer Console by pressing the ~, or tilde key on your computer. Once the developer console is opened, type sv_lan 1 and then map into the text field at the bottom, followed by the name of your map (without the filetype extension, such as .map, or .rmf). This will run your map in Half-Life, completely bypassing the use of Hammer for running your map.