1.需要提前准备
sudo apt-get install steamcmd:i386
steamcmd +@sSteamCmdForcePlatformType windows +login anonymous +force_install_dir /games/forest +app_update 556450 validate +quit
- wine(由于森林只提供windows服务端,需要wind在linux上运行)
sudo apt-get install wine-stable
sudo apt-get install winbind
sudo apt-get install xvfb
sudo apt-get install screen
2.搭建
- 新建一个脚本
run.sh
- 给脚本运行权限
chmod 777 run.sh
- 在脚本中写入命令
screen -t 'forest' -S 'forest' -dm bash -c 'cd /games/forest; xvfb-run --auto-servernum --server-args="-screen 0 640x480x24:32" wine ./TheForestDedicatedServer.exe -batchmode -nographics -savefolderpath "/games/data/forest/saves/" -configfilepath "/games/data/forest/config/config.cfg"; exec sh'
- 运行脚本
./run.sh
- 通过
screen -r forest
查看后台
3. 注意
- 上述流程均转载自
https://steamcommunity.com/sharedfiles/filedetails/?id=1423538141
,如有问题请自行查阅 - 服务器配置参照
https://www.594594.xyz/2020/03/19/ECS_build_The%20Forest_server/
4. 说下我自己遇到的问题
- 服务器需要开放
8766
, 27015
, 27016
三个端口 - 服务器配置中
ServerIP
需要是内网ip,不是外网ip - 后台没有报错还是无法正常开启,检查安装wine的版本(
wine --version
),如果是3.0
版本,想办法安装4.0以上的版本(http://iqotom.com/?p=244
) - 后台一直报错
RenderTexture.Create failed: format unsupported - 2.
, 在wine
的参数后面加|grep -v "RenderTexture.Create failed: format unsupported - 2."
,如下:(但还是会一直输出空行,感觉没什么意义)
screen -t 'forest' -S 'forest' -dm bash -c 'cd /home/forest; xvfb-run --auto-servernum --server-args="-screen 0 640x480x24:32" wine ./TheForestDedicatedServer.exe -batchmode -nographics -savefolderpath "/home/forest/saves/" -configfilepath "/home/forest/config/config.cfg" |grep -v "RenderTexture.Create failed: format unsupported - 2."; exec sh'