Downloading, Building, and Running the Hunt

Once you have installed and run the Steam game engine and Half-Life 2 on your computer, you can download, build, and run The Hunt. The Hunt is a multiplayer capture the flag game that is built on top of a multiplayer version of Half-Life 2 called Deathmatch.

Here are the steps to follow:

  1. You should skip this step if you are using one of our lab computers, or if you already have the DirectX SDK installed on your computer. Visit Microsoft's web site for the DirectX SDK. Go to the Downloads tab, click on the DirectX - August 2009 link, and then download and install. (Note: If you already have an older version of DirectX on your computer, it will work.)

  2. Run Visual Studio and go into Tools>Options>Projects and Solutions>VC++ Directories. Now, using Win32 as the platform, choose Include files under Show directories for. Choose the last blank line and double click. You get a box. Browse until you find the include directory that you just installed. It will be something like
    c:\program files\Microsoft DirectX SDK (August 2009)\Include
    
    Make sure that you select the Include directory, and then click Open. This will allow your sources to compile against the DirectX SDK.

  3. Using the same dialog as in the previous step, choose Library files under Show directories for. Again click the blank line, click the dots, and browse to the Lib/x86 directory (if you are running a 32-bit OS) or to the Lib/x64 directory (if you are running a 64-bit OS). It will be something like
    c:\program files\Microsoft DirectX SDK (August 2009)\Lib\x86
    
    Make sure that you select either the x86 or x64 directory, and then click Open. This will allow your program to link against the DirectX SDK.

  4. Close the dialog and exit from Visual Studio.

  5. Start Steam and click on the My games tab. You should see Half-Life 2 in the list of games that have been installed, and you should see Half-Life 2: Deathmatch on the list of games that have not been installed. Select Deathmatch and then click the Install button. (In the Windows Lab, it may have already been installed.)

  6. Once Deathmatch has been installed, it will show up in the list of installed games. Select it and click the Launch button. When it starts up, you can quit if you're not interested in actually playing it, but you definitely need to at least start it once.

  7. Still in Steam, choose the Tools tab and install, launch, and quit Source SDK. Do the same for Source SDK Base. This will download some more source files and tools. (In the Windows Lab, they may have already been installed.) Again, it is essential to launch both, although you can quit immediately.

  8. Exit from Steam.

  9. Now you're ready to download the actual source code with which you'll be working. Download this zip file. It contains a single Visual Studio solution called NewHunt, and you can unzip it into any convenient location, such as the place where you keep your other Visual Studio solutions.

  10. Go into the NewHunt directory and locate the QuickLaunch executable. This is a tool that we wrote to make it easier to work with all the code that you've been downloading. Double click to run it.

  11. In the QuickLaunch window, set the Project Root to be the full pathname of the NewHunt directory. Set the Steam Root to be the full pathname of the Steam root directory. (It is probably something like c:/Program Files/Steam.)

  12. At this point, the QuickLaunch window should expand to show you more options. Under Current Account choose your Steam account number. (If it isn't there, this is because you haven't yet played Half-Life 2.) Under Current Mod, choose TheHunt.

  13. Still in the QuickLaunch window, click on the Launch Steam button. This should start Steam. Once it is running and you have logged in, minimize the window. You'll come back to it later.

  14. Now click on the VC++ Solution button. This will bring up Visual Studio with the NewHunt solution displayed. It should consist of three projects. Whenever you want to work on the program, you'll need to launch Visual Studio from QuickLaunch to ensure that some environment variables are defined properly.

  15. In the Visual Studio window, client should be highlighted as the startup project. If not, right click on it and make it so.

  16. Still in Visual Studio, right click on the client project and display its properties. Go into Configuration properties>Debugging and make sure that these three properties are set properly:
    Command:$(STEAM_DIR)\steamapps\$(CURRENT_ACCOUNT)\source sdk base\hl2.exe
    Command Arguments:-dev -sw -game "$(STEAM_DIR)\steamapps\SourceMods\$(CURRENT_MOD)" -allowdebug
    Working Directory:$(STEAM_DIR)\SteamApps\$(CURRENT_ACCOUNT)\source sdk base

  17. Now build the solution, which will take a while. When you do this, you will get a lot of warnings. Two of the projects will build properly, but the client probably will not. You will see these two errors:
    Command line error D8036 : '/FoDebug HL2MP/hud_deathnotice1.obj' not allowed with multiple source files	cl
    
    error BK1506 : cannot open file '.\Debug HL2MP\bitbuf.sbr': No such file or directory	BSCMAKE
    
    If you build the solution again, these two errors should resolve themselves. (If anyone can figure out what's going on, I'd like to know!)

  18. Once you have built the solution, you can launch The Hunt under the Visual Studio debugger by pressing F5. (A dialog will appear warning you that there is no debugging information for hl2.exe. You can safely continue debugging.)

  19. When the game starts up you should see a faded picture of a cityscape. On the left-hand side of the window you will see a menu with four options. If the game has started in full screen mode, the first thing you should do is make it run inside a window. (This makes debugging much easier.) To do this, click on Options choose Video, and set Display Mode appropriately. Close the dialog.

  20. You should explore the various options. The Keyboard tab is particularly useful, as it will explain (and allow you to customize) the key presses that control the game.

  21. There is a console window that may (or may not) be displayed. You can toggle it by typing the ~ key. It may contain some error messages. I currently see in the console window when I first start the game:
    CSoundEmitterSystem:  Registered 5144 sounds
    CResponseSystem:  scripts/talker/response_rules.txt (217 rules, 214 criteria, and 208 responses)
    maxplayers set to 2
    Heap: 256.00 Mb
    Parsed 23 text messages
    Parent cvar in server.dll not allowed (tv_delaymapchange)
    CGameEventManager::AddListener: event 'hltv_fov' unknown.
    CGameEventManager::AddListener: event 'hltv_inertia' unknown.
    execing config.cfg
    cc_lang = 
    Sound Initialization
    DS:stereo speaker configuration detected
    Set primary sound buffer format: yes
    Using secondary sound buffer
       2 channel(s)
       16 bits/sample
       44100 samples/sec
    DirectSound initialized
    Sound sampling rate: 44100
    2 CPUs, Frequency: 2.4 Ghz,  Features: GenuineIntel SSE SSE2 MMX RDTSC CMOV FCMOV
    GetAllManifestFiles:  Unable to load maplist.txt
    execing valve.rc
    material "vgui/gfx/vgui/crosshair" not found
    --- Missing Vgui material vgui/gfx/vgui/crosshair
    

  22. You can play The Hunt in either single-player or multi-player mode. For the purposes of the debugging assignment, you should use single-player mode. The Hunt is implemented using a client-server architecture. When you play in single-player mode, both the client and the server will be running on your computer. When you play in multi-player mode, you can either create a server on your computer (which other players can join) or you can join a server that is running on someone else's computer. In either case, each player will have a client running on his or her computer.

  23. To play in single-player mode, simply click on Create Server, choose a map, and click Start. When working on the debugging assignment, you will have a much simpler time if you use "bob_firstmap" because it is simple and contains only three flags. When you click on "Start", you will be warned that an assertion has been violated. Unfortunately, this is only the first of many such warnings that will appear if you don't turn them off. Click on Ignore All Asserts.

  24. To play in multi-player mode using a server on your computer, enter this command into the bottom of the console window:
    SV_Hunt_Minplayers 2
    
    (This is for a two-player game; you can specify a larger number.) Then start the server as in single-player mode and wait for the right number of players to join your game.

  25. To play in multi-player mode using a server on another computer, click on "Find Servers" and look for a game to join.

  26. In any event, once you have started a game, you will see a scene that is blocked by a black text area with an OK button below. Click on that button.

  27. Now you'll see a scene with a Begin button. When you start the game by clicking on the button, the game will almost immediately crash. That's the first bug you'll need to fix for the debugging assignment!

  28. Here's how the game is supposed to work. You will be in a world with some number of flags, and the goal is to touch (get close to) each flag in the correct sequence. When you touch the correct flag, it will rise up on its flag pole. When you have touched all the flags, the game is over.

    In multi-player mode, the flags will be divided up among the players and the game becomes a race to see who can find his or her flags the fastest.

    In both modes, there is a radar that appears as part of the heads-up display on the screen. It shows you the direction and distance to your next flag. (To make things just a little bit challenging, it does not show you the elevation of the flag.)

  29. Once the game begins, the game will steal your keyboard focus. Use the ESC key to grab the focus back if you need to use another window.