DIF/Hammer
From TDN
Contents |
Introduction
This was the tool with which the levels for the games Tribes 2 and Half-Life were built with. The guides here will help you setup Worldcraft to make maps for Torque. Warning: There are some restrictions due to Valve's EULA which states that Hammer can only be used to develop Half-Life mods. Although the EULA hasn't been changed, Valve has approved Torque Developers using Hammer. Read the EULA for more details - Please use at your own risk.
Hammer Setup Files
It is advised that you remain with Hammer 3.4 and not use the 3.5 beta, as this may cause serious problems with your maps.
Get the latest version of Hammer
Hammer Setup Instructions
Follow the Hammer installer instructions and install Hammer where you want.
You will then need to add the Torque.fgd file to your Hammer directory. Launch Hammer and then follow the next configuration steps. This is the file that Hammer uses to confirgure the entities and engine requirements.
Hammer Torque Configuration
The main setup for Hammer to export Torque Maps will occur in the Tool/Options/ menu. This menu will open up on the General tab, so click on the Game Configuation tab.
Game Configuration
Link in the torque.fgd file by clicking the add button in the Game Data Files section. This will link in the torque.fdg to allow for the entities and other setup requirements to be loaded.Setup the following as described:
Game Executable Directory: C:\<game folder>
ex: C:\Torque\SDK\example
Mod Directory: C:\<game folder>\<mod folder>
ex: C:\Torque\SDK\example\starter.fps
Game Directory: C:\<game folder>\<mod folder>
ex: C:\Torque\SDK\example\starter.fps
RMF Directory: C:\<game folder>\<mod folder>\data\interiors
ex: C:\Torque\SDK\example\starter.fps\data\interiors\
Build Programs
This section is to link in the map2dif.exe/map2dif_plus.exe into Hammer for the map compilation process.First select the Torque game configuration from the drop-down menu to save the new info to the correct game config.
Setup the following areas are described here:
Game Executable: C:\<game folder>
ex: C:\Torque\SDK\example
CSG Directory: C:\<game folder>\<mod folder>\data\interiors\map2dif.exe
ex: C:\torque\tools\map2dif.exe
Textures
Simply load up the WAD files from your interiors folder.
Building and Saving
General building techniques will not be covered here due to the extensive tutorial base available for Half-Life 1 map making.
Saving
You will need to save your .rmf and .map file in the same folder, for example C:\torque\example\
fps\data\interiors\evil1\maps\box.rmf will be fine.
However, C:\torque\example\fps\data\interiors\evil1\maps\boxes\box.rmf wont work. If you want to do this then export it in a single level directory and then move it to your directory of choice.
Exporting and Playing
Once you have built your map you will need to export the information from Hammer to the Map2Dif.exe programme to convert it to the .dif format. To do this, go to File/Run or press F9. This will open up a menu whith a button Expert, select this option. Now you will normally get a set of exporting rules for Half-Life, ignore these and press on the Edit button next to the Game configuration and create a new configuration called Torque.You're next step will be to select this configuration and then create a new command. Enter $csg_exe in the Command properties box, followed by $path\$file.$ext as a parameter for that command.
You are now all set to run the exporter, if you followed all the steps above, you shouldn't have any trouble getting your .dif file into the game. All you will need to do next is load up the WorldEditor and load the right .dif file.
Level Of Detail
Creating levels of detail for a shape is a way to reduce the number of rendered faces and vertices as your shape reduces its apparent size. The fewer the faces and vertices in a shape, the less the transformations the game engine will have to manage resulting in higher frames. The trick is to make these transitions as transparent as possible while reducing the total number of polygons and vertices in your shape. Morian.exe (the shape processing tool) looks for a specific naming convention to process all of the pieces of any given shape in the correct order and finally include all of the levels of detail into one final file that is displayed in the game engine. The naming convention is as follows:
<Name of Map>_#.map
Map2Dif uses only the .map format files. The .rmf files are a slightly more inclusive format that will save your grouping information, and vis group information. I primarily work with the .rmf format files to preserve my groups, and vis group information. When I am ready to process the entire group of LOD's for one shape I export the latest version of each LOD in a given shape to .map format via the file menu "export to .map".
To set the LOD parameters for each level of detail in a shape you will have to access the "map properties" dialog box from the "Map" drop down. "Shape Detail Index" should be equal to the LOD value. "LOD_0.map" should have a "0" in this field. "LOD_1.map" should have a "1" in this field, and so on. "Minimum Pixels For Detail" sets the value for when the next LOD below the current LOD will be switched in the game engine. This value is based on the projected pixel height of the shape. If the value is set for 250 this means when the current shape is below 250 pixels high it will switch to the next lower LOD. The last LOD in any given shape should have a "minimum pixels for detail" of zero, however numbers higher than zero are acceptable.
After you have created all of your LOD's and have properly established the parameters for the LOD switching you will have to export each separate LOD into .map format via the file menu "export to .map". Then when you process the highest order of detail shape the rest of your LOD's will be processed and incorporated into the final .dif. Morian.exe looks for up to 10 LOD's for any shape. It would take "LOD_0.map", "LOD_1.map", "LOD_2.map", and "LOD_3.map" and process them all into "LOD.dif". Portal zone brushes are valid in all levels of detail.
There are several things to keep in mind while trying to minimize the appearance of LOD switching. Lighting can give away the change in LOD. Only eliminate lights that are not visible to the outside of you shape. If you have a strong light source in a doorway to the exterior of your shape, and that light suddenly disappears when you switch LOD it will be very noticeable and distracting to the player. When your shape gets smaller these changes will be less noticeable. Major geometry shifting or changes can also make for abrupt LOD changes. Keep major changes to a minimum until your shape is fairly small. Texture shifting on exterior faces can be another thing to watch out for when creating LOD's. Included in the WolrdCraft documentation below is a series of shapes files to illustrate the concept of switching LOD's. The shapes I have included are not necessarily designed to reduce polygon count, but to show how the concept works. These files are LOD_0.rmf and .map, LOD_1.rmf and .map, LOD_2.rmf and .map, and LOD_3.rmf and .map. These files use the badlands.wad as the texture source.
Resources
WorldCraft Documentation by Tim Gift
Configure Hammer/Worldcraft to compile and launch Torque]
Hammer: Setup/Config for Torque 1.5 SDK]



