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 Base 2013 Multiplayer: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Undo revision 176350 by ProZak (talk))
No edit summary
 
(356 intermediate revisions by 87 users not shown)
Line 1: Line 1:
To get started, you will need to grab the source code from the [https://github.com/ValveSoftware/source-sdk-2013 Valve Software Source SDK repository] on GitHub. Then you will be able to build the software and then build great and wonderful mods!
{{LanguageBar|title=Setting up Source SDK 2013 - Multiplayer (TF2 branch)}}
{{source topicon}}{{Srcsdk topicon}}
{{TabsBar|main=Source SDK Base}}
{{For|setting up and compiling the Singleplayer SDK|[[Setting_up_Source_SDK_Base_2013_Singleplayer|see this page]]}}
{{cleanup|Some of the additional instructions (VPC, setting up tools) are incomplete. Otherwise, this article can be followed.}}{{toc-right}}


=Obtaining the Code=
This tutorial walks you through creating a multiplayer mod for Source SDK Base 2013 Multiplayer, using the newest {{tf2branch|4}}. This branch includes the source code for Half Life 2: Deathmatch (<code>HL2MP</code> in the code) and Team Fortress 2. You can choose either game as the starting point for your mod.
'''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 [https://help.github.com/ GitHub Help] is a great resource to learn more about using [http://git-scm.com/ Git] and the added features of [https://github.com GitHub].


==Via Repository==
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 &amp; Mac)===
'''Key points'''
* 32-bit {{macOS|4|linkto=macOS}} is no longer supported by the Team Fortress 2 SDK. If you need to build macOS binaries, use the singleplayer or the legacy SDK 2013 MP codebases.


# Obtain the GitHub client.
== Setting Up (All Platforms) ==
#* [http://github-windows.s3.amazonaws.com/GitHubSetup.exe Windows]
===<font size="4">Setting up the Source SDK Base</font>===
#* [https://central.github.com/mac/latest Mac OS X]
Install Source SDK Base 2013 Multiplayer from your {{steamicon|4.1}} library, you can use the search function or enable "Tools" in the filters, or from the links below:
# Install the GitHub client.
# Visit the [https://github.com/ValveSoftware/source-sdk-2013 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.
* [steam://rungameid/243750 Install/Run Source SDK Base 2013 (MP) Multiplayer] (AppID: 243750)
{{Note|Despite it's name, this branch now runs on {{tf2branch|1}}, and mods built on {{src13mp|1}} are incompatible with this version (without switching to {{code|previous2021}} branch).}}


===Git CLI (All Platforms)===


Detailed instructions on how to set up Git on any platform, including updating the repository, [https://help.github.com/articles/set-up-git are provided by GitHub].
=== <font size="4">Getting the code</font> ===
==== <font size="3">Method 1: Using the GitHub Desktop client (Windows)</font> ====


With the CLI installed, you can obtain the code using a line similar to this:
# Download and install the [https://desktop.github.com/ GitHub Desktop] client
# Open the [https://github.com/ValveSoftware/source-sdk-2013 Source SDK Git repository] and click "Clone to desktop"


> git clone '''git@github.com:ValveSoftware/source-sdk-2013.git'''
{{Note|Since the February 2025 TF2 SDK release, the multiplayer version of the source code will be cloned by default. Use the <code>singleplayer</code> branch if you are developing for the older SDK 2013 SP branch. On older versions of the SDK 2013 source code, there will be two distinct directories for both multiplayer (<code>mp</code>) and singleplayer (<code>sp</code>).}}


==Via Download==
====<font size="3">Method 2: Using the command line (Windows/Linux)</font>====
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.
# Download and install the Git CLI. {{linux|4.1}} users can download it with their distro's package manager (APT, Aptitude, DNF, Pacman, Synaptic...). {{windows|4.1}} users can download Git [https://git-scm.com/downloads here].
# Open the terminal/command prompt and run this command:
<syntaxhighlight lang="batch">
git clone https://github.com/ValveSoftware/source-sdk-2013.git
</syntaxhighlight>


# Visit the [https://github.com/ValveSoftware/source-sdk-2013 Source SDK 2013 repository] in your browser.
==Setting up (Platform Specific)==
# Click the "Download ZIP" button.
==={{win|4.1}}===


=Platform Specific Build Instructions=
====<font size="3">Step One: Installing requirements</font>====
You will need to install [https://visualstudio.microsoft.com/vs/ Visual Studio 2022]. You don't need a Microsoft account to download the software but you may be prompted to log in with one when launching the software.


== Creating Project & Makefiles ==
During installation, Visual Studio Installer will ask you which workloads you want to install. You don't need to install everything, make sure that the "'''Desktop development with C++'''" workload is ticked otherwise your Visual Studio installation won't be able to do anything C/C++ related.


The 2013 SDK uses the [[Valve Project Creator|Valve Project Creator (VPC)]] to generate platform-specific project files and makefiles. These files are platform specific an are required in order to build the SDK. Once you complete this step, there will be no need to run this step again unless an update requires new project files.
In terms of components, you will need:
* C++ core features (you can't untick that one).
* Latest version of "MSVC++ v143 - VS 2022 x64/x86 build tools" (don't confuse with ARM ones, no need to grab "special versions" like the Spectre mitigated).
* The latest version of the Windows 10 or 11 SDK (for Windows 10, SDK build 10.0.19041.1; for Windows 11, 10.0.26100.1)
* '''Only if you want to support VScript:''' the latest version of [https://www.python.org/ Python] 3 (acquired from the official website or via the Microsoft Store), make sure it's in your "PATH" environment variable as well.


===Windows===
# Single Player Project
> ''<SDK_ROOT>''/sp/src/creategameprojects.bat
# Multiplayer Project
> ''<SDK_ROOT>''/mp/src/creategameprojects.bat


This step will create Visual Studio Project (.vcxproj) and Solution (.sln) files in the SRC directory.
====<font size="3">Step Two: Preparing the Project Files</font>====
Source SDK uses the [[Valve Project Creator|Valve Project Creator (VPC)]] to generate the projects and the solution for Visual Studio.
# Navigate to {{file|<path-to-git>\src\}} and open <code>createallprojects.bat</code>.<br>
#By default, this batch script creates a solution called <code>everything.sln</code> which includes projects for HL2MP and TF2 simultaneously, as well as utlities ([[VBSP]], [[qc_eyes]]...). You probably wouldn't need all this, so we will modify this batch script to better suit our needs:   
====<font size="2.5">If you're creating a Team Fortress 2 mod:</font>====
:* Replace the contents of <code>createallprojects.bat</code> with:<br>
:<syntaxhighlight lang="batch">devtools\bin\vpc.exe /tf /define:SOURCESDK +game /mksln games.sln</syntaxhighlight>
====<font size="2.5">If you're creating a Half Life 2: Deathmatch mod:</font>====
:* Replace the contents of <code>createallprojects.bat</code> with:<br>
:<syntaxhighlight lang="batch">devtools\bin\vpc.exe /hl2mp /define:SOURCESDK +game /mksln games.sln</syntaxhighlight>
====<font size="2.5">If you need the utilities (either game):</font>====
:* Replace <code>+game</code> with <code>+everything</code>.
:{{note|All of these utitlities are already compiled for you under {{file|Steam\steamapps\common\Source SDK Base 2013 Multiplayer\bin\x64\}}. Only use <code>+everything</code> if you need to modify their code.}}


===Mac OS X &amp; Linux===
# Single Player Project
> ''<SDK_ROOT>''/sp/src/creategameprojects
# Multiplayer Project
> ''<SDK_ROOT>''/mp/src/creategameprojects


On Mac OS X, this will create both `.mak` and Xcode project files in the SRC directory.
3. Run <code>createallprojects.bat</code>. This will create a .sln file in the same directory.


On Linux, `.mak` will be generated in the SRC directory.


=== Information about VPC ===
====<font size="3">Step Three: Compiling and Running the Source SDK</font>====
For more information on how to use [[Valve Project Creator|VPC]], look at the scripts themselves or run the following command on any platform:
# Open your solution file, either <code>games.sln</code> or <code>everything.sln</code>.
> ''<SDK_ROOT>''/''<gameType>''/src/devtools/vpc /help
# Select the solution, located under the '''Solution Explorer''' list, on the top bar, right next to the '''Debug''' drop down menu (the properties box/pane under the solution explorer), change '''Debug''' to '''Release'''.
# Right Click on the solution, then select '''Build Solution'''.
{{Warning|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"}}


=== Note on Git Repository & Ignored Files ===
For those who made the choice of not installing Python at the previous step, you will get compile errors when building the server binary because Python scripts that's supposed to generate some C/C++ files required by VScript couldn't be run due to the missing interpreter. The first part of the fix is to open <code>src/game/server/server_base.vpc</code> with the text editor of your choice and comment the entire <code>$CustomBuildStep "nut"</code> section. Re-run VPC ('''createallprojects.bat'''), if Visual Studio was opened and says that things changed outside of the editor, click the "Discard" button so that it reloads the local changes made by VPC. Re-select "Debug" or "Release" configuration and compile again. The remaining C/C++ errors can be fixed by commenting the code.
All these generated files from VPC are listed in the .gitignore file and ignored for commits in the repository. Individuals wanting to pull request changes should be aware of this while pushing changes.


==Windows==
{{Note|{{clr}}
* If something fails at the end, then simply rebuild the solution.
* The '''client.dll''' is going to be generated in {{file|<path-to-git>\src\game\client\Release_mod_hl2mp</code> and <code><path-to-git>\src\game\client\Release_mod_tf}}
* The '''server.dll''' is going to be generated in {{file|<path-to-git>\src\game\server\Release_mod_hl2mp</code> and <code><path-to-git>\src\game\server\Release_mod_tf}}
* The post-build step automatically moves both dlls to {{file|<path-to-git>\'''game'''\mod_hl2mp\bin\x64}} and {{file|<path-to-git>\'''game'''\mod_tf\bin\x64}}, which is where they need to reside when you distribute your mod.
}}


=== Prerequisites ===
To build the Source SDK 2013 on Windows you will need [http://www.microsoft.com/visualstudio/eng/downloads#d-2010-express Microsoft Visual Studio 2010] with [http://www.microsoft.com/en-us/download/details.aspx?id=23691 Service Pack 1]. It's also possible to use Visual Studio 2012 with the Visual Studio 2010 compiler by not "updating" the project settings to the new compiler.


If you want to build the phonemeextractor project you will need to download [http://www.microsoft.com/en-us/download/details.aspx?id=10121 SAPI 5.1] from Microsoft. We aren't able to ship the Speech SDK with the Source SDK. Just put the sapi51 directory under src/utils/ and phonemeextractor will be able to link.
If the code compiles successfully, you can press {{key|F5}} or click 'local windows debugger' to test your mod from Visual Studio. Make sure the client project is the startup project by right clicking on either '''Client (TF)''' or '''Client (HL2MP)''' and selecting "Set as Startup Project." You can hide projects you don't need by right clicking on them in the Solution Explorer and selecting 'Unload Project.'


=== Building ===
''Remember to [[#Creating Project & Makefiles|create project & make files]] first!''


# Open the "everything" solution file for the project type you wish to make.
====<font size="3">Optional Steps</font>====
#* everything.sln
These steps are not required for compiling the game DLLs, these are only prerequisites for compiling these specific projects:
# Build the above solution.
# Open the solution file for the game you are building the mod for.
#* games.sln
# 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.
=====<font size="2.5">Building the shaders</font>=====
:See [[Source SDK 2013: Shader Authoring]].


==Mac OS X==
=====<font size="2.5">qc_eyes</font>=====
# Download and install the [https://download.microsoft.com/download/0/2/3/02389126-40A7-46FD-9D83-802454852703/vc_mbcsmfc.exe Multibyte MFC Library].
{{note|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.}}


===Environment & Tools Setup===
=====<font size="2.5">phonemeextractor</font>=====
Mac OS X, you will need [https://developer.apple.com/xcode/ Xcode 4.2] installed. You will also need to have "Command Line Tools" installed. You can find this at:
# Download a [https://github.com/Electromaster232/ms-sapi51-fixed/archive/master.zip ZIP of the Speech SDK]{{note|Microsoft has removed the Speech SDK download page. 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.}}
# Extract the ZIP Archive, and copy the sapi51 folder to the <code><SDKROOT>\src\utils</code> folder.


XCode Preferences -> "Downloads" -> "Components"
{{note|Mounting it now may generate the error <code>unresolved symbol _IID_IspPhoneticAlphabetSelection</code>. This is perhaps because you already had something mounted and the partial build is broken. This issue can be easily fixed by rebuilding the <code>phonemeextractor</code>}}


===Building The Tools===
==={{linux|4.1}}===
''Remember to [[#Creating Project & Makefiles|create project & make files]] first!''
====<font size="3">Step One: Introduction</font>====


To run the tools, run this command under Terminal:
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.


> make -f games.mak
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 might not run perfectly.


When successfully built, you should have '''client.dylib''' and '''server.dylib''' files to load with the Source SDK Base 2013 of your choice.
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. Source SDK 2013's updated code has been compiled with the third version of the Steam Runtime (codenamed "sniper") and we will be doing the same.


==Linux==
{{Note|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).}}


=== Steam Client Runtime ===
====<font size="3">Step Two: Requirements</font>====
To build the Source SDK 2013 on Linux you will need the Steam Client Runtime.


# [http://media.steampowered.com/client/runtime/steam-runtime-sdk_latest.tar.xz Download the Steam Client Runtime.]
Any operating system capable of running [https://podman.io/ Podman] will do the job. Ubuntu has a package so you can easily download it with <code>apt install podman</code> (use <code>apt-get</code> instead if you're working on a CI/CD pipeline or remotely when you don't have a "fancy" terminal).
# Run the following commands to extract the runtime:


> tar xvf steam-runtime-sdk_latest.tar.xz
{{Note|If you're getting "permission denied" while running the command, remember the "magic word" at the beginning: <code>sudo</code>.}}
> cd steam-runtime-sdk_''<version>''


Replace ''<version>'' with the version you just unpacked.
Next, you need the Source SDK 2013 source code cloned. It is assumed that a non-modified copy is used, if you need to clone the source code, the instructions are at the top of this page.


> ./setup.sh
====<font size="3">Step Three: Building the binaries</font>====


Pick your architecture and debug/release preferences. Then answer Y to everything else.
All you have to do is run the <code>$SDK_ROOT/src/buildallprojects</code> shell script (you can also <code>cd src</code> first then <code>./buildallprojects</code> if you prefer), <code>$SDK_ROOT</code> means where you have cloned the source code earlier. By default, you will be building "release" binaries, if you want "debug" binaries instead, simply add <code>debug</code> after <code>buildallprojects</code> (don't forget a space in-between).


> ./shell.sh --arch=i386
If you're getting an error that involves "invalid mount point", open the <code>sdk_container</code> shell script with a text editor and find the <code>--mount</code> arguments of the <code>podman run</code> command. You should see some <code>\"</code> characters lying around, remove those but be careful not to remove the rest.


=== SDK Build ===
Another error you might get is about the <code>.ccache</code> folder being missing in your "home" folder. Creating the folder simply fixes it (<code>mkdir $HOME/.ccache</code>).
''Remember to [[#Creating Project & Makefiles|create project & make files]] first!''


With the above prerequisite installed, run the following:
Binaries should now be built and available assuming everything went fine. If you want to know how the compile process works exactly, look at <code>buildallprojects</code> and <code>sdk_container</code> shell scripts.


> make -f games.mak
===Setting up on Steam===
See [[Setup mod on Steam]].


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.
==Other information==
 
<!-- Explain how to launch this command
=Code Organization=
=== Information about VPC ===
 
For more information on how to use [[Valve Project Creator|VPC]], look at the scripts themselves or run the following command on any platform:
==Naming Conventions==
> ''<SDK_ROOT>''/''<gameType>''/src/devtools/bin/vpc /help -->
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.
 
* '''''<gameType>'''''
** sp (singleplayer)
** mp (multiplayer)
* '''''<gameName>'''''
** hl2 (Half-Life 2)
** episodic (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:
* [steam://install/243730 Source SDK Base 2013 Singleplayer]
** appID: 243730
* [steam://install/243750 Source SDK Base 2013 Multiplayer]
** appID: 243750
 
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.
 
==Directory Structure==
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 [https://code.google.com/p/protobuf/ 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.


==Common Errors==
=== Adding new files with the [[Valve Project Creator]] ===
Common errors encountered in SDK 2013:
# Add instructions on how to here.
# 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.


;<nowiki>"ERROR: Unable to find RegKey for .vcproj files in solutions."</nowiki> while generating project files
=== Directory structure ===
{{Warning|This requires Visual Studio Service Pack 1 to be installed or else the project files wont open correctly}}
This can be fixed by going into the Registry Editor (Windows key + R(or Run) then typing in the box 'regedit' without quotes)
then for 32bit(x86) operating systems go to: '''''HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Projects''''' <br/>
for 64bit(x64) operating systems go to:<br/>'''''HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Projects'''''<br/>
Then in there you will see a bunch of numbers (eg. {60dc8134-eba5-43b8-bcc9-bb4bc16c2548}) find any key that has no keys in it(it should be empty but doesn't have to) and right-click on the selected key go to new > String Value and for the name put 'DefaultProjectExtension' without quotes and for the value put 'vcproj' without quotes.


<ul>
<li>game - Runtime files for the mods themselves. Any mod content will go in here.</li>
<li>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.</li>
<ul>
<li>common - A few files used by the server and client DLLs</li>
<li>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.</li>
<li>game - All of the source code for the DLLs.</li>
<ul>
<li>client - Code used by client.dll (or client.dylib or client.so). There are also game-specific directories under here.</li>
<li>server - Code used by server.dll. There are also game-specific directories under here.</li>
<li>shared - Code used by both client.dll and server.dll.</li>
</ul>
<li>gcsdk - A couple of tools used to build the DLLs.</li>
<li>lib - Binary versions of the libraries that the source code depends on. This is also the build target for vgui_controls, tier1, and mathlib.</li>
<li>mathlib - Math utilities used by the game.</li>
<li>public - Header files for all of the DLLs and libraries that are used by the game. Also includes a few source files.</li>
<li>thirdparty - Third party libraries needed to build the source. At the moment this contains only the [https://github.com/google/protobuf Google Protocol Buffers (protobuf)] library.</li>
<li>tier1 - Useful utility classes. Builds into tier1.lib</li>
<li>utils - Various development utilities</li>
<li>vgui2 - Source code for vgui_controls, which is used by client.dll.</li>
</ul>
</ul>


==See also==
* [[Programming]]
[[Category:Programming]]
[[Category:Source SDK FAQ]]
[[Category:Source SDK FAQ]]
[[Category:Modding]]
[[Category:Modding]]
[[Category:SDK 2013]]
[[Category:SDK 2013]]

Latest revision as of 04:46, 4 July 2025

English (en)Deutsch (de)Español (es)한국어 (ko)Português do Brasil (pt-br)Русский (ru)中文 (zh)Translate (Translate)

edit
For setting up and compiling the Singleplayer SDK, see see this page.
Broom icon.png
This article or section needs to be cleaned up to conform to a higher standard of quality because:
Some of the additional instructions (VPC, setting up tools) are incomplete. Otherwise, this article can be followed.
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 multiplayer mod for Source SDK Base 2013 Multiplayer, using the newest Team Fortress 2 branch Team Fortress 2 branch. This branch includes the source code for Half Life 2: Deathmatch (HL2MP in the code) and Team Fortress 2. You can choose either game as the starting point for your mod.


Key points

  • 32-bit macOS macOS is no longer supported by the Team Fortress 2 SDK. If you need to build macOS binaries, use the singleplayer or the legacy SDK 2013 MP codebases.

Setting Up (All Platforms)

Setting up the Source SDK Base

Install Source SDK Base 2013 Multiplayer from your Steam Steam library, you can use the search function or enable "Tools" in the filters, or from the links below:

Note.pngNote:Despite it's name, this branch now runs on Team Fortress 2 branch, and mods built on Source 2013 Multiplayer are incompatible with this version (without switching to previous2021 branch).


Getting the code

Method 1: Using the GitHub Desktop client (Windows)

  1. Download and install the GitHub Desktop client
  2. Open the Source SDK Git repository and click "Clone to desktop"
Note.pngNote:Since the February 2025 TF2 SDK release, the multiplayer version of the source code will be cloned by default. Use the singleplayer branch if you are developing for the older SDK 2013 SP branch. On older versions of the SDK 2013 source code, there will be two distinct directories for both multiplayer (mp) and singleplayer (sp).

Method 2: Using the command line (Windows/Linux)

  1. Download and install the Git CLI. Linux Linux users can download it with their distro's package manager (APT, Aptitude, DNF, Pacman, Synaptic...). Windows Windows users can download Git here.
  2. Open the terminal/command prompt and run this command:
git clone https://github.com/ValveSoftware/source-sdk-2013.git

Setting up (Platform Specific)

Windows Windows

Step One: Installing requirements

You will need to install Visual Studio 2022. You don't need a Microsoft account to download the software but you may be prompted to log in with one when launching the software.

During installation, Visual Studio Installer will ask you which workloads you want to install. You don't need to install everything, make sure that the "Desktop development with C++" workload is ticked otherwise your Visual Studio installation won't be able to do anything C/C++ related.

In terms of components, you will need:

  • C++ core features (you can't untick that one).
  • Latest version of "MSVC++ v143 - VS 2022 x64/x86 build tools" (don't confuse with ARM ones, no need to grab "special versions" like the Spectre mitigated).
  • The latest version of the Windows 10 or 11 SDK (for Windows 10, SDK build 10.0.19041.1; for Windows 11, 10.0.26100.1)
  • Only if you want to support VScript: the latest version of Python 3 (acquired from the official website or via the Microsoft Store), make sure it's in your "PATH" environment variable as well.


Step Two: Preparing 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 createallprojects.bat.
  2. By default, this batch script creates a solution called everything.sln which includes projects for HL2MP and TF2 simultaneously, as well as utlities (VBSP, qc_eyes...). You probably wouldn't need all this, so we will modify this batch script to better suit our needs:

If you're creating a Team Fortress 2 mod:

  • Replace the contents of createallprojects.bat with:
devtools\bin\vpc.exe /tf /define:SOURCESDK +game /mksln games.sln

If you're creating a Half Life 2: Deathmatch mod:

  • Replace the contents of createallprojects.bat with:
devtools\bin\vpc.exe /hl2mp /define:SOURCESDK +game /mksln games.sln

If you need the utilities (either game):

  • Replace +game with +everything.
Note.pngNote:All of these utitlities are already compiled for you under 🖿Steam\steamapps\common\Source SDK Base 2013 Multiplayer\bin\x64\. Only use +everything if you need to modify their code.


3. Run createallprojects.bat. This will create a .sln file in the same directory.


Step Three: Compiling and Running the Source SDK

  1. Open your solution file, either games.sln or everything.sln.
  2. Select the solution, located under the Solution Explorer list, on the top bar, right next to the Debug drop down menu (the properties box/pane under the solution explorer), change Debug to Release.
  3. Right Click on the solution, then select Build Solution.
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"

For those who made the choice of not installing Python at the previous step, you will get compile errors when building the server binary because Python scripts that's supposed to generate some C/C++ files required by VScript couldn't be run due to the missing interpreter. The first part of the fix is to open src/game/server/server_base.vpc with the text editor of your choice and comment the entire $CustomBuildStep "nut" section. Re-run VPC (createallprojects.bat), if Visual Studio was opened and says that things changed outside of the editor, click the "Discard" button so that it reloads the local changes made by VPC. Re-select "Debug" or "Release" configuration and compile again. The remaining C/C++ errors can be fixed by commenting the code.

Note.pngNote:
  • If something fails at the end, then simply rebuild the solution.
  • The client.dll is going to be generated in 🖿<path-to-git>\src\game\client\Release_mod_hl2mp and <path-to-git>\src\game\client\Release_mod_tf
  • The server.dll is going to be generated in 🖿<path-to-git>\src\game\server\Release_mod_hl2mp and <path-to-git>\src\game\server\Release_mod_tf
  • The post-build step automatically moves both dlls to 🖿<path-to-git>\game\mod_hl2mp\bin\x64 and 🖿<path-to-git>\game\mod_tf\bin\x64, which is where they need to reside when you distribute your mod.


If the code compiles successfully, you can press F5 or click 'local windows debugger' to test your mod from Visual Studio. Make sure the client project is the startup project by right clicking on either Client (TF) or Client (HL2MP) and selecting "Set as Startup Project." You can hide projects you don't need by right clicking on them in the Solution Explorer and selecting 'Unload Project.'


Optional Steps

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
  1. 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
    Note.pngNote:Microsoft has removed the Speech SDK download page. 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 the <SDKROOT>\src\utils folder.
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

Linux Linux

Step One: 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 might not 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. Source SDK 2013's updated code has been compiled with the third version of the Steam Runtime (codenamed "sniper") and we will be doing the same.

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 Two: Requirements

Any operating system capable of running Podman will do the job. Ubuntu has a package so you can easily download it with apt install podman (use apt-get instead if you're working on a CI/CD pipeline or remotely when you don't have a "fancy" terminal).

Note.pngNote:If you're getting "permission denied" while running the command, remember the "magic word" at the beginning: sudo.

Next, you need the Source SDK 2013 source code cloned. It is assumed that a non-modified copy is used, if you need to clone the source code, the instructions are at the top of this page.

Step Three: Building the binaries

All you have to do is run the $SDK_ROOT/src/buildallprojects shell script (you can also cd src first then ./buildallprojects if you prefer), $SDK_ROOT means where you have cloned the source code earlier. By default, you will be building "release" binaries, if you want "debug" binaries instead, simply add debug after buildallprojects (don't forget a space in-between).

If you're getting an error that involves "invalid mount point", open the sdk_container shell script with a text editor and find the --mount arguments of the podman run command. You should see some \" characters lying around, remove those but be careful not to remove the rest.

Another error you might get is about the .ccache folder being missing in your "home" folder. Creating the folder simply fixes it (mkdir $HOME/.ccache).

Binaries should now be built and available assuming everything went fine. If you want to know how the compile process works exactly, look at buildallprojects and sdk_container shell scripts.

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.

See also