饥荒服务器搭建教程【云服务器】

  • 内容
  • 相关

流程

  • 安装环境库
  • 安装steam
  • 手动建立游戏(饥荒)文件夹
  • 配置游戏设置文件,服务器可以运行了!
  • 配置mod文件

  • 安装环境库

这边建议系统是ubuntu 32位

先输入以下命令:

sudo dpkg --add-architecture i386
sudo apt-get update

执行安装:

sudo apt-get install libcurl4-gnutls-dev:i386

  • 下载、安装steam

wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
tar -zxvf steamcmd_linux.tar.gz

运行steamcad

./steamcmd.sh

进入steam命令模式>steam

匿名登陆

login anonymous

指定安装文件夹 DSTserver

force_install_dir DSTserver

安装游戏

app_update 343050 validate

  • 创建游戏(饥荒)文件夹

mkdir -p ~/.klei/DoNotStarveTogether/Documents

Documents文件夹下,创建adminlist.txt文件和cluster_token.txt

adminlist.txt写入UserID,cluster_token.txt写入cluster_token,(UserID和cluster_token在官网获得。)


Documents文件夹下,再创建一个配置文件cluster.ini

写入配置如下:

[GAMEPLAY]
max_players = 6
pvp = false
game_mode = endless
pause_when_empty = true
vote_kick_enabled = true

[NETWORK]
cluster_description = 服务器描述
cluster_name = 服务器名称
cluster_password = 服务器密码
cluster_intention = cooperative

[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 = 10889
cluster_key = supersecretkey

Documents文件夹下,创建Master文件夹。进入Master文件夹,创建server.ini和worldgenoverride.lua

写入server.ini如下

[NETWORK]
server_port = 11000

[SHARD]
is_master = true

[STEAM]
master_server_port = 27018
authentication_port = 8768

[ACCOUNT]
encode_user_path = true

注意配置的完整性。

写入worldgenoverride.lua如下

return {
    override_enabled = true,
    preset = "SURVIVAL_TOGETHER",
}

这里就不弄地下世界Caves了。

cd ~,回到在主目录,创建启动脚本startDST.sh

写入配置如下:

#!/bin/bash
steamcmd_dir="$HOME/steamcmd"
install_dir="$HOME/DSTserver"
cluster_name="Documents"
cd "$install_dir/bin"

run_shared=(./dontstarve_dedicated_server_nullrenderer)
run_shared+=(-console)
run_shared+=(-cluster "$cluster_name")
run_shared+=(-monitor_parent_process $$)

#如果主机只有1g内存,必须删除 & 后面的caves的内容,因为带不动地下世界
"${run_shared[@]}" -shard Master | sed 's/^/Master: /' &
"${run_shared[@]}" -shard Caves  | sed 's/^/Caves:  /'

给脚本权限

chmod 777 startDST.sh

检查一下环境

ldd ~/DSTserver/bin/dontstarve_dedicated_server_nullrenderer

有时候DSTserver文件夹是其他的名字,比如dontstarve_dedicated_server,注意要改回DSTserver。

最后的安装个screen,方便查看内存和性能,还能后台。

screen -S dst  #开启,需要退出可以ctrl + a + d
screen -r dst #恢复screen

启动服务器

./startDST.sh

  • 配置mod

修改DSTserver/mods/目录下的dedicated_server_mods_setup.lua

先开启mod的配置:

ServerModSetup("mod代号,看上面注释的默认的")   --用于安装mod
ServerModCollectionSetup("mod代号,同理") --用于更新mod

再写入mod,如:

ServerModSetup("362175979") -- Wormhole Marks       标记相联通的虫洞
ServerModSetup("378160973") -- Global Positions     小地图显示玩家位置 共享地图发现
ServerModSetup("385006082") -- DST Path Lights      路径灯在黄昏时开启,在黎明时关闭
ServerModSetup("396822875") -- Spike Trap           增加两个陷阱 
ServerModSetup("444235588") -- Deluxe Campfires     豪华营火 增加燃烧时间
ServerModSetup("458587300") -- Fast Travel          快速旅行
ServerModSetup("458940297") -- FFood Values         显示食物价值
ServerModSetup("462372013") -- Always fresh         冰箱里物品永远不坏 
ServerModSetup("462434129") -- Restart              #重生 #复活 #自杀 Y:公聊 U:私聊
ServerModSetup("604761020") -- Multi Rocks          持久挖矿 让卵石更耐挖
ServerModSetup("623286817") -- Free transplant      移植无需施肥
ServerModSetup("661253977") -- Don't Drop Everything 死亡不掉落
ServerModSetup("666155465") -- Show Me              鼠标显示更多信息
ServerModSetup("785295023") -- Super Wall DST       超级墙DST 无敌的超级墙、自动门、栅栏和栅栏门
ServerModSetup("786556008") -- 45 Inventory Slots   45个格子
ServerModSetup("831523966") -- 999 Stack Size       叠加物品到 999 个
ServerModSetup("1301033176") -- Chinese Language    中文语言包 汉化了人物台词

在.klei/DoNotStarveTogether/Documents/Master/文件夹下创建modoverrides.lua。

写入格式为:

return {
    ["workshop-371920345"]={ configuration_options={  }, enabled=true },
    ...
  }

参考下面吧:

return {
  ["workshop-1200745268"]={
    configuration_options={
      Animal=true,
      BuildRepair=true,
      ChopTime=1,
      CookTime=0,
      FishTime=0,
      HSHU=true,
      MineTime=1,
      Others=true,
      Pick=true,
      QuickDry=true,
      QuickGrow=0 
    },
    enabled=true 
  },
  ["workshop-1301033176"]={ configuration_options={ LANG="auto" }, enabled=true },
  ["workshop-1673729468"]={
    configuration_options={ [""]=0, light_colour="white", light_radius="medium" },
    enabled=true 
  },
  ["workshop-356930882"]={ configuration_options={ uses=10000000, uses2=10000000 }, enabled=true },
  ["workshop-361994110"]={
    configuration_options={ HAT_DECAY=false, RELEASE_BEES=false, SPRING_BEES=true },
    enabled=true 
  },
  ["workshop-362175979"]={ configuration_options={ ["Draw over FoW"]="disabled" }, enabled=true },
  ["workshop-371920345"]={ configuration_options={  }, enabled=true },
  ["workshop-375850593"]={ configuration_options={  }, enabled=true },
  ["workshop-375859599"]={
    configuration_options={
      divider=5,
      random_health_value=0,
      random_range=0,
      show_type=0,
      unknwon_prefabs=1,
      use_blacklist=true 
    },
    enabled=true 
  },
  ["workshop-378160973"]={
    configuration_options={
      ENABLEPINGS=true,
      FIREOPTIONS=2,
      OVERRIDEMODE=false,
      SHAREMINIMAPPROGRESS=true,
      SHOWFIREICONS=true,
      SHOWPLAYERICONS=true,
      SHOWPLAYERSOPTIONS=2 
    },
    enabled=true 
  },
  ["workshop-386087632"]={ configuration_options={  }, enabled=true },
  ["workshop-396026892"]={ configuration_options={ OPT_DIFFICULTY=1 }, enabled=true },
  ["workshop-444235588"]={
    configuration_options={
      deluxeEndoFirepitBurnRate=0.75,
      deluxeFirepitBurnRate=0.75,
      dropLoot="yes",
      endoDropLoot="yes",
      heatStarBurnRate=0.9,
      heatStarDropLoot="yes",
      iceStarBurnRate=0.9,
      iceStarDropLoot="yes",
      recipeCost="standard",
      starsSpawnHounds="no" 
    },
    enabled=true 
  },
  ["workshop-458587300"]={ configuration_options={ Ownership=false, Travel_Cost=32 }, enabled=true },
  ["workshop-458940297"]={
    configuration_options={
      DFV_ClientPrediction="default",
      DFV_FueledSettings="default",
      DFV_Language="EN",
      DFV_MinimalMode="default",
      DFV_PercentReplace="default",
      DFV_ShowACondition="default",
      DFV_ShowADefence="default",
      DFV_ShowAType="default",
      DFV_ShowDamage="default",
      DFV_ShowFireTime="default",
      DFV_ShowInsulation="default",
      DFV_ShowTemperature="default",
      DFV_ShowUses="default" 
    },
    enabled=true 
  },
  ["workshop-462372013"]={ configuration_options={  }, enabled=true },
  ["workshop-462434129"]={
    configuration_options={
      MOD_RESTART_ALLOW_KILL=true,
      MOD_RESTART_ALLOW_RESTART=true,
      MOD_RESTART_ALLOW_RESURRECT=true,
      MOD_RESTART_CD_BONUS=0,
      MOD_RESTART_CD_KILL=3,
      MOD_RESTART_CD_MAX=0,
      MOD_RESTART_CD_RESTART=5,
      MOD_RESTART_CD_RESURRECT=7,
      MOD_RESTART_FORCE_DROP_MODE=0,
      MOD_RESTART_IGNORING_ADMIN=true,
      MOD_RESTART_MAP_SAVE=2,
      MOD_RESTART_RESURRECT_HEALTH=0,
      MOD_RESTART_TRIGGER_MODE=1,
      MOD_RESTART_WELCOME_TIPS=true,
      MOD_RESTART_WELCOME_TIPS_TIME=6 
    },
    enabled=true 
  },
  ["workshop-478005098"]={ configuration_options={  }, enabled=true },
  ["workshop-604761020"]={
    configuration_options={
      RUOYINXIAN=false,
      SHENGDANSHI=false,
      baoshibaolv=1,
      blue_baoshi=1,
      er_shuoming=0,
      green_baoshi=1,
      huangjinbaolv=1,
      marble_suipian=1,
      orange_baoshi=1,
      purple_baoshi=1,
      red_baoshi=1,
      shishengzhang=0,
      shitoubaolv=1,
      thulecite_xiukuang=1,
      wajuecishu=2,
      yellow_baoshi=1,
      yi_shuoming=0 
    },
    enabled=true 
  },
  ["workshop-623286817"]={ configuration_options={ NOFERTILIZE=false }, enabled=true },
  ["workshop-661253977"]={
    configuration_options={ amudiao=true, baodiao=1, kong=0, rendiao=2, zbdiao=true },
    enabled=true 
  },
  ["workshop-666155465"]={
    configuration_options={
      food_estimation=-1,
      food_order=0,
      food_style=0,
      lang="auto",
      show_food_units=-1 
    },
    enabled=true 
  },
  ["workshop-670918115"]={ configuration_options={  }, enabled=true },
  ["workshop-785295023"]={
    configuration_options={
      bossres=true,
      companion=true,
      dist=2.5,
      healthmul=-1,
      language="AUTO",
      minimapicon=false,
      ownership=0,
      rebounddmg=0,
      recipe="normal",
      recipe_door=true,
      recipe_fence=true,
      recipe_tool=true,
      recipe_vanilla=false,
      recipe_wall=true 
    },
    enabled=true 
  },
  ["workshop-786556008"]={
    configuration_options={ ENABLEBACKPACK=false, EXTRASLOT=0, INVENTORYSIZE=45 },
    enabled=true 
  },
  ["workshop-831523966"]={ configuration_options={  }, enabled=true },
  ["workshop-856487758"]={ configuration_options={  }, enabled=true },
  ["workshop-922251350"]={ configuration_options={ auto_stack=true, auto_stack_range=10 }, enabled=true } 
}

数字就是mod的代码,对应写入。

游戏的更新

配置好mod后就是更新游戏了。

启动steam

在steamcmd文件夹下:

./steamcmd.sh

匿名登陆并更新游戏

login anonymous
app_update 343050 validate

清空swap缓存

sync
echo 3 > /proc/sys/vm/drop_caches

重启你的Linux服务器,启动脚本,后台,就ok了

建议少量修改&保存你的cluster.ini(比如服务器名字加个字)


31f90b47ada01bbaadd54597931f60b1.jpg



本文标签:

版权声明:若无特殊注明,本文皆为《z》原创,转载请保留文章出处。

本文链接:饥荒服务器搭建教程【云服务器】 - https://www.52zzk.cn/post-115.html

发表评论

电子邮件地址不会被公开。 必填项已用*标注