Post tutorial Report RSS Building the DLLs with VS.NET 2003 for Steam

Teaches you how to setup your VS.NET 2003 to build the Half-Life dlls, and how to get them working on Steam.

Posted by on - Basic Client Side Coding

[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...". Click yes. VS.NET will convert the project to be named dlls\mp.vcproj, so use that one from now on. In the Solution Explorer on the right, click on "Solution 'mp' (1 Project)". Look down to the Properties box and change Active Config to Release. Now click Build on the top menu, and go Build Solution. A Save File As box will pop up, just click Save and the DLL will start building. It will be built as dlls\Releasemp\mp.dll.

[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

Post comment Comments
ShortCutMan
ShortCutMan - - 806 comments

Neat tutorial, explains a bit of everything coding side too!

Reply Good karma Bad karma+1 vote
d0t Author
d0t - - 2 comments

thanks! :)

Reply Good karma+1 vote
bobby0415
bobby0415 - - 21 comments

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..

Reply Good karma Bad karma+1 vote
bobby0415
bobby0415 - - 21 comments

Sorry I forgot to mention, the errors I get, well, theres like 300 of them.... so basically the build always fails...

Reply Good karma Bad karma+1 vote
bobby0415
bobby0415 - - 21 comments

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...

Reply Good karma Bad karma+1 vote
bobby0415
bobby0415 - - 21 comments

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!!!!

Reply Good karma Bad karma+1 vote
ackar
ackar - - 164 comments

please how to converted to dll in bloodshave c++?

Reply Good karma Bad karma+1 vote
Guest
Guest - - 690,211 comments

were do you download steam?

Reply Good karma Bad karma0 votes
Admer456
Admer456 - - 823 comments

Store.steampowered.com There you go, sir.

Reply Good karma Bad karma+1 vote
tomaxx11
tomaxx11 - - 5 comments

I can't find visual studio 2003. help please!

Reply Good karma Bad karma+1 vote
Admer456
Admer456 - - 823 comments

Do i really need to use VS 2003, because i have Visual C++ 2010 Express.

Reply Good karma Bad karma+2 votes
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: