Don't Starve Together 饥荒服务器端开服教程

分享讨论IT相关的内容
回复
头像
BobMaster
锋芒初露
锋芒初露
帖子: 1356
注册时间: 2020年 12月 7日 08:05
来自: 神秘的东方
我的状态: 🎯
为圈友点赞: 433 次
被圈友点赞: 282 次
联系:

Don't Starve Together 饥荒服务器端开服教程

帖子 BobMaster »

最近有一个饥荒服务器的架设需求,遂尝试部署了一下,这篇文章记录一下
采用Docker部署,基于dst-dedicated-server项目: https://github.com/mathielo/dst-dedicated-server

1. 首先clone项目

代码: 全选

cd /opt && git clone https://github.com/mathielo/dst-dedicated-server

2. 获取开服需要的cluster_token

进入游戏后打开账号页
图片
在GAMES里配置游戏服务器
图片
根据提示创建一个token用于开服
图片
最后将刚才创建的token写入DSTClusterConfig/cluster_token.txt文件

3. 编辑cluster.ini配置文件

根据里面的注释按需修改即可,这里给大家一个参考

代码: 全选

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Cluster Configuration File
;;;
;;; Customize the values as you wish! Make sure to replace
;;; every place where you can find a "[CHANGE THIS]" comment.
;;;
;;; Further reference on Cluster / Server options:
;;; - http://steamcommunity.com/sharedfiles/filedetaicluster_language = zhls/?id=590565473
;;; - https://forums.kleientertainment.com/topic/6cluster_language = zh4552-dedicated-server-settings-guide/
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

[GAMEPLAY]
;; survival|endless|wilderness
game_mode = survival
;; 1..64
max_players = 16
;; true|false
pvp = false
;; true|false
pause_when_empty = true
;; Set to true to enable voting features.
;; true|false
vote_enabled = true

[NETWORK]
;; cooperative|competitive|social|madness
cluster_intention = cooperative

;;; [CHANGE THESE]
cluster_description = 圈圈之地开服教程
cluster_name = 圈圈之地饥荒服
cluster_password = quanquan.space
;; true|false
autosaver_enabled = true
;; true|false
enable_vote_kick = false
;; 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. It is recommended to
;; leave this at the default value of 15. If you do change this option, do so only for LAN games,
;; and use a number evenly divisible into 60 (15, 20, 30).
;; 10|15|30|60
tick_rate = 15
;; milliseconds before unresponsive clients gets kicked out
connection_timeout = 8000
cluster_language = zh
server_port = 10999

;;; OFFLINE MODE ;;;
;;; Enabling this flag removes the need of generating a token and updating cluster_token.txt
;;; However your server will NOT be available over the network (local or internet). Used mostly
;;; for debugging purposes.
; offline_server = true

[MISC]
;; Maximum number of snapshots to retain. These snapshots are created every time a save occurs,
;; and are available in the “Rollback” tab on the “Host Game” screen.
max_snapshots = 6
;; true|false
console_enabled = true

;;; STEAM GROUP ;;;
;;; Associates a Steam Group to your server. This is *completely optional* and has a few advantages:
;;;  - All the members of your group will see the server at the top of the server list
;;;  - People will see your group page when clicking on the "flag"(group) icon in the Server Description
;;;  - One can easily make the server accessible ONLY by group members, so no need for password.
;;;
;;; Uncomment any of the following config lines under [STEAM] according to your needs.
;;;
;;; More info - and how to find your Steam Group ID:
;;;  - https://forums.kleientertainment.com/topic/55994-server-admin-associate-your-server-with-a-steam-group/
[STEAM]
;; numbers only, your Steam Group ID
; steam_group_id = 00000000000

;; If this is set to true, GROUP MEMBERS ONLY will be allowed to join the server. You might consider
;; disabling `cluster_password` above if enabling this feature.
;; true|false
; steam_group_only = false

;; When this is set to true, admins of the steam group specified in steam_group_id will also have admin
;; status on the server.
; steam_group_admins = false

[SHARD]
;;; [CHANGE THIS]
;;; Optimally a randomly generated key
cluster_key = 0dUekwnCjgn0KBzHZ6YI5tN85tgu

;;; Do NOT change the settings below
shard_enabled = true
;;; Allows connections from other hosts (other containers)
bind_ip = 0.0.0.0
;;; The master "IP" is the network alias as defined in docker-compose.yml "links"
master_ip = dst_master

4. 编辑地图配置

DSTClusterConfig/Master路径下创建worldgenoverride.lua文件,里面用于覆盖默认的地图配置,比如关闭死亡血量惩罚等
参考资料: 这里给大家一个参考
healthpenalty(Max Health Penalty) 关闭血量上限惩罚
portalresurection(Revive At Florid Postern) 开启在绚丽之门复活
darkness(Darkness Damage) 黑暗伤害改为非致命
grassgekkos(Grass Gekko Morphing) 草壁虎转化改为很少

代码: 全选

return {
        override_enabled = true,
        overrides = {
                healthpenalty = "none",
                portalresurection = "always",
                darkness = "nonlethal",
                grassgekkos = "rare",
        },
}

5. 添加服务端mods

编辑DSTClusterConfig/mods下的dedicated_server_mods_setup.lua文件,这里放我安装的mods

代码: 全选

--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")

-- 防卡两招_新
-- https://steamcommunity.com/sharedfiles/filedetails/?id=3044756151
ServerModSetup("3044756151")

-- Global Positions
-- https://steamcommunity.com/sharedfiles/filedetails/?id=378160973
ServerModSetup("378160973")

-- 快速采集
-- https://steamcommunity.com/sharedfiles/filedetails/?id=501385076
ServerModSetup("501385076")

-- Show Me(中文)
-- https://steamcommunity.com/sharedfiles/filedetails/?id=2287303119
ServerModSetup("2287303119")

-- 成熟的箱子
-- https://steamcommunity.com/sharedfiles/filedetails/?id=2097358269
ServerModSetup("2097358269")

-- Restart(重生)
-- https://steamcommunity.com/sharedfiles/filedetails/?id=462434129
ServerModSetup("462434129")

-- 4/5/6格装备栏(适配mod版)
-- https://steamcommunity.com/sharedfiles/filedetails/?id=2798599672
ServerModSetup("2798599672")

-- 智能小木牌
-- https://steamcommunity.com/sharedfiles/filedetails/?id=1595631294
ServerModSetup("1595631294")

-- 木牌传送(皮肤版)
-- https://steamcommunity.com/sharedfiles/filedetails/?id=3353852416
ServerModSetup("3353852416")

-- 多年生作物
-- https://steamcommunity.com/sharedfiles/filedetails/?id=3328408598
ServerModSetup("3328408598")

-- 有阿比在,我不害怕!
-- https://steamcommunity.com/sharedfiles/filedetails/?id=3424873454
ServerModSetup("3424873454")

-- 暖心相拥
-- https://steamcommunity.com/sharedfiles/filedetails/?id=3359995816
ServerModSetup("3359995816")
接着编辑modoverrides.lua启动mods,应该很好懂,项目里也有示例

代码: 全选

-- Use this file to enable and configure your mods. The mod will only be available in the game
-- if you set "enabled=true"!!!
--
-- Also, during the container startup this file will be copied to both Master/ and Caves/ folders. What's setup here
-- will be available in both shards!
--
-- See the example below:

return {
        -- 防卡两招_新
        -- https://steamcommunity.com/sharedfiles/filedetails/?id=3044756151
        ["workshop-3044756151"]={
          configuration_options={
          },
          enabled=true
        },
    
        -- Global Positions
        -- https://steamcommunity.com/sharedfiles/filedetails/?id=378160973
        ["workshop-378160973"]={
            configuration_options={
            },
            enabled=true
        },
    
        -- 快速采集
        -- https://steamcommunity.com/sharedfiles/filedetails/?id=501385076
        ["workshop-501385076"]={
            configuration_options={
            },
            enabled=true
        },
    
        -- Show Me(中文)
        -- https://steamcommunity.com/sharedfiles/filedetails/?id=2287303119
        ["workshop-2287303119"]={
            configuration_options={
            },
            enabled=true
        },
    
        -- 智能小木牌
        -- https://steamcommunity.com/sharedfiles/filedetails/?id=1595631294
        ["workshop-1595631294"]={
            configuration_options={
                Icebox=true,
                SaltBox=true,
                BundleItems=true
            },
            enabled=true
        },
    
        -- Restart(重生)
        -- https://steamcommunity.com/sharedfiles/filedetails/?id=462434129
        ["workshop-462434129"]={
            configuration_options = {
                MOD_RESTART_CD_RESTART=3,
                MOD_RESTART_CD_RESURRECT=0,
                MOD_RESTART_CD_KILL=3,
                MOD_RESTART_FORCE_DROP_MODE=2,
                MOD_RESTART_MAP_SAVE=1,
                MOD_RESTART_RESURRECT_HEALTH=100
            },
            enabled=true
        },
    
        -- 4/5/6格装备栏(适配mod版)
        -- https://steamcommunity.com/sharedfiles/filedetails/?id=2798599672
        ["workshop-2798599672"]={
            configuration_options={
            },
            enabled=true
        },

        -- 木牌传送(皮肤版)
        -- https://steamcommunity.com/sharedfiles/filedetails/?id=3353852416
        ["workshop-3353852416"]={
            configuration_options={
                CH_LANG=true,
                HomesignEnable=true
            },
            enabled=true
        },

        -- 多年生作物
        -- https://steamcommunity.com/sharedfiles/filedetails/?id=3328408598
        ["workshop-3328408598"]={
            configuration_options={
            },
            enabled=true
        },

        -- 有阿比在,我不害怕!
        -- https://steamcommunity.com/sharedfiles/filedetails/?id=3424873454
        ["workshop-3424873454"]={
            configuration_options={
            },
            enabled=true
        },

        -- 暖心相拥
        -- https://steamcommunity.com/sharedfiles/filedetails/?id=3359995816
        ["workshop-3359995816"]={
            configuration_options={
            },
            enabled=true
        },
      }

6. 配置权限

看Dockerfile文件可以看到程序所用的用户是dst,而非root,所以直接运行会有权限问题,我们需要提前修改下权限

代码: 全选

chown 1000:1000 -R /opt/dst-dedicated-server

7. 启动服务器

这一步比较耗时,首先需要从dockerhub拉一个将近2G的容器,启动后服务器还需要从steam下载服务器下载一系列文件,最后还会生成地图,初次启动耗费时间因各种因素而异。

代码: 全选

# 启动容器
docker compose up -d
# 查看日志
docker compose logs -f
耐心等待服务器加载完毕,应该就能在饥荒搜索到自己的服务器了。
以下圈友为 BobMaster 的帖子点了赞:
genivel
人生如音乐,欢乐且自由
回复

在线用户

正浏览此版面之用户: 没有注册用户 和 10 访客