早在 2015 年底,Klei 就将整个饥荒的配置系统都换了,所以之前写的配置方法算是老古董没法用了,于是这不,博主更新了最新的配置方法。
说起来真是残念,在 2016 年 5 月初,我就差不多把整个新版本的配置写完了,然而是在虚拟机里写的,打算写完一口气复制、粘贴过来,一下搞定,然而…特么手贱恢复了快照,于是…博主心(lan)灰(de)意(zai)冷(xie),所以这个更新拖了将近一个月。
虽然难产,但是好歹算是产下来了,于是大家将就看吧…
前文提供了在 Windows 和 Linux 上安装饥荒独立服务器的方法,接下来,是最重要的配置环节,配置完成后,就可以快乐地玩耍了。前文传送门:《Windows》、《Linux》。
首先,准备配置文件,配置文件准备完成后,就可以拷贝到相应位置,然后 Gay 姆,死哒坨
~
一、准备文件
1、新建一个文件夹,用于保存配置完成的文件
2、配置 token 文件(必须)
之前的版本只有在 Online 模式中需要搜索到服务器才需要配置 token 文件,而局域网不需要,如今,没有 token 文件服务器压根跑不起来。
不同于之前的呼出控制台,输入 会自动生成 token 文件,现在不用输入任何内容,鼠标点点就能得到你的 token。TheNet:GenerateServerToken()
How?
打开游戏客户端,在游戏主界面,在右下角找到 Account
图标,点开。
在打开的页面下部,找到 Generate Server Token
按钮,在右侧的输入框内输入相应描述,比如输入 DST Dedi Server Token
,然后点击 Generate Server Token
按钮,即生成了一个不会失效的 token。可以在按钮上方找到相应描述的 token,复制备用。
之后,将复制的 token 粘贴到 cluster_token.txt
文件中,此时不用在意之前蛋疼的 NUL
结尾了。
与之前一样,生成该 token 的用户将默认带有管理员权限。
3、配置世界地图(必须)
世界地图的配置方法与之前相差不大,但是因为新出了一些萌死他,所以有了更多的配置选项。
文件依旧分为地上部分和洞穴部分。
地上部分,将文件保存为 worldgenoverride.lua
,并放进 Master
文件夹中:
return { override_enabled = true, preset = "SURVIVAL_TOGETHER", -- "SURVIVAL_TOGETHER", "MOD_MISSING", "SURVIVAL_TOGETHER_CLASSIC", "SURVIVAL_DEFAULT_PLUS", "COMPLETE_DARKNESS", "DST_CAVE", "DST_CAVE_PLUS" overrides = { -- default is "never", "rare", "default", "often", "always" -- MISC task_set = "default", -- "classic", "default", "cave_default" start_location = "default", -- "caves", "default", "plus", "darkness" world_size = "default", -- "small", "medium", "default", "huge" branching = "default", -- "never", "least", "default", "most" loop = "default", -- "never", "default", "always" autumn = "default", -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random" winter = "default", -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random" spring = "default", -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random" summer = "default", -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random" season_start = "default", -- "default", "winter", "spring", "summer", "autumnorspring", "winterorsummer", "random" day = "default", -- "default", "longday", "longdusk", "longnight", "noday", "nodusk", "nonight", "onlyday", "onlydusk", "onlynight" weather = "default", earthquakes = "default", lightning = "default", frograin = "default", wildfires = "default", touchstone = "default", regrowth = "default", -- "veryslow", "slow", "default", "fast", "veryfast" cavelight = "default", -- "veryslow", "slow", "default", "fast", "veryfast" boons = "default", prefabswaps_start = "default", -- "classic", "default", "highly random" prefabswaps = "default", -- "none", "few", "default", "many", "max" -- RESOURCES flowers = "default", grass = "default", sapling = "default", marshbush = "default", tumbleweed = "default", reeds = "default", trees = "default", flint = "default", rock = "default", rock_ice = "default", meteorspawner = "default", meteorshowers = "default", mushtree = "default", fern = "default", flower_cave = "default", wormlights = "default", -- UNPREPARED berrybush = "default", carrot = "default", mushroom = "default", cactus = "default", banana = "default", lichen = "default", -- ANIMALS rabbits = "default", moles = "default", butterfly = "default", birds = "default", buzzard = "default", catcoon = "default", perd = "default", pigs = "default", lightninggoat = "default", beefalo = "default", beefaloheat = "default", hunt = "default", alternatehunt = "default", penguins = "default", cave_ponds = "default", ponds = "default", bees = "default", angrybees = "default", tallbirds = "default", slurper = "default", bunnymen = "default", slurtles = "default", rocky = "default", monkey = "default", -- MONSTERS spiders = "default", cave_spiders = "default", hounds = "default", houndmound = "default", merm = "default", tentacles = "default", chess = "default", lureplants = "default", walrus = "default", liefs = "default", deciduousmonster = "default", krampus = "default", bearger = "default", deerclops = "default", goosemoose = "default", dragonfly = "default", bats = "default", fissure = "default", worms = "default", }, }
洞穴部分,将文件保存为 worldgenoverride.lua
,并放进 Caves
文件夹中:
return { override_enabled = true, preset = "DST_CAVE", -- "SURVIVAL_TOGETHER", "MOD_MISSING", "SURVIVAL_TOGETHER_CLASSIC", "SURVIVAL_DEFAULT_PLUS", "COMPLETE_DARKNESS", "DST_CAVE", "DST_CAVE_PLUS" overrides = { -- defalut is "never", "rare", "default", "often", "always" -- MISC task_set = "cave_default", -- "classic", "default", "cave_default" start_location = "default", -- "caves", "default", "plus", "darkness" world_size = "default", -- "small", "medium", "default", "huge" branching = "default", -- "never", "least", "default", "most" loop = "default", -- "never", "default", "always" autumn = "default", -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random" winter = "default", -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random" spring = "default", -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random" summer = "default", -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random" season_start = "default", -- "default", "winter", "spring", "summer", "autumnorspring", "winterorsummer", "random" day = "default", -- "default", "longday", "longdusk", "longnight", "noday", "nodusk", "nonight", "onlyday", "onlydusk", "onlynight" weather = "default", earthquakes = "default", lightning = "default", frograin = "default", wildfires = "default", touchstone = "default", regrowth = "default", -- "veryslow", "slow", "default", "fast", "veryfast" cavelight = "default", -- "veryslow", "slow", "default", "fast", "veryfast" boons = "default", prefabswaps_start = "default", -- "classic", "default", "highly random" prefabswaps = "default", -- "none", "few", "default", "many", "max" -- RESOURCES flowers = "default", grass = "default", sapling = "default", marshbush = "default", tumbleweed = "default", reeds = "default", trees = "default", flint = "default", rock = "default", rock_ice = "default", meteorspawner = "default", meteorshowers = "default", mushtree = "default", fern = "default", flower_cave = "default", wormlights = "default", -- UNPREPARED berrybush = "default", carrot = "default", mushroom = "default", cactus = "default", banana = "default", lichen = "default", -- ANIMALS rabbits = "default", moles = "default", butterfly = "default", birds = "default", buzzard = "default", catcoon = "default", perd = "default", pigs = "default", lightninggoat = "default", beefalo = "default", beefaloheat = "default", hunt = "default", alternatehunt = "default", penguins = "default", cave_ponds = "default", ponds = "default", bees = "default", angrybees = "default", tallbirds = "default", slurper = "default", bunnymen = "default", slurtles = "default", rocky = "default", monkey = "default", -- MONSTERS spiders = "default", cave_spiders = "default", hounds = "default", houndmound = "default", merm = "default", tentacles = "default", chess = "default", lureplants = "default", walrus = "default", liefs = "default", deciduousmonster = "default", krampus = "default", bearger = "default", deerclops = "default", goosemoose = "default", dragonfly = "default", bats = "default", fissure = "default", worms = "default", }, }
是不是非常简单粗暴?
4、配置通用配置文件(必须)
记得之前么,之前是把所有配置都放在一个文件内,然后在地上部分的存档和洞穴部分的存档中各拷贝一份。
现在不是这样了,Klei 已经把一些通用的配置内容提取到一个文件中了。详细配置:
[MISC] max_snapshots = 6 # 最大快照数,决定了可回滚的天数 console_enabled = true # 是否开启控制台 [SHARD] shard_enabled = true # 服务器共享,要开启洞穴服务器的必须启用 bind_ip = 127.0.0.1 # 服务器监听的地址,当所有实例都运行在同一台机器时,可填写 127.0.0.1,会被 server .ini 覆盖 master_ip = 127.0.0.1 # master 服务器的 IP,针对非 master 服务器,若与 master 服务器运行在同一台机器时,可填写 127.0.0.1,会被 server.ini 覆盖 master_port = 10888 # 监听 master 服务器的 UDP 端口,所有连接至 master 服务器的非 master 服务器必须相同 cluster_key = dst # 连接密码,每台服务器必须相同,会被 server.ini 覆盖 [STEAM] steam_group_only = false # 只允许某 Steam 组的成员加入 steam_group_id = 0 # 指定某个 Steam 组,填写组 ID steam_group_admins = false # 开启后,Steam 组的管理员拥有服务器的管理权限 [NETWORK] offline_server = false # 离线服务器,只有局域网用户能加入,并且所有依赖于 Steam 的任何功能都无效,比如说饰品掉落 tick_rate = 15 # 每秒通信次数,越高游戏体验越好,但是会加大服务器负担 whitelist_slots = 0 # 为白名单用户保留的游戏位 cluster_password = # 游戏密码,不设置表示无密码 cluster_name = ttionya test # 游戏房间名称 cluster_description = description # 游戏房间描述 lan_only_cluster = false # 局域网游戏 cluster_intention = madness # 游戏偏好,可选 cooperative, competitive, social, or madness,随便设置,没卵用 [GAMEPLAY] max_players = 16 # 最大游戏人数 pvp = true # 能不能攻击其他玩家,能不能给其他玩家喂屎 game_mode = survival # 游戏模式,可选 survival, endless or wilderness,与玩家死亡后的负面影响有关 pause_when_empty = false # 没人服务器暂停,刷天数必备 vote_kick_enabled = false # 投票踢人
然后上干货:
[MISC] max_snapshots =6 console_enabled = true [SHARD] shard_enabled = true bind_ip = 127.0.0.1 master_ip = 127.0.0.1 master_port = 11001 cluster_key = dst [STEAM] steam_group_only = false steam_group_id = 0 steam_group_admins = false [NETWORK] offline_server = false tick_rate = 15 whitelist_slots = 2 cluster_name = ttionya test cluster_description = just test lan_only_cluster = false cluster_intention = cooperative [GAMEPLAY] max_players = 16 pvp = true game_mode = endless pause_when_empty = true vote_kick_enabled = true
忘了说,把这个文件保存为 cluster.ini
文件。
5、配置独立配置文件(必须)
然后剩下的就是独立配置文件了,看详细配置:
[SHARD] is_master = true /false # 是否是 master 服务器,只能存在一个 true,其他全是 false name = caves # 针对非 master 服务器的名称 id = ??? # 随机生成,不用加入该属性 [STEAM] authentication_port = 8766 # Steam 用的端口,确保每个实例都不相同 master_server_port = 27016 # Steam 用的端口,确保每个实例都不相同 [NETWORK] server_port = 10999 # 监听的 UDP 端口,只能介于 10998 - 11018 之间,确保每个实例都不相同
由于分为地上部分和洞穴部分,所以分开写。
地上部分,保存为 server.ini
,并放到 Master
文件夹内:
[SHARD] is_master = true [STEAM] authentication_port = 12345 master_server_port = 12346 [NETWORK] server_port = 10999
洞穴部分,保存为 server.ini
,放到 Caves
文件夹内:
[SHARD] is_master = false name = caves [STEAM] authentication_port = 12347 master_server_port = 12348 [NETWORK] server_port = 11000
6、配置下载的 Mod 文件(建议)
无 Mod,不饥荒。Mod 是玩饥荒必备的东西,所以非常建议开启 Mod 玩耍。
饥荒通过一个名为 dedicated_server_mods_setup.lua
的文件确认需要下载哪些 Mod。
首先去创意工坊找些 Mod,并获得其 id,或者找些 Mod 合集,将 Mod id 按以下形式(换行复制粘贴)保存在文件中。以下是完整文件内容:
--There are two functions that will install mods, ServerModSetup and ServerModCollectionSetup. Put the calls to the functions in this file and they will be executed on boot. --ServerModSetup takes a string of a specific mod's Workshop id. It will download and install the mod to your mod directory on boot. --The Workshop id can be found at the end of the url to the mod's Workshop page. --Example: http://steamcommunity.com/sharedfiles/filedetails/?id=350811795 --ServerModSetup("350811795") --ServerModCollectionSetup takes a string of a specific mod's Workshop id. It will download all the mods in the collection and install them to the mod directory on boot. --The Workshop id can be found at the end of the url to the collection's Workshop page. --Example: http://steamcommunity.com/sharedfiles/filedetails/?id=379114180 --ServerModCollectionSetup("379114180") ServerModSetup("458940297") ServerModSetup("375859599") ServerModSetup("375850593") ServerModSetup("343762271") ServerModSetup("347079953") ServerModSetup("556027744") ServerModSetup("444438334") ServerModSetup("378160973") --ServerModCollectionSetup("id")
上面我推荐了几个经常使用的 Mod,反正我觉得这些应该都会带上的吧?!
问我怎么加载自定义 Mod?其实我也不是很清楚…有待你自行发掘了(;¬_¬)
7、配置 Mod 文件(建议)
之前的 dedicated_server_mods_setup.lua
文件是用于下载 Mod,但是 Mod 是否启用及配置则是 modoverrides.lua
文件的功能。
不多说,针对上面的文件,直接给出干货:
return { ["workshop-458940297"] = { enabled = true }, ["workshop-375859599"] = { enabled = true }, ["workshop-375850593"] = { enabled = true }, ["workshop-343762271"] = { enabled = true }, ["workshop-556027744"] = { enabled = true }, ["workshop-444438334"] = { enabled = true, configuration_options = { keybind = 103, maxLights = 2, backpackCategory = "food" } }, ["workshop-378160973"] = { enabled = true }, ["workshop-347079953"] = { enabled = true } }
有几点需要注意,1、最后不要加逗号;2、
好像没有第二点…Σ(  ̄□ ̄||)
想起来了,这个文件保存为 modoverrides.lua
,并且分别往 Master
和 Caves
文件夹里复制一份。
纳尼?(゚Д゚≡゚д゚)!? 你问我 configuration_options
里怎么配置的?自己查看 mod 文件夹里的 modinfo.lua
,通过 default
和 options
的值去猜怎么写吧= =,很容易的
8、设定管理员(可选)
能不能多设置几个管理员?母鸡龙!
首先,你要得到你想要设为管理员的玩家的用户 id
。
有两种方法:
1、让该玩家加入游戏,再查看日志,你会在日志中找到 KU_
开头的一串用户 id
2、让该玩家点击游戏主页面的 Account
按钮(和获得 token 一样),在页面中会有用户 id
之后,把用户 id
一行放一个,保存在 adminlist.txt
文件中。下面是栗子:
KU_3N5kE2Zp KU_BJY3CxYT KU_DF1orNGA KU_FAd2Yr8m KU_vvbUjgIX
为什么要设置管理员呢?因为管理员可以使用远程指令,比如说回滚,强行保存,踢人等等
9、Ban 用户(可选)
岂可休,有个奇怪的人进来就烧家
玛戈急,有个绅士给我喂屎
日了狗,对面的妹纸从裤裆中掏出了我想掏出的东西(喂
但是这种人踢了又进来,简直丧(gan)心(de)病(piao)狂(liang),不想再让他进来?Ban 了他!
从日志中找到他的 SteamID64
,添加到 blocklist.txt
中,一行一个。
从此,讨厌的家伙就一个都进不来了(°∀°)ノ
10、白名单席位(可选)
哇,服务器太火爆了,管理员都进不来了。怎么?想占着茅坑不拉屎?可以!
还记得 cluster.ini
里有一个 whitelist_slots
配置吗?这就是白名单席位。
白名单席位占用最大游戏人数,比如说,服务器一共开了 16 个位置,设置了 6 个白名单席位,此时,最多只能加入 10 个普通玩家。
与 blocklist.txt
对应,这个文件是 whitelist.txt
,但是里面的内容是以 KU_
开头的用户 id
。
二、移动文件至指定位置
如果你是按照上面的方法,并且每个文件都有创建的话,你会得到以下文件结构:
一共有 12 个文件。
之后给出最终效果图,请自行复制至指定位置,所有位置为之前安装时指定的位置。(真绕舌
1、Windows 系统 Don’t Strave Together Dedicated Server 搭建
C:\Users\[User]\Documents\Klei\DoNotStarveTogether_EasyConfigOverworld | |---Cluster_1 | adminlist.txt(/adminlist.txt) | blocklist.txt(/blocklist.txt) | cluster.ini(/cluster.ini) | cluster_token.txt(/cluster_token.txt) | whitelist.txt(/whitelist.txt) | |---Master | modoverrides.lua(/Master/modoverrides.lua) | server.ini(/Master/server.ini) | worldgenoverride.lua(/Master/worldgenoverride.lua) | 其他文件 | |---其他文件夹 C:\Users\[User]\Documents\Klei\DoNotStarveTogether_EasyConfigCaves | |---Cluster_1 | adminlist.txt(/adminlist.txt) | blocklist.txt(/blocklist.txt) | cluster.ini(/cluster.ini) | cluster_token.txt(/cluster_token.txt) | whitelist.txt(/whitelist.txt) | |---Master | modoverrides.lua(/Caves/modoverrides.lua) | server.ini(/Caves/server.ini) | worldgenoverride.lua(/Caves/worldgenoverride.lua) | 其他文件 | |---其他文件夹 steamapps\common\Don't Strave Together Dedicated Server\mods | | dedicated_server_mods_setup.lua(/dedicated_server_mods_setup.lua)
2、Windows 系统 SteamCMD 搭建
C:\Users\[User]\Documents\Klei\DoNotStarveTogether\MyDediServer | | adminlist.txt(/adminlist.txt) | blocklist.txt(/blocklist.txt) | cluster.ini(/cluster.ini) | cluster_token.txt(/cluster_token.txt) | whitelist.txt(/whitelist.txt) | |---Master | | modoverrides.lua(/Master/modoverrides.lua) | | server.ini(/Master/server.ini) | | worldgenoverride.lua(/Master/worldgenoverride.lua) | | 其他文件 | | | |---其他文件夹 | |---Caves | modoverrides.lua(/Caves/modoverrides.lua) | server.ini(/Caves/server.ini) | worldgenoverride.lua(/Caves/worldgenoverride.lua) | 其他文件 | |---其他文件夹 D:\dst\mods | | dedicated_server_mods_setup.lua(/dedicated_server_mods_setup.lua)
3、Linux 系统 SteamCMD 搭建
/home/dst/.klei/DoNotStarveTogether\MyDediServer | | adminlist.txt(/adminlist.txt) | blocklist.txt(/blocklist.txt) | cluster.ini(/cluster.ini) | cluster_token.txt(/cluster_token.txt) | whitelist.txt(/whitelist.txt) | |---Master | | modoverrides.lua(/Master/modoverrides.lua) | | server.ini(/Master/server.ini) | | worldgenoverride.lua(/Master/worldgenoverride.lua) | | 其他文件 | | | |---其他文件夹 | |---Caves | modoverrides.lua(/Caves/modoverrides.lua) | server.ini(/Caves/server.ini) | worldgenoverride.lua(/Caves/worldgenoverride.lua) | 其他文件 | |---其他文件夹 /home/dst/dst/mods | | dedicated_server_mods_setup.lua(/dedicated_server_mods_setup.lua)
我觉得上面的表已经描述得非常清楚了,详细你一定看得懂。
三、Game Start(Gay 姆,死哒坨)
离成功只有一步之遥了,加油!
1、Windows 系统 Don’t Strave Together Dedicated Server 搭建
双击运行位于 steamapps\common\Don't Strave Together Dedicated Server\bin\scripts\launch_preconfigured_servers.bat
。
O 了
2、Windows 系统 SteamCMD 搭建
分别运行位于 D:\dst\bin\dst_overworld.bat
和 D:\dst\bin\dst_caves.bat
两个文件。
O 了,吐
3、Linux 系统 SteamCMD 搭建
咳咳,这下就稍微麻烦点。
su - dst script /dev/null cd ~/dst/bin screen sh ./dst_overworld.sh # 手动同时按 Ctrl 和 A 键,之后按 C 键 sh ./dst_caves.sh
这样,即使关闭终端,也不会被结束进程了。顺便,为什么要使用 script /dev/null
命令呢,详细原因见《解决Screen出现Cannot open your terminal ‘/dev/pts/0’问题》
如何关闭游戏呢?博主建议到命令行中输入 c_shutdown()
关闭服务器!!!
如何关闭游戏呢?博主建议到命令行中输入 c_shutdown()
关闭服务器!!!
四、更多命令
当你为服务器管理员时,在游戏中按 ~
呼出控制台,再按 Ctrl
键即可转换为 Remote
模式,会出现 “Remote”
字样。
c_sethealth(percent) #设置血量,括号里填百分比,0.9=90% c_setsanity(percent) #设置san值,括号里填百分比,0.9=90% c_sethunger(percent) #设置饱食度,括号里填百分比,0.9=90% c_godmode() #上帝模式 c_speedmult(multiplier) #设置移动速度,一般1.2足够 c_reset() #在不保存世界的情况下重载,会导致掉线 c_regenerateworld() #删除当前世界并生成新世界 c_save() #手动保存 c_shutdown(true | false) #c_shutdown(true)或c_shutdown()保存游戏并关闭服务器,c_shutdown(false)不保存游戏直接关闭服务器 c_rollback(count) #回档,count从1开始计算,回到之前保存的状态
更多命令见这里。
五、更多
其实,还有很多小技巧,比如说:
将游戏注册成服务,可以通过服务达到开机自启,崩溃自动重新运行进程等目的
设置自动更新,使用 Windows 的任务计划
或使用 Linux 的 crontab
等等
请看参考:
http://steamcommunity.com/sharedfiles/filedetails/?id=635281092
http://steamcommunity.com/sharedfiles/filedetails/?id=590681995
http://steamcommunity.com/sharedfiles/filedetails/?id=590565473
http://steamcommunity.com/sharedfiles/filedetails/?id=591543858
并没有抄他的哦,因为他写的时间在我后面
原创文章,转载请以链接形式注明出处:https://blog.ttionya.com/article-1235.html