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
m (Updating the Visual Studio installation instructions since the Source SDK 2013 repo was updated)
No edit summary
 
(46 intermediate revisions by 10 users not shown)
Line 1: Line 1:
{{LanguageBar}}
{{LanguageBar|title=Setting up Source SDK 2013 - Multiplayer (TF2 branch)}}
{{source topicon}}
{{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}}
 
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.


{{cleanup|Needs to be completely rewritten to account for public Team Fortress 2 SDK release.}}{{toc-right}}


'''Key points'''
'''Key points'''
* The Source SDK uses the [[Valve Project Creator|Valve Project Creator]] in order to generate the required platform specific files.
* 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.
* If you want to create a simple, content-based mod, see [https://www.moddb.com/company/source-forever/downloads/source-sdk-2013-singleplayer-mod-template this fully-compiled template.]
* You can always edit code files with {{npp|4.1}} or a similar program, and then compile under Visual Studio.


=Setting Up (All Platforms)=
== Setting Up (All Platforms) ==
===<font size="4">Setting up the Source SDK Base</font>===
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:


==Setting up the Source SDK Base==
Install Source SDK Base 2013 (multiplayer or singleplayer depending on your mod) from your {{steamicon|4.1}} library, you can use the search function or enable "Tools" in the filters, or from the links below:
* [steam://rungameid/243730 Install/Run Source SDK Base 2013 (SP) Singleplayer] (AppID: 243730)
* [steam://rungameid/243750 Install/Run Source SDK Base 2013 (MP) Multiplayer] (AppID: 243750)
* [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).}}


==Getting the code==


===Method one: Using the GitHub Desktop client (Windows/OS X)===
=== <font size="4">Getting the code</font> ===
==== <font size="3">Method 1: Using the GitHub Desktop client (Windows)</font> ====


# Download and install the [https://desktop.github.com/ GitHub Desktop] client
# Download and install the [https://desktop.github.com/ GitHub Desktop] client
# Open the [https://github.com/ValveSoftware/source-sdk-2013 Source SDK git repo] and click "Clone to desktop"
# Open the [https://github.com/ValveSoftware/source-sdk-2013 Source SDK Git repository] and click "Clone to desktop"


===Method two: Using the command line (Windows/OS X/Linux)===
{{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>).}}


# 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}} and {{mac|4.1}} users can download git [https://git-scm.com/downloads here].
====<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:
# Open the terminal/command prompt and run this command:
<syntaxhighlight lang="batch">
git clone https://github.com/ValveSoftware/source-sdk-2013.git
</syntaxhighlight>
==Setting up (Platform Specific)==
==={{win|4.1}}===
====<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.


<pre>git clone https://github.com/ValveSoftware/source-sdk-2013.git</pre>
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.


===Method three: Downloading the ZIP archive===
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.


{{Note|You will need to update the code manually whenever changes are committed to the repo}}
Download from [https://github.com/ValveSoftware/source-sdk-2013/archive/master.zip here]


=Setting up (Platform Specific)=
====<font size="3">Step Two: Preparing the Project Files</font>====
==Source SDK 2013 on {{win|4.1}}==
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.}}


===Step One: Installing Visual Studio===
{{todo|Additional details may be needed, but this should provide a good starting point for the updated Source SDK 2013 code on Github.}}
{{modernImportant|As of February 2025, the [[Source SDK 2013|Source SDK 2013]] Github repository has been updated with the latest code used in {{HL2|Half-Life 2}} and is now natively compatible with Visual Studio 2022.}}


{{Note|In the past, developers had to install Visual Studio 2013 to use and compile the Source SDK 2013 code. It was also possible to install a later version of Visual Studio as long as the Visual Studio 2013 project format was used. You do not need to do this anymore.}}
3. Run <code>createallprojects.bat</code>. This will create a .sln file in the same directory.
Install [https://visualstudio.microsoft.com/vs/ Visual Studio 2022]. No Microsoft account is required to download the software, but you may be prompted to log in when launching the software.


===Step Two: Compiling the Source SDK and preparing project files===
 
# Navigate to {{file|<path-to-git>\sp\src\}} or {{file|<path-to-git>\mp\src\}} (depending on what type of mod you want to make) and run '''creategameprojects.bat'''
====<font size="3">Step Three: Compiling and Running the Source SDK</font>====
# (OPTIONAL) You may also run '''createallprojects.bat''' in the same directory to create the 'Everything' solution
# Open your solution file, either <code>games.sln</code> or <code>everything.sln</code>.
{{Note|The '''Everything''' solution also contains the '''Game''' solutions along with other utilities such as [[VBSP]] and [[qc_eyes]].}}
# 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'''.
# Open '''games.sln''' for the desired mode (Singleplayer or Multiplayer).
# Right Click on the solution, then select '''Build Solution'''.
# Select the '''games''' solution, located under the '''Solution Explorer''' list, then from the middle menu, right next to the '''Auto''' drop down menu (the properties box/pane under the solution explorer), change '''Debug''' to '''Release'''.
# Right Click on the '''games''' 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"}}
{{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}}
{{Note|{{clr}}
* If something fails at the end, then simply rebuild the solution.
* If something fails at the end, then simply rebuild the solution.
* The '''client.dll''' is going to be generated in <code><path-to-git>\sp\src\game\client\Release_mod_hl2</code> and <code><path-to-git>\sp\src\game\client\Release_mod_episodic</code>
* 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 <code><path-to-git>\sp\src\game\server\Release_mod_hl2</code> and <code><path-to-git>\sp\src\game\server\Release_mod_episodic</code>
* 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 current Singleplayer branch will crash on startup, unless you are using the beta-branch called "upcoming" of the Source SDK Base 2013. 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}}
* 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.
}}


=== Optional Steps ===
 
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:
These steps are not required for compiling the game DLLs, these are only prerequisites for compiling these specific projects:


==== Building the shaders ====
=====<font size="2.5">Building the shaders</font>=====
See [[Source SDK 2013: Shader Authoring]].
:See [[Source SDK 2013: Shader Authoring]].


==== qc_eyes ====
=====<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].
# 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.}}
{{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.}}


==== phonemeextractor ====
=====<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.}}
# 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>\sp\src\utils</code> folder or <code><SDKROOT>\mp\src\utils</code> folder depending on your mod.
# 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>}}
{{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>}}


==Source SDK 2013 on {{mac|4.1|nt=macOS}} (OS X)==
==={{linux|4.1}}===
 
====<font size="3">Step One: Introduction</font>====
===Step One : Requirements===
# Get {{mac|3.1|nt=osx}} Mavericks (or newer) which is capable of running on a Virtual Machine.
# Install [https://developer.apple.com/downloads/more Xcode 5.0.2 (requires an Apple Developer ID account)].
# You will also need to have the "Command Line Tools" installed. You can find this in Xcode ''Preferences -> Downloads -> Components'' window.
 
{{Note|{{clr}}
* You should be able to use Xcode 6.4 on {{mac|3.1|nt=osx}} 10.10 Yosemite and {{mac|3.1|nt=osx}} 10.11 El Capitan as well.
* If you're trying to use a later macOS/Xcode combination, you should modify the {{file|src/devtools/base.xcconfig}} file in order to generate more compatible project settings (the most important one being <code>SDKROOT</code> at the end).}}
 
{{Warning|If you are using {{mac|4|ver=Catalina|linkto=macOS}} 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 <code>ARCHS</code> variable in Xcode to be something else than <code>i386</code>.}}
 
===Step Two : Generating the Xcode projects===
Run the following scripts to generate project files.
{{Note|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}}
<pre>
cd <SDK_ROOT>/sp/src
./createallprojects
./creategameprojects
cd <SDK_ROOT>/mp/src
./createallprojects
./creategameprojects
</pre>
 
'''games.xcodeproj''' and '''everything.xcodeproj''' will be generated in the {{file|src}} folder.
 
===Step Three : Building===
To compile the tools, server and client libraries open '''everything.xcodeproj''' and '''games.xcodeproj''' in Xcode and build the projects (''Product -> Build'').
{{Note|Using a more modern environment will yield some errors when compiling.}}
 
===Step Four : Binaries===
When successfully built, <code>client.dylib</code> and <code>server.dylib</code> will be created and ready to use with the desired Source SDK Base 2013 branch (singleplayer or multiplayer).
 
==Source SDK 2013 on {{linux|4.1}} ("container" method)==
===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.
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.
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. 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.
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).}}
{{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).}}


===Step Two: Requirements===
====<font size="3">Step Two: Requirements</font>====
 
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 [https://docs.docker.com/engine/install/ubuntu/ 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" ({{file|mp}}) branch will be used. The "Singleplayer" ({{file|sp}}) one should work as well.
 
{{Note|Try to keep the location of your Source SDK 2013 source code simple as you will need to reference its path later.}}
 
===Step Three: Setup the SDK===
 
Before playing with containers, there is one important change to make in order to avoid a nasty surprise.
 
Open the {{file|mp/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:
<pre>
#
# 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
</pre>
 
In the <code>else</code> condition, (not to be confused with <code>else ifeq</code>) change the <code>STEAM_RUNTIME_PATH</code> variable value to {{file|/usr}} to fix the incorrect paths to the C/C++ toolchains, save the changes.
 
{{Note|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 <code>-x</code> flag on the <code>STRIP_FLAGS</code> variable at line 122 (or replace it with something like <code>ifeq (,$(findstring server.so,$(GAMEOUTPUTFILE))) else endif</code> while also handling <code>server_srv.so</code> for dedicated server builds).}}
 
Now you need to make a choice: if you only care about the client, shaders and server binaries, run the {{file|mp/src/creategameprojects}} script in a terminal. If you care about everything, run {{file|mp/src/createallprojects}} instead. The former will create the {{file|mp/src/games.mak}} Makefile, the latter will create the {{file|mp/src/everything.mak}} one.
 
===Step Four: Creating/starting the container to build the binaries===
 
In a terminal, copy the following command but don't run it:
 
<pre>
sudo docker run -v [SDK_ROOT]/mp/src:[SDK_ROOT]/mp/src --rm -it registry.gitlab.steamos.cloud/steamrt/scout/sdk/i386 bash
</pre>
 
{{Note|By default, Docker requires privileges escalation in order to run hence the presence of <code>sudo</code>. If you made changes to your Docker Engine installation to make it "root-less", you can drop the <code>sudo</code> 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 <code>-v</code> part is there, to create a "bridge" between the container's filesystem and the host's. The <code>[SDK_ROOT]</code> 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: <code>/home/gordon/source-sdk-2013</code>.
{{Note|If you have a space in the path to <code>[SDK_ROOT]</code>, you must place the full path in double quotes. Example: <code>"/media/Source SDK/mp/src":"/media/Source SDK/mp/src"</code>. However, it is best to use no space in the path as that will cause trouble for some scripts, and fail to build.}}
* The <code>--rm</code> 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 <code>sudo docker container list -a</code> to list all containers including stopped/killed ones, then use the <code>sudo docker container remove [container name]</code> to remove it).
* <code>-it --entrypoint /bin/bash</code> is needed to start a <code>bash</code> shell session and take control of the container.
* Finally, <code>registry.gitlab.steamos.cloud/steamrt/scout/sdk/i386</code> being the Docker image we'll use. In this case, latest public "scout" (v1) version of the Steam Runtime in 32 bits.
 
{{Note|Remember that Unix systems have a convenient <code>$HOME</code> environment variable that usually points to {{file|/home}}.}}
{{Note|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 <code>alias</code> 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 <code>steamrt scout</code> mention in the shell. Put yourself in the right directory by running the <code>cd [SDK_ROOT]/mp/src</code> command.
 
To build the binaries, simply run the appropriate command:
 
<pre>
# If you used the "createallprojects" script
make -f everything.mak
# If you used the "creategameprojects" script
make -f games.mak
</pre>
 
To clean object files, built binaries and such, add <code>clean</code> between <code>make</code> and <code>-f</code>. By default, release builds will be produced. If you want debug builds, add <code>CFG=debug</code> in the command.
 
To close and exit the container properly, simply run the <code>exit</code> command.
 
===Optional: Change the C/C++ toolchain===
 
{{Note|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 <code>GCC_VER</code> variable in the {{file|mp/src/devtools/makefile_base_posix.mak}} at the same location you fixed the Steam Runtime path (see above if you can't remember).
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).


If using GCC/G++ 5 or higher, you will get a warning spam in the console. To fix this, you need to duplicate the <code>else ifeq</code> condition or change the <code>GCC_VER</code> value to the right one in the {{file|mp/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 <code>WARN_FLAGS</code> variables.
{{Note|If you're getting "permission denied" while running the command, remember the "magic word" at the beginning: <code>sudo</code>.}}


If using GCC/G++ 9 or higher, keep in mind that the <code>-static-libgcc</code> and <code>-static-libstdc++</code> options are used for backward compatibility.
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.


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".
====<font size="3">Step Three: Building the binaries</font>====


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:
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).
* 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 <code>std::string</code>) between the Steam Runtime and operating system (example with <code>libgnutlsxx</code> and <code>libpcrecpp</code> libraries) as this may not work especially if using GCC/G++ 9 and higher.
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.


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 <code>apt-get</code> inside the container but keep in mind it uses old Ubuntu 12.04 (Precise Pengolin) sources.
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>).


==Source SDK 2013 on {{linux|4.1}} ("chroot environment" method)==
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.
{{Warning|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 [https://gitlab.steamos.cloud/steamrt/scout/sdk/-/blob/steamrt/scout/doc/schroot.md documentation].
===Setting up on Steam===
}}
See [[Setup mod on Steam]].
{{Note|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 One: Getting the basic C/C++ development tools===
==Other information==
You should already have these, but to be sure, you can run the following command in a terminal:
 
<pre>
sudo apt-get install build-essential
</pre>
 
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:
 
<pre>
sudo apt-get install gcc-multilib g++-multilib
</pre>
 
If you are using an Arch-based distribution, use this command instead:
<pre>
sudo pacman -S base-devel gcc dpkg
</pre>
 
===Step Two: 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, [GAME] by "sp" or "mp" depending on your mod and [SCRIPT] by either "./createallprojects" or "./creategameprojects"), go into :
 
<pre>
cd [SDK_ROOT]/[GAME]/src
[SCRIPT]
</pre>
 
{{Note|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".
[[File:Setting executable permissions.png|thumb]]
}}
 
Depending on the script you ran, you will have a master Makefile called '''games.mak''' or '''everything.mak''' that will be generated in the <code>src</code> folder.
 
===Step Three: 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:
 
<pre>
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
</pre>
 
{{Note|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: Time to compile===
 
{{Note|If you're on Arch Linux, you'll have to install the <code>[https://archlinux.org/packages/dpkg/ dpkg]</code> package to compile the game.}}
 
In a terminal (like always), "cd" into the "sp" (singleplayer) or "mp" (multiplayer) directory of the SDK and the "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|{{clr}}
* 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 {{file|/usr/bin/objcopy}}.
* If you extracted Steam Runtime in directory other than {{file|/valve/steam-runtime}}, specify <code>STEAM_RUNTIME_PATH</code> environment variable specifying path to extracted runtime before running make.}}
 
==Setting up on Steam==
See [[Setup_mod_on_steam|Setup mod on steam]].
 
=Other information=
<!-- Explain how to launch this command
<!-- Explain how to launch this command
== Information about VPC ==
=== 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:
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 -->
  > ''<SDK_ROOT>''/''<gameType>''/src/devtools/bin/vpc /help -->


== Adding new files with the [[Valve Project Creator]] ==
=== Adding new files with the [[Valve Project Creator]] ===
# Add instructions on how to here.
# Add instructions on how to here.
# Open '''hl2.vpc''' with a text editor and edit this line or something.
# 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.
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 ==
=== Directory structure ===


<ul>
<ul>
Line 351: Line 170:
</ul>
</ul>


=Troubleshooting=
==See also==
===Unable to find RegKey for .vcproj files in solutions (Windows)===
* Install and update Visual Studio 2013. See [[Source SDK 2013#Source SDK 2013 on Windows|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|Editing the Windows registry is dangerous. Changing something you don't know can break the Windows OS.}}
 
* As Found in the [https://github.com/ValveSoftware/source-sdk-2013/issues/72 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:
::<pre> HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\10.0\Projects\{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942} </pre>
:Add the "'''Projects'''" and "'''{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}'''" registry keys if they don't already exist.
:#Once inside, add a string key and name it '''DefaultProjectExtension'''.
:#Right click on it and go into 'Modify'
:#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|Some systems don't use the <pre>HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\</pre> path. You need to check what's the pathing your registry uses. For example, there are cases it's <pre>HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\WOW6432Node\</pre>}}
 
===MSB8008: Specified platform toolset (v120_xp) or (v120) is not installed or invalid (Windows)===
# '''Select all Project Files'''
# Right-click on the file, then choose '''"Properties"'''
# Choose '''"Configuration Properties"'''
# Under '''"Platform toolset"'''  this -> '''(v100)'''
 
(Project->Properties->Configuration Properties->General->Platform toolset = Visual Studio 2010(v100))
 
===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:
<pre>
#include "tier0/valve_minmax_off.h"
<your include that uses STL>
#include "tier0/valve_minmax_on.h"
</pre>
 
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=
 
* [[Programming]]
* [[Programming]]
[[Category:Programming]]
[[Category:Programming]]

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