《幻兽帕鲁》的热潮正在席卷游戏界。对于那些更喜欢与熟悉的伙伴们共同探险的玩家来说,搭建一个私人服务器无疑是最佳选择。拥有个人服务器不仅意味着更高的隐私性,还允许你根据喜好调整游戏参数,比如改变游戏内的工作速度倍率、经验值获取倍率等,从而打造一个定制化的游戏环境。本教程将带你快速步入搭建《幻兽帕鲁》服务器的过程,让你在几分钟之内就能和朋友们开启专属的冒险之旅。
准备工作
1.一台服务器
硬件要求:
参数 | 数值 | 备注 |
---|---|---|
CPU | 4核推荐 | |
内存 | 16GB建议使用 32GB 以上才能稳定运行。用8GB启动服务器是可以的,但是玩得越久,服务器就会因为内存不足而崩溃。 | |
网络 | UDP 端口 8211(默认) |
2.系统镜像选择
有Windows、Linux可供选择,建议使用Linux系统,得益于其极佳的稳定性。
3.选购服务器
腾讯云:推荐腾讯云轻量应用服务器4C8G配置,系统推荐CentOS7.6
阿里云:阿里云游戏联机服务器专题页,点击 一键购买及部署 即可快速搭建出你的专属幻兽帕鲁服务器。
安装部署
PalServer安装
1.安装软件库
yum install glibc.i686 libstdc++.i686
2.创建用户
sudo useradd -m steam sudo passwd steam sudo -u steam -s cd /home/steam
3.下载SreamCMD
mkdir ~/Steam && cd ~/Steam curl -sqL "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" | tar zxvf -
4.下载PalServer
./steamcmd.sh +login anonymous +app_update 2394010 validate +quit
下载完成后,必须进入到游戏目录中,尝试运行。
cd steamapps/common/PalServer ./PalServer.sh
如果出现报错
.steam/sdk64/steamclient.so: cannot open shared object file: No such file or directory
打开steamcmd目录,输入以下命令行
cd /home/steam/Steam mkdir -p ~/.steam/sdk64/ ./steamcmd.sh +login anonymous +app_update 1007 +quit cp ~/Steam/steamapps/common/Steamworks\ SDK\ Redist/linux64/steamclient.so ~/.steam/sdk64/
重新启动游戏服务端
cd steamapps/common/PalServer ./PalServer.sh
如果出现以下信息为正常情况
sh: xdg-user-dir: command not found dlopen failed trying to load: steamclient.so with error: steamclient.so: cannot open shared object file: No such file or directory [S_API] SteamAPI_Init(): Loaded '/home/steam/.steam/sdk64/steamclient.so' OK. (First tried local 'steamclient.so') CAppInfoCacheReadFromDiskThread took 1 milliseconds to initialize Setting breakpad minidump AppID = 2394010 [S_API FAIL] Tried to access Steam interface SteamUser021 before SteamAPI_Init succeeded. [S_API FAIL] Tried to access Steam interface SteamFriends017 before SteamAPI_Init succeeded. [S_API FAIL] Tried to access Steam interface STEAMAPPS_INTERFACE_VERSION008 before SteamAPI_Init succeeded. [S_API FAIL] Tried to access Steam interface SteamNetworkingUtils004 before SteamAPI_Init succeeded.
编辑配置文件
默认配置文件位置[/home/steam/Steam/steamapps/common/PalServer/DefaultPalWorldSettings.ini]
cp /home/steam/Steam/steamapps/common/PalServer/DefaultPalWorldSettings.ini /home/steam/Steam/steamapps/common/PalServer/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini vim /home/steam/Steam/steamapps/common/PalServer/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini
配置文件参数
参数 | 英文 | 机翻 |
---|---|---|
DayTimeSpeedRate | Day time speed | 白天速度 |
NightTimeSpeedRate | Night time speed | 夜间速度 |
ExpRate | EXP rate | 经验率 |
PalCaptureRate | Pal capture rate | 好友捕获率 |
PalSpawnNumRate | Pal appearance rate | Pal出现率 |
PalDamageRateAttack | Damage from pals multipiler | 好友倍增器造成的伤害 |
PalDamageRateDefense | Damage to pals multipiler | 对好友倍增器造成伤害 |
PlayerDamageRateAttack | Damage from player multipiler | 玩家倍增造成的伤害 |
PlayerDamageRateDefense | Damage to player multipiler | 对玩家造成的伤害乘数 |
PlayerStomachDecreaceRate | Player hunger depletion rate | 玩家饥饿消耗率 |
PlayerStaminaDecreaceRate | Player stamina reduction rate | 玩家体力减少率 |
PlayerAutoHPRegeneRate | Player auto HP regeneration rate | 玩家自动HP回复率 |
PlayerAutoHpRegeneRateInSleep | Player sleep HP regeneration rate | 玩家睡眠HP回复率 |
PalStomachDecreaceRate | Pal hunger depletion rate | 伙伴饥饿消耗率 |
PalStaminaDecreaceRate | Pal stamina reduction rate | 帕尔耐力减少率 |
PalAutoHPRegeneRate | Pal auto HP regeneration rate | Pal自动HP回复率 |
PalAutoHpRegeneRateInSleep | Pal sleep health regeneration rate (in Palbox) | Pal 睡眠健康恢复率(Palbox 中) |
BuildObjectDamageRate | Damage to structure multipiler | 多层结构损坏 |
BuildObjectDeteriorationDamageRate | Structure determination rate | 结构测定率 |
CollectionDropRate | Getherable items multipiler | 可收集物品倍增器 |
CollectionObjectHpRate | Getherable objects HP multipiler | 可收集的物体 HP 倍增器 |
CollectionObjectRespawnSpeedRate | Getherable objects respawn interval | 可收集物体的重生间隔 |
EnemyDropItemRate | Dropped Items Multipiler | 掉落物品倍增器 |
DeathPenalty | Death penalty None : No lost, Item : Lost item without equipment, ItemAndEquipment : Lost item and equipment, All : Lost All item, equipment, pal(in inventory) | 死亡后 None : 没有丢失, Item : 丢失的没有装备的物品, ItemAndEquipment : 丢失的物品和装备, All : 丢失所有物品、装备、朋友(库存中) |
GuildPlayerMaxNum | Max player of Guild | 公会最大玩家数 |
PalEggDefaultHatchingTime | Time(h) to incubate massive egg | 孵化大蛋的时间(h) |
ServerPlayerMaxNum | Maximum number of people who can join the server | 服务器最多可加入人数 |
ServerName | Server name | 服务器名称 |
ServerDescription | Server description | 服务器描述 |
AdminPassword | AdminPassword | 管理员密码 |
ServerPassword | Set the server password. | 设置服务器密码。 |
PublicPort | Public port number | 公共端口号 |
PublicIP | Public IP | 公共IP |
RCONEnabled | Enable RCON | 启用RCON |
RCONPort | Port number for RCON | RCON 的端口号 |
6.连接到游戏服务器
服务器控制台防火墙放通udp8211
7.在游戏中使用管理员命令
按下Enter
调出聊天框,输入/adminpassword 你设置的管理员密码 即可获得管理员权限
管理员命令
命令 | 描述 | 机翻描述 |
---|---|---|
/Shutdown {Seconds} {MessageText} | The server is shut down after the number of Seconds Will be notified of your MessageText. | 服务器关闭后的秒数将通知您的 MessageText。 |
/DoExit | Force stop the server. | 强制停止服务器。 |
/Broadcast {MessageText} | Send message to all player in the server. | 向服务器中的所有玩家发送消息。 |
/KickPlayer {SteamID} | Kick player from the server. | 将玩家从服务器中踢出。 |
/BanPlayer {SteamID} | BAN player from the server. | 从服务器禁止玩家。 |
/TeleportToPlayer {SteamID} | Teleport to current location of target player. | 传送到目标玩家的当前位置。 |
/TeleportToMe {SteamID} | Target player teleport to your current location | 目标玩家传送到您当前的位置 |
/ShowPlayers | Show information on all connected players. | 显示所有已连接玩家的信息。 |
/Info | Show server information. | 显示服务器信息。 |
/Save | Save the world data. | 保存世界数据。 |
9.获取steamID
在获取管理员权限后,按下 ESC
后点击 选项
即可看到steamid,右键单击两次即可复制
10.添加启动服务
Ctrl+C停止游戏服务程序,输入以下命令挂起程序
切到root用户
sudo su sudo usermod -aG wheel steam
vim /etc/systemd/system/palserver.service
填写以下配置
[Unit] Description=PalServer After=network.target [Service] User=steam ExecStart=/usr/bin/sudo -u steam /home/steam/Steam/steamapps/common/PalServer/Pal/Binaries/Linux/PalServer-Linux-Test Pal "" Restart=always [Install] WantedBy=default.target
保存后输入systemctl daemon-reload
重载配置
设置开机自启 sudo systemctl enable palserver 启动 sudo systemctl start palserver 查看状态 sudo systemctl status palserver 停止 sudo systemctl stop palserver 重启 sudo systemctl restart palserver
11.配置虚拟内存以及定时清理缓存
配置虚拟内存
查看当前虚拟内存空间
free -h
设置虚拟内存为12G,建议根据机型调整
内存小于等于 2GB: 设置为内存的两倍。 内存大于 2GB 且小于 8GB: 设置为内存的1.5倍。 内存大于 8GB 且小于 64GB:等于内存大小。 内存大于 64GB: 设置为64GB。
sudo fallocate -l 12G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
检查虚拟内存空间
free -h
配置定时清理缓存
vim clean.sh
#!/bin/bash sync echo 1 > /proc/sys/vm/drop_caches
vim /etc/crontab
这里设置的是每2h执行一次,可以根据服务器配置进行调整。
0 */2 * * * root /path/to/sync.sh
参考文献
幻兽帕鲁官网教程:https://tech.palworldgame.com/dedicated-server-guide