A .wad file could be described best as an archive similar to a zip. Using BuildWad or a program such as Wally, you compile all your texture files into a single file known as a Wad. Hammer uses this Wad to load all your textures into the editor. A wad files is ONLY used by Hammer and the actual export process requires you to source your individual textures from outside the Wad. This will be explained further on.
These files are your saved map projects within the editor and are the source files used to export to the .dif format. These files are not used by the engine but are your editable files.
This is your finished, exported file. A properly exported file will have all the BSP data and texture sourcing information. If you set up your editor as described in this guide you will be able to quickly and easily create content in Hammer and load it into your Torque project.
In order to complete this tutorial you will need to have the Torque SDK installed on your computer. This tutorial was based on Torque version 1.5.
Note: I realize that there are several resources pertaining to Hammer, however I also know that if you are like me, compiling all the information scattered across the forums, engine documentation and TDN can be tedious and difficult. I do not mean to piggy back off of anyone's work, so if you have an issue with anything in this resource email me and I will edit it.
Step One: Downloading and installing Hammer
Hammer version 3.4 is currently the most recent stable release and can be found at Valve-ERC here. There is a beta version available however I do not know how the setup will differ and I am not including it for that reason. After you have downloaded the setup file install it to any directory. For the purpose of this guide I have used the default install path but any path will work.
Step Two: Creating a .wad file
There are two techniques for creating a .wad file. The first is to use the included BuildWad tool found in the Torque 1.5 SDK, and the other is to use 3rd party tools. For the purpose of this guide I will be using the Quake tool Wally. Once you have obtained Wally, install it to the directory of your choice. At this point in time I am going to assume you have your own texture files however if you do not the for the sake of this guide we will use the textures provided for us in the 1.5 release of Torque. Open the (torque SDK directory)\example\demo\interiors\ folder and you will see a variety of textures both in the main directory and in the individual folders within. Load up Wally and click new. You should see a screen that says create new texture. Click on the type option and select wad3 (.wad) and press ok.
At this point you should see a screen listed as untitled1. In the left hand side is a label that says image list and a directory search button for browsing for new textures. At this point if you resize the window and bring up the explorer window pointing at the interiors directory you can simply drag the textures in that or any other folder of your choosing and bring them into the image list. Once you have loaded all of your textures (or all your textures in a certain category) into your wad you can save the file. Remember where you store the file because when you set up the editor you have to brows to the wad file in order to load your textures into the editor.
You should now have your Wad file(s).
Step Three: Game Configurations
At this point in time we are ready to start configuring the editor. We have our .wad file, the editor is installed and we have a gleaming copy of Torque 1.5 loaded on our computer. So now to fire it up! Load the Hammer editor and it will warn you that you must load a game configuration before creating or editing a map. It will ask you if you want to run the configuration guide. Click no and the configure panel will pop up.
Click on the Game configurations tab and you will see a configuration section. To the right of the drop down menu (which at this point should be empty unless you previously made maps for source games) click on the edit button. Choose add and name the new configuration Torque. Next, under game data files click on the add button and browse to your (torque SDK directory)\tools\map2dif folder and add the torque.fgd file. Your texture format drop down should have only one option (Wad3 Half-life/TFC) as well as your map type drop down which should be set to half-life/TFC.
You are then asked to set your default Point and Solid Entities. I set the default for my point entity to Light_spot (my most commonly used PointEntity class) and the default SolidEntity to collision.
Setup the rest of the game configuration options as follows:
Game Executable Directory:
(Torque SDK directory)\example
(Torque SDK directory)\example\YourProjectName
(Torque SDK directory)\example\YourProjectName
(Torque SDK directory)\example\YourProjectName\data\interiors
At this point you have completed the game configuration and you need to finish setting up your build options. Click on the build options and in the drop down menu select Torque as your configuration and then press the browse button to point to the game executable. In this case the game executable is your torqueDemo.exe file which is located at (Torque SDK directory)\example\torqueDemo.exe.
Next click on the browse button and point it to your CSG program, in this case your map2dif_plus tool. This tool is located at (Torque SDK directory)\tools\map2dif_plus.exe.
The final step in the build options is to browse to your interiors directory under the 'place compiled maps in this directory before running the game' option.
That concludes the build options! The last thing we need to do in order to begin creating maps (not exporting mind you, we will get to that in a second) is add the .wad files for the editor to source from. Click on the textures tab and click add wad. Browse to your wad file location and add it to the list.
Step Four: Setting up the compile options
In order to get your Map/RMF file exported into the proper format you need to set up your run/compile options which actually start the conversion process. In order to access the run options you need to save the file you are currently working on and click the F9 key or the run option from the file menu. Once the Run dialogs comes up click on the edit button next to the configuration drop down and add Torque to the list. Once you finish adding it, make sure it is selected before you continue.
Under the Compile/Run commands options click the new button and a command properties box with a command and parameters field will open. In the command field enter: $csg_exe under the parameters field enter: $path\$file.$ext
There are a wide variety of commands and parameters you can use to help in your exporting processes, however for the sake of simplicity this is the only one we will cover. Make sure the box 'use process window' is checked and then close the window.
Hammer is now totally ready to run!
Start a new map and create whatever you want!
Step Five: Texturing
If you're taking the time to figure out how to set up Hammer as opposed to software which supports Torque out of the box I am also going to assume you know how to map, texture and save your map/RMF files IN Hammer. If not, these are things easily covered in tutorials for half-life mapping, which for the most part is identical to using Hammer for Torque with the exception of entities. However I am also going to assume that using this configuration, run commands and parameters that you don't know why your textures are not showing up in the engine. So here is your answer.
The wad file is used only by the editor, to load your textures INTO the editor. In order for map2dif_plus to properly export with your textures it needs to source them from somewhere. In order to do this, open your wad file and export ALL the textures in the wad to the directory in which you saved your un-compiled map file. When the map compiles it will automatically source the textures from that directory.
Now that your .dif has the textures sourced, it still needs them locally to call once there loaded into the engine. Export the textures again to your main interiors directory. Now you're ready to go! If you want you can organize your exported files into subdirectories without having to move your textures, but this would only be for organizations sake.
For Torque Game Engine Advanced, just use the same set up but put all of the necessary files into its corresponding folder (e.g. ~tgea/examples/stronghold/data/interiors/house) and drag and drop the .MAP file onto the map2dif_plus_tgea tool located in the engine folder of TGEA. The file with go through the cmd window and show up in the corresponding folder where you drag and drop the .MAP file creating its .DIF file for the engine.
I used this tutorial from GarageGames to build models and assets from Hammer 3.5 and import them into the game engine. Thank You!