Prepping your Game for Steam
Exporting your Project
There is a full tutorial for exporting to NW.js so we won't go into full detail here, but a couple of things to note:
- It's been said a few times now, but it is very important: make sure that your NW.js version is the correct one for your version of Greenworks. Especially if you're downloading NW.js at export.
- You'll need to add some files to your game once it's been exported and the exact method will depend on how you export. If you enable the Package Assets option then a file called package.nw will be created and you'll need to edit that to add the necessary files (we'll cover this more shortly) but if the Package Assets option is disabled, you can just drop the additional files into the game folder. Check the manual page for the NW.js export for more information on the Package Assetsoption.
Post-Export Tasks
Add the Steamworks SDK DLL Files
As we mentioned above, you'll need to add some files to your game to make sure it integrates properly with Steam. To do this, you'll need to unzip both your exported game and the Steamworks SDK.
As we mentioned previously the exact method for adding these files will change depending on how you've exported your game. If you used the Package Assets method, you'll need to locate package.nw in your game's folder.
Package.nw is just a zip file with a different extension. You can open it either by renaming it to .zip, adding a file, then renaming it back to .nw (you may need to change settings to show file extensions). Alternatively you can associate the .nw file extension with a program that can open zips like WinRAR and just drag-and-drop extra files in.
If you didn't package assets on export, then you can just drop the DLL files into the game folder.
As for the actual files you need to add – first locate the redistributable_bin folder in the Steamworks SDK, it should be in the sdk folder. Here you'll find DLL files for various platforms. Copy the appropriate file for the platform your build is aimed at. For example add steam_api.dll to package.nw for the win32 build, steam_api64.dll for the win64 build, etc.
You also need to add a sdkencryptedappticket library. This can be found in public\steam\lib in the Steamworks SDK. You need to copy this to package.nw in the same way you did for steam_api.dll. For example, for the win64 version, use the sdkencryptedappticket.dll and .lib file from the win64 folder.
Create a Steam ID Text File
Create a new txt file in the root folder of your game write your game's ID into the file. You can find this in your game's Steam Page URL. Do not add anything else to this file.
Save the file in an ANSI format and call it steam_appid.txt. If you don't save in an ANSI/ASCII format, it may put a UTF-8 BOM at the start of the file, rendering it useless for this task.
Enabling F12 use for Steam Screenshots and Steam Overlay
For this, you'll need to edit the package.json file found in your game's folder. This will involve adding some new strings to the "chromium-args" line.
Add the following to that line:
--in-process-gpu
--disable-direct-composition
--disable-devtools
So you should end up with:
"chromium-args": "--enable-node-worker --disable-plugins --disable-internal-flash --disable-popup-blocking --allow-file-access-from-files --ignore-gpu-blacklist --in-process-gpu --disable-direct-composition --disable-devtools
These changes should allow the Steam Overlay to open and should stop NW.js opening Devtools when a player uses the standard Steam Screenshot key - F12.