Server

From Palworld Wiki
Jump to navigation Jump to search

Servers are dedicated game servers maintained by Pocketpair or by independent server hosts.

Types of servers

Official server

Palworld runs their own official servers, to view their current status, you can do so here: https://palworld.statuspage.io/

Dedicated server

If you wish to use a cloud hosting provider, you can view the actively maintained Server Hosting Providers for an up-to-date list of who you can host through.

Hosting Your Own Server

The Palworld Devs have official documentation on setting up and configuring a dedicated server on both Windows and Linux, view the most up-to-date guide here.

If you run into issues, there is an actively maintained FAQ page the Palworld Discord uses here.

Alternate Installation Methods

If you don't want to use the officially documented way to run a dedicated server, there are a few other ways that you can get a server deployed.

Docker

If you want to run the Palworld server on Linux using a Docker container, you can use one of the following images:

GSM (Game Server Manager)

You can use GSM to quickly get a server up and running on Linux or Windows: https://linuxgsm.com/servers/pwserver/

Server Scripts

This is a list of popular scripts for Linux and Windows that can make server management easier. You should independently verify these scripts on your own, if you don't know what they do, don't run them!

Windows

Affinity Script [1]

WARNING: This is for advanced users, if you don't understand what the below scripts are doing, do not run them!

If you would like to set what CPU cores the Palword server should run on, you can use the below set of scripts.

Inside the Palworld server folder, create a file called run.bat with the following contents:

@echo off
start PalServer.exe -port=youserverport -players=80 -EpicApp=PalServer -publicip=youserevrip -serverpassword=""
timeout /t 3
PowerShell -ExecutionPolicy Bypass -File SetAffinity.ps1

Where youserverport is the port that the server should run on, and youserverip is your public IP address. Then, create SetAffinity.ps1 in the same folder:

$processName = "PalServer-Win64-Test-Cmd" 
$affinity = 0xF

while ($true) {
    $process = Get-Process $processName -ErrorAction SilentlyContinue
    if ($process) {
        $process.ProcessorAffinity = $affinity
        break
    }
    Start-Sleep -Seconds 1
}

Set the affinity variable to one of the following based on what cores you want the server to run on:

Core Numbers Hex Value
0, 1, 2, 3 $affinity = 0xF
4, 5, 6, 7 $affinity = 0xF0
8, 9, 10, 11 $affinity = 0xF00
12, 13, 14, 15 $affinity = 0xF000
0, 1 $affinity = 0x3
2, 3 $affinity = 0xC
4, 5 $affinity = 0x30
6, 7 $affinity = 0xC0
8, 9 $affinity = 0x300
10, 11 $affinity = 0xC00
12, 13 $affinity = 0x3000
14, 15 $affinity = 0xC000

From there, simply run the run.bat file, and the server should come up and start working.

Backup Script [1]

WARNING: This is for advanced users, if you don't understand what the below scripts are doing, do not run them!

This script can be added to the run.bat script above to create periodic backups of the game. Create BackupScript.ps1 with the following:

$sourceFolder = "D:\PalWorld\steamapps\common\PalServer\Pal\Saved\SaveGames\0"
$backupFolder = "D:\PalWorld\steamapps\common\PalServer\Pal\Saved\SaveGames\backups"
$interval = 2 * 60 * 60 # interval in seconds
$maxBackups = 10 # backup copy count

while ($true) {
    if (Test-Path -Path $sourceFolder) {
        $timestamp = Get-Date -Format "yyyyMMddHHmmss"
        $backupPath = Join-Path $backupFolder ("Backup_" + $timestamp)
        Copy-Item $sourceFolder $backupPath -Recurse

        $backups = Get-ChildItem $backupFolder | Sort-Object CreationTime -Descending
        if ($backups.Count -gt $maxBackups) {
            $backups | Select-Object -Skip $maxBackups | Remove-Item -Recurse
        }
    }

    Start-Sleep -Seconds $interval
}

Replace the first 4 lines to match your setup, the path that you have the server installed to, the path you would like to back up to, how often you would like to back it up, and the max number of backups to keep. Then, add the following line to the run.bat file above:

PowerShell -ExecutionPolicy Bypass -File BackupScript.ps1

Linux

Simple Backup Script

WARNING: This is for advanced users, if you don't understand what the below scripts are doing, do not run them!

You can use this script to create a backup of the server whenever manually run:

#!/bin/bash

# Define source directory and backup directory
SOURCE_DIR="/opt/game/Pal/Saved/SaveGames/0"
BACKUP_DIR="/path/to/your/backup/directory"
DATE=$(date +%Y%m%d_%H%M%S)

# Create a gzip compressed tarball
tar -czf "${BACKUP_DIR}/backup_${DATE}.tar.gz" -C "${SOURCE_DIR}" .

echo "Backup of ${SOURCE_DIR} completed at ${BACKUP_DIR}/backup_${DATE}.tar.gz"

[2]

Make sure the bash file is executable with chmod +x backup.sh. Then you can run it by simply running ./backup.sh

If you would like to have this run on a schedule, you can use something like CRON or systemd-timers to run it periodically

CRON

Install the following CRON job into /etc/crontab to run hourly backups, replacing /path/to/script with the real path:

0 * * * * /path/to/script

The job should then be executed at the top of every hour.

systemd-timers

First, you need to create a systemd service for the backup script, install a file called palworld-backup.service into /etc/systemd/system/

[Unit]
Description=Creates backup for Palworld server
Wants=palworld-backup.timer

[Service]
Type=oneshot
ExecStart=/path/to/script

[Install]
WantedBy=multi-user.target

Then, we need to create the timer file at the same location, called palworld-backup.timer:

[Unit]
Description=Run palworld backup hourly
Requires=palworld-backup.service

[Timer]
Unit=myMonitor.service
OnCalendar=hourly

[Install]
WantedBy=timers.target

Now we can reload systemd and start the timer:

sudo systemctl daemon-reload
sudo systemctl enable --now palworld-backup.timer

The server backup should run at the top of every hour.


  1. 1.0 1.1 Written by user 'sephirothcreascent' on the Palworld Discord server
  2. Palworld discord FAQ - https://gist.github.com/Toakan/3c78a577c21a21fcc5fa917f3021d70e#linux