26 ratings
Setting up a single player Source Engine 2013 mod.
By Wazanator
A guide that shows you how to setup a single player mod on the Source Engine SDK 2013 branch.
Rate  
Favorite
Favorited
Unfavorite
Things you will need to download
To start off you're going to need to download a few things:

  • The source code for 2013 off of GitHub. Link to Page[github.com] Direct Link to the Zip file[github.com]

  • Notepad++[notepad-plus-plus.org] is great for looking at text files (.cfgs, .txt, etc)

    NOTE: Default notepad has some issues when looking at files like gameinfo.txt the formatting is kind of off. It's still usable but I highly recommended notepad++ so you dont have to deal with it.

  • Microsoft Speech SDK 5.1[www.microsoft.com], just choose SpeechSDK51.exe.

  • Multibyte MFC library[www.microsoft.com] (install this AFTER visual studio 2013)

  • Source SDK base 2013 Singleplayer

  • Visual Studio 2013[www.visualstudio.com] NOTE: If you are a currently enrolled student you can get this product for free from Microsoft

    OR

    Visual Studio 2013 Express[www.visualstudio.com] if you don't want to buy the full version and are not a student. NOTE: You will have issues most likely with compiling the everything.sln later on you can ignore that and just compile games.sln instead it gives you the proper .dlls you need.

Once you have installed both Source SDK base 2013 singleplayer and visual studio 2013 run both to make sure they launch before continuing.
Setting up the work folder
Choose a location you want for your mod source files to be. This will serve as the location that you will keep all your files both WIP and final. This includes but isn't limited to maps, models, sounds, textures, scripts, code, etc.

Once you've picked out a spot create a new folder and name it your mods name.

Move the source-sdk-2013-master.zip into this folder, right click it and choose to extract it here.

Open up the Source-sdk-2013 folder and delete the MP branch since we do not need it.

NOTE: For some odd reason code compile is only successful for people if they put their main mod folder at C:/

Example: C:/modname/sp/
Setting up Microsoft Speech SDK (SAPI)
Run the SpeechSDK51.exe file you downloaded. 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 of your mod and rename it sapi51.

Navigate to sp\src\utils\sapi51\Include and open sphelper.h in visual studio.

The following are changes you need to make to the code (hint if you line numbers are off by default read this[msdn.microsoft.com]):

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

Setting up the codebase
Navigate to source-sdk-2013\sp\src

Right click createallprojects.bat and choose edit. Select all the text and press delete. Copy the following code and paste it in:

pushd %~dp0
devtools\bin\vpc.exe /hl2 /2013 /episodic +everything /mksln everything.sln
popd

Same thing with creategameprojects.bat

pushd %~dp0
devtools\bin\vpc.exe /hl2 /2013 /episodic +game /mksln games.sln
popd

Run both.

Open games.sln in visual studio 2013. It shouldn't ask if you want to update files but if it does say yes. Right click on the everything solution and go to properties.


Choose Configuration Properties then click Configuration Manager...


For the Active Solution configuration choose Release


Click Close, then OK.

Right click on the everything solution again but this time choose "Rebuild Solution". Wait for it to compile. If you did everything correctly you should get no errors. If you get an error debug it like you normally would, if you have never really coded before this means google the error and try and figure out why it broke on your own. Yes this might mean spending thirty minutes to an hour to figure out what broke. If you can't figure it out and you have put a good amount of time into trying to do it on your own post on the forums as well as other places like stack overflow.

Click File -> Open -> Project/Solution and find the everything.sln you created earlier.

Do the same thing as above.

NOTE: If you do not plan on modifying things like vbsp, vrad, vvis, shaders and the like you do not need to bother with everything.sln
Setting up the mod folder
Go to Steam\steamapps\common\Source SDK Base 2013 Singleplayer

Copy the hl2 folder.

Paste it into Steam\steamapps\sourcemods (should be about 2.6 GB)

Rename it to your mods name (if your mods name contains spaces use underscores instead).

Open the folder up.

Delete the following:

  • ALL vpk files

  • Both of the vpk.sound.cache files

Make sure the following folders exist:

  • bin

  • cfg

  • maps

  • materials

  • media

  • models

  • particles

  • resource

  • scripts

  • sound



The gameinfo.txt file [IMPORTANT]
The https://developer.valvesoftware.com/wiki/Gameinfo.txt is a very important file for your mod. It's what tells the engine what to call your mod in steam, the title to use on the main menu, what kind of mod it is, and most importantly what files to mount.

First thing you need to do upon opening it up is select everything and delete it. Then copy paste this in:

"GameInfo"
{
game "Our Example Mod"
title "Our Example Mod"
type singleplayer_only

FileSystem
{
SteamAppId 243730 // Source SDK Base 2013 Singleplayer
SearchPaths
{
// No /custom/ folders because they can interfere with mod content and shouldn't be in mod gameinfo.
game+mod+mod_write+default_write_path |gameinfo_path|. // Mod
gamebin |gameinfo_path|bin // Mod's Binaries

// Base Half-Life 2 Content: ep2, episodic, hl2
game_lv |all_source_engine_paths|hl2/hl2_lv.vpk
game |all_source_engine_paths|hl2/hl2_english.vpk
game |all_source_engine_paths|hl2/hl2_pak.vpk
game |all_source_engine_paths|hl2/hl2_textures.vpk
game |all_source_engine_paths|hl2/hl2_sound_vo_english.vpk
game |all_source_engine_paths|hl2/hl2_sound_misc.vpk
game |all_source_engine_paths|hl2/hl2_misc.vpk
platform |all_source_engine_paths|platform/platform_misc.vpk

// TODO; find out what is it and why it's here
game |all_source_engine_paths|hl2
platform |all_source_engine_paths|platform
}
}

}

Of course change/add things to this file as you want.

Now then if you want to mount additional content from a game like Counter-Strike: Source this is the file you do it in. Follow Valves example, in the case of CSS it would look like:

game "|all_source_engine_paths|../Counter-Strike Source/cstrike/cstrike_pak.vpk"
The bin folder
The bin folder is where your client and server .dll files will go from your compiled code

Navigate to ModSourceFolder\source-sdk-2013\sp\src\game\client\Release_mod_hl2 and copy the client.dll and paste it into the bin folder located in your steamapps\sourcmodes\modname

Same thing for server.dll
The cfg folder
The cfg folder is where you will keep all your config files for the game.

Common .cfg files found in this folder include:

  • 360controller.cfg (Button mapping for gamepads)

  • undo360Controller.cfg (undoes the gamepad settings)

  • config_default.cfg (Default button mapping for keyboard and mouse players)

  • config.cfg (Game creates this one on it's own, it stores the users current keybindings and loads them up automatically)

  • chapter#.cfg (Typically runs the map command followed by the name of the map that starts the chapter off but can be used to run other commands as well) example:
    map d1_trainstation_05

  • modsettings.cfg (Loaded by the engine on startup. If this file is not present in the mod's cfg folder, will not fallback based on search path)

  • skill.cfg (Default stats for your weapons, npcs, etc, the game assumes these are the values to be used when played on normal difficulty and adjusts them depending on what difficulty the player picks)

  • skill_manifest.cfg (executes the skill.cfg, must have for skill.cfg to work)

  • thirdperson.cfg/thirdperson_joy360.cfg/thirdperson_keypad.cfg/thirdperson_mayamode.cfg (thirdperson settings)
The maps folder
Shockingly this is where you put your maps for your mod
The materials folder
This is where you put your materials. Please try and keep some consistency and order when putting materials in here.

For example I suggest having a "models" folder for where materials that models use go. Brick is where brick textures go, etc.
The models folder
Models go here, again like the materials folder try and keep them organized.

Popular organization methods:

  • General folders such as junk, boxes, pipes, skybox, etc

  • Folders for models that are used only in one level

  • Folders for non props such as npc models
The particles folder
This is where you will place your particle files
The resource folder
The resource folder is the folder that is used to contain close caption text, icons, fonts, cursors, UI and just general .res files.
The scripts folder
The folder that is used to hold the script files for things like soundscapes, weapon scripts, chapter titles, propdata, sentences, sound scripts for npcs, soundmixers, hudlayout, game sounds, ui animations, vehicles, effects and a lot more.

Take an hour and go through these so you know what it is you can change via the scripts.
The sound folder
Surprise this is where your sound files go. Shocking
You're done!
Now just restart steam and your mod name should popup in the library ready to be launched!
46 Comments
< >
Kon Oct 19 @ 6:36am 
'Visual Studio Express 2013 for Windows Desktop'
Wazanator  [author] Oct 18 @ 10:15pm 
Which version of virtual studio are you using?
Kon Oct 18 @ 2:15pm 
Also did that for when I opened everything.sln, and I do not know what I did wrong on here.
Kon Oct 18 @ 2:14pm 
Help, after I ran the .bat files and I opened games.sln - I get this.[puu.sh] Can anybody help me to solve this?
Thamstras Oct 15 @ 6:07am 
If I may suggest a couple changes:
1) You currently need to opt in to the "upcoming beta" branch of Source SDK 2013 Base Singleplayer in Steam tools or your mod will not load
2) You should set to release, rebuild everything.sln then copy sp/game/mod_episodic or /mod_hl2 to steamapps/sourcemods, then rename the folder and edit gameinfo.txt appropriately. copying the hl2 folder from the SDK base leaves you with a load of un-needed stuff. (in fact, you only need the bin, resource, scripts and shaders folders from mod_episodic or mod_hl2, but that's going a little deeper than necessary.)
The Elite Gir Oct 8 @ 9:14pm 
For some reason Hammer is just loading defaults (as if scripts are missing)whenever I try to make edits and there's an uncompiled file marked hl2_scripts.dsp in the scripts folder. Did I miss something?
Jack Skellington³ Oct 5 @ 7:50am 
Is there a difference between Visual Studio 2013 and Visual Studio 2013 Express for Windows Desktop?
func_i1lusI0nary Oct 3 @ 3:09am 
Can't find games.sln,after run creategameprojects.bat
Wazanator  [author] Oct 1 @ 8:34pm 
If you don't plan on modifying shaders you can just compile games.sln
func_i1lusI0nary Oct 1 @ 5:47pm 
Why I see WARNING: No shaders found in stdshader_dx9_30.txt?
(run createallprojects.bat after) sorry for my bad english...