In developing a C3 game for Steam distribution, I found I needed more API calls than the official plugin, so using the official plugin as a template, I added the ACEs for the following Greenworks APIs: Cloud File, Achievements (the remaining APIs) and Stats.
Please use the github issue list to report issues, so we can track, do not report issues in the comments below, they won't be tracked as well.
Installing steamworks sdk and steam_appid.txt
See the official Greenworks plugin documentation for a description of where to get and where to install the needed *.dlls (windows) or *.dynlibs (osx) and steam_appid.txt after export to nw.js.
Exporting and overlay
When exporting to nw.js, add the command line '--in-process-gpu' in the export dialog box for windows overlay to work (working under Windows 10.) Mac OS overlay with Greenworks appears to be difficult, buggy, do not expect it to work. For nw.js version, use only 0.33.3. Later versions of nw.js are unlikely to work.
The plugin generally follows this pattern: Call action (API call), wait for trigger (API callback), check expressions for data or error, depending on the trigger triggered. Some data which is relatively static are always available in expressions (language, userID, etc. from the original plugin.) Most of the others require an action call and trigger before using the data. [Technical aside, this is due to the Greenworks API being called on the DOM side vs render side, so each call requires a JS promise/resolve/reject call.]
This is a beta release, so there are likely to be bugs, please report on the github issue list, not in comments below, so we can track and close the bugs.
Some obvious things to check for which I have hit more than once myself:
- Enable the nw.js or electron debug console to look for errors and info
- If exporting with nw.js, it version 0.33.3? Other versions may not work.
- steamworks sdk libs (*.dll or *.dynlib are installed in exported folder?
- steam_appidt.txt is installed in exported folder with a valid id? '480' is a good test id, all users own this game. Use '480' for the example project.
- Steam is running and a user is logged in?
- To test with unreleased game or the test project on Steam use 'Games->Add non-steam game...'
- Launched game _from_ Steam program for overlay to work?
- If overlay not working, check if '--in-process-gpu' is used as command argument for nw.js,/electron.
- If overlay not working, make sure render is occurring each frame, if needed add small rotating sprite in the display (set opacity to 1% so it's not visible to the user.)
- See greenworks github docs for details on Greenworks APIs Greenworks APIs
- On release to steam, disable F12 devtool shortcut for nw (otherwise Steam may reject it.) See this thread for more info on one devs way to intercept this. Also look at nw.js for options to remove developer mode.
I am also using Electron to build the final executable, so added support for Electron (where the user must build the greenworks libraries. See Armaldio's excellent ElectronForConstruct for a description of the process/tool that they created to support Construct with Electron (an advanced section also describes how to build the greenworks libraries.)
For Mac tip see: https://github.com/greenheartgames/greenworks/issues/183
Will be mostly focused on bug fixes, since this version supported what I required for game launch. However, I used the excellent c3IDE addon IDE from Piranha305 to develop the plugin and I have added that *.c3IDE source file up to the GitHub for this plugin.
Note: the Greenworks API does not support Steamworks leaderboards (a conscious decision on part of the Greenworks developers.)