Setup mod on Steam: Difference between revisions
No edit summary |
(Visual changes) |
||
Line 1: | Line 1: | ||
{{cleanup|Article could be improved to include instructions for | {{cleanup|Article could be improved to include instructions for Mac/Linux}} | ||
=Mod files= | =Mod files= | ||
In order to launch your mod, the necessary files need to be created in your steamapps folder. [[Source SDK 2013]] provides some base files for you in the | In order to launch your mod, the necessary files need to be created in your <code>steamapps</code> folder. [[Source SDK 2013]] provides some base files for you in the <code>game/</code> directory. This folder contains all the necessary assets, binaries and scripts for your mod, the most important being <code>gameinfo.txt</code>, <code>bin/client.dll</code> and <code>bin/server.dll</code>. | ||
* Singleplayer: Copy the directory from | * Singleplayer: Copy the directory from <code><your mod>/sp/game/mod_hl2</code> (or <code>mod_episodic</code>) to <code><steam_path>/steamapps/sourcemods/<your mod></code> | ||
* Multiplayer: Copy the directory from | * Multiplayer: Copy the directory from <code><your mod>/mp/game/mod_hl2mp</code> to <code><steam_path>/steamapps/sourcemods/<your mod></code> | ||
Restart Steam after this step and you will find your mod listed in your Steam library. | Restart Steam after this step and you will find your mod listed in your Steam library. | ||
{{Warning|It is advised to create a symlink from <code>mod_</code> directory to the <code>sourcemods</code> folder instead, as changes done to the <code>mod_</code> won't be synchronized with the mod folder created inside the <code>steamapps</code> folder.}} | |||
=Symlink mod directory= | =Symlink mod directory= | ||
It would get tedious to copy over the mod directory every time we build our binaries, so instead we can symlink our ''mod_'' folder so that it is always up-to-date. First, delete the folder we created in the previous step under ''sourcemods/'' (if you have no other mods installed, this directory should be empty now). | It would get tedious to copy over the mod directory every time we build our binaries, so instead we can symlink our ''mod_'' folder so that it is always up-to-date. First, delete the folder we created in the previous step under ''sourcemods/'' (if you have no other mods installed, this directory should be empty now). | ||
# Open up your command prompt or terminal. | |||
# Navigate to directory ''<steam_path>/sourcemods/'' | |||
# Create a symlink to your mod directory | |||
* Windows: | |||
<pre> | |||
mklink /J <mod_name> <path_to_source>/<sp|mp>/game/<mod_hl2mp|mod_hl2|mod_episodic> | |||
</pre> | |||
* Linux: | |||
<pre> | |||
mkdir <mod_name> && sudo mount --bind <path_to_source>/<sp|mp>/game/<mod_hl2mp|mod_hl2|mod_episodic> <mod_name> | |||
</pre> | |||
Now, every time you update assets or rebuild your code in your | Now, every time you update assets or rebuild your code in your <code>game/mod_</code> directory the changes will automatically be there the next time you launch your mod. | ||
=Change output directory= | =Change output directory= | ||
You can change the output directory of your binaries to something other than | You can change the output directory of your binaries to something other than <code>mod_hl2</code>, <code>mod_episodic</code> or <code>mod_hl2mp</code> by right clicking Project -> Properties -> Build events -> Post build events and changing the paths as desired. This must be done for both Client and Server. | ||
Example | Example: | ||
<source> | <source> | ||
if not exist "..\..\..\game\MY_MOD\bin\." mkdir "..\..\..\game\MY_MOD\bin\." | if not exist "..\..\..\game\MY_MOD\bin\." mkdir "..\..\..\game\MY_MOD\bin\." |
Revision as of 03:22, 26 November 2023

Mod files
In order to launch your mod, the necessary files need to be created in your steamapps
folder. Source SDK 2013 provides some base files for you in the game/
directory. This folder contains all the necessary assets, binaries and scripts for your mod, the most important being gameinfo.txt
, bin/client.dll
and bin/server.dll
.
- Singleplayer: Copy the directory from
<your mod>/sp/game/mod_hl2
(ormod_episodic
) to<steam_path>/steamapps/sourcemods/<your mod>
- Multiplayer: Copy the directory from
<your mod>/mp/game/mod_hl2mp
to<steam_path>/steamapps/sourcemods/<your mod>
Restart Steam after this step and you will find your mod listed in your Steam library.

mod_
directory to the sourcemods
folder instead, as changes done to the mod_
won't be synchronized with the mod folder created inside the steamapps
folder.Symlink mod directory
It would get tedious to copy over the mod directory every time we build our binaries, so instead we can symlink our mod_ folder so that it is always up-to-date. First, delete the folder we created in the previous step under sourcemods/ (if you have no other mods installed, this directory should be empty now).
- Open up your command prompt or terminal.
- Navigate to directory <steam_path>/sourcemods/
- Create a symlink to your mod directory
- Windows:
mklink /J <mod_name> <path_to_source>/<sp|mp>/game/<mod_hl2mp|mod_hl2|mod_episodic>
- Linux:
mkdir <mod_name> && sudo mount --bind <path_to_source>/<sp|mp>/game/<mod_hl2mp|mod_hl2|mod_episodic> <mod_name>
Now, every time you update assets or rebuild your code in your game/mod_
directory the changes will automatically be there the next time you launch your mod.
Change output directory
You can change the output directory of your binaries to something other than mod_hl2
, mod_episodic
or mod_hl2mp
by right clicking Project -> Properties -> Build events -> Post build events and changing the paths as desired. This must be done for both Client and Server.
Example:
if not exist "..\..\..\game\MY_MOD\bin\." mkdir "..\..\..\game\MY_MOD\bin\."
copy "$(TargetDir)$(TargetFileName)" "..\..\..\game\MY_MOD\bin\.\$(TargetFileName)"
if ERRORLEVEL 1 goto BuildEventFailed
if exist "$(TargetDir)$(TargetName).map" copy "$(TargetDir)$(TargetName).map" ..\..\..\game\MY_MOD\bin\.\$(TargetName).map
copy "$(TargetDir)$(TargetName).pdb" ..\..\..\game\MY_MOD\bin\.\$(TargetName).pdb
if ERRORLEVEL 1 goto BuildEventFailed
goto BuildEventOK
:BuildEventFailed
echo *** ERROR! PostBuildStep FAILED for $(ProjectName)! EXE or DLL is probably running. ***
del /q "$(TargetDir)$(TargetFileName)"
exit 1
:BuildEventOK
Problems with running your mod
If, at startup, after the intro video, your mod crashes while Steam is active, but it runs without problem if Steam is shut down, then you follow these instructions:
- - to Open file steam_api.h (src\public\steam)
- - Find this and DELETE/COMMENT (Lines 551 - 562):
m_pSteamMusicRemote = SteamClient()->GetISteamMusicRemote( hSteamUser, hSteamPipe, STEAMMUSICREMOTE_INTERFACE_VERSION );
if ( !m_pSteamMusicRemote )
{
return false;
}
m_pSteamHTMLSurface = SteamClient()->GetISteamHTMLSurface( hSteamUser, hSteamPipe, STEAMHTMLSURFACE_INTERFACE_VERSION );
if ( !m_pSteamHTMLSurface )
{
return false;
}