Dedicated Server:zh-cn
From NS2 community wiki
Contents |
| | 此条目是不完整的。 |
配置需求
NS2服务端的配置需求:
* physx* * directx* * HLDS Update Tool或Steam (用于更新) * NS2的有偿版本(如果使用Steam的话)
带*号的软件位于.\\steam\steamapps\common\natural selection 2\redist目录下。
通过HLDSUpdateTool安装
通过HLDSUpdateTool来安装和更新Natural Selection 2服务器的方案最为简单方便,我们极力推荐。
首先你需要从Valve下载安装程序。
如果你已经为其他游戏的服务端安装过HLDSUpdateTool,那么你不必再为此安装一个单独的副本。
一旦装好了HLDSUpdateTool,以管理员身份运行命令提示符。然后输入下列命令 (假设HLDSUpdateTool被安装在默认位置):
cd "c:\Program Files\Valve\HLServer" HLDSUpdateTool -command update -game naturalselection2 -dir <install dir>
把此目录<install dir>替换为你想安装的服务端文件目标路径。
dedicated_server_usage.txt是有关服务端的说明文件,其中包含了教你如何运行服务端。这个文件将会与游戏文件一起被安装进同一个目录(见下文)。
Windows环境
基本安装
- 1. 使路由器/防火墙转发端口27015
- 2. 使用HLDS Update Tool来下载服务端文件(看上面的说明)。
- 3. 确保你能够运行Steam*
- 3.1 进入\Steam\steamapps\common\natural selection 2目录
- 3.2 右键单击server.exe并创建快捷方式
- 3.3 右键单击server.exe的快捷方式并编辑编辑“目标”一栏,使之如下所示:
.\\Steam\steamapps\common\natural selection 2\Server.exe" -name SERVERNAME -map ns2_tram -limit 8 -lan false
- 4. 运行服务端!
注:想对服务器进行高级设置,请参阅下面的章节
* Steam并不是也要跟服务端一起运行,只是用于服务端更新文件。
* 我们强烈推荐使用HLDS Update Tool来安装服务端。
自动更新
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环境
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.
远程管理
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> <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
反馈
All server feedback please report to here

