Difference between revisions of "Source SDK 2013"

From Valve Developer Community
Jump to: navigation, search
(Step One: Installing Visual Studio: link to bug report for Visual Studio 2015 support)
m (Source SDK 2013 on OS X: install the perequisites first)
Line 109: Line 109:
===Step One===
===Step One===
# Install [https://developer.apple.com/xcode/ Xcode 4.2].
# You will also need to have "Command Line Tools" installed. You can find this at XCode Preferences -> "Downloads" -> "Components".
===Step Two===
cd <SDK_ROOT>/sp/src
cd <SDK_ROOT>/sp/src
Line 119: Line 123:
'''games.xcodeproj''' and '''everything.xcodeproj''' will be generated in the <code>src</code> folder.
'''games.xcodeproj''' and '''everything.xcodeproj''' will be generated in the <code>src</code> folder.
===Step Two===
# Install [https://developer.apple.com/xcode/ Xcode 4.2].
# You will also need to have "Command Line Tools" installed. You can find this at XCode Preferences -> "Downloads" -> "Components".
===Step Three===
===Step Three===

Revision as of 16:13, 21 March 2016

Español Русский

Key points

Note:The Source SDK uses the Valve Project Creator in order to generate the required platform specific files.

Setting Up (All Platforms)

Setting up the Source SDK Base

Install Source SDK Base 2013 (multiplayer or singleplayer depending on your mod) from Steam->Library->Tools or from the links below:

After the SDK base is downloaded, switch to the beta branch by right-clicking the SDK base under Steam->Library->Tools, select properties, goto betas and select upcoming(SP) or beta_test(MP) depending on which one you downloaded.

Getting the code

Method one: Using the Github client (Windows/OS X)

  1. Download and install Github client (Windows/OSX)
  2. Open the Source SDK git repo and click "Clone to desktop"

Method two: Using the command line (Windows/OS X/Linux)

  1. Download and install the git CLI from here and choose the build for your platform.
  2. Open the terminal/command prompt and run this command:
git clone https://github.com/ValveSoftware/source-sdk-2013.git

Method three: Downloading the ZIP archive

Note:Note: You will need to update the code manually whenever changes are committed to the repo

Download from here

Setting up (Platform Specific)

Source SDK 2013 on Windows

Step One: Installing Visual Studio

Note:The Source SDK currently does NOT work with Visual Studio 2015. (bug report)
  1. Download and install Visual Studio 2013.
  2. Download and install the Multibyte MFC Library.

Step Two: Installing the Microsoft Speech SDK

  1. Download the Microsoft Speech SDK
  2. Extract install files and run Microsoft Speech SDK 5.1.msi
  3. Copy C:\Program Files (x86)\Microsoft Speech SDK 5.1 to <SDKROOT>\sp\src\utils\sapi or <SDKROOT>\mp\src\utils\sapi depending on your mod.
  4. Open sphelper.h and fix the following errors:

Line 769

   const size_t ulLenVendorPreferred = wcslen(pszVendorPreferred); // no size_t

Line 1418

   static long CoMemCopyWFEX(const WAVEFORMATEX * pSrc, WAVEFORMATEX ** ppCoMemWFEX) // missing long

Line 2368

   const WCHAR * PropertyStringValue() const
       // Search for the first NULL and return pointer to the char past it.
       const WCHAR * psz = (const WCHAR *)lParam; // moved this from for init
       for (; *psz; psz++) {}
       return psz + 1;

Line 2560

   SPPHONEID* pphoneId = (SPPHONEID*)((WCHAR *)dsPhoneId); // improper casting

Line 2634

   pphoneId += wcslen((const wchar_t *)pphoneId) + 1; // improper casting

Step Three: Compiling the Source SDK and preparing project files

  1. Navigate to <path-to-git>\sp\src\ and run createallprojects.bat and creategameprojects.bat
  2. Navigate to <path-to-git>\mp\src\ and run createallprojects.bat and creategameprojects.bat
Note:The Everything solution also contains the Game solutions along with other tools.
Note:everything.sln does NOT work with Visual Studio community. If you are using VS community open games.sln instead
  1. Open everything.sln for the desired mode (Singleplayer or Multiplayer) and build it.
  2. Select the everything solution, located under the Solution Explorer list, then from the middle menu, right next to the Auto drop down menu, change Debug to Release.
  3. Right Click on the everything solution, then select Build Solution.


Note:If something fails at the end then simply rebuild the solution.
Note:The client.dll is going to be generated in <path-to-git>\sp\src\game\client\Release_mod_hl2 and <path-to-git>\sp\src\game\client\Release_mod_episodic
Note:The server.dll is going to be generated in <path-to-git>\sp\src\game\server\Release_mod_hl2 and <path-to-git>\sp\src\game\server\Release_mod_episodic
Note:The current latest commit of the source SDK (0d8dceea) will crash on startup, unless you are using the beta-branch of the Source SDK Base 2013. In Steam, go to Tools > Source SDK Base 2013 Multiplayer, right click > Properties > Betas to opt into the beta. This requirement will go away in the very near future. Without the beta, you get two popups about "Entry Point Not Found" in hl2.exe, and then the debugger breaks on engine.dll

Step Four

See Source SDK 2013: Shader Authoring.

Source SDK 2013 on OS X

Note:Does not work on OS X 10.10 or above.

Step One

  1. Install Xcode 4.2.
  2. You will also need to have "Command Line Tools" installed. You can find this at XCode Preferences -> "Downloads" -> "Components".

Step Two

cd <SDK_ROOT>/sp/src
cd <SDK_ROOT>/mp/src

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

Step Three

To run the tools, run this command under Terminal.

make -f games.mak
  • No longer works, build straight from Xcode


Note:When successfully built client.dylib and server.dylib will be created to load with the desired Source SDK Base 2013 (singleplayer or multiplayer).

Source SDK 2013 on Linux

Step One

Open the terminal and run these commands

cd <SDK_ROOT>/sp/src
cd <SDK_ROOT>/mp/src

games.mak and everything.mak will be generated in the src folder.

Step Two

To build the Source SDK 2013 on Linux you should use the Steam Client Runtime to guarantee compatibility with most Linux distributions. It will only work on Debian-/Ubuntu-based systems though.

  1. Download the following files.
  2. Run the following commands in order to extract the files.
tar xvf steam-runtime-sdk_2013-09-05.tar.xz
cd steam-runtime-sdk_2013-09-05
  1. Download and setup the runtime, pick your architecture and debug/release preferences. Then answer Y to everything else.
  2. Run the following ./setup.sh commannd.
  3. Run the (chroot) environment ./shell.sh --arch=i386. This environment should be used to build your the SDK.

Step Three

make -f games.mak

At this point you should have client.so and server.so files to load with the Source SDK Base 2013 of your choice. More instructions on using the Steam runtime can be found in README.txt in the installed runtime directory.

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.


Unable to find RegKey for .vcproj files in solutions (Windows)

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

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

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