Half-Life
(Servono più voti)
How to setup Visual Studio [Gold Src Modding]
Da B L λ C K F L λ M E
I am creating this guide so those people who are interested in modding can learn where to start
In this guide you'll learn how to
  • Configure Visual Studio (2019 or above) alongside Half-Life Gold Src SDK for programming
  • Learn How to build,run and compile the code
  • Run the game in Debug mode
Let's begin
   
Premio
Aggiungi ai preferiti
Preferito
Rimuovi dai preferiti
Installation
What to do?
  • Must have Visual Studio 2019 (or above) installed (If don't have it why are you even here dude?)
  • Download Half-Life updated SDK from SoloKiller's (Now Known as SamVanheer) Github Repository HERE[github.com]
    After downloading the ZIP file extract it anywhere
The Installation section is complete now double check everything before moving forward
Opening project file and configuration
Step 1
Navigate the "halflife-master" folder after you've extracted it and locate the projects.sln file
The path is
halflife-master\halflife-master\projects\vs2010
Here's an image to show which file to open
Step 2
Now you WILL and MUST see an image that asks you to update VC++ compiler and libraries
Click OK


Step 3
To the extreme right of the IDE will be 6 projects in the Solution Explorer

We're interested in using hldll (bold means start up project)
NOTE:-If hldll isn't the start up project (which it MUST BE) simply right-click hldll and select "Set as StartUp Project"

Step 4
Now we need to make changes to hldll's properties so simply right-click on it and select "properties"
Now you should have a menu like the one below,change the configuration in the top-left corner to "All Configurations" (Highlighted in screenshot below).This means that changes we make to the properties page will be the same throughout all other project configurations in our case both "Debug" and "Release".


Step 5
Now to disable post build processes which is shown in screenshot below


Step 6
Now we're going to make some changes to the "General" tab under "Configuration" as shown in screenshot below
The default path is
$(Configuration)\$(ProjectName)\
Change it to directory where your Half-Life installation is and where you'll find hl.dll
For me it is
D:\SteamLibrary\steamapps\common\Half-Life\valve\dlls

Now after configuring your tab should look somewhat like this


Step 7
Now to set the debugger
We need to provide path to hl.exe in our debugger tab
go to "Debugging->Command" to provide the path to hl.exe
In my case it is
D:\SteamLibrary\steamapps\common\Half-Life\hl.exe
You'll also see "Command Arguments" below "Command"
copy and paste the following arguments into "Command"
-windowed -debug -dev
Now set the "working directory" below command arguments to the root Half-Life directory
which for me is
D:\SteamLibrary\steamapps\common\Half-Life
This is how it is supposed to look
Build Project
Now time to build our project. Go to build->Project Only->Build only hldll
My screenshot looks like this because I unloaded all other projects don't worry if yours looks different that's ok too


Now wait for the compilation to complete
And yes there must be some warnings that appear when our code is compiling
That's because C++ evolved over time and the sdk was released by Valve on github in 2013

To disable warnings
Right-Click on hldll and go to "properties" and go to "configuration properties" from there it is like
configuration properties->C/C++->Advanced
and make sure that the configuration is set to "All Configurations" On the top left of the properties window

now copy this line below
4028;4058;4996
and paste it in "Disable Specific Warnings"
your screen MUST look like this now


Now apply settings and compile the code again,No more warnings will appear
Your build has now succeeded and for verification you can go to the Half-Life directory and check for the timestamp of the newly generated hl.dll
For me it is located here

D:\SteamLibrary\steamapps\common\Half-Life\valve\dlls

If everything is done correctly to this point now we can run the game from visual studio

Click on the Local Windows Debugger Button


If everything has been done correctly you should now see that Half-Life is running now through steam

But if steam isn't running you'll receive an error saying

Failed to Initialize authentication interface. Exiting...



If every instruction of this guide was followed correctly then YOU WILL DEFINITELY SEE Half-Life running

and this will appear on your screen

Thank You
Thank You for reading my guide

If this guide helped you please rate it up
16 commenti
B L λ C K F L λ M E  [autore] 8 mag 2022, ore 0:08 
@DavilarekPL @BUTTERDOGESTARWARS Sorry for late response I updated the SDK required for this

Use SoloKiller(SamVanheer)'s updated Half-Life sdk with VS2019 or above
DavilarekPL 8 feb 2021, ore 2:24 
I can't build it in vs 2019 because 628 errors
BUTTERDOGESTARWARS 7 ago 2020, ore 17:51 
It did have filecopy.bat
however, it didn't show the name of the files that were missing
B L λ C K F L λ M E  [autore] 7 ago 2020, ore 17:17 
Join the twhl (the whole half-life) discord server and post your issue there it is a very helpful community which basically is a "forum" of modders like you

https://twhl.info/news/view/351
B L λ C K F L λ M E  [autore] 7 ago 2020, ore 17:14 
does your mod directory have those files which appear to be missing?
BUTTERDOGESTARWARS 7 ago 2020, ore 16:28 
adding to the last part of my comment, parts of the directories were blocked out by a bunch of dots (like this: . ).
BUTTERDOGESTARWARS 7 ago 2020, ore 16:16 
'p4' is not recognized as an internal or external command,
1> operable program or batch file.
1> The system cannot find the file specified.
1> 'p4' is not recognized as an internal or external command,
1> operable program or batch file.
1> The system cannot find the file specified.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I cut a part out, but it basically just typed the mod compile directory and, strangely, the directory for filecopy.bat
B L λ C K F L λ M E  [autore] 7 ago 2020, ore 16:00 
Post the error message here
every detail that you can share
BUTTERDOGESTARWARS 7 ago 2020, ore 13:40 
hl_cdll fails to compile. What do I do?
BUTTERDOGESTARWARS 7 ago 2020, ore 13:36 
Thank you!