With the largest fanbase of any game ever released and well over 50 awards to it's name, Half-Life by Valve Software is undoubtably one of the greatest games ever. Half-Life's great assets though is it's modding potential and as shown by brilliant titles such as Counter-Strike, Day of Defeat, Team Fortress Classic, there is no question as to why more mods exist for Half-Life than any other game. If you havn't given this game a whirl and one of it's many mods you are definitely missing out!

Report this article 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 d0t on Sep 26th, 2004 digg this super bookmark
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

Quote:HasWeapon( CBasePlayerItem *pCheckItem );

to

Quote: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

Quote:i = sqrt(i);

to

Quote: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

Comments
ShortCutMan
ShortCutMan Oct 16 2004, 8:47pm says:

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

+1 vote     reply to comment
d0t
d0t Feb 22 2005, 10:39pm says:

thanks! :)

+1 vote     reply to comment
bobby0415
bobby0415 Jul 5 2006, 10:32am says:

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

+1 vote     reply to comment
bobby0415
bobby0415 Jul 5 2006, 10:37am says:

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

+1 vote     reply to comment
bobby0415
bobby0415 Jul 5 2006, 9:23pm says:

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

+1 vote     reply to comment
bobby0415
bobby0415 Jul 5 2006, 11:40pm says:

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

+1 vote     reply to comment
Post a Comment

Only registered members can share their thoughts. So come on! Join the Mod DB community today (totally free) and do things you never thought possible.

Icon
Half-Life
Platform
PC
Developer & Publisher
Valve
Engine
GoldSource
Contact
Send Message
Official Page
Valvesoftware.com
Release Date
Released Oct 26, 1998
Game Watch
Track this game
Bookmark
Digg Super bookmark
Tutorial
Browse
Tutorials
Views
1,041 (2 today)
Report Abuse
Report this article
Bookmark
Digg Super bookmark
Related Games
Half-Life
Half-Life
Single & Multiplayer First Person Shooter