Half-Life

Half-Life

Not enough ratings
Starting a Dedicated Server
By hiphopparappa
This guide will show you how to create a dedicated server for any GoldSource game, including Half-Life, Opposing Force, Counter-Strike, Ricochet, and other GoldSource mods.
Note: OPT. = optional section
   
Award
Favorite
Favorited
Unfavorite
I. Setting a Static IP Address
Before we begin, we need to set a static IP address to our computer. You need to download a program called Port Forward Network Utilities[portforward.com] to continue. Once it is installed, select the Static IP Address option in the menu. Select your network device in the drop-down menu and press the Make it Static button.
The reason why we are doing this is because if your IP address is still dynamic, it will keep changing every time you restart your PC and it needs to be the same.
II. Port Forwarding
Finding the Default Gateway
Before you get to the server part, you need to forward some ports on your router so that Half-Life Dedicated Server (the tool we're using) can use them, and clients from other networks can access those ports.
Open your start menu and type cmd and open the Command Prompt. Elevation is not required. In the command prompt, type the command ipconfig. A list of configurations for the network devices you have will appear. Find the one you're using, and get the address for your Default Gateway. Type that address in the URL bar of your browser. NOTE: make sure you keep CMD open!! We will need it later. You should have a prompt appear to type a username and password. Most routers have the username and password admin, but some people, like me, have the username admin and a password. You can go to your router and there should be a sticker showing the default gateway password (it isn't the one you use to connect to your router). If you can't find it, you should look around the house for any other things that came with the router, or contact your ISP.

Port Forwarding
Now, we can port forward! Find the page for port forwarding on your router settings. If you can't find it, your ISP should show you how on their website.
Using this page we can add "rules" to your router. Create one, [name it whatever you want] and enter the IP for your PC. In ALL the boxes where you can enter a port, type 27015 and select the TCP protocol and save the rule. Repeat the exact same step, but this time, use the UDP protocol. NOTE: you cannot use the "UDP/TCP" protocol. Repeat the same step again, but this time, type the port 27020. Make sure you keep the UDP protocol. Repeat the step again, but with the port 26900.
Now, you should be port forwarded!
III. Downloading Half-Life Dedicated Server (HLDS)
SteamCMD
You'd think you could just go into Steam Tools and download the tool from there, but for unknown reasons, that version of the tool is broken. You need to download SteamCMD to get the fixed version of the tool. Extract the ZIP to any folder you want [if you have multiple drives, save it to the one with the most space, 3 GB+ is recommended]. Now, you can open SteamCMD and wait for it to download all the files it needs.

Half-Life Dedicated Server
Once SteamCMD has finished downloading, you can sign in to your Steam account, though if you don't want to, you can try using the anonymous account.

Your account:
login <USERNAME>

Anonymous:
login anonymous

Once you're logged in, you can install Half-Life Dedicated Server (we will refer to it as HLDS from now on). In SteamCMD, type app_update 90 validate and it will begin downloading, then it will validate all the files. The download will suddenly stop, so type the command again until there are no more updates. Once it is finished, go to your SteamCMD folder, then steamapps, common, Half-Life.
IV. Setting up HLDS
Create a batch file in your HLDS folder. The batch file tells HLDS what settings to use. Name the batch file with the name of the game/mod of which you want to host a server for. You can create more batch files for different mods/games.

Format:
hlds.exe -console -game <game/mod folder> +maxplayers <2-32> +map <map> -ip <your ip> +port 27015
The -game variable is not required for normal Half-Life.

Example:
hlds.exe -console -game cstrike +maxplayers 32 +map de_dust2 -ip 192.168.1.1 +port 27015

If you want mods/other games, such as Counter-Strike, copy their folders from your Half-Life directory, which can be found by going to Half-Life's properties in your Steam library, LOCAL FILES and then BROWSE LOCAL FILES. Copy the mod/game folder to your HLDS directory.

Folder names
Half-Life: valve
Counter-Strike: cstrike
CS Condition Zero: czero
Deathmatch Classic: dmc
Opposing Force: gearbox
Ricochet: ricochet
007 Nightfire: nightfire
Gunman Chronicles: rewolf
Day of Defeat: dod
Team Fortress Classic: tfc
For mod folder names, play the mod, open the console and type gamedir
Tracking Your Progress
HLDS should be able to work at this point, though with only basic functions. Before we go any further, start your batch file for Half-Life and make sure you have your IP on your clipboard. Open Half-Life, open the console, and type connect <your IP> and you should be able to join. If it says STEAM validation rejected, close the server and run the batch file again.

If you're able to join the server, you now need to see if other people from other networks can join. Search "what it my ip address" or just "ip" and your public IP address should appear. You can send this to playtesters of the server and they should be able to join if you port forwarded correctly.

To shut down your server, do not simply close the HLDS window, otherwise players will just lose connection. Type quit in the server console and players will be kicked from the server before HLDS closes with the message "Kicked: server shutting down."
V. Configuring HLDS
In your HLDS directory, go to the game/mod folder you want to host for, and open server.cfg with Notepad. The default looks like this:
// Use this file to configure your DEDICATED server. // This config file is executed on server startup. // disable autoaim sv_aim 0 // player bounding boxes (collisions, not clipping) sv_clienttrace 3.5 // disable clients' ability to pause the server pausable 0 // default server name. Change to "Bob's Server", etc. // hostname "Half-Life" // maximum client movement speed sv_maxspeed 270 // load ban files exec listip.cfg exec banned.cfg

In this file you can change the server name, how fast players can move and add your own commands you want to run on server startup. It is recommended that you add // custom commands at the bottom of the file to enter your own commands. See section VII for a list of commands.

In ordinary deathmatch games such as Half-Life, Opposing Force, Team Fortress Classic and Deathmatch Classic, they have a mapcycle.txt file which allows you to change what maps you want in the server. After a match, the server uses that file to decide the next map. Plugins for AMX MOD X (see section VI) allow players to vote for the next map.
VI. [OPT] AMX MOD X
AMX MOD X is the plugin base for all servers that run on HLDS. I will not show you how to install and make your own plugins.
You can download it here[www.amxmodx.org] and in the installer, select Select Mod Directory and choose the game/mod in your HLDS directory that you want to host for.
VII. HLDS Commands
There are lots of handy commands in HLDS that you can use to make your server better. A lot of SV commands that work in Half-Life also work in HLDS, such as sv_airaccelerate. These commands can be added to your // custom commands section of your server.cfg file.

changelevel
Value: <mapname>
Function: Changes the map without kicking out all players.

maxplayers
Value: 2-32
Function: Changes the amount of players that can be in the server. Changes are applied on the next changelevel

sv_maxspeed
Value: 10-<no max>
Function: Changes how fast players can walk. Jumping may be slowed down due the the bunnyhop cap implemented into the engine in 2003.

hostname
Value: <your server name in quotation marks>
Function: sets the server name shown in server browser and leaderboard

sv_password
Value: <your password in quotation marks, with no spaces>
Function: Sets a password to the server. Players will need the password to connect to and join the server.

If you want more commands let me know in the comments.
VIII. Conclusion
You should now be able to run your own server. If you ran into any problems, let me know in the comments.
Thank you for reading this guide!
< >
25 Comments
hiphopparappa  [author] Mar 16 @ 10:45am 
No, you don't. The Trial feature is perfectly functional for making a static IP and has no time limit. And once the user has made their IP static they are free to uninstall the software.
varhansen1 Mar 9 @ 5:53pm 
You should mention that you have to pay for that Port Forwarding software
hiphopparappa  [author] Mar 4 @ 11:53am 
moleman, can you confirm that your IP is static? open port forward networking tools [in trial mode], go to Static IP Address, and select the correct network adaptor in the drop-down list. it should say "your IP address is currently static."
moleman Feb 28 @ 5:27pm 
followed this guide and was able to set up my own server. It's both showing on my LAN and internet server list but my steam friends can't see it. I tried giving them my public IP to manually connect to but it won't let them connect with an error of either "server not responding" or "failed to contact game server".
hiphopparappa  [author] Feb 6 @ 2:43pm 
I'm assuming you're giving your friend your public IP address and not the local one on your computer, right?
You can find your public IP by googling "what is my ip address"
Bahzzle Jan 29 @ 3:22pm 
Yeah, that's what I was wondering too, so I had my friend try to join the server, but he got the "failed to contact game server" error. I asked him if he could find the server in the browser, he said he couldn't so I gave him the IP to connect to.
hiphopparappa  [author] Jan 29 @ 10:30am 
How so? If you launch the game on the computer that's also running the server, it might show up in the LAN tab of the server browser - that's normal. Are other people able to join it?
Bahzzle Jan 28 @ 8:35pm 
My console says:
"Console initialized.
Protocol version 48
Exe version 1.1.2.2 (valve)
Exe build: 19:52:53 Aug 3 2020 (8684)
STEAM Auth Server
Server IP address (My IP & Port)
"sv_lan" is "0"
Connection to Steam servers successful.
VAC secure mode is activated."
But it still refuses to launch as a non-lan server :(.
hiphopparappa  [author] Jan 28 @ 7:21am 
Bahzzle, trying adding "sv_lan 0" to your server.cfg file - that should fix it. :)
Bahzzle Jan 27 @ 6:03pm 
Yes, that did fix the issue! Now my only problem is that the server keeps booting up as LAN, which to my knowledge, means only people on the same network can join the server. I have all my ports forwarded, my IP is static, and my network is ready for sharing in windows. I have limited experience with networking, so your help is much appreciated.