Skip to content

Instantly share code, notes, and snippets.

@Mototroller
Last active October 31, 2016 09:46
Show Gist options
  • Select an option

  • Save Mototroller/801143433b4625f8b48185ba173538ab to your computer and use it in GitHub Desktop.

Select an option

Save Mototroller/801143433b4625f8b48185ba173538ab to your computer and use it in GitHub Desktop.

This instruction based on ags131's and coteyr's instructions and scripts.

For more information visit

there are some additional answers and instructions here.

Requiremets:

Steps:

  1. Download Steamworks SDK v1.37 (zip file);

  2. Clone Greenworks:

    git clone https://github.com/greenheartgames/greenworks.git

    and move to its folder: cd greenworks;

  3. Follow the Greenworks building instructions very carefully:

    The most and only "difficult" step here is provide correct directories tree after Steamworks unzip'ing, it must be like:

     greenworks
     |-- deps 
     |   |-- misc
     |   |-- steamworks_sdk # <===== newly unpacked Steamworks SDK
     |   |   |-- client
     |   |   |-- glmgr
     |   |   |-- public
     |   |   |-- redistributable_bin
     |   |   |-- steamworksexample
     |   |   `-- tools
     |   `-- zlib
     |       |-- contrib
     |       `-- google
    

    You can check it by $ tree -d -L 3 inside greenworks/ dir.

  4. Run npm to build Greenworks:

    npm install - as ordinary user

    OR

    npm install --unsafe-perm - as root (to avoid warnings and force building)

  5. Not sure about node-gyp configure and node-gyp rebuild from Greenworks building instructions, so I didn't do that;

  6. Now you can copy server dir to the current machine from a machine with Steam and installed Screeps+Server. The location of server is smth like: /home/USER/.steam/steam/steamapps/common/Screeps/server/;

  7. To be sure all modules are valid and rebuilt for the current machine, you can run this script inside server directory (create a file rebuild.sh, copy-paste this script here and call it bash rebuild.sh):

    #!/bin/bash
    # Comment this out if not needed 
    #npm install -g node-gyp
    for M in modules/*/
    do
            pushd $M
            # npm install graceful-fs # coteyr?
            rm node_modules -Rf
            npm install
            npm build
            popd
    done
    pushd modules/driver/native/
    node-gyp configure
    node-gyp build
    popd
  8. The last step is replace incorrect Greenworks lib with newly built one, just copy it from Greenwork's build:

    cp -f greenworks/build/Release/*.node server/modules/backend/greenworks/lib/

Due to Steam authentification you should set steam_api_key in .screepsrc file, you can get it from here (Steam login required).

Now you can try node modules/launcher/bin/screeps start to start server on the remote machine.

Possible errors

  • Greenworks version mismatch:

    Error: Module version mismatch. Expected 48, got XX.
     at Error (native)
     at Object.Module._extensions..node (module.js:597:18)
     at Module.load (module.js:487:32)
     at tryModuleLoad (module.js:446:12)
     at Function.Module._load (module.js:438:3)
     at Module.require (module.js:497:17)
     at require (internal/module.js:20:19)
     at Object.<anonymous> (/home/screeps/server/modules/backend/greenworks/greenworks.js:22:18)
     at Module._compile (module.js:570:32)
     at Object.Module._extensions..js (module.js:579:10)
    

    Solution: check out you rebuilt Greenworks and replaced *.node libs correctly

  • libsteam_api.so:

    Error: /home/screeps/server/modules/driver/native/build/Release/native.node: invalid ELF header
    ...
    

    or

    Error: libsteam_api.so: cannot open shared object file: No such file or directory
     at Error (native)
     at Object.Module._extensions..node (module.js:568:18)
     at Module.load (module.js:458:32)
     at tryModuleLoad (module.js:417:12)
     at Function.Module._load (module.js:409:3)
     at Module.require (module.js:468:17)
     at require (internal/module.js:20:19)
     at Object.<anonymous> (/home/XXX/screeps/server/modules/backend/greenworks/greenworks.js:22:18)
     at Module._compile (module.js:541:32)
     at Object.Module._extensions..js (module.js:550:10)
    

    Solution: OS version mismatch: replace Steam libraries with native from Steamworks SDK (see steamworks_sdk/sdk/redistributable_bin).

  • Steamworks SDK version mismatch (while greenworks building):

    In file included from ../src/api/steam_api_friends.cc:12:0:
    ../src/api/steam_api_friends.cc: In function ‘void greenworks::api::{anonymous}::InitFriendRelationship(v8::Handle<v8::Object>)’:
    ../src/api/steam_api_friends.cc:54:39: error: ‘k_EFriendRelationshipSuggested’ was not declared in this scope
       SET_TYPE(relationship, "Suggested", k_EFriendRelationshipSuggested);
                                           ^
    ../src/api/steam_api_registry.h:18:23: note: in definition of macro ‘SET_TYPE’
    

    Solution: check your downloaded steamworks_sdk_XXX.zip to be 1.37.

  • "<some Steam lib> not found" errors while greenworks building.

    Solution: check greenworks' directory tree (see step #3).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment