Setting up a custom server

Discussion in 'PA: TITANS: General Discussion' started by flubbateios, April 11, 2018.

  1. flubbateios

    flubbateios Active Member

    Messages:
    103
    Likes Received:
    240
    REPLACED BY: https://planetaryannihilation.com/guides/hosting-a-local-server/



    Original Post

    The exodus esports guide is outdated since it uses the old and soon-to-be deprecated PA Stats API.

    I'm using debian "stretch".

    First, check that you have the papatcher dependencies:
    Code:
    $ python3
    Python 3.5.3 (default, Jan 19 2017, 14:11:04)
    >>> import pycurl
    
    We will need to install some stuff now.

    Update your package lists:
    Code:
    sudo apt-get update
    
    Install an opengl library:
    Code:
    sudo apt-get install libgl1-mesa-glx
    If you got an error on "import pycurl", we need some additional things:
    Code:
    sudo apt-get install python3-pip
    sudo pip3 install pycurl
    Now that we have our dependencies installed, we can install PA.
    Code:
    wget "https://raw.githubusercontent.com/flubbateios/papatcher/master/papatcher.py" -O papatcher.py
    python3 papatcher.py -u YOUR_UBERNAME -p YOUR_PASSWORD -s stable --unattended
    
    It's now time to start the server. To ensure that it stays up after each game finishes, we'll need to make a short bash script to startup the server.

    Code:
    while true;do
        "$HOME/.local/share/Planetary Annihilation/stable/server" \
        --allow-lan \
        --game-mode "PAExpansion1:lobby" \
        --server-name "Your server name" \
        --enable-crash-reporting \
        --mt-enabled \
        --max-players 32 \
        --max-spectators 5 \
        --output-dir "/data/replays" \
        --replay-filename "UTCTIMESTAMP" \
        --replay-timeout 10 \
        --gameover-timeout 30 \
        --headless  \
        --community-servers-url "auto" --community-server-region "your_server_region" \
        --server-password "your_server_password";
        sleep 2;
    done
    Some explanation on some of the options:

    --game-mode must be either "lobby" or "PAExpansion1:lobby" (the latter is for TITANS)
    --mt-enabled enables multithreading
    --output-dir is where replays are saved (/data/replays is just an example)
    --replay-filename is the format of the replay file name. It should be left on UTCTIMESTAMP. I don't know of any other formats.
    --replay-timeout is the amount of time in seconds for the replay to be saved after the game ends
    --gameover-timeout is the amount of time in seconds for the server to shutdown after the game ends
    --headless prevents a window from being opened
    --community-servers stuff is for the community server feed

    Save this somewhere with your favourite text editor. I'm going to save it as startpa.sh. Make sure you can execute it, then start the server.
    Code:
    chmod +x startpa.sh
    nohup ./startpa.sh & disown
    
    If you need to kill the script that's starting the server after each game (replace PID with the PID that you find from ps -aux):
    Code:
    ps -aux | grep startpa
    kill PID
    https://wiki.palobby.com/wiki/Planetary_Annihilation_Custom_/_Dedicated_/_LAN_/_Local_Servers for more info.

    Since ~June 2018, custom servers (other than PA Inc's community dedicated servers) no longer show up on the public server browser. To connect to one of these servers you'll have to use wondible's Connect Buttons mod.
    Last edited by a moderator: April 10, 2020
    Clopse, dukyduke, veracious3 and 7 others like this.
  2. dukyduke

    dukyduke Active Member

    Messages:
    167
    Likes Received:
    40
    Thank you !

    It's also possible to use apt instead of pip to install pycurl :
    sudo apt install python3-pycurl
    flubbateios likes this.
  3. flubbateios

    flubbateios Active Member

    Messages:
    103
    Likes Received:
    240
    It's actually on debian stretch by default but this guide should apply to other distros :).

    I don't know which is faster: pip or apt for pycurl.

    I've opted for steam servers for my script since they're significantly faster for downloading PA.
    Last edited: April 18, 2018
    dukyduke likes this.
  4. flubbateios

    flubbateios Active Member

    Messages:
    103
    Likes Received:
    240
  5. Quitch

    Quitch Post Master General

    Messages:
    5,853
    Likes Received:
    6,045
    Updated eXodus guide to point to this guide.

Share This Page