SRCDS Steam group


Post Reply 

Left 4 Dead 2 - Dedicated Server Answers (SRCDS - Windows)

Author Message
Unnecessary Complications Offline
Newbie

Posts: 3
Joined: Nov 2011
Reputation: 0
Post: #1
Left 4 Dead 2 - Dedicated Server Answers (SRCDS - Windows)
This post is a bit of a guide, a plea for help, an attempt to spell out some things, and hopefully a place to put together a more complete understanding of how to setup a L4D2 Server.

I've scoured the Internet. I've read many many forum threads, webpages, and tutorials. The answers to setting up a l4d2 dedicated server are just not out there in a complete and proper way.

The two main things we all see in so called tutorials (aside from how to download and update it using the HLDS tool) are how to configure the server configuration file (server.cfg) and the start up script batch file (startup.bat).

Let's build a start up script. A start up script can be either A. a windows shortcut B. a batch file or C. a manually typed command line. I'm just using the batch file version since it's as easy and the most versatile of the 3. In this case, you just create a text file named name.bat (whatever name you want) and enter some commands into it using notepad. A typical script that I come across is:

Code:
start /wait left4dead2\srcds.exe -console -game left4dead2 +hostip YOUR.WAN.IP.ADDY -ip YOUR.LAN.IP.ADDY +hostport 27016 +clientport 27006 -nohltv +maxplayers 8 +exec server.cfg +map l4d_hospital05

The start up script data varies from tutorial to tutorial. (I'm pretty sure many of the tutorials are verbatim copies of each other ...sighs... this means if one is wrong many are) From what I gather only a few things are completely necessary: a start command, the proper path, the -game left4dead2 parameter, the -console parameter, and an initially loaded map using the map name_of_map parameter OR through the execution of a separate configuration file.

Code:
start path\path\srcds.exe -console -game left4dead2 +map name_of_map

Dissecting the start and path part: Duh, we have to call the executable we want to run in the first place. There are a few variations from tutorials here. Mainly they are in the optional usage syntax of the batch command start. Look up a tutorial on the start command if you want to know all there is to know about start. Also likely you will want to enclose the path part of the command to avoid having trouble with paths that contain spaces. The path is determined via the relationship between the batch file itself and the executable being called OR not at all determined by this relationship when a complete path starting from drive letter to executable is declared. I prefer to use the relationship method since this way I can transport my entire server folder structure and not have to worry about links (paths) being broken. Where the executable srcds.exe is two directories below the start up batch file in a folder named "path" which itself is in a folder named "my path" the script would look like this:

Code:
start "my path\path\srcds.exe"
Generally this translates to:
start "directory name you gave to the HLDS update executable\left4dead4\srcds.exe"

Many tutorials use /wait as part of a watchdog script to restart a crashed server instance by waiting for termination of the app before continuing to the next line in the batch. Usually the next lines would contain some sort of goto command pointing the script back to the beginning to relaunch the executable. There is also a supposedly non optional title syntax enclosed in quotes that is to go before the path portion:

Code:
start "title you want - does little" "directory name you gave to the HLDS update executable\left4dead4\srcds.exe"

(PS: The -console parameter just puts the game server in console (black window) mode.)

From what I've read and through trial and error, Left 4 Dead 2 no longer uses or needs several of those additional parameters in the start line. Namely:
+hostip
-ip
+hostport
+clientport
-nohltv
+maxplayers


(citation need)
+hostip is deprecated. I have read that L4D2 master servers will automatically determine the WAN IP of a dedicated server. I am having trouble with this myself and do not know specifics.
-ip parameter is unnecessary unless you have multiple NICs in the server or multiple IPs on one NIC. The game server will bind to the network IP of your physical server.
+hostport is actually a deprecated parameter replaced by -port. The game server will bind to port 27015 by default and each instance after that will bind to the next higher port 27016+. For most installations, assigning a port appears unneeded.
+clientport is apparently deprecated and unused.
-nohltv I've read conflicting answers on this one. Most sources agree that L4D2 does not use or perhaps even support Half Life TV. This appears unnecessary.
+maxplayers Defining max players does not seem to apply to L4D2 since L4D2 allows only 4 or 8 max players for games. Don't count this parameter out entirely as it does play a part for certain mods and specials also count against the player count in certain setups.
(/citation need)

You will undoubtedly find additional parameters defined in other tutorials you read. Many of those parameters can be defined in the *.cfg files also. The question then is "Where the F_%@ is the right place for them?" The answer to that I can't give you at this time. As a long time server admin I assume that only the most basic parameters needed to start the game server should ever go in the start up script. Namely, things like IP, Port, initial map or initial *.cfg file to parse. I have not read anywhere (like that matters... much of this info seems spotty at best) that certain parameters are required to be defined upon initial start up rather than defined later while parsing a *.cfg file. Case and point would be the +hostport parameter. You can define it in either the start up script or a *.cfg file. As best I can tell only the last one read matters.

Now let's talk about the configuration file server.cfg. Only a few sources will tell you that this file is run on every map load (though it is sorta mentioned at the top of the file). Often, you are tempted (as was I) to place cvars in this file assuming they are only read/executed once. In fact, one uber failure is to add a map load command in this file. Upon loading of any map the server will read the server.cfg file, execute the map line and begin to load the map specified.... in which case the server reads the server.cfg file and..... In this file, I would only configure what things are common to all game/map/play scenarios. In other words, things like Server name, which steam group the server is bound to, whether or not cheats are allowed, what network rates are allowed, does it create log files, etc. Depending on what you want most other game/map/play related parameters/cvars are best put in their own *.cfg file and called/executed from the console or from other *.cfg files.

A typical server.cfg is:
Code:
//##Server.cfg###########################
//Basic server cfg - loaded on each map #
//#######################################


/////////////////////////
//Server info
////////////
hostname YourServerName        //Hostname for server
rcon_password "passwordhere"    //remote console password
sv_password ""             //Server password for entry into multiplayer games [only needed to make your server private.]
sv_contact "EmailHere"        //contact email for server sysop


/////////////////////////
//Internet, region, lobby setup
////////////
hostport 27016            //default 27015; Host game server port
sv_lan 0             //Server is a lan server (no heartbeat, no authentication, no non-class C addresses) [enable LAN = 1; disable LAN = 0]
sv_region 0             //The region of the world to report this server in.
sv_allow_lobby_connect_only 0     //default 1; If set players may only join this server from matchmaking lobby, may not connect directly [enable/disable Lobby connections only 1/0]


/////////////////////////
//Game Settings
////////////
mp_disable_autokick 1         //(command)prevents a userid from being auto-kicked (Usage mp_diable_autokick )
sv_allow_wait_command 0        //default 1; Allow or disalow the wait command on clients connected to this server.
sv_alternateticks 0        //defulat 0; (singleplayer)If set, server only simulates entities on even numbered ticks.
sv_clearhinthistory 0        //(command)Clear memory of server side hint displayed to the player.
sv_consistency 0        //default 1; Whether the server enforces file consistency for critical files
sv_pausable 0            //default 0; is the server pausable
sv_forcepreload 1        //default 0; Force server side preloading
sv_pure_kick_clients 0        //default 1; If set to 1, the server will kick clients with mismatchng files. Otherwise, it will issue a warning to the client.
sv_pure 0            //If set to 1, server will force all client files execpt whitelisted ones (in pure_server_whitelist.txt) to match server's files.
                //If set to 2, the server will force all clietn files to come from steam and not load pure_server_whilelist.txt. Set to 0 for disabled.

/////////////////////////
//communication
////////////
sv_voiceenable 1        //default 1; enable/disable voice comm
sv_alltalk 1            //default 0; Players can hear all other players' voice communication, no team restrictions


/////////////////////////
//LOGGING
////////////
log on            //Creates a logfile (on | off)
sv_logecho 0            //default 0; Echo log information to the console.
sv_logfile 1        //default 1; Log server information in the log file.
sv_log_onefile 0    //default 0; Log server information to only one file.
sv_logbans 1        //default 0;Log server bans in the server logs.
sv_logflush 0        //default 0; Flush the log files to disk on each write (slow).
sv_logsdir logs        //Folder in the game directory where server logs will be stored.


/////////////////////////
//Bans
//  execute banned.cfgs at server start. Optimally at launch commandline.
//  Put writeip/wrtieid commands in the bottom of server.cfg AFTER banned.cfgs have loaded.
////////////
exec banned_user.cfg    //loads banned users' ids
exec banned_ip.cfg    //loads banned users' ips
writeip          //Save the ban list to banned_ip.cfg.
writeid          //Wrties a list of permanently-banned user IDs to banned_user.cfg.


/////////////////////////
//Master server - "setmaster" - add/remove/enable/disable master servers
////////////
//Usage: setmaster
setmaster add 188.40.40.201:27011  
setmaster add 68.142.72.250:27011
setmaster add 72.165.61.151:27013


/////////////////////////
//Network Tweaks - Increase network performance
////////////
rate 10000        //default 10000; Max bytes/sec the host can recieve data
sv_minrate 15000       //default "5000"; Min bandwidth rate allowed on server, 0 = unlimited
sv_maxrate 30000    //default "0";  Max bandwidth rate allowed on server, 0 = unlimited
sv_mincmdrate 20    //default 0; This sets the minimum value for cl_cmdrate. 0 = unlimited [cevo=67]
sv_maxcmdrate 33    //default 40; (If sv_mincmdrate is > 0), this sets the maximum value for cl_cmdrate. [cevo=101]

So much is apparently wrong here. First of all, hostport is arguably not needed as discussed above. If you plan for multiple game server instances perhaps this is a valuable entry though it is still deprecated and replaced with -port in the start up script. Next we have mp_disable_autokick. This cvar isn't recognized by SRCDS... at least during my testing of SRCDS as a L4D2 server. The next thing may be useful and may not.
Code:
/////////////////////////
//Master server - "setmaster" - add/remove/enable/disable master servers
////////////
//Usage: setmaster
setmaster add 188.40.40.201:27011  
setmaster add 68.142.72.250:27011
setmaster add 72.165.61.151:27013
My testing has been inconclusive and I've read conflicting things about their use on a L4D2 server. I believe these entries are left here as part of some outdated code or perhaps for servers for other source games. These cvars are valid to SRCDS but I have yet to see them make any difference to the function of the game server. (citation need)

The next section
Code:
/////////////////////////
//Network Tweaks - Increase network performance
////////////
rate 10000        //default 10000; Max bytes/sec the host can recieve data
sv_minrate 15000       //default "5000"; Min bandwidth rate allowed on server, 0 = unlimited
sv_maxrate 30000    //default "0";  Max bandwidth rate allowed on server, 0 = unlimited
sv_mincmdrate 20    //default 0; This sets the minimum value for cl_cmdrate. 0 = unlimited [cevo=67]
sv_maxcmdrate 33    //default 40; (If sv_mincmdrate is > 0), this sets the maximum value for cl_cmdrate. [cevo=101]
..... now here's a headache waiting for you. There is so much differing things about these entries out there on the net. Where a L4D2 server is concerned I've read where cmdrate entries do not even matter and that it's lock at 33 I believe it was. There are also other entries you're likely to come across:
sv_unlag
sv_maxunlag
tickrate
client fps
server fps
sv_maxupdaterate
sv_minupdaterate
cl_updaterate
cl_cmdrate
So many of these apparently do not apply to a L4D2 SRCDS game server. The best I can gather from all the sources I've reviewed is that these are the required/desired/applicable settings you should use here:
Code:
///////////////////////////////////////////////
//Network Tweaks - Increase network performance
///////////////////////////////////////////////
rate 10000        //default 10000; Max bytes/sec the host can receive data
sv_minrate 5000       //default "5000"; Min bandwidth rate allowed on server, 0 = unlimited
sv_maxrate 30000    //default "0";  Max bandwidth rate allowed on server, 0 = unlimited
Mainly we're just talking about bandwidth. How fast can your server receive data from clients and how fast can it be sent out. More accurately how MUCH/TIME can be transmitted/received by your server.

Now that we've went over (sporadically in some cases) many of the WTFs you'll come across while researching L4D2 Dedicated Server Guides, Let's ask the experts here at SRCDS.com some questions.

-How do you actually get your L4D2 server to register with the master servers so that it provides its WAN IP for clients to connect? hostip and setmaster do not seem to make one bit of difference during my testing.
-Would solving the above problem also solve the situation where players cannot join the server via a Lobby?
-Is there any way to take in, as a variable perhaps, the map desired to play on from a lobby and place it into a cvar so that that map loads as a mutation. For instance, clients start a lobby on c1m1_hotel of Dead Center as a normal game, but when they arrive they find themselves in a mutation (in my case Iron Man) and perhaps even of difficulty expert that cannot be changed??
-And finally... please please does anyone know how to keep dead survivors dead? I'd like to make Iron Man what it should have been from the beginning. No more safe room come backs.


Please feel free to correct anything found in error here. I'm learning just as those who will undoubtedly find this thread with many of the same WTFs as I've come across while trying to get things setup perfectly and contemporary. (/run on)
(This post was last modified: 12-09-2011 04:34 PM by Unnecessary Complications.)
11-28-2011 09:24 AM
Find all posts by this user Quote this message in a reply
realchamp Offline
Super Moderator

Posts: 7,778
Joined: May 2008
Reputation: 83
Post: #2
RE: Left 4 Dead 2 - Dedicated Server Answers (SRCDS - Windows)
Moved to tutorials. Would probably fit better in here.
11-29-2011 06:07 AM
Find all posts by this user Quote this message in a reply
Unnecessary Complications Offline
Newbie

Posts: 3
Joined: Nov 2011
Reputation: 0
Post: #3
RE: Left 4 Dead 2 - Dedicated Server Answers (SRCDS - Windows)
Wink Thanx
11-29-2011 06:08 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:





User(s) browsing this thread: 1 Guest(s)