Es/Setting up Source SDK Base 2013 Multiplayer
Para empezar, necesitarás coger el código de fuente desde Valve Software Source SDK repository GitHub. ¡Después, podrás ser capaz de compilar la compilación y programar nuevos mods!
Obteniendo el código
GitHub te proporciona numerosas maneras para obtener el código y actualizarlo. Aquí tienes unas instrucciones para obtener el código de manera principal, pero Ayuda de GitHub es una buena fuente para aprender a cómo utilizar Git, y las novedades añadidas de GitHub.
Vía directa
La manera más fácil de mantenerse actualizado y tener siempre la última versión del código actualizado, es usar Git para obtener el repositorio. Git en sí, es una "CLI" para todas las plataformas, pero GitHub también te proporciona instaladores que instalan la versión CLI y una interfaz para ayudarte a mantener tus repositorios.
GitHub (Windows & Mac)
- Obtén GitHub.
- Instala GitHub .
- Visita el Source SDK 2013 en tu navegador, y pincha en "Clone in Desktop".
- Esto abrirá el programa GitHub. Sigue las instrucciones para clonar el repositorio en tu ordenador.
Cuando quieras descargarte una versión moderna del código, lo puedes hacer haciendo clic en "Sync" (sincronizar) o "Sync Branch" (sincronizar ramas).
Git CLI (Para todas las plataformas)
Instrucciones detalladas para cómo montar Git en cualquier plataforma, incluyendo la actualización del repositorio. [1].
Con el CLI instalado, puedes obtener el código usando una línea parecida a esta:
> git clone git@github.com:ValveSoftware/source-sdk-2013.git
Descarga directa
También puedes descargarte el ZIP. Esto te dará la última versión, pero tendrás que manualmente descargarla para actualizar el código. Si planeas contribuir en el repositorio con tus aportaciones al código, necesitarás seguir las instrucciones de arriba para Git, con una instancia separada de tus archivos locales.
Descarga la última versión de Source SDK 2013
Instrucciones de compilación para plataformas específicas
Creando el proyecto y los archivos
El SDK de 2013 usa el Valve Project Creator (VPC) para generar los archivos específicos para el proyecto. Estos archivos son específicos para las plataformas y son requeridos para montar el SDK. Una vez que completes este paso no necesitarás volver a llevarlo acabo si una actualización requiere nuevos archivos de proyecto.
Ve a estos directorios y ejecuta los archivos .bat para empezar a montar.
Windows
# Proyecto de un jugador (Singleplayer) > <Directorio del SDK>/sp/src/creategameprojects.bat > <Directorio del SDK>/sp/src/createallprojects.bat # Proyecto multijugador (Multiplayer) > <Directorio del SDK>/mp/src/creategameprojects.bat > <Directorio del SDK>/mp/src/createallprojects.bat
Este paso creará los archivos del Visual Studio (.vcxproj) y los de la solución (.sln) en el directorio SRC.
Nota: ¡Si no tienes Visual Studio, recibirás errores en el proceso de arriba!
Mac OS X & Linux
Nota: Mac OS X Mavericks necesita hacer cambios en algunos archivos para compilar el proyecto: Elimina el -fpredictive-commoning desde OTHER_CFLAGS en el archivo src/devtools/release.xcconfig. Cambia SDKROOT a macosx10.8 en src/devtools/base.xcconfig.
# Proyecto de un jugador (Singleplayer) > <Directorio del SDK>/sp/src/creategameprojects > <Directorio del SDK>/sp/src/createallprojects # Proyecto multijugador (Multiplayer) > <Directorio del SDK>/mp/src/creategameprojects > <Directorio del SDK>/mp/src/createallprojects
En Mac OS X, esto creará los archivos "src/games.xcodeproj" y "src/everything.xcodeproj".
En Linux, "src/games.mak" y "src/everything.mak"
Información sobre el VPC
Para obtener información sobre cómo usar el VPC, observa los scripts o ejecuta el siguiente comando:
> <Carpeta del SDK>/<gameType>/src/devtools/bin/vpc /help
Nota sobre el repositorio Git y los archivos ignorados
Los archivos de proyecto generados por VPC son listados en el .gitignore, de seta manera no son publicados en el repositorio. Los que quieran publicar sus cambios deben hacerlo haciendo una petición informando de lo que se está subiendo.
Añadiendo archivos a tu proyecto con VPC
VPC genera archivos de proyecto para todas las plataformas que el SDK soporta, así que si quieres añadir archivos a tu proyecto de una manera que te pueda permitir montar fácilmente en otras plataformas, considera usar VPC. Por ejemplo, para montar un mod multijugador, puedes añadir la línea a src/game/client/client_hl2mp.vpc
Windows
Prerequisitos
Para montar el Source SDK 2013 en Windows necesitarás Microsoft Visual Studio 2010 con Service Pack 1. También es posible usar el Visual Studio 2012 con el compilador de Visual Studio 2010 mediante "no actualizar" las configuraciones del proyecto para el nuevo compilador.
Si también quieres montar el proyecto phonemeextractor tendrás que descargar el SAPI 5.1 desde Microsoft. No se puede incluir el SDK Speech con el Source SDK por que son de empresas distintas. Simplemente descarga "SpeechSDK51.exe", elige el destino de extracción, y extrae. Ve al directorio donde extraíste los archivos y ejecuta el instalador MSI. Localiza "C:/Archivos de programa (x86)/Microsoft Speech SDK 5.1" , copia su contenido a "src/utils/". Renombra la carpeta "Microsoft Speech SDK 5.1" a "sapi51" y el phonemeextractor funcionará.
Montando
¡Recuerda primero haber leído el apartado de la creación de archivos!
- Abre la solución "everything" para el tipo de proyecto que desees crear (singleplayer o multiplayer)
- everything.sln
- Monta la solución de arriba.
- Abre la solución de arriba para el juego que estás montando.
- games.sln
- Monta la solución de arriba.
En este punto deberías tener el client.dll y el server.dll para cargar el Source Engine en el que estás basando el mod.
Montando los "shaders" (efectos)
Si estás planeando añadir nuevos efectos gráficos en tu mod necesitarás montar los archivos runtime shader en Windows. Los shaders son efectos gráficos, como los reflejos del agua, espejos, el fuego, la iluminación, las sombras, el humo y las partículas en general.
- Ve a Inicio, y ejecuta "cmd" y haz el comando CD en uno de los siguientes :
sp/src/materialsystem/stdshaders
(para mods de un solo jugador)mp/src/materialsystem/stdshaders
(para mods multijugadores)
- Duplica el archivo
build<gamename>shaders.bat
y renómbralo amontarmisshaders.bat
COPY /B build<gamename>shaders.bat montarmisshaders.bat
- Abre el archivo que renombraste
montarmisshaders.bat
en un editor de texto. - Cambia la variable
SDKBINDIR
a la localización de lainformación del cliente desde Steam. Esta carpeta puede cambiar según dónde hayas instalado el juego.
set SDKBINDIR=<steaminstallpath>\SteamApps\common\Source SDK Base 2013 Singleplayer\bin
- Ejecuta el
montarmisshaders.bat
Para más información sobre autorizando shaders en el Source SDK, consultar Shader Authoring.
Compiling Source SDK 2013 with Visual Studio 2012
Valve recommends that mod creators should use Visual Studio 2010 with Service Pack 1 to create a mod. However, this section describes how to compile a mod using Visual Studio 2012. Follow the guide on this page up until the Windows - Prerequisites section. In the Windows - Prerequisites section, it recommends that the mod creator does not update the Visual Studio projects and touches on the fact that the mod creator will have to obtain sapi.lib from Microsoft's Speech SDK. This section will describe instead how to 1. obtain and setup the Speech SDK library, 2. setup the necessary protobuf library and 3. setup and compile the Source SDK 2013 with Visual Studio 2012.

Setting up Microsoft Speech SDK (SAPI)
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.
SPDBG_ASSERT(eEventId == SPEI_PROPERTY_STRING_CHANGE);
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
Nota: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.
Setting up protobuff
The Source SDK 2013 requires a protobuff version 2.3.0 library. A detailed set of instructions on obtaining and compiling the protobuf library can be found here on the Allied Modders Wiki.
Once compiled, copy the libprotobuf.lib
file from protobuf-2.3.0\vsprojects\Debug
or protobuf-2.3.0\vsprojects\Release
, depending on which configuration it was built in, and paste it into the src\lib\public
directory.
Setting up the Visual Studio Projects
Open everything.sln in either the source-sdk-2013\sp\src
or source-sdk-2013\mp\src
directory depending on if your mod is a single player or multiplayer mod, respectively. A prompt should appear asking if you want to update the VC++ compiler and libraries for each project in the solution. More details of this process can be found here. Click the Update
button to update the projects and solution. If you don't get such a prompt or earlier chose not to update, the projects within the solution can be updated to the newest Visual Studio at any time by right-clicking on the solution and selecting Update VC++ Projects
.
Select the project configuration to be build, either Debug or Release. This is done by right-clicking on the everything
solution in the solution explorer, selecting properties
, then navigating to Configuration Properties/Configuration Manager/Active Solution Configuration
, selecting either Debug or Release (Debug is default), pressing Close
and then Ok
.
Now build the solution by right-clicking on the everything
solution in the solution explorer and clicking Build All
. Now close the everything
solution, open the games
solution and update the projects as you did for the everything
solution. Continue the guided setup process from the Building Shaders section.
Nota:Building the solution before updating sapi and updating the protobuf library may cause a number of compiler errors including missing sapi.lib
and _MSC_VER: value '1600' doesn't match value '1700'
. The following sections should fix these errors.
Nota:Once the build is complete, consider setting up your mod for debugging.
Mac OS X
Environment & Tools Setup
Mac OS X, you will need Xcode 4.2 installed. You will also need to have "Command Line Tools" installed. You can find this at:
XCode Preferences -> "Downloads" -> "Components"
Building The Tools
Remember to create project & make files first!
To run the tools, run this command under Terminal:
> make -f games.mak
When successfully built, you should have client.dylib and server.dylib files to load with the Source SDK Base 2013 of your choice.
Linux
Steam Client Runtime
To build the Source SDK 2013 on Linux you will need the Steam Client Runtime.
- Download the Steam Client Runtime.
- Run the following commands to extract the runtime:
> tar xvf steam-runtime-sdk_latest.tar.xz
> cd steam-runtime-sdk_<version>
Replace <version> with the version you just unpacked.
> ./setup.sh
Pick your architecture and debug/release preferences. Then answer Y to everything else.
> ./shell.sh --arch=i386
SDK Build
Remember to create project & make files first!
With the above prerequisite installed, run the following:
> 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.
Code Organization
Naming Conventions
The Source SDK is split into two directories at the root for <gameType>, followed by source for <gameName>. If you are building a single player mod, use the "sp" directory. If you are building a multi-player mod you should base yourself on the code in the "mp" directory.
- <gameType>
- sp (singleplayer)
- mp (multiplayer)
- <gameName>
- hl2 (Half-Life 2)
- episodic (Half-Life 2 Episodes)
- hl2mp (Half-Life 2: Deathmatch)
Each directory has a matching Source SDK 2013 Base appID to use to get the base mod files:
- Source SDK Base 2013 Singleplayer
- Client AppID: 243730
- Source SDK Base 2013 Multiplayer
- Client AppID: 243750
- Server AppID: 244310 (see SteamCMD for instructions on how to install this one)
These two base apps are very similar, differing mostly in update schedule. The Singleplayer base will only update with HL2 and the Episodes do, which isn't very often. The Multiplayer base will update a few times a year to incorporate engine changes from TF2 and Counter-Strike: Source. None of these updates should break mod compatibility.
Directory Structure
Under each of these directories is a very similar directory structure:
- game - Runtime files for the mods themselves. Your mod content will go in here.
- src - All the source code for that kind of mod. The root of the src directory contains .sln or root level .mak files for building the source.
- common - A few files used by the server and client DLLs
- devtools - Scripts and utilities that are used to build the source. These are called by the makefiles and projects and you probably won't need to interact with them directly.
- game - All of the source code for the DLLs.
- client - Code used by client.dll (or client.dylib or client.so). There are also game-specific directories under here.
- server - Code used by server.dll. There are also game-specific directories under here.
- shared - Code used by both client.dll and server.dll.
- gcsdk - A couple of tools used to build the DLLs.
- lib - Binary versions of the libraries that the source code depends on. This is also the build target for vgui_controls, tier1, and mathlib.
- mathlib - Math utilities used by the game.
- public - Header files for all of the DLLs and libraries that are used by the game. Also includes a few source files.
- thirdparty - Third party libraries needed to build the source. At the moment this contains only the Google Protocol Buffers (protobuf) library.
- tier1 - Useful utility classes. Builds into tier1.lib
- utils - Various development utilities
- vgui2 - Source code for vgui_controls, which is used by client.dll.
We recommend that you follow the conventions here as you add files for your own mod.
Common Errors
Common errors encountered in SDK 2013. Please use Discussion before posting other solutions.
vgui_controls
Doesn't Compile
As of 14 February 2014, Mangr0v3 had identified this as an artifact of building in a directory whose path contains spaces: vpc.exe will create .vcxproj files containing unquoted spaces in pathnames, some of which will then fail. See https://github.com/ValveSoftware/source-sdk-2013/issues/225
This problem was previously fixed by obtaining a fresh copy from the SDK distribution. If you're using a local GitHub repository, do a Sync (pull) on your repository. Otherwise you can download and reapply the ZIP file.
RegKey Errors While Generating Project Files
"ERROR: Unable to find RegKey for .vcproj files in solutions."
This problem is usually caused by missing file extensions associations in the your system registry.
Visual Studio 2010
Aviso:Make sure to have 2010 Visual Studio Service Pack 1 or later installed.
- Open Registry Editor
- Windows key + R
- Type 'regedit' without quotes and then hit Enter.
- Navigate to one of the following registry keys, based on the operating system you're currently using:
# For 32-bit (x86) Operating Systems:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Projects\{60dc8134-eba5-43b8-bcc9-bb4bc16c2548}
# For 64-bit (x64) Operating Systems:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Projects\{60dc8134-eba5-43b8-bcc9-bb4bc16c2548}
- At the key, you will need to create a new string value.
- Navigate to: New > String Value
- Fill out the following information:
- Name:
DefaultProjectExtension
- Value:
vcproj
- Click "OK" to save the registry key.
Visual Studio 2012
A tool has been created by a member of the community to fix this type of error on Visual Studio 2012. Use at your own risk.
Download source from GitHub (AutoIt v3 is needed).
Releasing on Steam
If you have a Source Engine game that you are interested in releasing on Steam, please read this FAQ for more details.