Installing a usable private screeps server on Raspberry Pi.



  • Recently there was a patch that reduced tick degradation in servers without mongodb.

    I've ran this for a few solid days on a Raspberry Pi 2 and am getting 1 tick per second, you could possibly get more on a Raspberry Pi 3 but obviously it depends on how intensive the scripts running are, and how many users are going to be on.

    Anyway, here's how I set it up for those who want to try:

    sudo apt-get update && sudo apt-get upgrade
    sudo apt-get install -y npm build-essential tcl git nodejs g++
    #if npm -v returns version < 8 do "curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -"
    sudo npm i -g npm
    sudo nano /etc/dphys-swapfile
    # set CONF_SWAPSIZE = 1000, feel free to set it back after npm install screeps
    sudo sudo /etc/init.d/dphys-swapfile restart
    sudo adduser --disabled-password --gecos "" screeps
    sudo su screeps
    mkdir ~/screeps-server
    cd ~/screeps-server
    npm install isolated-vm
    npm install screeps
    # install any mods, auth, admin-utils, screepsmod-features # manual tick-rate is now part of admin-utils
    npx screeps init
    npx screeps start
    ^C # Control + C to quit screeps
    exit # this just exits the screeps user
    sudo nano /etc/systemd/system/screeps-server.service
    # Copy this into the file
        [Unit]
        Description=Screeps Server (world)
        Wants=network-online.target
        After=network-online.target
    
        [Service]
        Type=simple
        WorkingDirectory=/home/screeps/screeps-server
        ExecStart=/home/screeps/world/node_modules/screeps/bin/screeps.js start
        User=screeps
        Group=screeps
    
        [Install]
        WantedBy=multi-user.target
    sudo systemctl daemon-reload
    sudo systemctl start screeps-server
    

    Additional things to do while the screeps server is running:

    sudo su screeps
    cd ~/screeps-server
    npx screeps cli
    # wait for cli to load
    setTickRate(1000)
    

    Also, delete all the bots unless you need them.

    This should give you a server that can handle 2~3 players without becoming incredibly slow.

    A few notes:

    • Use a reasonable power supply, a weak PSU will cause the pi to reset if it gets under load... and possibly corrupt everything in the process.
    • Remember to back up your world a few times before killing the server and set routine backups.
    • I haven't tried this with CPU intensive scripts, it may suffer if you have a few users running intense scripts every tick.
    👍


  • This should be pinned in the forum.