Hosting a Local Server

Planetary Annihilation includes a local server for single player that also fully supports both offline and online multiplayer LAN games on your personal super computer.

Playing PA with a local server on the same computer requires a MODERN mid-top spec CPU and plenty of free RAM. eg minimum 8GB free and ideally 16GB free.

The minimum specs for using single player local servers with TITANS are:

  • MODERN quad core
  • 8GB RAM for dedicated GPUs
  • 12GB RAM for integrated GPUs

A good indicator of raw CPU performance is: https://www.cpubenchmark.net/singleThread.html

If you’re playing and hosting a local server on the same computer then high core counts are useful especially if you are also streaming.

Failing to connect to a local server is usually caused by:

  • firewalls / security suites / antivirus interfering with network connections
  • incorrect port mapping / forwarding / pinholes with WAN games over the internet
  • corrupt files
  • broken mods

Hosting multiplayer games on a local server requires a top spec modern CPU ideally with 16GB+ RAM.

Multiplayer LAN Games

When all players and the server are on the same IPv4 local network you can host a LAN game.

Offline (not logged in) LAN Games

When offline you are NOT logged in using a PA or Steam account. You can also be disconnected from the internet after initial setup.

LAN Setup

  • Every player must have the same build of PA
  • Every player must use a unique username
  • Every player must be on the same network subnet to receive LAN beacons
  • Every player must enable Community Mods
  • Servers use TCP port 20545 for games and UDP port 8192 for LAN beacons to advertise local games

Hosting a LAN Game From Within PA

  • Local server and local server multi-threading should be enabled in:
    • settings > server
  • Create a local game on your personal super computer using:
    • start > multiplayer > custom > create game
  • Make the game public to start broadcasting the LAN beacon for your game
  • Leave the game public to allow players to reconnect or spectate

Joining a LAN Game

  • Players can join your LAN game using:
    • start > multiplayer > custom
  • Public LAN games are listed under the Local region

Online (logged in) LAN Games

When online you are logged in using a PA or steam account via the internet.

Each player must be logged in using a different account or offline using a different username.

When hosting ensure host game locally is enabled before you create the game.

Multiplayer WAN Games Over the Internet

Using the Connect Buttons mod from Community Mods players can connect to private servers hosted over the internet.

WAN Setup

  • Every player must have the same build of PA
  • Every player must use a unique username
  • Every remote player needs to install the Connect Buttons mod and will need to know the public IPv4 or DNS address of your server
  • Servers use TCP port 20545 for games and need to be accessible via a public IPv4 address
    • If your local server is using a private IPv4 address like 192.168.x.x or 10.x.x.x then you’ll need to setup port mapping / port forwarding / pinholes in your router / modem
  • You’ll need high quality broadband or fibre to host a local server over the internet
    • At least 5 Mbit/s upload is recommended and ideally 10+ Mbit/s for bigger games with spectators
    • Larger games with more players and spectators will require more bandwidth

Port Mapping / Port Forwarding / Pinholes

You’ll need to figure this out yourself… don’t ask for help about your specific router. Try google or https://www.howtogeek.com/66214/how-to-forward-ports-on-your-router/

Your local PC hosting your local PA server on TCP port 20545 will be using a private IP address not accessible from the internet. eg 192.168.x.x or 10.x.x.x

Port mapping / port forwarding / pinholes open TCP port 20545 on your public IP address so that your local PA server can be accessed via the internet.

eg assuming your public IP address is 45.33.44.0 and the private IP address of your local computer with PA is 192.168.1.100 then you want to port map external TCP 20545 to internal 192.168.1.100 TCP 20545.

NEVER use DMZ unless you know what you are doing and have a very secure firewall setup.

Offline (not logged in) WAN Games

When offline you are NOT logged in using a PA or Steam account. You must be connected to the internet for WAN games.

Hosting a WAN Game From Within PA

  • Local server and local server multi-threading should be enabled in:
    • settings > server
  • Create a local game on your personal super computer using:
    • start > multiplayer > custom > create game
  • Make the game public
  • Leave the game public to allow players to reconnect or spectate

Joining a WAN Game

  • Install the Connect Buttons mod from Community Mods
  • Add the public IPv4 or DNS address with TCP port to:
    • settings > server
    • Host = public IPv4 or DNS address
  • Players can join your WAN game using:
    • start > connect to > public IPv4 or DNS address of your server
  • Privately hosted WAN games are not shown in the public games browser

Online (logged in) WAN Games

When online you are logged in using a PA or steam account via the internet.

Each player must be logged in using a different account or offline using a different username.

When hosting ensure host game locally is enabled before you create the game.

Game invites can be used when you connect to the public IP address of a manually started server (see below).

Firewalls

If not using steam on windows you may need to manually add exceptions.

Steam Windows Firewall Rules

The steam install automatically adds PA to the allowed apps in Windows Defender Firewall:

  • Planetary Annihilation (32 bit) %INSTALLDIR%\\bin_x86\\PA.exe
  • Planetary Annihilation – Crash Reporter (32 bit) %INSTALLDIR%\\bin_x86\\crashupload.exe
  • Planetary Annihilation – User Interface (32 bit) %INSTALLDIR%\\bin_x86\\host\\CoherentUI_Host.exe
  • Planetary Annihilation (64 bit) %INSTALLDIR%\\bin_x64\\PA.exe
  • Planetary Annihilation – Crash Reporter (64 bit) %INSTALLDIR%\\bin_x64\\crashupload.exe
  • Planetary Annihilation – User Interface (64 bit) %INSTALLDIR%\\bin_x64\\host\\CoherentUI_Host.exe
  • Planetary Annihilation – LAN and Offline Game Server (64 bit) %INSTALLDIR%\\bin_x64\\server.exe

The steam windows firewall rules do not apply to:

  • third party firewalls or security suites
  • moved steam apps
  • other installations such as the PA launcher

Server Mods

Server mods from the first player to connect as game creator / host will be automatically uploaded to the server and distributed to players and spectators automatically.

Downloading PA

PAnet accounts can use papatcher or the legacy PA launcher (Windows / macOS prior to 10.15 Catalina) to download a DRM free local server: https://store.planetaryannihilation.net/download/pa

Steam accounts can be linked to a PAnet account: https://support.planetaryannihilation.com/kb/faq.php?id=63

Steam install location: https://support.planetaryannihilation.com/kb/faq.php?id=51

papatcher

Download papatcher.go from https://raw.githubusercontent.com/planetary-annihilation/papatcher/master/papatcher.go

Install golang from repo (Linux) or https://golang.org/

go run papatcher.go --stream=stable --update-only

Windows Dependencies

For Windows you may need to install the latest Visual Studio 2019 64 bit runtime: https://support.microsoft.com/en-nz/help/2977003/the-latest-supported-visual-c-downloads

Linux Dependencies

Headless servers require:

  • libsdl2
  • libgl1
  • libstdc++6
  • libcurl
  • libuuid

On Fedora / NixOS the following environment variable may be needed:

SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt

Manually Starting a Server

To manually start a local server in waiting lobby config mode create a script or desktop shortcut to the server executable with the following command line parameters:

  • --allow-lan
  • --game-mode PAExpansion1:config (for TITANS) OR --game-mode config (for classic PA)
  • --server-name "local" (initial name displayed in server browser)
  • --enable-crash-reporting
  • --mt-enabled (for multi-threading)

Customise with the following additional command line parameters:

  • --max-players 12 (up to 32 players depending on the specs of your local super computer and high speed internet)
  • --max-spectators 5 (depending on the specs of your high speed internet)
  • --spectators 5 (default spectators)
  • --output-dir "path-to/your/planetary-annihilation-data-directory" (to save local replays)
  • --empty-timeout 3600
  • --replay-filename "UTCTIMESTAMP" (to automatically name replays using a UTC timestamp)
  • --replay-timeout 180 (timeout after game over when replay is written even if players are still reviewing)
  • --gameover-timeout 360 (timeout after game over when server is shutdown even if players are still reviewing)
  • --headless (no window)
  • --port 20545 (default port)
  • --server-password "password"
  • --disable-ai (disable adding of AI players)

Example Linux Service

Example systemd unit:

[Unit]

Description=PA
After=network.target

[Service]
User=root

ExecStart=/srv/pa/pa.sh

StandardOutput=null
StandardError=null

Restart=always
RestartSec=5

NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes

ProtectKernelTunables=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
ProtectSystem=strict
ProtectHome=read-only
SystemCallFilter=~@mount
ReadWritePaths=/srv/pa/output/

[Install]
WantedBy=multi-user.target

Example pa.sh:

OUTPUT=/srv/pa/output
export MINIDUMP_DIRECTORY=$OUTPUT

mkdir -p $OUTPUT

/path/to/server \
--port 20545 \
--headless \
--allow-lan \
--mt-enabled \
--max-players 32 \
--max-spectators 5 \
--spectators 5 \
--empty-timeout 5 \
--replay-filename "UTCTIMESTAMP" \
--replay-timeout 180 \
--gameover-timeout 360 \
--server-name "server" \
--game-mode "PAExpansion1:config" \
--output-dir $OUTPUT

Example Windows Batch File

Example server.bat with PA launcher or papatcher path to server.exe:

SET OUTPUT="%LOCALAPPDATA%\Uber Entertainment\Planetary Annihilation"
SET MINIDUMP_DIRECTORY=%OUTPUT%

mkdir %OUTPUT%

:start

cls

"C:\Games\Planetary Annihilation\Planetary Annihilation\stable\bin_x64\server.exe" ^
--port 20545 ^
--headless ^
--allow-lan ^
--mt-enabled ^
--max-players 32 ^
--max-spectators 5 ^
--spectators 5 ^
--empty-timeout 5 ^
--replay-filename "UTCTIMESTAMP" ^
--replay-timeout 180 ^
--gameover-timeout 360 ^
--server-name "server" ^
--game-mode "PAExpansion1:config" ^
--output-dir %OUTPUT%

goto start

THE GALAXY WON'T CONQUER ITSELF Get it now on Steam!
Get It on Steam

90% off for classic PA owners