Dedicated Server



  • I was able to get the server to run as a dedicated server "hosted on a vps" with a little help from ags131.

    In case anyone is interested, it's a bit complicated, but not impossible.:

     

    First you need to make sure you have a valid and working node setup including node, npm, and node-gyp. This was by far the most complicated part.  Once that was done, the rest was pretty smooth.

     

    Run steamcmd 

    force_install_dir /home/steam/screeps
    login username
    app_update 464350 -beta Server -betapassword the-password-here validate
    exit

     

    edit the .screepsrc file in the server directory you just installed:

    cd /home/steam/screeps/server/
    nano .screepsrc

     

    Next you need to install greenworks. The copy that comes packaged with the server probably won't work for one or more of many reasons. 

    git clone https://github.com/greenheartgames/greenworks.git
    cd greenworks/
    cd deps/
    unzip ~/steamworks_sdk_137.zip # you have to get this from your steam developer account
    mv sdk steamworks_sdk
    cd ..

    npm install
    cp build/Release/greenworks-linux64.node ~/screeps/server/modules/backend/greenworks/lib/greenworks-linux64.node

     

    Now this will give you a server that still won't run so it's time to rebuild things., then start the server. I combined these into a single script  for starting the server.

    #!/bin/bash
    cd /home/steam/steamcmd/
    ./steamcmd.sh +force_install_dir /home/steam/screeps +login user +app_update 464350 -beta Server -betapassword the-password-here validate +exit
    cd /home/steam/screeps/server
    cp /home/steam/greenworks/build/Release/greenworks-linux64.node ~/screeps/server/modules/backend/greenworks/lib/greenworks-linux64.node
    for M in modules/*/
    do
    pushd $M
    rm node_modules -Rf
    npm install
    npm build
    popd
    done
    pushd modules/driver/native/
    node-gyp configure
    node-gyp build
    popd
    rm logs/* -Rf
    node modules/launcher/bin/screeps.js start

     

    The script effectively has to download the server every time because of the rebulid, The rebuild it because it just downloaded it. The process doesn't take too long though and it ensures a running, updated, server every time.

    Even if screeps was on npm I would probably still do it this way as it most closely matches my other steam game server setups.

    But just in case your trying to setup a server, this is what I did, and I hope it helps.



  • What version of node are you using? For me on

    $ uname -a
    Linux G5070 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u1 (2016-09-03) x86_64 GNU/Linux

    greenwork can't `npm install` work with neither of

    gyp ERR! node -v v6.9.1
    gyp ERR! node-gyp -v v3.4.0

    nor

    gyp ERR! node -v v0.10.29
    gyp ERR! node-gyp -v v0.12.2


  • Got greenwork to build, problem was too new steamworks_sdk. I updated your part

    # Remove everything related to node, so that `node`, `nodejs`, `npm`, `n` or `node-gyp` is not found.
    # Probably not the simplest way but it works.
    curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - sudo aptitude install -y nodejs

    sudo npm install npm@latest -g
    sudo npm install node-gyp@latest -g

    node -v # v6.9.1
    npm -v # 3.10.9
    node-gyp -v # v3.4
    git clone https://github.com/greenheartgames/greenworks.git
    cd greenworks/deps/
    unzip ~/path-to/steamworks_sdk_137.zip # It has to be v1.37 and you have to get this from your steam developer account
    mv sdk steamworks_sdk
    cd ..
    npm install

     


  • Culture

    Also, you can skip the need to recompile greenworks by commenting out the require('greenworks') lines in the top ofmodules/backend/game/server.js and modules/backend/game/api/auth.js

    This does not affect behavior at all since greenworks is only used if launched via steam or from the client.