This article's documentation is for anything that uses the Source engine. Click here for more information.
This article relates to the software/tool "Source SDK". Click here for more information.

Setting up Source SDK 2013 - Singleplayer

From Valve Developer Community
Jump to navigation Jump to search
English (en)Translate (Translate)
Edit Tabs

For setting up and compiling the Multiplayer SDK (TF2 branch), see this page.
For players who want information about installing Source SDK Base 2013 SP to play a mod, see this page.
Broom icon.png
This article or section needs to be cleaned up to conform to a higher standard of quality because:
The content of this page is copy and pasted from a 09:54, 17 November 2024‎ revision of the original SDK 2013 setup page in order to archive and preserve the original compile steps which still apply to the Singleplayer version of the SDK. Linux version may need to be retested (to make sure it's still compile properly) since this page has been edited to remove mentions of "sp" and "mp" folder (which has been replaced with GitHub's branch selection). Additionally the macOS (OS X) instructions are still incomplete, with the files cannot be possibly built due to the Windows dependencies, they need to be re-written from scratch.
For help, see the VDC Editing Help and Wikipedia cleanup process. Also, remember to check for any notes left by the tagger at this article's talk page.


This tutorial walks you through creating a singleplayer mod for Source 2013 Singleplayer, using the Source 2013 engine branch. This branch includes the source code for Half-Life 2 Half-Life 2 and Half-Life 2: Episode Two Half-Life 2: Episode Two. You can choose either game as the starting point for your mod.


Key points

  • Source SDK 2013 Singleplayer code currently does NOT have new changes (and bug fixes) from Half-Life 2's 20th Anniversary update (or the Team Fortress 2 branch) yet. This also means that you will need to use Visual Studio 2013 (for Windows), or an earlier version of GCC (for Linux). This is also the case with Source SDK Base 2013 Singleplayer.
  • This page also applies to legacy (pre-2025) version of Source 2013 Multiplayer Source 2013 Multiplayer, with the code for this version located here.
  • If you want to create a simple, content-based mod, see this fully-compiled template.
  • You can always edit code files with Notepad++ Notepad++ or a similar program, and then compile under Visual Studio.
  • Icon-Important.pngImportant:Linux only - As Source SDK Base 2013 SP runs on older version of Source 2013, systems that have been updated with glibc 2.41 or later will cause SDK Base 2013 SP to crash on startup with executable stack error.
    PlacementTip.pngWorkaround:Install execstack and run execstack -c engine.so on the 🖿Source SDK Base 2013 Singleplayer\bin directory to patch the file. More info on this YouTube logo YouTube video.
  • See the troubleshooting section if you get stuck.

Setting Up (All Platforms)

Step 1. Set up Source SDK Base

Install Source SDK Base 2013 singleplayer from your Steam Steam library. You can use the search function by enabling "Tools" in the filters, or by clicking the green link below.

After installing, you will need to select the upcoming beta branch.

  1. Open Steam, go to Source SDK 2013 Singleplayer, right click Properties
  2. A window will open. Go to "Game Versions & Betas", select upcoming beta branch.
  3. Steam will automatically re-download the files.

Step 2. Get the Code

Clone the Github repository by using the following command:

git clone https://github.com/ValveSoftware/source-sdk-2013.git --branch singleplayer --single-branch

The singleplayer code is in a separate singleplayer branch. The master branch is for multiplayer.

View the Github here: ValveSoftware/source-sdk-2013 ValveSoftware/source-sdk-2013.

Setting up (Platform Specific)

Windows Windows

Step 1: Install Visual Studio 2013

In order to build the code, you must install Visual Studio 2013, as the necessary C++ compiler is coupled to the IDE. The code does NOT compile with Visual Studio 2015 or newer. You can still use the latest Visual Studio for compilation, as long as the VS 2013 project format is used (that is, you skip the dialog where Visual Studio will try to upgrade your projects).


Install steps:

  1. Download the ISO of Visual Studio Community 2013 from download.microsoft.com (or archive.org).
  2. Double click the ISO to mount it as a virtual disk. Alternatively, you may use an external ISO mounting program (such as 7-Zip or WinCDEmu).
  3. Run the "vs_community.exe" file on the virtual disk (if it does not start, see troubleshooting).
  4. Follow the prompts in the installer. Make sure "Microsoft Foundation Classes for C++" is checked before you click install.

If at any point you get stuck, you can watch this video.


Step 2: Setup the Mod Folder

Next, we will set up the mod folder, which will contain all the mod's assets.

  1. Navigate to 🖿<path-to-git>\game\.
  2. Rename either mod_episodic or mod_hl2 (depending on the base game you wish to use) to the name of your mod (e.g. 'mymod'). This is the folder which you will distribute to other people.
  3. Open your mod folder. Inside, open gameinfo.txt with a text editor.
  4. Change the game key to the name of your mod as it will appear on Steam.
  5. Change the title key to the name of your mod as it will appear on the main menu.

For more information, see Gameinfo.txt.


Step 3: Setup the Project Files

Source SDK uses the Valve Project Creator (VPC) to generate the projects and the solution for Visual Studio.

  1. Navigate to 🖿<path-to-git>\src\ and open creategameprojects.bat.
  2. By default, this batch script creates a solution called games.sln which includes projects for HL2 and EP2 simultaneously. You probably won't need all this, so we will modify this batch script to better suit our needs:
If you're creating a Half-Life 2 mod:
  • Replace the contents of creategameprojects.bat with:
devtools\bin\vpc.exe /hl2 +game /mksln games.sln
If you're creating a Half-Life 2: Episode Two mod:
  • Replace the contents of createallprojects.bat with:
devtools\bin\vpc.exe /episodic +game /mksln games.sln
If you need the utilities (either game):
  • Replace +game with +everything.
Note.pngNote:
  • All of these utilities are already compiled for you under 🖿Steam\steamapps\common\Source SDK Base 2013 Singleplayer\bin\. Only use +everything if you need to modify their code.
  • If you use the everything solution, there is additional setup you need to do in order to make it compile, which is explained later in this section.

We can now configure VPC to output client.dll and server.dll from the build process directly into our mod's bin/ folder.

  1. Navigate to 🖿<path-to-git>\src\game\client and open client_hl2.vpc or client_episodic.vpc.
  2. On line 9, change $Macro GAMENAME "mod_episodic" [$SOURCESDK] to $Macro GAMENAME "<YOUR-MOD-FOLDER-NAME-HERE>" [$SOURCESDK].
  3. Navigate to 🖿<path-to-git>\src\game\server and open server_hl2.vpc or server_episodic.vpc.
  4. Repeat step 2.

Now, run creategameprojects.bat. This will create a .sln file in the same directory.


(OPTIONAL) Additional Setup For "Everything" Solution

These steps are not required for compiling the game DLLs, these are only prerequisites for compiling these specific projects:

Building the shaders

See Source SDK 2013: Shader Authoring.

qc_eyes

Download and install the Multibyte MFC Library.

Note.pngNote:The Multibyte MFC Library add-on doesn't work with Visual Studio Express 2013. The add-on installer doesn't detect Visual Studio Express 2013 as an install because Visual Studio Express 2013 doesn't support MFC.
phonemeextractor
  1. Download a ZIP of the Speech SDK. The link above will download a ZIP of the SDK's contents, including code fixes made by the SDK2013CE community that were previously documented on this page.
  2. Extract the ZIP Archive, and copy the sapi51 folder to 🖿<SDKROOT>\src\utils.
Note.pngNote:Mounting it now may generate the error unresolved symbol _IID_IspPhoneticAlphabetSelection. This is perhaps because you already had something mounted and the partial build is broken. This issue can be easily fixed by rebuilding the phonemeextractor


Step 4: Compile the Code

  1. Open your solution file, either games.sln or everything.sln.
  2. At the top dropdown which says 'Debug', change 'Debug' to 'Release'.
    Note.pngNote:If you plan to work with the C++ code, keep the build configuration on Debug. This will give you get better debugging information. When distributing your mod (or if you don't plan to touch the code any longer), set it to Release.
  3. On the menu bar, click Build, then Build Solution.
  4. Wait for it to finish compiling. If something fails at the end, simply rebuild the solution.
  5. Check the bin directory in your mod folder. It should contain client.dll and server.dll. If it doesn't, make sure the code has compiled successfully and your changes in 'client_*.vpc' and 'server_*.vpc' are correct.
Warning.pngWarning:When compiling on Windows 10 and 11 make sure you have unchecked "Use Unicode UTF-8 for worldwide language support". In order to disable it go to "Control Panel\Clock and Region", then click "Region" then "Administrative" tab and "Change system locale"


5. Run the Mod

Run from Visual Studio

To launch your mod from Visual Studio, see: Launching from Visual Studio 2013 (the page is written for VS2013, but the setup is identical in all subsequent versions).

Run from Steam

To launch your mod from Steam, copy your mod folder (the one that has gameinfo.txt inside) to 🖿steam/steamapps/sourcemods/ (the same way you would with any sourcemod), then restart Steam. Launch the mod from your library.
For more information, see Setup mod on Steam.

Note.pngNote:
  • If you built the code using the Debug configuration, assertions will appear. You can make them go away by clicking "Ignore All Asserts" on the window that appears. If you build for Release, they will not appear at all.
  • The current Singleplayer branch will crash on startup, unless you are using the beta-branch called upcoming of the Source SDK Base 2013 SP. In Steam, go to Tools > Source SDK Base 2013 Singleplayer, right click > Properties > Betas > choose "upcoming" to opt into the beta. Without the beta, you get two popups about "Entry Point Not Found" in hl2.exe, and then the debugger breaks on engine.dll. This does not apply to MP (now Team Fortress 2 branch).



macOS macOS (OS X)

Step 1: Installing requirements

  1. Get OS X Mavericks (or newer) which is capable of running on a Virtual Machine.
  2. Install Xcode 5.0.2 (requires an Apple Developer ID account).
  3. You will also need to have the "Command Line Tools" installed. You can find this in Xcode Preferences -> Downloads -> Components window.
Note.pngNote:
  • You should be able to use Xcode 6.4 on OS X 10.10 Yosemite and OS X 10.11 El Capitan as well.
  • If you're trying to use a later macOS/Xcode combination, you should modify the 🖿src/devtools/base.xcconfig file in order to generate more compatible project settings (the most important one being SDKROOT at the end).
Warning.pngWarning:If you are using macOS Catalina macOS Catalina or higher, building the Source SDK 2013 source code will be highly complicated due to Apple's depreciation of the 32-bit architecture, as well as Source SDK 2013 code, by default, does not have support for ARM architecture (used in M1, M2 or newer Apple silicon Macs). You will get an error/warning about updating the ARCHS variable in Xcode to be something else than i386.


Step 2: Generating the Xcode projects

Run the following scripts to generate project files.

Note.pngNote:You'll only need to run the scripts for the base gamemodes you're creating a mod for; sp for single player and mp for multiplayer.
Note.pngNote:Originally prior to TF2 SDK, it had two folder, one is sp, the other is mp branch, and both folder had src folder inside.
cd <SDK_ROOT>/src
./createallprojects
./creategameprojects

games.xcodeproj and everything.xcodeproj will be generated in the 🖿src folder.


Step 3: Building

To compile the tools, server and client libraries open everything.xcodeproj and games.xcodeproj in Xcode and build the projects (Product -> Build).

Note.pngNote:Using a more modern environment will yield some errors when compiling.


Step 4: Binaries

When successfully built, client.dylib and server.dylib will be created and ready to use with the desired Source SDK Base 2013 branch (Singleplayer or Multiplayer).



Linux Linux ("container" method - Recommended)

Step 1: Introduction

By default, Steam on Linux and everything on top of it (games, apps...) runs through a sand-boxed environment called the Steam Runtime. It is basically a stripped down Ubuntu installation with the necessary stuff (drivers, libraries...) required to run Steam itself and games.

Valve recommends that everything destined to be run on Linux and more specifically Steam is built and running through this runtime. Building "natively" is heavily discouraged as there are no guarantees that the build will be a success (especially with modern C/C++ toolchains) and your mod will run perfectly.

In the past, Valve used the "chroot environment" technique for the Steam Runtime. However, they changed and recommend the usage of containers based solutions like Podman and Docker. We will be using the first version of the Steam Runtime (codenamed "scout") because we're building a code base from 2013 and it is known that "old code" and "modern toolchains" hate each other. Obvious note: we're using the 32 bits one since Source 2013 SP and MP aren't ported to 64 bits.

Note.pngNote:This guide has been written and tested on an Ubuntu 22.04.4 LTS (Jammy Jellyfish) virtual machine. If you want to use anything else (ArchLinux, Debian, Gentoo, Linux Mint...), you take the responsibility of adapting the instructions and commands as needed (as well as the factor that it might not work due to system differences and such).


Step 2: Requirements

First, you will need any operating system capable of running Docker Engine (not to be confused with Docker Desktop which is a different thing). Since this guide is written with Ubuntu in mind, the installation instructions for it are there, the APT method has been used when writing this guide. Be sure to run the "Hello World" container to confirm your installation works.

Second, you need the Source SDK 2013 source code cloned. It is assumed that a non-modified copy is used and the "Multiplayer" (🖿mp) branch will be used. The "Singleplayer" (🖿sp) one should work as well.

Note.pngNote:Try to keep the location of your Source SDK 2013 source code simple as you will need to reference its path later.


Step 3: Setup the SDK

Before playing with containers, there is one important change to make in order to avoid a nasty surprise.

Open the 🖿src/devtools/makefile_base_posix.mak file with a text editor. Between lines 83 and 112, you should be able to see something like this:

#
# If we should be running in a chroot, check to see if we are. If not, then prefix everything with the 
# required chroot
#
ifdef MAKE_CHROOT
	export STEAM_RUNTIME_PATH := /usr
	ifneq ("$(SCHROOT_CHROOT_NAME)", "$(CHROOT_NAME)")
		$(info '$(SCHROOT_CHROOT_NAME)' is not '$(CHROOT_NAME)')
		$(error This makefile should be run from within a chroot. 'schroot --chroot $(CHROOT_NAME) -- $(MAKE) $(MAKEFLAGS)')  
	endif
	GCC_VER = -4.8
	P4BIN = $(SRCROOT)/devtools/bin/linux/p4
	CRYPTOPPDIR=ubuntu12_32_gcc48
else ifeq ($(USE_VALVE_BINDIR),1)
	# Using /valve/bin directory.
	export STEAM_RUNTIME_PATH ?= /valve
	GCC_VER = -4.6
	P4BIN = p4
	CRYPTOPPDIR=linux32
else
	# Not using chroot, use old steam-runtime. (gcc 4.6.3)
	export STEAM_RUNTIME_PATH ?= /valve/steam-runtime
	GCC_VER =
	P4BIN = p4
	CRYPTOPPDIR=ubuntu12_32
endif

In the else condition, (not to be confused with else ifeq) change the STEAM_RUNTIME_PATH variable value to 🖿/usr to fix the incorrect paths to the C/C++ toolchains, save the changes.

Note.pngNote:If you are making a multiplayer project, then it's very likely that server operators will install and use the popular community tool: SourceMod. If you want people to retrieve the gamedata/offsets easily and removing the stripping of symbols isn't a problem for you. You can remove the -x flag on the STRIP_FLAGS variable at line 122 (or replace it with something like ifeq (,$(findstring server.so,$(GAMEOUTPUTFILE))) else endif while also handling server_srv.so for dedicated server builds).

Now you need to make a choice: if you only care about the client, shaders and server binaries, run the 🖿src/creategameprojects script in a terminal. If you care about everything, run 🖿src/createallprojects instead. The former will create the 🖿src/games.mak Makefile, the latter will create the 🖿src/everything.mak one.


Step 4: Creating/starting the container to build the binaries

In a terminal, copy the following command but don't run it:

sudo docker run -v [SDK_ROOT]/src:[SDK_ROOT]/src --rm -it registry.gitlab.steamos.cloud/steamrt/scout/sdk/i386 bash
Note.pngNote:By default, Docker requires privileges escalation in order to run hence the presence of sudo. If you made changes to your Docker Engine installation to make it "root-less", you can drop the sudo part.


Some explanations for those who aren't familiar with Docker:

  • Containers do not have access to the host's filesystem by default. This is why the -v part is there, to create a "bridge" between the container's filesystem and the host's. The [SDK_ROOT] parts in the value must be replaced by the absolute path to the root of your Source SDK 2013 copy. For example, if the Linux username is called "gordon" and the Source SDK 2013 code has been cloned in his personal folder, it would be: /home/gordon/source-sdk-2013.
Note.pngNote:If you have a space in the path to [SDK_ROOT], you must place the full path in double quotes. Example: "/media/Source SDK/src":"/media/Source SDK/src". However, it is best to use no space in the path as that will cause trouble for some scripts, and fail to build.
  • The --rm flag is used to indicate that the container is ephemeral and will be deleted after usage. Without it, the container is kept and this can bloat storage space easily and fast (if that happens, run sudo docker container list -a to list all containers including stopped/killed ones, then use the sudo docker container remove [container name] to remove it).
  • -it --entrypoint /bin/bash is needed to start a bash shell session and take control of the container.
  • Finally, registry.gitlab.steamos.cloud/steamrt/scout/sdk/i386 being the Docker image we'll use. In this case, latest public "scout" (v1) version of the Steam Runtime in 32 bits.
Note.pngNote:Remember that Unix systems have a convenient $HOME environment variable that usually points to 🖿/home.
Note.pngNote:Primary reason for requiring an absolute path is because VPC (Valve Project Creator) writes absolute paths in the Makefiles. If the path and/or "bridge" isn't good, then expect a spam of "file/directory not found" problems.

You may now run the command. If it works, an optional but convenient thing to do is to create an alias on the host system so that you don't have to copy/paste/adapt the entire command again.

The first time you will be running the command, it will take a while because Docker need to download the image (around 700Mb). Once the download is complete, subsequent container creation and startup will be faster (unless you remove the image or there is an update to it).

Once the container is ready, you will have control of it as indicated by the steamrt scout mention in the shell. Put yourself in the right directory by running the cd [SDK_ROOT]/src command.

To build the binaries, simply run the appropriate command:

# If you used the "createallprojects" script
make -f everything.mak
# If you used the "creategameprojects" script
make -f games.mak

To clean object files, built binaries and such, add clean between make and -f. By default, release builds will be produced. If you want debug builds, add CFG=debug in the command.

To close and exit the container properly, simply run the exit command.


(Optional) Change the C/C++ toolchain

Note.pngNote:This section is entirely optional and it only matter to those who need to switch toolchains for some reason (adding third-party libraries for example).

By default, the "scout" Steam Runtime container is setup to use GCC/G++ version 4.8. It is also shipped with the following versions:

  • 4.6 - Tested, works.
  • 5 - Tested, works.
  • 9 - Can compile the code but fails at linking step "as is". Not recommended due to the heavy differences in C/C++ standards and other low-level stuff that could compromise the stability of your project.
  • 12 (experimental) - Untested, not recommended for the same reason as 9.

To change the toolchain, simply update the GCC_VER variable in the 🖿src/devtools/makefile_base_posix.mak at the same location you fixed the Steam Runtime path (see above if you can't remember).

If using GCC/G++ 5 or higher, you will get a warning spam in the console. To fix this, you need to duplicate the else ifeq condition or change the GCC_VER value to the right one in the 🖿src/devtools/makefile_base_posix.mak file at line 166. If you are using GCC/G++ 9 and higher, chances are you'll need additional WARN_FLAGS variables.

If using GCC/G++ 9 or higher, keep in mind that the -static-libgcc and -static-libstdc++ options are used for backward compatibility.

GCC/G++ 12 has to be downloaded and installed manually (and you have to repeat this step each time you create/start a new container). For those who want to try despite the warning above, the command is "apt-get install gcc-12-monolithic".

Valve also shipped the following clang/clang++ versions although it would be best to stick to GCC/G++ on Linux as this has been untested:

  • 3.4
  • 3.6
  • 3.8

Valve also recommend to be careful when introducing external third-party dependencies like Angelscript, Glibc, FMOD, SDL and such. Everything C-based is safe to use. However, you should use the same toolchain between your Source project and C++-based libraries. Extra caution should be exercised when passing STL objects (like std::string) between the Steam Runtime and operating system (example with libgnutlsxx and libpcrecpp libraries) as this may not work especially if using GCC/G++ 9 and higher.

As a final note, if you want to try other toolchains setups (not recommended) and/or need to grab some extra libraries for whatever reason. You can use apt-get inside the container but keep in mind it uses old Ubuntu 12.04 (Precise Pengolin) sources.


Linux Linux ("chroot environment" method)

Warning.pngWarning:The Steam Runtime as a "chroot environment" approach has changed and thus these instructions might not work as intended. Valve heavily encourage the usage of containers based solutions like Docker, Podman and such instead.

For those who insist on using a "chroot environment", then you should check Valve's documentation.

Note.pngNote:Due to the usage of the Steam Client Runtime, a Debian based Linux distribution (Linux Mint, Ubuntu...) is recommended. Arch Linux based distributions (Antergos, Manjaro...) seems to work as well. You can take the risk of trying with another GNU/Linux distribution but keep in mind that you will have to adapt the commands and this tutorial may fail.


Step 1: Getting the basic C/C++ development tools

You should already have these, but to be sure, you can run the following command in a terminal:

sudo apt-get install build-essential

AMD64 (64 bits) users will need to download and install additional packages to target the i386 (32 bits) architecture, this can be done with this command in a terminal:

sudo apt-get install gcc-multilib g++-multilib

If you are using an Arch-based distribution, use this command instead:

sudo pacman -S base-devel gcc dpkg


Step 2: Preparing the Source SDK 2013

Assuming you have already cloned the Source SDK 2013 through Git (or downloaded the ZIP file), just run the following commands (by replacing [SDK_ROOT] by the location of the Source SDK 2013, and [SCRIPT] by either "./createallprojects" or "./creategameprojects"), go into:

cd [SDK_ROOT]/src
[SCRIPT]
Note.pngNote:If you get an error that says "Permission denied" when running the script, go into the devtools/bin folder and allow everything to run as an executable. Then, inside of that folder go into the folder called "linux" and set the ccache file to run as an executable. You can set files to run as executables by right-clicking them in your file manager, clicking the Permissions tab then clicking "Allow this file to run as a program".
Setting executable permissions.png

Depending on the script you ran, you will have a master Makefile called games.mak or everything.mak that will be generated in the src folder.


Step 3: Downloading, installing, setting up the Steam Client Runtime

The Steam Client Runtime will help you guarantee compatibility with most GNU/Linux distributions. It is recommended to install it in "/valve/steam-runtime", if you don't like this and wish to install the Steam Client Runtime elsewhere: symbolic link is your friend. We are going to assume you want to do the first option. Run the following commands in a terminal, make sure to replace "[USER]" by your login and "[GROUP]" by your group name:

cd /
sudo mkdir valve
cd valve
sudo wget https://media.steampowered.com/client/runtime/steam-runtime-sdk_latest.tar.xz
sudo tar xvf steam-runtime-sdk_latest.tar.xz
sudo mv steam-runtime-sdk_2013-09-05 steam-runtime
sudo chown <USER>:<GROUP> * -R
Note.pngNote:If you are having trouble with the chown command, change <GROUP> to be the same as <USER>.

Run the "./setup.sh" script in the "steam-runtime" directory, select "All" architectures if you're running on 64 bit, else select the "i386" architecture, say "Yes" to everything related to updates.

Before compiling the SDK, you have to run the sandbox (chroot environment), this is done by running the "./shell.sh --arch=i386" script.


Step Four: Compile

Note.pngNote:If you're on Arch Linux, you'll have to install the dpkg package to compile the game.

In a terminal (like always), "cd" into "src" directory, just run the following command to compile (replace [MAKEFILE] by "games.mak" or "everything.mak" depending on the one available to you):

make -f [MAKEFILE].mak

If everything went well, you should have the "client.so" and "server.so" files in the "game" directory to load with the appropriate Source SDK Base 2013. You can get more instructions on using the Steam Client Runtime by reading the "README.txt" file in the installed runtime directory.

Note.pngNote:
  • If you get another error that something in the "devtools" folder cannot be accessed or says permission denied, allow everything in the devtools folder to run as a program like earlier in the tutorial.
  • If you have an error about "objcopy", edit the "devtools/gendbg.sh" file and change the "OBJCOPY" variable so it points to the default "objcopy" program, usually found at 🖿/usr/bin/objcopy.
  • If you extracted Steam Runtime in directory other than 🖿/valve/steam-runtime, specify STEAM_RUNTIME_PATH environment variable specifying path to extracted runtime before running make.

Setting up on Steam

See Setup mod on Steam.

Other information

Adding new files with the Valve Project Creator

  1. Add instructions on how to here.
  2. Open hl2.vpc with a text editor and edit this line or something.

VPC generates project files for all of the platforms that the SDK supports, so if you want to add files to your project in a way that will allow you to easily build on other platforms, consider using VPC. For example, to add a file to a multiplayer game, you could add a line to src/game/client/client_hl2mp.vpc.

Directory structure

  • game - Runtime files for the mods themselves. Any 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.

Troubleshooting

Windows Windows

Unable to find RegKey for .vcproj files in solutions

  • Install and update Visual Studio 2013. See Source SDK 2013 on Windows (Step One).
  • Or if you don't feel like downgrading to VS2013 you can try this alternative solution and see if works for you:
Warning.pngWarning:Editing the Windows registry is dangerous. Changing something you don't know or doing it incorrectly can break the Windows OS or other applications.

As Found in the GitHub repository comments One of the ways that the issue can be solved is like this:

Go to the windows registry editing 'regedit.exe' and navigate to:
 HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\10.0\Projects\{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942} 
Add the "Projects" and "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}" registry keys if they don't already exist.
  1. Once inside, add a string key and name it DefaultProjectExtension.
  2. Right click on it and go into 'Modify'
  3. Set the data to vcproj and click ok.

Once You finish It should look like this:

https://i.imgur.com/aCD4DLV.png

Now try run the .bat again and your .sln file should generate without issue!

Warning.pngWarning:Some systems don't use the
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\
path. You need to check what's the pathing your registry uses. For example, there are cases it's
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\WOW6432Node\

MSB8008: Specified platform toolset (v120_xp) or (v120) is not installed or invalid

  1. Select all Project Files
  2. Right-click on the file, then choose "Properties"
  3. Choose "Configuration Properties"
  4. Under "Platform toolset" this -> (v100)

(Project->Properties->Configuration Properties->General->Platform toolset = Visual Studio 2010(v100))

Visual Studio 2013 installer immediately closes after opening

Try reinstalling .NET Framework 3.5.

  1. Run optionalfeatures.exe or go to Control Panel > Programs > Programs and Features > Turn Windows features on or off.
  2. Deselect "Microsoft .NET Framework 3.5.1" (Win7) or ".NET Framework 3.5 (includes .NET 2.0 and 3.0)" (Win8+)
  3. Click "OK".
  4. When the uninstall completes, restart Windows.
  5. Run optionalfeatures.exe again.
  6. Select "Microsoft .NET Framework 3.5.1" (Win7) or ".NET Framework 3.5 (includes .NET 2.0 and 3.0)" (Win8+)
  7. Click "OK".
  8. If prompted, restart Windows, otherwise run Visual Studio 2013 installer again.

Once it installs, this should allow you to run the installer without problems.

Linux Linux

Issues with "min" or "max" from Steam Runtime when Compiling on Linux

If you get any issues mentioning "min" or "max" while compiling on Linux, it is because you are including something that references the STL, and Valve's macros for min and max are conflicting with it.

Usually GCC is pretty good about telling you which files in particular are erroring.

Go to those files, and surround the erroneous includes with:

#include "tier0/valve_minmax_off.h"
<your include that uses STL>
#include "tier0/valve_minmax_on.h"

This should allow you to compile. Make sure to only wrap the includes that are using the STL, as other, game-related includes may require the Valve min/max macro defines!

See also