How do I get the most from my Dedicated Server?
Both HL1 (HLDS) and Source (SRCDS)
There are three types of servers in Half-life and Source Games:
The HLDS Server is available from the Tools menu.
When running a Server under Win32, the default is to run the Server at normal priority.
Priority is basically a setting that tells the operating system what tasks to service first and for how long. Servers are very real-time applications and players are very sensitive to lag. Running your Server at normal priority can cause unpleasent lag. The solution is to run your server at High priority.
WindowsXP assigns every program and process running on your PC a priority which determines the relative amount of CPU time that it gets compared to other programs. XP offers several settings: Realtime, High, AboveNormal, Normal, BelowNormal and Low .
Realtime is not recommended since it competes with the device drivers and can cause instability.
Most programs are assigned the Normal priority, but using the Task Manager you can change the priorities assigned to any process or program.
To manually change the priority of a running program or process:
When you assign a new priority to a process or program, the new priority setting only lasts as long as the program or process is continuously running. The next time you launch the program, it will default to the priority assigned by Windows.
If you wish to launch your HLDS at high priority every time, you must use a batch file.
Here is an example .bat file that runs a Half-Life Deathmatch server.
Inside the file it looks like this:
start /high c:\HLServer\hlds.exe -game valve -port 27015 +maxplayers 9
Here's a breakdown of the commands:
cd c:\HLServer - Changes the directory to the directory where the server is installed.
-game valve - Specifies the game, in this case Half-Life Deathmatch.
-port 27015 - Sets the port which the server will accept connections through (port 27015 will be used by default if no port is specified)
+maxplayers 9 - Sets the maximum number of players the server will accept to nine.
Source Dedicated Servers (SRCDS.EXE) should be run at AboveNormal priority not at High.
start /high c:\HL2Server\srcds.exe -game hl2dm -port 27015 -ip xxxx.xxxx.xxxx.xxxx +maxplayers 9
The maxplayers setting should be optimized related to your uplink connection. If you are unsure of your uplink connection speed, go to www.dslreports.com and run the free speed test.
You will see two numbers, download and upload (or uplink).
Download is how fast you can get data to the server. Upload/uplink is how fast the server can send data out to players.
Basically for internet connections (bits/second):
Your particular optimal setting may vary depending on your connection. Local players on LAN are not included in this count.
A good rule for HLDS is 35.6Kbits per player .
A good rule for SRCDS (Source Games) is 53.4KBits per player (about 1.5x more than HLDM).
Certain maps and MODs may take more uplink bandwidth.
This maxplayers setting also assumes you are running the following server rate limits (in the server.cfg file):
//minimum rate allowed
// use 5000 for SRCDS Servers
// no limit on maxrate for LAN only use 7500 for regular server
// this controls how fast maps can be downloaded by clients
//sv_maxrate 0 = unlimited
// Use 9999 for SRCDS servers
// this is the minimum playable updaterate, leave this at 13
// 60 for updaterate is LAN ONLY use 13 for internet
// 20 is default but will cut the maxplayers you can handle in 1/2
// for SRCDS Servers use 30 - you might be able to use 20
// sv_maxupdaterate 60
You can use the following set of alias parameters to test your server rate quickly.
Put these in your server.cfg file:
//echo *** Adding Server RATE Alias' ***
alias dslow sv_minrate 2500;sv_maxrate 2500;sv_minupdaterate 5;sv_maxupdaterate 5;echo dead slow
alias vslow sv_minrate 3500;sv_maxrate 3500;sv_minupdaterate 13;sv_maxupdaterate 13;echo very slow
alias slow sv_minrate 3500;sv_maxrate 5000;sv_minupdaterate 14;sv_maxupdaterate 14;echo slow
alias norm sv_minrate 3500;sv_maxrate 7500;sv_minupdaterate 15;sv_maxupdaterate 15;echo normal
alias fast sv_minrate 3500;sv_maxrate 9999;sv_minupdaterate 20;sv_maxupdaterate 20;echo fast
alias vfast sv_minrate 3500;sv_maxrate 20000;sv_minupdaterate 20;sv_maxupdaterate 60;echo LAN fast
// quick display of all the current settings
alias rates sv_minrate;sv_maxrate;sv_minupdaterate;sv_maxupdaterate
Download cs_server_cfg_file.cfg (must be renamed to server.cfg for use)
Download hl2dm_server_cfg_file.cfg (must be renamed to server.cfg for use)
server.cfg files for SRCDS are placed in the CFG folder for each Game Type.
HLDS Servers render frames independently from the Client.
HLDS Servers use the CVAR sys_ticrate to control how many frames per second are rendered.
SRCDS Servers use the CVAR fps_max to control how many frames per second are rendered.
Why do you need to control this?
There are two good reasons for you to manage the server FPS. The number one reason is loading on your Server CPU. The higher the FPS the higher the load. If you are getting more than 50% CPU utilization with your current FPS settings, you are either running too many players or you have the FPS set too high.
HLDS Servers start with a default of 60FPS and can easily run up to 1000FPS (sys_ticrate 1000)
SRCDS Servers start with a default of 300FPS but can also run up to 1000FPS, though that framerate will require a substantially higher performance CPU.
Win32 Servers should be run on WIN2K / XP Pro platforms with HLDS on a 1.8GHz cpu and a minimum of 512MB of RAM and SRCDS Servers should be run on 2.2GHz CPUs minimum with 512MB of RAM.
Unfortunately, both of these servers will not achieve these FPS settings on a Win32 platform without one tweak. In order for the server to get service from the operating system, there must be a high-resolution timer running. Normally, the operating system runs a low resolution timer that is only good for a max of maybe 100FPS.
Running Media Player (you need not play a file, just have it sitting there open) will force the operating system to use a high-res times that will give your server the capability of running up to 1000FPS. Media Player requires about 5MB while in idle, so it offers relatively low overhead for this improvement. You can also run a Macromedia SWF file in Internet Explore and it will do the same thing.
If you set sys_ticrate (HLDS) or fps_max (SRCDS) to 1000, most Intel CPUs running on Intel chipsets will run the full 1000fps (plus or minus a few). AMD CPUs and Intel CPUs on non Intel motherboard chipsets may only run at 500FPS with a setting of 1000.
The key reason to run higher FPS is the render time. At 1000FPS, the server is rendering one frame every 1 millisecond (ms). This means that the worst-case adder to the player ping is only 1ms, IE: the player gets more accurate data and can get it more often.
At 300FPS it's only 3ms which is perfectly acceptable, but at 100FPS it's 10ms, which is a significant percentage of a 100 ping (10%). A player with a 100 ping would actually be getting 110ms response time from the server. Many AMD systems will only run 60FPS without the ping booster which is 17ms.
This is still not too significant but it can change the feel and response time of your server for players.
Without the FPS Boost your server will use significantly less CPU but accuracy may suffer.