饥荒服务器搭建(windows)

时间:2022-12-20 21:55:31

1. 获取服务器票据

步骤1:登录Klei官网

步骤2:点击菜单栏游戏——选择饥荒服务器

饥荒服务器搭建(windows)

步骤3:创建服务器获取票据,后面将会用到。

饥荒服务器搭建(windows)

2. 新建游戏存档

步骤1:下载游戏和服务器工具

⭐ 游戏:饥荒联机版
⭐ 工具:Don’t Starve Together Dedicated Server

饥荒服务器搭建(windows)

步骤2:创建游戏存档

通过饥荒联机版创建一个存档,配置一下服务器模组。

步骤3:复制文件夹

饥荒中的存档一般放在C盘—文档—Klei中,如C:\Users\67095\Documents\Klei\DoNotStarveTogether

打开这个数字文件夹(这个应该是跟账号有关系)

饥荒服务器搭建(windows)
因为我新装的游戏,所以这里只有一个本地存档

饥荒服务器搭建(windows)

把他复制到刚刚的DoNotStarveTogether目录下

饥荒服务器搭建(windows)

步骤4:添加票据

打开Cluser_1文件夹,创建 cluster_token.txt,并填写第一步复制的票据。

饥荒服务器搭建(windows)
至此存档新建完成。

其他:cluster.ini

通过修改cluster.ini 可以对服务器进行简单的设置

[GAMEPLAY]
game_mode = survival  # 生成模式
max_players = 6 # 最大玩家数
pvp = false
pause_when_empty = true


[NETWORK]
lan_only_cluster = false
cluster_password = xxx # 服务器密码
cluster_description =   # 
cluster_name = xxx # 服务器名称
offline_cluster = false
cluster_language = zh
cluster_cloud_id = 8612D97401006009


[MISC]
console_enabled = true


[SHARD]
shard_enabled = true
bind_ip = 127.0.0.1
master_ip = 127.0.0.1
master_port = 10888
cluster_key = defaultPass

3. 饥荒服务器配置

根据自己的安装目录打开 Don't Starve Together Dedicated Server

我这里是D:\Program Files (x86)\Steam\steamapps\common\Don't Starve Together Dedicated Server\bin\scripts

打开后可以看到 launch_preconfigured_servers.bat 文件

复制一份,并重命名成自己喜欢的名字

饥荒服务器搭建(windows)
使用记事板打开,替换成以下内容:

@ECHO OFF

set SteamAppId=322330
set SteamGameId=322330

cd ..
start "Don't Starve Together Overworld" /D "%~dp0.." "%~dp0..\dontstarve_dedicated_server_nullrenderer.exe" -cluster cluster_1 -console -shard Master
start "Don't Starve Together Caves"     /D "%~dp0.." "%~dp0..\dontstarve_dedicated_server_nullrenderer.exe" -cluster cluster_1 -console -shard Caves

其实就是换了服务器名称。

饥荒服务器搭建(windows)
运行刚刚修改的文件

服务器启动成功界面如下,均出现Sim paused

饥荒服务器搭建(windows)

关闭服务器在黑窗口点击CTRL+C即可,不过关闭服务器之前,玩家最好都退出服务器,否则会有数据流失,至此服务器创建完成,进入游戏,在浏览游戏中搜索存档名称。

4. 添加mod

来到饥荒的创意工坊,选择自己想要的mod,空白处右键复制url,会得到这样的连接:

https://steamcommunity.com/sharedfiles/filedetails/?id=2074508776&searchtext=auto+door

记住其中的id,比如2074508776

来到饥荒服务器目录下:D:\Program Files (x86)\Steam\steamapps\common\Don't Starve Together Dedicated Server\mods,找到文件 dedicated_server_mods_setup.lua,在里面添加自己想要的mod,比如:

ServerModSetup("2074508776")

下面是暂时的是我添加的mod

https://steamcommunity.com/sharedfiles/filedetails/?id=2074508776&searchtext=auto+door
https://steamcommunity.com/sharedfiles/filedetails/?id=661253977&searchtext=dont+drop+everything
https://steamcommunity.com/sharedfiles/filedetails/?id=375850593&searchtext=extra+equip+slots
https://steamcommunity.com/sharedfiles/filedetails/?id=378160973&searchtext=global+positions
https://steamcommunity.com/sharedfiles/filedetails/?id=375859599&searchtext=health+info
https://steamcommunity.com/sharedfiles/filedetails/?id=356930882&searchtext=infinite+tent+uses
https://steamcommunity.com/sharedfiles/filedetails/?id=396026892&searchtext=large+chest
https://steamcommunity.com/sharedfiles/filedetails/?id=1079538195&searchtext=moving+box
https://steamcommunity.com/sharedfiles/filedetails/?id=604761020&searchtext=multi+rocks
https://steamcommunity.com/sharedfiles/filedetails/?id=466732225&searchtext=no+thermal+stone
https://steamcommunity.com/sharedfiles/filedetails/?id=501385076&searchtext=quick+pick
https://steamcommunity.com/sharedfiles/filedetails/?id=519266302&searchtext=season+starting+item
https://steamcommunity.com/sharedfiles/filedetails/?id=1895335315&searchtext=storeroom
https://steamcommunity.com/sharedfiles/filedetails/?id=1271089343&searchtext=your+skeleton+respawn
https://steamcommunity.com/sharedfiles/filedetails/?id=1898181913&searchtext=%E5%86%B0%E7%AE%B1  (冰箱保鲜)
https://steamcommunity.com/sharedfiles/filedetails/?id=1231473531&searchtext=%E8%84%91%E6%AE%8B    (脑残)

以及他们对应的id:

ServerModSetup("2074508776")
ServerModSetup("661253977")
ServerModSetup("375850593")
ServerModSetup("378160973")
ServerModSetup("375859599")
ServerModSetup("356930882")
ServerModSetup("396026892")
ServerModSetup("1079538195")
ServerModSetup("604761020")
ServerModSetup("466732225")
ServerModSetup("501385076")
ServerModSetup("519266302")
ServerModSetup("1895335315")
ServerModSetup("1271089343")
ServerModSetup("1898181913")
ServerModSetup("1231473531")

添加完毕后,重启服务器就可以自动加载这些mod了,这些mod的配置与本地存档无关,而是由 dedicated_server_mods_setup.lua文件内所指定的mod决定的。

参考:https://blog.csdn.net/LW1491215201/article/details/126267093