Difference between revisions of "Setup mod on steam"

From Valve Developer Community
Jump to: navigation, search
m (Change whith to with)
 
(6 intermediate revisions by 3 users not shown)
Line 13: Line 13:
 
It would get tedious to copy over the mod directory everytime 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 everytime 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 terminal (Windows: cmd.exe)
+
* Open up your terminal (Windows: cmd.exe, OS X: Applications/Utilities/Terminal, Linux: xterm or terminal)
 
* Change directory to ''<steam_path>/sourcemods/''
 
* Change directory to ''<steam_path>/sourcemods/''
 
* Create a symlink to your mod directory
 
* Create a symlink to your mod directory
 
** Windows: ''mklink /J <mod_name> <path_to_source>/<sp|mp>/game/<mod_hl2mp|mod_hl2|mod_episodic>''
 
** 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.  
+
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 =
 
= Change output directory =
Line 40: Line 41:
  
  
= Problems whith running your mod =
+
= Problems with running your mod =
  
If, at startup, '''after video, game is crashes''' '''(STEAM IS ON)'''. But, '''if STEAM IF OFF''', the mod '''runs without problems''', then you need:
+
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:
  
  
 
1 - to Open file '''steam_api.h''' (src\public\steam)
 
1 - to Open file '''steam_api.h''' (src\public\steam)
  
2. - Find this and '''DELETE''' or '''COMMENT''' (about line 550):
+
2. - Find this and '''DELETE/COMMENT''' (Lines 551 - 562):
  
  
Line 63: Line 64:
 
}
 
}
 
</source>
 
</source>
 
--[[User:Slam12f|Slam12f]] ([[User talk:Slam12f|talk]]) 02:26, 21 October 2015 (UTC)
 
  
  
 
[[Category:Programming]]
 
[[Category:Programming]]

Latest revision as of 19:08, 1 July 2018



Mod files

In order to launch your mod then the necessary files need to be created in your steamapps folder. The source 2013 sdk 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 (or mod_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. Every time you rebuild your binaries you will need to make sure to copy them to your mod directory under sourcemods/ before you launch your mod.

Symlink mod directory

It would get tedious to copy over the mod directory everytime 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 terminal (Windows: cmd.exe, OS X: Applications/Utilities/Terminal, Linux: xterm or terminal)
  • Change directory to <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:


1 - to Open file steam_api.h (src\public\steam)

2. - 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;
	}