Skip to content

a node.js/node-webkit plugin to integrate with steamworks

License

Notifications You must be signed in to change notification settings

Schine/greenworks

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

##New Release 0.4 The newest release enables compatibility with node v0.11.x and v0.12.x, NW.js v0.12.X and atom-shell v0.21.X. If you find the release useful, please consider donating.

Click here to lend your support to: Greenworks v0.3+ and make a donation at pledgie.com !

#Greenworks

Greenworks is a MIT-licensed node.js addon allowing you to integrate your HTML5 app or game with Steamworks by exposing a number of Steamworks APIs to JavaScript.

Greenworks is developed by Greenheart Games, originally to enable Steam integration in Game Dev Tycoon, and has since been open-sourced and used in other projects. The project is funded by Greenheart Games and other donors.

The project is built using NAN to support both different node versions.

Currently greenworks supports:

  • node v0.10.X, v0.11.X and v0.12.X
  • iojs v1.6.2
  • NW.js(formerly node-webkit) v0.8.X, v0.11.X and v0.12.X
  • atom-shell v0.21.X

##Download

Prebuild binaries of greenworks for NW.js can be found on the release page.

##APIs

Greenworks currently supports Steam Cloud, Steam Achievement and Workshop synchronization related methods.

For a complete list of supported methods see the API Reference for details.

##Start Greenworks in NW.js

  1. Download the release binaries from release page and unzip.
  2. Copy the steam_api.dll/libsteam_api.dylib/libsteam_api.so from Steamworks SDK(<steam_sdk_path>/redistributable_bin/) to <greenworks_path>/lib. Please make sure the architecture (32 bits or 64 bits) of the steam dynamic library is the same as NW.js's.
  3. Create a steam_appid.txt file with your Steam APP ID under <greenworks_path>/ directory. ( You only need the steam_appid.txt file for developing. If you launch the game from Steam, Steam will automatically know the APPID of your game)
  4. Create your NW.js app code under <greenworks_path>/ directory.

A hello-world sample

Create index.html:

<html>
<head>
  <meta charset="utf-8">
  <title>Hello Greenworks</title>
</head>

<body>
  <h1>Greenworks Test</h1>
  SteamAPI Init:
  <script>
    var greenworks = require('./greenworks');
    document.write(greenworks.initAPI());
  </script>
</body>

Create package.json:

{
  "name": "greenworks-nw-demo",
  "main": "index.html"
}

The NW.js v0.11.2 hello-world demo directory on Mac OS X like:

|-- greenworks.js
|-- index.html
|-- lib
|   |-- greenworks-linux32.node
|   |-- greenworks-linux64.node
|   |-- greenworks-osx32.node
|   |-- greenworks-osx64.node
|   |-- greenworks-win32.node
|   `-- libsteam_api.dylib
|-- package.json
`-- steam_appid.txt

##Usage Requirement

Before using greenworks, you need to:

  1. Copy steam_api.dll/libsteam_api.dylib/libsteam_api.so library from the Steamworks SDK(<steam_sdk_path>/redistributable_bin/) to greenworks binaries directory.
  2. Create a steam_appid.txt file with your Steam APP ID under code directory.

##Building Instructions

###Prerequisties

  • Steamworks SDK 1.30
  • nodejs v0.10.X or v0.11.X
  • node-gyp (or nw-gyp if you use NW.js)

Download Steamworks SDK and unzip to <greenworks_src_dir>/deps/steamworks_sdk directory.

###Nodejs Addon Building Steps

# change to greenworks src directory.
cd greenworks
# install the dependencies.
npm install
# configure gyp project.
node-gyp configure
# build greenworks addon.
node-gyp rebuild

Once building is done, you can find greenworks-(linux/win/osx).node under build/Release.

If you encounter any issues consult the troubleshooting page.

###NW.js Building Steps

Using Greenworks in NW.js, you need to use nw-gyp instead of node-gyp to build.

# install nw-gyp
sudo npm install -g nw-gyp

cd greenworks
# generate the building files
nw-gyp configure --target=<0.10.5 or other nw version>

# build Greenworks
nw-gyp build

After building finished, you can find the greenworks-(linux/win/osx).node binaries in build/Release.

A sample NW.js application is provided here.

###Atom-shell Building Steps

To build Greenworks for atom-shell, we use node-gyp with some custom settings.

cd greenworks

HOME=~/.atom-shell-gyp node-gyp rebuild --target=<0.17.1 or other atom-shell versions> --dist-url=https://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist

After building finished, you can find the greenworks-(linux/win/osx).node binaries in build/Release.

A sample atom-shell application is provided here.

For more details, you can refer to Using native Node modules page.

##Test

Greenworks uses Mocha framework to test the steamworks APIs.

Since Greenworks is interacting with Steamworks, you need to create a steam_appid.txt file with a valid Steam Game Application ID in the <greenworks_src_dir>/test directory, in order to run the tests.

cd greenworks
./test/run-test

See how to find the application ID for a Steam Game.

##License

Greenworks is published under the MIT license. See LICENSE file for details.

If you use Greenworks, please let us know at @GreenheartGames and feel free to add your product to our product list.

##Donate

Please consider donating to the project:

Click here to lend your support to: Greenworks v0.3+ and make a donation at pledgie.com !

About

a node.js/node-webkit plugin to integrate with steamworks

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 89.4%
  • JavaScript 6.0%
  • Python 4.5%
  • Shell 0.1%