|
|
 |
| Hammer Tutorial |
|
Hammer is the official Half-Life 2 map editor used to create content
for the game. If you have just installed the Virtual
Video Mod, the Hammer editor is a good starting point for setting up
virtual environments and scenarios in which to place your cameras. This tutorial
guides you through installation and basic usage, using as an example the simple
(and most common) task of repositioning the default camera location in a map.
For further details on using the Hammer editor, see the
The Valve Developer Community wiki.
Half-Life 2 maps exist in two forms: VMF files and BSP files. VMF files can be loaded
into Hammer for editing and compiling. The compilation process automatically generates light maps,
BSP trees and other structures used by the graphics, physics and AI engines. The output of the
compilation process is a BSP file that can be loaded into the game. Note that only VMF files
can be edited in Hammer and only BSP files can be loaded into Half-Life 2, so you must obtain
the VMF version if you intend to edit a map. The Source SDK provides
a collection of sample VMF files in the directory
C:\Program Files\Steam\SteamApps\<username>\sourcesdk_content\hl2\mapsrc
that provide a good starting point for creating Virtual Video scenarios. BSP files usually live in the
game directory C:\Program Files\Steam\SteamApps\<username>\half-life 2\hl2\maps
or C:\Program Files\Steam\SteamApps\SourceMods\Virtual Video\maps
The two main elements of a map are brushes and entities. Brushes describe the
static geometry of the map including walls, floors, sky, etc., including non-visible geometry
such as clipping boundaries that restrict player movement. Entities serve a wide range of purposes, such as
defining static and dynamic geometry including furniture, trees, people and other 'props', and controlling
light sources, shadows and reflections. Other non-visible entites are associated with the physics and
AI engines, and control physical constraints between props, triggering scripts and other elements
of event flow control. A complete list of available entities can be found
here, although typically only a few
are required in a Virtual Video scenario. In this tutorial, we will only deal with the
info_player_start and item_suit entities.
|
 |
| Installing and Launching Hammer |
- Open Steam and click on the Tools tab.
- Source SDK should be listed in the main
window. If this item is greyed out, you have not yet installed the Source SDK.
To install, right-click on Source SDK and
select Install game... (note that the Source SDK is
free to download for Half-Life 2 license holders). Once the SDK has installed, the text in the Status
column will change to 100% - Ready as in the figure below.
- To launch Hammer, first double-click Source SDK
to bring up the tools window shown in the figure below. Then double-click
Hammer Editor under Applications
to launch the map editor.
|
 |
| Loading a Map and Changing the Default Camera Location |
- Once Hammer is running, select File->Open... to bring
up the open file dialog.
- In this tutorial, we will edit the map sdk_d1_trainstation_02.vmf.
Select this file and click Open.
- After the map has loaded, Hammer will appear as shown in the figure below. The four panes in the
main window show the top, left and right plan views of the map and a textured perspective rendering from
the current view position. Each view can be zoomed using the scroll wheel on the mouse. The plan
views can be translated by clicking and dragging the map while holding the spacebar on the keyboard,
or using the arrow keys.
The orientation of the perspective view is controlled using the arrow keys on the keyboard, and the
position is controlled using the
A, S,
D and W keys. Note that keyboard
navigation only affects the view currently under the mouse pointer.

- In the Virtual Video Mod, the default position of the camera is determined by the
initial player location when the map loads, which in turn is set through
an info_player_start entity. To change the default camera
location, we will delete any existing info_player_start entities
and create a new one at the desired position. Open a list of all entities in the map as shown below by
selecting Map->Entity Report....
- Scroll down until you find two info_player_start entities
in the list. Double-click on the first info_player_start to
select and centre the entity in the perspective view as shown in the figure below.
- Delete the selected info_player_start entity by clicking the
Delete button in the Entity Report
dialog.
- Repeat for the other info_player_start entity, then close
the Entity Report by clicking the
Close button.
- With the mouse over the perspective view pane, use the keyboard to navigate back to the
front of the trainstation building where we will place a new
info_player_start entity on top of the portico.
- Once you have navigated to the view shown in the figure below (left),
select the Entity Tool by clicking the fourth button
from the top of the toolbar on the left, or using the keyboard shortcut
SHIFT + E. Ensure that the drop-down list at the bottom
of the toolbar on the right has info_player_start selected, as shown in the figure below (right).

- Place a new info_player_start entity
by clicking on the portico roof in the perspective view, as shown below. To edit the properties
of the player, using the keyboard shortcut SHIFT + S to switch
to the Selection Tool, then double-click on the
info_player_start entity to open the
Object Properties dialog. We will not need to
change any player properties in this tutorial.
- We will now place an item_suit entity at the same location
as the info_player_start. When the map is launched, the player
will automatically acquire the suit, enabling him to walk slowly or run fast with the
appropriate keyboard combination (these modes are only possible while wearing the suit).
Activate the Selection Tool (SHIFT + S),
and select item_suit from the drop down menu on the right as shown
in the figure below (right). Then click on the rendered view in the same location as the previous entity.
The item_suit and info_player_start
entities should appear as shown below (left).

- Select File->Save As... from the main menu,
give the map a new name such as sdk_d1_trainstation_02_edit.vmf,
and click the Save button.
- We are now ready to compile the map into a BSP file. Select
File->Run Map... from the main menu to open the Run Map dialog.
Check that the settings match with those shown below. The 'Fast' settings
reduce compilation time but produce lower
resolution light maps and simplified visibility calculations, leading to slightly poorer
image quality and reduced rendering performance. When releasing maps to the public, you should
recompile using the 'Normal' settings (with considerably longer compilation time).

- Hit OK ... then grab a cup of coffee or walk around the block a few times.
Compilation may take up to 20-30 minutes, depending on the speed and memory of your machine.
After compilation, the BSP file is automatically copied into the game directory.
- Launch the Virtual Video Mod and load your new map using the console command
map sdk_d1_trainstation_02_edit (see also
Launching Mod). That's it! You've successfully
created your first Virtual Video scenario!
|
 |
|
|
|