Windows Dedicated Server Setup

From GMod Wiki

Revision as of 20:56, 1 December 2011 by [Junkies] Xero (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Recommended Specs for your PC/Server. (For a 10 Slot Server) - 512MB Ram, 1.6GHZ Processor. Any lower, it will be very sensitive.

Contents

Win.png Windows / React-logo.png ReactOS

Please note: Due to memory issues, it doesn't work yet in ReactOS - but this is a temporary situation.

Welcome to the srcds installation tutorial. Here we will explain how to get a Source Dedicated Server running on Windows. We assume you have enough Windows knowledge to find, download, and run files, etc. Please read the whole tutorial before asking questions.


It's strongly recommended to use the Console version of srcds instead of the Steam GUI version. Here we will use the console version!


Getting started with HLDSUpdatetool

First of all download hldsupdatetool from the VALVe webserver. We save it to a temporary location. Do not save it to where your server will be, this will cause a conflict resulting in the error: "Please close the half-life dedicated server update tool that is already running. Now run the hldsupdatetool from the directory you saved it, just by double clicking on it like normal. Navigate through the wizard like you are used to, which means next most of the time. When it asks you about the destination folder, click browse. Type c:\srcds in the textfield and click on OK. Finish the wizard.

Directory.PNG


Now click on Start, Run and type cmd . Type in the commands mentioned here and end a line with the enter key. Command(s):

C:
cd \srcds
hldsupdatetool

The new version of HLDSUpdateTool will be downloaded now. After finishing the download and printing out some help, you may press enter to return to the prompt.

Downloading the files

We can start downloading the files. This can take a few hours depending on the connection the server uses.

Batch file installer

Batch files are little script files that tell Windows what to do. This batch file will install your server for you instead of you having to open cmd. You can also use this tool just to update your server's files, it wont reinstall your stuff unless the files are missing or have changed. First we open notepad. What we write in there is the following:
Command(s):

@echo off
cd c:\srcds\
echo This will take a long time, I would recommend you go do something else.
echo Updating/installing CS:S
hldsupdatetool -command update -game "Counter-Strike Source" -dir C:\srcds
echo Updating/installing L4D/L4D2
hldsupdatetool -command update -game "left4dead" -dir C:\srcds
echo Updating/installing Episode 1
hldsupdatetool -command update -game "episode1" -dir C:\srcds
echo Updating/installing dods
hldsupdatetool -command update -game "dods" -dir C:\srcds
echo Updating/installing hl2mp
hldsupdatetool -command update -game "hl2mp" -dir C:\srcds
echo Updating/installing tf
hldsupdatetool -command update -game "tf" -dir C:\srcds
echo Updating/installing Orange Box
hldsupdatetool -command update -game orangebox -dir C:\srcds
echo Updating/installing Garrysmod
hldsupdatetool -command update -game garrysmod -verify_all -retry -dir C:\srcds
echo Update/installation Complete
echo Installed to c:\srcds\
echo Your server is now ready to use!
echo To add extra addons or maps etc. place them in c:\srcds\orangebox\garrysmod\
echo This installer can also update necessary server files, so it is recommended that you run it often.
pause

Now save the file as server_download.bat in notepad (NOT .txt) and click the server_download.bat file. This batch file will download the garrysmod content aswell as CS:S, dods, hl2mp, tf, sin, and the ship content but it will not copy any non multiplayer content, see the next section for that.

Server Download Filetype.PNG


Install it manually

Now go back to your hldsupdatetool you originally downloaded. Right click it and click 'Create Shortcut'. Now right click the shortcut file you just created, click 'Properties'. In the 'Target' box, enter the following command after the location, *leave a space between the location and the command*. This will update your server when it needs updating.

Command(s):

-command update -game garrysmod -dir C:\srcds

You might want to go and grab a cup of tea at this point, maybe go for a jog.

Alternately: If you already have Garry's Mod 10, you can extract the server files from "steamapps/garrysmod.gcf" using GCFScape. If you haven't already, you will need to install Microsoft .NET Framework in order to run the program. This process is pretty straight-forward: open the GCF file using GCFScape. You can either drag and drop the garrysmod folder from the window to the correct directory, or right click, select extract, and browse to the correct directory.

GCF Extract.PNG

Please note that in the 2007 update of Garry's Mod, as it has moved to the Orange Box engine, the actual install directory of gmod will be located at:
./srcds/orangebox/
as apposed to:
./srcds/

note2: Do not set the hldsupdatetool -dir to /orangebox/ -- it won't work!
Once you have finished extracting, run the steps above to get the remaining few server files not included in the GCF file.

Extra Content

See: General_Server_Setup_Information

Port Forwarding

Before you can start your server, you have to have certain ports forwarded on your router.
You must first obtain you internal IP Address by pressing Start/Run then type in cmd then press enter.
A little black box will open up. In it, type ipconfig. Look for the item that is called Default Gateway and write down the number across from it.
Then find IPv4 Address and write that down. You can then close cmd by typing exit and pressing enter.
1.Go into your browser and type in your Default Gateway number into the address bar. (make sure to include the periods)
2.Enter in your router's username and password. If you do not know these, then you can contact whoever handles the router and they can tell you. (Parents, Boss, etc..)
3.Go to the menu area for Port Forwarding/Port Triggering
4.Open these ports:
PROTOCOL / INBOUND / OUTBOUND
UDP 1200 1200
UDP 26901 26901 (This will allow the server to show up on the master server list.)
UDP 27000 27015
TCP 27020 27039
UDP 27015 27015 (you may not be able to open this one, but it is suggested that you try)
UDP 27020 27020
TCP 27015 27015

If un - sure of how to Port Forward go to http://portforward.com/ and select your Router Type.

Starting srcds

First edit (or create) c:\srcds\orangebox\garrysmod\cfg\server.cfg like you want it to be. In this file, you can put rcon passwords, server passwords, sandbox settings, etc. Now we are ready to run the srcds. We can create another little batch file to do all this for us.

@echo off
cd c:\srcds/orangebox
echo Starting game server.
echo Beginning "Garry's Mod"
srcds.exe -console -game garrysmod +map gm_construct +maxplayers 16 -ip 0.0.0.0
echo "Garry's Mod" has now started.
echo It is recommended that you start Server Crash Recovery aswell.

Your srcds should now be up and running.

Server is on.PNG

If you want to use the GUI mode, with the interface do not add any options to it. (just srcds.exe)

Also, if you scroll to the top of the SRCDS console you'll see a bar telling you the Basic information about your server.

SRCDS Console Bar.PNG

Note that this will start the server at the default port, 27015. If you want to run multiple servers, either on a single machine or on multiple machines that share a single IP address, you have to set a different port number. Experimentation has shown that ports spaced about 20 apart will work, so a second server could be started with a slightly different batch file.

@echo off
cd c:\srcds/orangebox
echo Starting game server.
echo Beginning "Garry's Mod"
srcds.exe -console -game garrysmod -port 27035 +map gm_construct +maxplayers 16 -ip 0.0.0.0
echo "Garry's Mod" has now started.
echo It is recommended that you start Server Crash Recovery aswell.

This would start a server on the construct map at port 27035. To connect to this server, assuming the server itself is at 192.168.0.101, you would enter

192.168.0.101:27035

as the address of the server to connect to.

Crash recovery

Batch file recovery

Batch files are little scripts that tell Windows what to do. If srcds crashes, we can use a batch script to restart it for us.
What we are going to do is make sure that as soon HLDS suddenly quits it will restart. First we open notepad. Copy-paste this in:

@echo off
cls
echo Protecting srcds from crashes...
echo If you want to close srcds, close the srcds window and type Y depending on your language followed by Enter.
title Server Watchdog
:srcds
echo (%time%) srcds started.
start /wait srcds.exe -console -game garrysmod +map gm_construct +maxplayers 16
echo (%time%) WARNING: srcds closed or crashed, restarting.
goto srcds

Replace the marked part with your own commandline and values. Save the file as C:\srcds\orangebox\srcds.bat in notepad (NOT .txt) and next time click the srcds.bat file. If you need to close srcds, close the hlds window and press Y (depending on language) at the Terminate batch question. Also, it's important to note that this won't restart your server if it locks up and never closes. Error messages can be disabled to improve the chance that the bat file works properly.

Server Files

Server.cfg (Required) - Has all the necessary commands in this file. Edit with notepad/Notepad++.
Please Save as server.cfg
Download:
Here is the Server.cfg

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox