[page=Introduction]
current version: 1.0
Many people have been asking me how to get their mod to compile successfully with Visual Studio .NET and how to get it working on Steam. After about 20 people asking me this, I decided to write a tutorial for it. This tutorial is almost noob friendly.
version 1.0 - finished first version, posted on moddb
//version 0.5 - almost done
//version 0.2 - half done
//version 0.1 - just starting
[page=Note]
This tutorial will be written for the multi player source, which uses the "mp" project. If you are building the single-player source, substitute the "mp" project for the "hl" project.
[page=Requirements]
-Visual Studio .NET (No DL Link - Not Free)
-Half-Life SDK either Standard or Source
'- Standard: Code, Model base, plugins, etc. (Link) (Alternate Link)
'- Source: Source Code Only (Link) (Alternate Link)
[page=Starting Up]
First of all, launch the development environment. Open up the file dlls\weapons.h and go to line around 448. Change
HasWeapon( CBasePlayerItem *pCheckItem );
to
BOOL HasWeapon( CBasePlayerItem *pCheckItem );
Now close that file, and open up cl_dll\hud_spectator.cpp. Scroll down to around line number 1079, and change
i = sqrt(i);
to
i = sqrt((float)i);
Save and close that file as well.
[page=Building Server DLL]
Now it's time to build the DLLs. First we will build the server side DLL. Open up the dlls\mp.dsp file in the .NET environment. A dialog box will pop up saying "The project 'mp.dsp' must be converted...
[page=Building Client DLL]
Now we will do the same for the client.dll. Open the cl_dll\cl_dll.dsp file. Again it asks you to convert, convert it, and use the cl_dll\cl_dll.vcproj file. Change the cl_dll solution's Active Config to Release just like in the mp solution, and build. Save the solution as the default name again and wait for the building to finish. The dll will be built as cl_dll\Release\client.dll.
[page=Setting up on Steam]
If you got this far, good job, you built your mod without problems! If not, check over that you did all the steps.
Well, you built your mod, and you're probably wondering, how to install it on Steam? It's not that hard.
Run half-life at least once so the folder is created, then GO to "Steam install dir"\SteamApps\"YOUR ACCOUNT"\half-life and make a folder for your mod. Let's say I am calling my mod "modDB Tutorial Mod". I would make a folder called moddbtut (only make it up to 8 chars, no spaces or symbols, just letters and numbers). In there make four folders: "dlls", "resource", "maps" and "cl_dlls". Now in the root mod folder (my example = moddbtut) create a file called "liblist.gam" and open it in notepad. Put in this:
//name of your mod
game "modDB Test Mod"
//the following are only for single player mods, uncomment if mod is SP
//startmap "mission01"
//trainmap "training01"
//leave next 2 as is
svonly "0"
cldll "1"
//the DLL. change to location. change to dlls\hl.dll if singleplayer mod
gamedll "dlls\mp.dll"
//if mod is MP leave the setting below, if SP change to singleplayer_only
type "multiplayer_only"
Change the things relevant and save. Now copy over the mp.dll into the dlls folder and the client.dll into the cl_dlls folder.
Now, if you want your mod to have a custom menu, (by menu I mean the New Game/Load Game/etc) then, go to resource and create two new files. One name GameMenu.res and one name YOURMODDIR_english.txt (yourmoddir changes to the directory of your mod, for me it would be moddbtut).
In GameMenu.res put somthing similar to this, edit it to suit your needs:
"GameMenu"
{
"1"
{
"label" "#YOURMOD_ResumeGame"
"command" "ResumeGame"
"OnlyInGame" "1"
}
"2"
{
"label" "#YOURMOD_Disconnect"
"command" "Disconnect"
"OnlyInGame" "1"
}
"3"
{
"label" ""
"command" ""
"OnlyInGame" "1"
}
"4"
{
"label" ""
"command" ""
"notmulti" "1"
}
"5"
{
"label" "#YOURMOD_Browse"
"command" "OpenServerBrowser"
}
"6"
{
"label" "#YOURMOD_Create"
"command" "OpenCreateMultiplayerGameDialog"
}
"7"
{
"label" ""
"command" ""
}
"8"
{
"label" "#YOURMOD_Options"
"command" "OpenOptionsDialog"
}
"9"
{
"label" "#YOURMOD_Quit"
"command" "Quit"
}
}
and in the YOURMODDIR_english.txt reflect the values, eg.:
"lang"
{
"Language" "English"
"Tokens"
{
"YOURMOD_ResumeGame" "Resume"
"YOURMOD_Disconnect" "Disconnect"
"YOURMOD_Create" "Create Game"
"YOURMOD_Browse" "Join Game"
"YOURMOD_Options" "Options"
"YOURMOD_Quit" "Quit"
}
}
Save. Now into the map folder, copy any HL map, download one, whatever. For me if I didn't have a map in there my mod would crash. So find some sort of map and copy it over. Now open up the Games list in Steam and under third party games, your mod should be listed. Double click it to open. Configure the settings, and using the menu, create a server and play.
[page=Finishing]
Congratulations! You have successfully built and installed your mod. If you have any questions or find errors, email me at artemh@gmail.com or just post a comment. Also if you find this helpful, want to thank me, etc, send an email or post a comment.
I hope this helped you, as it did for me and my friends :D
Neat tutorial, explains a bit of everything coding side too!
thanks! :)
Everytime I compile all the .dps I always get a lot of errors. And when the solution is complete it says "succesful 0, failed 1" and it gives my a folder named release with files in it, but it doesn't make a dll. Any suggestions?
Things I've tried to fix this problem:
DLed 2 SDK packs
Tried compiling both mp and hl - had the same results...
And yes, my version of VS is: Microsoft Visual Studio 2005 - also with .Net framework..... believe me... that is the "right" program..
Sorry I forgot to mention, the errors I get, well, theres like 300 of them.... so basically the build always fails...
Hmm. sorry bout the mix up but.... if i compile it in "debug" mode it will give me a dll but it's only a partial dll instead of a full dll...
Ok all fixed, turns out that it is hell trying to compile with 2005 vs, all you gotta do is get vs 2003 and it works perfectly. No errors, you just build the .dsp and it works so perfect that the only hard part of it is waiting for it to complete its building xD, but thanks for the tut anyway :).. Because it did help me find out where to put the dlls and how to start making my mod..... ;) keep it up!!!!
please how to converted to dll in bloodshave c++?
were do you download steam?
Store.steampowered.com There you go, sir.
I can't find visual studio 2003. help please!
Do i really need to use VS 2003, because i have Visual C++ 2010 Express.