Source SDK 2013
To get started, you will need to grab the source code from the Valve Software Source SDK repository on GitHub. Then you will be able to build the software and then build great and wonderful mods!
- 1 Obtaining the Code
- 2 Platform Specific Build Instructions
- 3 Code Organization
Obtaining the Code
GitHub provides a number of ways to obtain and update the code. Here's a review of the main ways to get the code, but GitHub Help is a great resource to learn more about using Git and the added features of GitHub.
The easiest way to keep updated on the latest released code is to use Git to obtain the repository. Git itself is a CLI for all platforms, but GitHub also provides installers that install both the CLI version and a GUI to help manage your repositories.
GitHub Client (Windows & Mac)
- Obtain the GitHub client.
- Install the GitHub client.
- Visit the Source SDK 2013 repository in your browser and click the "Clone in Desktop" button.
- This will open the GitHub client. Follow the instructions to clone the desktop onto your computer.
When you wish to update the code, you may do so by hitting the "Sync" or "Sync Branch" button in the repository.
Git CLI (All Platforms)
Detailed instructions on how to set up Git on any platform, including updating the repository, are provided by GitHub.
With the CLI installed, you can obtain the code using a line similar to this:
> git clone firstname.lastname@example.org:ValveSoftware/source-sdk-2013.git
You may also download a ZIP bundle. This will give you the latest release, but you will need to manually download and update the code. If you also plan on contributing code back to the repository, you will need to follow the above Git instructions with a separate instance of your local files.
- Visit the Source SDK 2013 repository in your browser.
- Click the "Download ZIP" button.
Platform Specific Build Instructions
Creating project files or makefiles
The 2013 SDK uses the Valve Project Creator (VPC) to generate platform-specific project files and makefiles. Run creategameprojects (or creategameprojects.bat on Windows) in sp/src or mp/src to create projects. This script will create Visual Studio .vcxproj files and .sln files on Windows, .mak and Xcode project files on OSX, and .mak files on Linux. The projects and makefiles themselves aren't checked in, so you will need to run VPC before you use the platform-specific instructions below.
For more information on how to use VPC look at the scripts themselves or run "vpc /help".
To build the Source SDK 2013 on Windows you will need Microsoft Visual Studio 2010 with Service Pack 1. It's also possible to use Visual Studio 2012 with the Visual Studio 2010 Express compiler by changing the project settings.
- Open the "everything" solution file for the project type you wish to make.
- Build the above solution.
- Open the solution file for the game you are building the mod for.
- Build the above solution.
At this point you should have client.dll and server.dll to load with the Source Engine game you based the mod on.
Mac OS X
To build Source SDK 2013 on Mac OS X, you will need Xcode 4.2 installed.
You will also need to have "Command Line Tools" installed via the XCode Preferences -> "Downloads" -> "Components".
To run the tools, run this command under Terminal:
> make -f games.mak
When successfully built, you should have client.dylib and server.dylib files to load with the Source SDK Base 2013 of your choice.
Steam Client Runtime
To build the Source SDK 2013 on Linux you will need the Steam Client Runtime.
- Download the Steam Client Runtime.
- Run the following commands to extract the runtime:
> tar xvf steam-runtime-sdk_latest.tar.xz > cd steam-runtime-sdk_<version>
Replace <version> with the version you just unpacked.
Pick your architecture and debug/release preferences. Then answer Y to everything else.
> ./shell.sh --arch=i386
With the above prerequiste installed, run the following:
> make -f games.mak
At this point you should have client.so and server.so files to load with the Source SDK Base 2013 of your choice. More instructions on using the Steam runtime can be found in README.txt in the installed runtime directory.
The Source SDK is split into two directories at the root for <gameType>, followed by source for <gameName>. If you are building a single player mod, use the "sp" directory. If you are building a multi-player mod you should base yourself on the code in the "mp" directory.
- sp (singleplayer)
- mp (multiplayer)
- episodic (Half-Life 2 & Half-Life 2 Episodes)
- hl2mp (Half-Life 2: Deathmatch)
Each directory has a matching Source SDK 2013 Base appID to use to get the base mod files:
These two base apps are very similar, differing mostly in update schedule. The Singleplayer base will only update with HL2 and the Episodes do, which isn't very often. The Multiplayer base will update a few times a year to incorporate engine changes from TF2 and Counter-Strike: Source. None of these updates should break mod compatibility.
Under each of these directories is a very similar directory structure:
- game - Runtime files for the mods themselves. Your mod content will go in here.
- src - All the source code for that kind of mod. The root of the src directory contains .sln or root level .mak files for building the source.
- common - A few files used by the server and client DLLs
- devtools - Scripts and utilities that are used to build the source. These are called by the makefiles and projects and you probably won't need to interact with them directly.
- game - All of the source code for the DLLs.
- client - Code used by client.dll (or client.dylib or client.so). There are also game-specific directories under here.
- server - Code used by server.dll. There are also game-specific directories under here.
- shared - Code used by both client.dll and server.dll.
- gcsdk - A couple of tools used to build the DLLs.
- lib - Binary versions of the libraries that the source code depends on. This is also the build target for vgui_controls, tier1, and mathlib.
- mathlib - Math utilities used by the game.
- public - Header files for all of the DLLs and libraries that are used by the game. Also includes a few source files.
- thirdparty - Third party libraries needed to build the source. At the moment this contains only the Google Protocol Buffers (protobuf) library.
- tier1 - Useful utility classes. Builds into tier1.lib
- utils - Various development utilities
- vgui2 - Source code for vgui_controls, which is used by client.dll.
We recommend that you follow the conventions here as you add files for your own mod.