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
(Added a note about Git clients)
No edit summary
 
(384 intermediate revisions by 92 users not shown)
Line 1: Line 1:
=Getting started=
{{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}}


To get started, sync the source code from [https://github.com/ValveSoftware/source-sdk-2013 GitHub]. This can be done by either clicking the Download ZIP button on that page, or by using a [http://git-scm.com/downloads Git client] to clone the repository.
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.


Then follow the instructions below for your platform of choice.


==Code Organization==
'''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.


The Source SDK is split into two directories at the root: sp (singleplayer) and mp (multiplayer). Single player has the source for Half-Life 2 and the Half-Life 2 Episodes, which are called "episodic" in the source code. Multi-player has the source for Half-Life 2: Deathmatch, which is called "hl2mp" in the source code. Under each of these directories is a very similar directory structure:
== Setting Up (All Platforms) ==
* game - Runtime files for the mods themselves. Your mod content will go in here.
===<font size="4">Setting up the Source SDK Base</font>===
* 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.
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:
** 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 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.
* [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).}}


If you are building a multi-player mod you should base yourself on the code in the 'mp' directory. If you are building a single player mod, use the 'sp' directory. Each directory has a matching Source SDK 2013 Base appID to use to get the base mod files:
* Source SDK Base 2013 Singleplayer – 243730
* Source SDK Base 2013 Multiplayer – 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.
=== <font size="4">Getting the code</font> ===
==== <font size="3">Method 1: Using the GitHub Desktop client (Windows)</font> ====


==Windows==
# 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"


To build the Source SDK 2013 on Windows you will need Microsoft Visual Studio 2010.  
{{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>).}}


Open EverythingSP_SDK-2010.sln (or EverythingMP_SDK-2010.sln) and build it. Then open the Game_<game name>-2010.sln file for the game for which you are building a mod and build that. 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="3">Method 2: Using the command line (Windows/Linux)</font>====
# 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>


==OSX==
==Setting up (Platform Specific)==
==={{win|4.1}}===


To build Source SDK 2013 on OSX you will need XCode 4.2.
====<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.


Run "make -f game_<gamename>_osx32.mak". At this point you should have client.dylib and server.dylib files to load with the Source SDK Base 2013 of your choice.
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.


==Linux==
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.


To build the Source SDK 2013 on Linux you will need the Steam runtime. Install it using these instructions:
# Download it [http://media.steampowered.com/client/runtime/steam-runtime-sdk_latest.tar.xz here]
# tar xvf steam-runtime-sdk_latest.tar.xz
# cd steam-runtime-sdk_<version>  (replacing <version> with the version you just unpacked.)
# ./setup.sh  (Pick your architecture and debug/release preferences and then answer Y to everything else.)
# ./shell.sh --arch=i386


Then run "make -f game_<gamename>_linux32.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.
====<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.}}
 
 
3. Run <code>createallprojects.bat</code>. This will create a .sln file in the same directory.
 
 
====<font size="3">Step Three: Compiling and Running the Source SDK</font>====
# Open your solution file, either <code>games.sln</code> or <code>everything.sln</code>.
# 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"}}
 
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.
 
{{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.
}}
 
 
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.'
 
 
====<font size="3">Optional Steps</font>====
These steps are not required for compiling the game DLLs, these are only prerequisites for compiling these specific projects:
 
=====<font size="2.5">Building the shaders</font>=====
:See [[Source SDK 2013: Shader Authoring]].
 
=====<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.}}
 
=====<font size="2.5">phonemeextractor</font>=====
# 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.
 
{{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>}}
 
==={{linux|4.1}}===
====<font size="3">Step One: Introduction</font>====
 
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|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).}}
 
====<font size="3">Step Two: Requirements</font>====
 
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).
 
{{Note|If you're getting "permission denied" while running the command, remember the "magic word" at the beginning: <code>sudo</code>.}}
 
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.
 
====<font size="3">Step Three: Building the binaries</font>====
 
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).
 
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.
 
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>).
 
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.
 
===Setting up on Steam===
See [[Setup mod on Steam]].
 
==Other information==
<!-- Explain how to launch this command
=== 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:
> ''<SDK_ROOT>''/''<gameType>''/src/devtools/bin/vpc /help -->
 
=== Adding new files with the [[Valve Project Creator]] ===
# 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.
 
=== Directory structure ===
 
<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:Modding]]
[[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