采用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
文件,里面用于覆盖默认的地图配置,比如关闭死亡血量惩罚等参考资料:
- https://forums.kleientertainment.com/fo ... ol-update/
- https://forums.kleientertainment.com/fo ... gs/page/5/
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
代码: 全选
-- 防卡两招_新
-- 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")
modoverrides.lua
启动mods,应该很好懂,项目里也有示例
代码: 全选
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=2097358269
["workshop-2097358269"]={
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