Dedicated Server
From NS2 community wiki
Contents |
Requirements
Dedicated ns2 server currently requires:
* physx* * directx* * HLDS Update Tool or Steam (for updates) * Paid version of NS2 (if using Steam)
* supplied in .\\steam\steamapps\common\natural selection 2\redist
Install via HLDSUpdateTool
This is the recommended and simplest way to install and keep updated the server.
Setting up Natural Selection 2 server with the HLDSUpdateTool is very simple. First you need to download the installer from Valve.
If you're already using HLDSUpdateTool for other dedicated servers you don't need to install a separate copy.
Once HLDSUpdateTool is installed, open a command prompt with administrator privileges. Then run the following command (assuming the default location for the HLDSUpdateTool installation):
cd "c:\Program Files\Valve\HLServer" HLDSUpdateTool -command update -game naturalselection2 -dir <install dir>
Substitute the directory where you would like the server files to be installed for <install dir>. Instructions for how to run a dedicated server are included in the file dedicated_server_usage.txt that will be installed along with the game files (see below).
Windows Setup
Basic Setup
- 1. Forward port 27015 for the servers router/firewall: Portforward.com
- 2. Download the server using HLDS Update Tool (see above for instructions).
- 3. Alternatively you can use Steam*
- 3.1 Navigate to \Steam\steamapps\common\natural selection 2
- 3.2 Right click on server.exe and create shortcut
- 3.3 Right click on the shortcut for server.exe and edit the target line to show something similar to this
.\\Steam\steamapps\common\natural selection 2\Server.exe -name SERVERNAME -map ns2_tram -limit 8 -lan false
- 4. Launch the server!
Note: For advanced configuring of the server files please see the below sections
* Steam is not required for the server, only for updates. * It is highly recommended to use HLDS Update Tool for the server.
Automatic Updates
The NS2 server does not have any method to do automatic updates yet. There is a third party tool that can be found here that will do it. To install it, perform the Basic Setup above, then follow the instructions on the NS2Update readme. Note: You must use hldsupdatetool if you want to make use of this.
Linux Setup
Zimzum posted linux guide, he uses opensuse v11.3 with latest build of wine v1.2. You MUST use 32-bit wine 1.2.2 or higher for wine to work with ns2. This script installs 32bit wine-1.2.2 for 64 bit centos 5.
All you have to do is run server.exe through wine with the command line parameters:
wine Server.exe -name <whatever> -map ns2_tram -limit 8 -lan <whatever>
* A Linux dedicated server is planned, but for now don't have high priority (sorry, lots of other things to do first).
Dedicated_Server_Usage.txt
The server stores its settings in the file: %APPDATA%/Natural Selection 2/server.xml
If the file does not exist, it will create a default copy the first time it is run.
The server options can be changed in the file manually, or they can be specified individually on the command line (those changes will be saved by default.)
Optional command line settings are:
-file [path] (allows you to specify a different configuration file for server settings) -name [name] (specifies the server name to be shown in the server browser) -map [name] (specifies the map to load) -ip [address] (specifies IP address) -port [number] (default is 27015) -limit [number] -lan [1 or 0, or true/false] (specifies how/if this map shows up in the master server list - default is false) -password [optional] -save [1 or 0, or true/false] - (specifies whether to save out command line overrides - default is true)
Note: It is recommended that you do not host a game on port 27016, as it will interfere with master server listing.
Examples:
- Server.exe -map ns2_tram -limit 32 -lan false
- Server.exe -file "c:\my servers\config.xml" -map ns2_rockdown -lan true -save false
Server.xml
You can also edit server.xml inside %appdata%\roaming\natural selection 2 or %appdata%\natural selection 2
<options>
<lanGame>false</lanGame>
<mapName>ns2_tram</mapName>
<password></password>
<port>27015</port>
<serverName>SERVERNAME</serverName>
<address></address>
<playerLimit>8</playerLimit>
</options>
It is a good practice to add on the name of the server the players limit, and if it's a dedicated server or a home based one.
Server Console
You can access the server console by selecting the active server window, hitting tab (to bring up the console window) and then ~ (tilde) (to bring up the console command line).
See Console Commands for the list of available commands.
Web Administration
You can also administer the server via a web interface. This feature was added in alpha patch 152. By default the web administration feature is turned off. Take into consideration that it is still beta and many features are not added or correctly working.
To add a user to have access to the web interface do the following:
Server.exe -webadduser newuser -webpass secret -webdir "c:\web_directory" -webdomain localhost
Commands relevant to user administrator for the web interface:
-webadduser username (Adds a new user to the .htpasswd file.) -webedituser username (Updates the settings of a user in the .htpasswd file) -webdeleteuser username (Removes an existing user from the .htpasswd file)
When configuring users, the following options (described in the previous section) must be set as well:
-webdomain [name] -webdir [directory] -webpass [password, required for adding/editing users only]
Examples for configuring users:
Server.exe -webadduser newuser -webpass secret -webdir "c:\web_directory" -webdomain localhost Server.exe -webedituser existinguser -webpass newsecret -webdir "c:\web_directory" -webdomain localhost Server.exe -webdeleteuser existinguser -webdir "c:\web_directory" -webdomain localhost
To turn on the web interface do the following:
Server.exe -webadmin 1 -webdir "c:\web_directory" -webdomain localhost
Or you can write in server.xml :
<webadminActive>true</webadminActive> <webadminDomain>localhost</webadminDomain> <webadminPort>8080</webadminPort> <webadminDirectory>"c:\web_directory"</webadminDirectory>
By default the web administration interface uses port 8080.
Additional command line settings relevant for web administration:
-webadmin [1 or 0, or true/false] (specifies whether web administration is active - default is false) -webdomain [name] (specifies the web server's domain name, primarily used in authentication phase) -webdir [directory] (specifies the web server's root directory, which must exist on disk and must contain a .htpasswd file) -webport [number] (default is 8080)
To access the web interface use the following
http://<webdomain>:<webport>
Example:
http://localhost:8080
Server Feedback
All server feedback please report to here

