前言

这里主要是服务器太贵了利用frp取巧的方法物理机,理论上99一年的2H2G服务器带宽4M左右,可以支持四五个人组队玩吧?

mac安装(intel)

下载安装 docker ,https://www.docker.com/
Settings - Resources里面CPU和内存按需调整。
image

docker-compose.yml

自己搜索如何安装docker-compose。
然后创建一个文件夹 比如:
mkdir /Users/apple/Desktop/palServer
mkdir /Users/apple/Desktop/palServer/game
配置如下,mem_limit可以自己定内存达到这个程度会重启,其他的官网上都有见名知意了。

version: '3'
services:
  palworld-server:
    #build: .
    container_name: palworld-server
    image: jammsen/palworld-dedicated-server:latest
    restart: always
    mem_limit: 20g
    network_mode: bridge
    ports:
      - target: 8211 # Gamerserver port inside of the container
        published: 8211 # Gamerserver port on your host
        protocol: udp
        mode: host
      - target: 25575 # RCON port inside of the container
        published: 25575 # RCON port on your host
        protocol: tcp
        mode: host
    environment:
      - TZ=Asia/Shanghai # Change this for logging and backup, see "Environment-Variables"
      - ALWAYS_UPDATE_ON_START=true
      - MULTITHREAD_ENABLED=true
      - COMMUNITY_SERVER=true
      - BACKUP_ENABLED=true
      - BACKUP_CRON_EXPRESSION=0 * * * *
      - DIFFICULTY=None
      - DAYTIME_SPEEDRATE=1.000000
      - NIGHTTIME_SPEEDRATE=1.000000
      - EXP_RATE=1.000000
      - PAL_CAPTURE_RATE=1.000000
      - PAL_SPAWN_NUM_RATE=1.000000
      - PAL_DAMAGE_RATE_ATTACK=1.000000
      - PAL_DAMAGE_RATE_DEFENSE=1.000000
      - PLAYER_DAMAGE_RATE_ATTACK=1.000000
      - PLAYER_DAMAGE_RATE_DEFENSE=1.000000
      - PLAYER_STOMACH_DECREASE_RATE=1.000000
      - PLAYER_STAMINA_DECREACE_RATE=1.000000
      - PLAYER_AUTO_HP_REGENE_RATE=1.000000
      - PLAYER_AUTO_HP_REGENE_RATE_IN_SLEEP=1.000000
      - PAL_STOMACH_DECREACE_RATE=1.000000
      - PAL_STAMINA_DECREACE_RATE=1.000000
      - PAL_AUTO_HP_REGENE_RATE=1.000000
      - PAL_AUTO_HP_REGENE_RATE_IN_SLEEP=1.000000
      - BUILD_OBJECT_DAMAGE_RATE=1.000000
      - BUILD_OBJECT_DETERIORATION_DAMAGE_RATE=1.000000
      - COLLECTION_DROP_RATE=1.000000
      - COLLECTION_OBJECT_HP_RATE=1.000000
      - COLLECTION_OBJECT_RESPAWN_SPEED_RATE=1.000000
      - ENEMY_DROP_ITEM_RATE=1.000000
      - DEATH_PENALTY=All
      - ENABLE_PLAYER_TO_PLAYER_DAMAGE=false
      - ENABLE_FRIENDLY_FIRE=false
      - ENABLE_INVADER_ENEMY=true
      - ACTIVE_UNKO=false
      - ENABLE_AIM_ASSIST_PAD=true
      - ENABLE_AIM_ASSIST_KEYBOARD=false
      - DROP_ITEM_MAX_NUM=3000
      - DROP_ITEM_MAX_NUM_UNKO=100
      - BASE_CAMP_MAX_NUM=128
      - BASE_CAMP_WORKER_MAXNUM=15
      - DROP_ITEM_ALIVE_MAX_HOURS=1.000000
      - AUTO_RESET_GUILD_NO_ONLINE_PLAYERS=false
      - AUTO_RESET_GUILD_TIME_NO_ONLINE_PLAYERS=72.000000
      - GUILD_PLAYER_MAX_NUM=20
      - PAL_EGG_DEFAULT_HATCHING_TIME=72.000000
      - WORK_SPEED_RATE=1.000000
      - IS_MULTIPLAY=false
      - IS_PVP=false
      - CAN_PICKUP_OTHER_GUILD_DEATH_PENALTY_DROP=false
      - ENABLE_NON_LOGIN_PENALTY=true
      - ENABLE_FAST_TRAVEL=true
      - IS_START_LOCATION_SELECT_BY_MAP=true
      - EXIST_PLAYER_AFTER_LOGOUT=false
      - ENABLE_DEFENSE_OTHER_GUILD_PLAYER=false
      - COOP_PLAYER_MAX_NUM=4
      - MAX_PLAYERS=32
      - SERVER_NAME=画质不如原神
      - SERVER_DESCRIPTION=原神真好玩
      - ADMIN_PASSWORD=服务器管理密码123456
      - SERVER_PASSWORD=
      - PUBLIC_PORT=8211
      - PUBLIC_IP=
      - RCON_ENABLED=true
      - RCON_PORT=25575
      - REGION=
      - USEAUTH=true
      - BAN_LIST_URL=https://api.palworldgame.com/api/banlist.txt
    volumes:
      - /Users/apple/Desktop/palServer/game:/palworld

启动服务

docker-compose pull

docker-compose up -d

image-1706261563993
image-1706262901123

frp 安装

frps.toml,也就是frp服务端配置。

bindPort = 7001
transport.tls.enable = true

#身份验证
auth.method = "token"  #{可选}身份验证方式
auth.token = "123456" #token 设置密码,用于通过身份验证创建连接

#frp 服务仪表板配置
webServer.port = 17888  #{也可自行修改端口}
webServer.addr = "0.0.0.0" #公网 ip 或者域名
webServer.user = "abc" #登录用户名{可自行修改}
webServer.password = "abc" #登录密码{可自行修改}

frpc.toml,frp客户端配置

serverAddr = "111.111.111.111" #填写你的 frps 服务器
serverPort = 7001 #填写你的 frps 服务的端口
auth.token = "123456"
transport.tls.enable = true

[[proxies]]
name = "palworld-udp"
type = "udp"
localIP = "127.0.0.1"
localPort = 8211
remotePort = 8020

[[proxies]]
name = "palworld-rcon"
type = "tcp"
localIP = "127.0.0.1"
localPort = 25575
remotePort = 7575

服务器防火墙规则

image-1706263153618

原神启动

客户端连接专用服务器111.111.111.111:8020,这里我们端口转发成了8020

性能相关

这是三个人轻度玩了两天的内存占用。
image-1706492511243

rcon

https://github.com/gorcon/rcon-cli
运行命令: rcon -a 111.111.111.111:7575 -p 123456
即可使用服务器管理指令,rcon里面可以不用/
管理员可以用的指令大致如下

Command 命令 Description 描述
/Shutdown {Seconds} 正常关闭服务器 Gracefully shuts down server with an optional timer and/or message to notify players in your server. 使用可选的计时器和/或消息正常关闭服务器,以通知服务器中的玩家。
/DoExit 强制关闭服务器 Forcefully shuts down the server immediately. It is not recommended to use this option unless you’ve got a technical problem or are okay with potentially losing data. 立即强制关闭服务器。不建议使用此选项,除非您遇到技术问题或可以接受可能丢失数据的情况。
/Broadcast 广播消息 Broadcasts a message to all players in the server. 向服务器中的所有玩家广播消息。
/KickPlayer 踢出玩家 Kicks player from the server. Useful for getting a player’s attention with moderation. 将玩家踢出服务器。有助于适度地吸引玩家的注意力。
/BanPlayer 禁止玩家进入服务器 Bans player from the server. The Player will not be able to rejoin the server until they are unbanned. 禁止玩家进入服务器。玩家在解禁之前将无法重新加入服务器。
/TeleportToPlayer {PlayerUID or SteamID} INGAME ONLY 游戏内传送到玩家 Immediately teleport to the target player. 仅限游戏内立即传送到目标玩家。
/TeleportToMe {PlayerUID or SteamID} INGAME ONLY 游戏内将玩家传送到自己身边 Immediately teleports target player to you. 仅限游戏内立即将目标玩家传送到您身边。
/ShowPlayers 显示已连接玩家信息 Shows information on all connected players. 显示所有已连接玩家的信息。
/Info 显示服务器信息 Shows server information. 显示服务器信息。
/Save 保存世界数据 Save the world data to disk. Useful to ensure your Pal, player, and other data is saved before stopping the server or performing a risky gameplay option. 将世界数据保存到磁盘。有助于确保您的好友、玩家和其他数据在停止服务器或执行有风险的游戏选项之前得到保存。

Q.E.D.


味无味处求吾乐,材不材间过此生。