Source SDK 2013

Part 2: Compiling the code

Pre-Requisites

Creating the Visual Studio Projects

Head over to your checked out code, and go to the src folder in either the sp or mp folders, depending on which branch you're using.

The singleplayer source includes vanilla HL2 and episodic HL2 code.

Double click creategameprojects.bat. A Visual Studio solution called games.sln will be created (right).

Compiling

Open games.sln in Visual Studio.

Build the client and server projects for either vanilla HL2, or episodic HL2 (right click -> build with them selected).

We are building a mod for Episodic HL2 in this tutorial.

Binaries

In the output window you will see:

[...]
4>     Creating library .\Debug_mod_episodic\server.lib and object .\Debug_mod_episodic\server.exp
4>  server_episodic.vcxproj -> E:\Development\Git\source-sdk-2013\sp\src\game\server\.\Debug_mod_episodic\server.dll
4>          1 file(s) copied.
4>          1 file(s) copied.
========== Build: 5 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

The process will have created a client.dll and server.dll file in your mod's bin folder, along with debugging symbol files.

Running Your Mod

Before running your mod:

  1. Right click on it in Steam, and hit Properties
  2. Click Set launch options...
  3. Enter -sw -w 1280 -h 720 into the window that appears.

This is an important step if you're developing the game, as if the game starts fullscreen, you may miss engine-related messages at startup.

Done!

Hit play, and your mod should run.

In part 3 we'll discuss how to set up Hammer.