Main Menu

Optimizing a Dedicated Server

How do I get the most from my Dedicated Server?
Both HL1 (HLDS) and Source (SRCDS)

HLDS and SRCDS Server Rate Tuning

There are three types of servers in Half-life and Source Games:

  • Listen Server
    • A listen server is launched within the game you wish to play.
    • It has a minimal control panel.
    • A listen server requires the Steam Client and your game to be running.
    • All the stock game content is contained in a single cache file.
  • Client HLDS Server

    The HLDS Server is available from the Tools menu.

    • Players must connect to it from LAN or over the internet. (You cannot play from the same computer as is hosting the game.)
    • The HLDS server requires Steam Client to always be running.
    • It has a full server control panel.
    • All the stock game content is contained in a single cache file.
  • Stand-Alone HLDS_1120 Server or Source Dedicated Server
    • Stand-alone servers are independent from Steam.
    • It does not require Steam client to be running.
    • Players must connect to it from a LAN or over the internet. (You cannot play from the same computer as is hosting the game.)
    • There are no cache files, all game content and resources are unpacked.
    • Source Servers must be installed in separate folders from HLDS Servers.

 

Optimizing Server Priority

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 .

Warning:

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.

 

Instructions

To manually change the priority of a running program or process:

  1. Open your Task Manager by pressing Ctrl+Alt+Del then clicking on the Task Manager button.
  2. Click on the Processes tab.
  3. Right-click on the program or process whose priority you want to change then highlight Set Priority and choose the priority for the program.

Note:

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.

 

Steam_HLDS.bat

Here is an example .bat file that runs a Half-Life Deathmatch server.

Download Steam_HLDS.bat

Inside the file it looks like this:

c:
cd c:\HLServer
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.

Note

Source Dedicated Servers (SRCDS.EXE) should be run at AboveNormal priority not at High.

 

Example

c:
cd c:\HL2Server
start /high c:\HL2Server\srcds.exe -game hl2dm -port 27015 -ip xxxx.xxxx.xxxx.xxxx +maxplayers 9

 

Determining Optimal Maxplayers

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):

  • 128k uplink = 4 players (2 players for srcds)
  • 256k uplink = 7 players (4 players for srcds)
  • 320k uplink = 9 players (6 players for srcds)
  • 512k uplink = 14 players (9 players for srcds)
  • 768k uplink = 21 players (14 players for srcds)
  • 1024k uplink = 28 player (19 players for srcds - note 16 players is max for HL2DM)
  • 1140k uplink = 32 players (max for HLDS) (21 players for CS:S)
  • 1708k uplink = 32 players for CS:S (max)

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
sv_minrate 3500

// 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
sv_maxrate 7500

// this is the minimum playable updaterate, leave this at 13
sv_minupdaterate 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
sv_maxupdaterate 13

 

Testing Server Rates

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

 

Example Server.cfg Files

 

Generic server.cfg for CS:S Servers

Download cs_server_cfg_file.cfg (must be renamed to server.cfg for use)

 

Generic server.cfg for HL2DM Servers

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.

 

Server FPS Control

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.

 

FPS Boost

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.

 

Intel vs. AMD CPUs

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.

 

WHY HIGHER FPS?

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.

 

Problem with Steam?

Contact Steam Support