2015年的圣诞,怂恿了一大波小伙伴入手了 Steam 的 Don’t Starve Together。然而截止 2016 年 1 月 9 日,Cave 洞穴服务器依然是 Beta 测试,并且直接用 DST 的游戏客户端无法开启洞穴,开启洞穴必须要使用另外的服务器。经过了很长时间的 Beta 版,饥荒联机版终于在 2016 年 4 月 22 日迎来了正式版,结束了抢先体验。不知道在哪个版本中,饥荒联机已经可以在 DST 的游戏客户端中直接建立洞穴服务器了,以后要玩带洞穴的游戏再也不需要另外的服务器了。
虽然可以用 DST 客户端直接建立地上和洞穴服务器,但是依旧有使用独立服务器进行游戏的需求,所以这篇教程的标题也就去将洞穴替换成了独立,变成了现在这副样子。
说实在的,Klei 的文档写的还是非常详细的,通过英文文档,可以很容易地搭建一个同时运行地面和洞穴的服务器。这里,天天为你介绍在 Windows 上搭建带地面及洞穴的 DST 独立服务器的方法。想知道 Linux 端的搭建方式,请参考 《Linux篇》。
使用 Windows 搭建地面及洞穴服务器非常容易,有两个方法可以搭建该服务器:一种是用 Steam 客户端里的 Don't Strave Together Dedicated Server
工具搭建;另一种是用 SteamCMD
命令搭建。
使用 Don’t Strave Together Dedicated Server 搭建
1、首先你得有个 Steam 账户,其次,你得安装 Steam 客户端,然后,你需要购买 Don’t Strave Together 游戏,地址:http://store.steampowered.com/app/322330/
2、按下图所示选择“工具”,并找到名为 Don't Strave Together Dedicated Server
的工具,右键安装
3、安装完成后,右键点击属性
,选择本地文件
选项卡,再点击浏览本地文件
,打开下载的目录。进入 bin/scripts
文件夹,直接点开里面的 launch_preconfigured_servers.bat
文件。
4、此时,会打开两个命令行窗口,标题分别为 Don't Starve Together Overworld
和 Don't Starve Together Caves
。当出现日志中出现 Your Server Will Not Start
后,分别键入 c_shutdown()
关闭窗口。(此时日志提示需要 token 文件)
5、打开文档
->Klei
,能看到生成了 DoNotStarveTogether_EasyConfigOverworld
和 DoNotStarveTogether_EasyConfigCaves
两个文件夹,这就是地上和洞穴的存档和配置目录。之后,对配置文件进行配置后即可开始游戏,配置文件的方法请移步《配置篇》。
使用 SteamCMD 搭建
1、首先,为某些喜欢查看英文文档的人提供官方地址:
由 V 社提供的 SteamCMD
使用方法的 Wiki 网址,点此进入
由 Klei 提供的 Don't Strave Together Dedicated Server
搭建教程,点此进入
由 Klei 建议的 Don't Strave Together Dedicated Server
搭建指南,点此进入(强烈建议)
2、建议新建一个非管理员账户,这样可以让服务器更加安全
3、创建一个用于存放 SteamCMD 的文件夹,例如 D:\SteamCMD
4、从 https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip 下载 SteamCMD 的压缩文档,并解压到 D:\SteamCMD
文件夹中
5、运行解压出的 steamcmd.exe
文件。该文件会自动为你下载所需的各种文件,下载完成后,会进入如 Steam>
形式的命令行界面
6、登陆 Steam 账户。此时,可以登录你的 Steam 账户,直接输入 login 用户名
,再键入密码即可登陆,但是,并没有什么卵用,因为可以直接使用匿名账户 anonymous
进行登陆,直接 login anonymous
即可登陆匿名账号
7、设置默认安装目录(可选)。登陆后,输入 force_install_dir D:\dst
把 D:\dst
作为默认下载路径(若带空格请用双引号),否则,默认下载路径为 D:\SteamCMD\steamapps\common\Don't Starve Together Dedicated Server
8、下载 Don’t Strave Together Dedicated Server 。在 Steam>
下输入 app_update 343050 validate
,其中 343050 是该文件的编号
其实,根本没这么复杂,6-8 步可以用一个批处理搞定
在
D:\SteamCMD
文件夹里创建DST.bat
,往里面输入steamcmd +login anonymous +force_install_dir "D:\dst" +app_update 343050 validate +quit
,无需管理员权限,直接双击运行,就可以自动更新/下载最新版本
9、下载完成后,进入下载目录
->bin
(默认为 D:\SteamCMD\steamapps\common\Don't Starve Together Dedicated Server
),新建名为 dst_overworld.bat
和 dst_caves.bat
两个文件。再往这两个文件内写入以下内容:
::dst_overworld.bat dontstarve_dedicated_server_nullrenderer -console -cluster DediServer -shard Master ::dst_caves dontstarve_dedicated_server_nullrenderer -console -cluster DediServer -shard Caves
之后分别启动 dst_overworld.bat
和 dst_caves.bat
两个文件。当出现日志中出现 Your Server Will Not Start
后,分别键入 c_shutdown()
关闭窗口。(此时日志提示需要 token 文件)
10、打开文档
->Klei
,能看到生成了 DoNotStarveTogether
文件夹,里面有一个叫 DediServer
的文件夹,再里面是 Master
和 Caves
两个分别代表地上和洞穴的配置目录。之后,对配置文件进行配置后即可开始游戏,欲知配置如何,请看下回分解~
关于更新的问题,因为只要 DST 客户端更新了,服务端也会有相应的更新,所以必须保证 DST 独立服务器的版本为最新版本。
若使用 Don’t Strave Together Dedicated Server 搭建,则不用在意更新的问题,打开 Steam 就会自动更新了
若使用 SteamCMD 搭建,则再次运行一次
D:\SteamCMD\DST.bat
文件就能更新了(^・ω・^ )
这里列出了第⑨步中其他可用的命令:
拷贝自 http://steamcommunity.com/sharedfiles/filedetails/?id=590681995 -persistent_storage_root Change the directory that your configuration directory resides in. This should be an absolute path. The full path to your files will be <persistent_storage_root>/<conf_dir>/ where <conf_dir> is the value set by -conf_dir. The default for this option depends on the platform: Windows: <Your documents folder>/Klei Mac OSX: <Your home folder>/Documents/Klei Linux: ~/.klei -conf_dir Change the name of your configuration directory. This name should not contain any slashes. The full path to your files will be <persistent_storage_root>/<conf_dir> where <persistent_storage_root> is the value set by the -persistent_storage_root option. The default is: "DoNotStarveTogether". -cluster Set the name of the cluster directory that this server will use. The server will expect to find the cluster.ini file in the following location: <persistent_storage_root>/<conf_dir>/<cluster>/cluster.ini, where <persistent_storage_root> and <conf_dir> are the values set by the -persistent_storage_root and -conf_dir options. The default is "Cluster_1". -shard Set the name of the shard directory that this server will use. The server will expect to find the server.ini file in the following location:<persistent_storage_root>/<conf_dir>/<cluster>/<shard>/server.ini, where <persistent_storage_root>, <conf_dir>, and <cluster> are the values set by the -persistent_storage_root, -conf_dir, and -cluster options. The default is "Master". -offline Start the server in offline mode. In offline mode, the server will not be listed publicly, only players on the local network will be able to join, and any steam-related functionality will not work. -console Allow lua commands to be entered in the command prompt or terminal that the server is running in. -bind_ip <bind_ip> Change the address that the server binds to when listening for player connections. This is an advanced feature that most people will not need to use. -port <port_number> Valid values: 1..65535 The UDP port that this server will listen for connections on. This option overrides the [NETWORK] / server_port setting in server.ini. If you are running a multi-level cluster, this port must be different for each server. This port must be between 10998 and 11018 inclusive in order for players on the same LAN to see it in their server listing. Ports below 1024 are restricted to privileged users on some operating systems. -players <max_players> Valid values: 1..64 Set the maximum number of players that will be allowed to join the game. This option overrides the [GAMEPLAY] / max_players setting in cluster.ini. -steam_master_server_port <port_number> Valid values: 1..65535 Internal port used by steam. This option overrides the [STEAM] / master_server_port setting in server.ini. Make sure that this is different for each server you run on the same machine. -steam_authentication_port <port_number> Valid values: 1..65535 Internal port used by steam. This option overrides the [STEAM] / authentication_port setting in server.ini. Make sure that this is different for each server you run on the same machine. -backup_logs Create a backup of the previous log files each time the server is run. The backups will be stored in a directory called "backup" in the same directory as server.ini. -tick <tick_rate> Valid values: 15 .. 60 This is the number of times per-second that the server sends updates to clients. Increasing this may improve precision, but will result in more network traffic. This option overrides the [NETWORK] / tick_rate setting in cluster.ini. It is recommended to leave this at the default value of 15. If you do change this option, it is recommended that you do so only for LAN games, and use a number evenly divisible into 60 (15, 20, 30).
参考:http://steamcommunity.com/sharedfiles/filedetails/?id=590681995
原创文章,转载请以链接形式注明出处:https://blog.ttionya.com/article-1171.html