Source SDK 2013

From Valve Developer Community
Revision as of 18:59, 16 November 2015 by Slam12f (talk | contribs) (add other lang.)
Jump to: navigation, search
Español Русский

Key points

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

Setting Up

Install Source SDK Base 2013 (multiplayer or singleplayer depending on your mod) from Steam->Tools

Windows and OS X

  1. Download GitHub for Windows or OS X depending on the operating system and install it.
  2. Open the following page, then click the Clone in Desktop button.
  3. Navigate to <path-to-git>\sp\game and copy the mod_hl2 or mod_episodic folder to <Steam-folder>\steamapps\sourcemods

Source SDK 2013 on Windows

The Source SDK currently does NOT work with Visual Studio 2015.

Step One

  1. Download and install Visual Studio 2013.
  2. Run Visual Studio, then under Tools, select Extensions and Updates.
  3. From the left list, select Updates, Product Updates, then select Visual Studio 2013 Update 5 and push the Update button.
  4. Run VS2013.5.exe and agree to the license, push the Install button, then follow the on screen instructions.
  5. Download and install the Multibyte MFC Library. This only works for Visual Studio Enterprise, Professional or Ultimate editions, so if you followed step 1, you're out of luck here. Try the old instructions, for Visual Studio 2010.

Step Two

  1. Download the following archivemirror and extract the sapi51 folder to <path-to-git>\sp\src\utils and <path-to-git>\mp\src\utils
  2. Navigate to <path-to-git>\sp\src\ and run createallprojects.bat and creategameprojects.bat
  3. Navigate to <path-to-git>\mp\src\ and run createallprojects.bat and creategameprojects.bat

Step Three

Note.png Note: The Everything solution also contains the Game solutions along with other tools.
  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.png Note: If something fails at the end then simply rebuild the solution.
Note.png 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.png 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.png 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

Step One

  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.png Note: The games.xcodeproj and everything.xcodeproj files will be created.

Step Two

  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 Three

To run the tools, run this command under Terminal.

make -f games.mak


Note.png 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

  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

This will create games.mak and everything.mak.

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

3. Download and setup the runtime, pick your architecture and debug/release preferences. Then answer Y to everything else. 4. Run the following ./ commannd. 5. Run the (chroot) environment ./ --arch=i386. This environment should be used to build your the SDK.

Step Three

> make -f games.mak

At this point you should have and 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 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.

Manually Setting up Microsoft Speech SDK (SAPI)

Warning.png Warning: This step is an alternative to downloading the archive provided on step 2. If you downloaded the archive you DO NOT need to perform this step.

The Source SDK requires the Microsoft Speech SDK but doesn't come with it for licensing reasons. Download the Speech SDK 5.1 from here. This should download the SpeechSDK51.exe file. Run this and it should unzip contents to a selected folder. One of the contents it unzips is Microsoft SDK 5.1.msi. Running this with the default settings should create a directory in C:\Program Files (x86) called Microsoft Speech SDK 5.1. Copy the Microsoft Speech SDK 5.1 directory into the src/utils directory and rename it sapi51.

Compiling now shows a number of errors in the sphelper.h file. There is more than one way to fix these errors. This section will describe how to fix them manually.

Change the following lines t have the code shown below.

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

Note.png Note: Building now might generate an error unresolved symbol _IID_IspPhoneticAlphabetSelection. This was perhaps caused because you had already built and the partial build is broken. This could be fixed by rebuilding the phonemeextractor project.

Issues fixed

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))