February 13, 2021

Connecting your MZ game with Steam

Instructions on how to use Cyclone Steam to integrate your MZ game with Steam.

Greenworks is an integration with the SteamWorks API created by Greenheart Games, the developers of GameDev Tycoon! They've kindly released it for everyone who wants to integrate their Javascript games with Steam.

Using it can be very complicated for someone with no coding experience, but the Cyclone Steam plugin integrates it with Rpg Maker to make that job a little easier. It can still be complicated to setup all the files that you'll need in place, so you'll have to pay attention to the following instructions.

Configuring the Plugin

If you simply put the CycloneSteam.js plugin on your project, it will simulate a steam connection so you don’t get any errors while playtesting, even if you don’t have greenworks properly configured.

Configuring Greenworks

First of all, you'll need to download the latest version  of Greenworks. You can always find a fresh version of Greenworks on this dedicated website:  https://greenworks-prebuilds.armaldio.xyz/
It generates hundreds of versions every day so you'll need to be careful to pick one where everything matches what you're going to use. On the left side there is an option to filter the files, fill it like this:

  • Release Tag:  Latest release available
  • OS: Every OS you want to support.
  • Architecture: Every architecture you want to support.
  • Runtime: NW.js
  • Versions: v80

Those are the options you'll want to use on a default MZ 1.1 game, but if you've switched to Electron or updated to a newer NW.js version, you'll need to adjust it accordingly or the files will not be loaded!

Extract the downloaded files somewhere on your computer then open the folder it generated and all of it's subfolders. You'll find one or more files of the "Node File" type, with the name starting with "greenworks-". Copy the file(s) there, then go to your project and create a new folder called "lib" and paste those files inside it.

Next, download this file  - alternate link here.

Put this new file (called greenworks.js) inside your project folder too (but not inside "lib").

Next, download the latest version of the Steamworks SDK.  You can find it for download on the steamworks site, if you log in with your steam account there. Make sure the version matches what was listed on the Release Tag of the greenworks file you downloaded. If greenworks hasn't released any version compatible with the latest Steamworks SDK yet, then you need to use an older SDK.

There are several files that you'll have to copy from the SDK and some that you have to rename, like this (you can ignore any OS/CPU you don’t care about):

If you're using a different version of Nw.js or using Electron, you'll not be able to connect to steam while playtesting. When you click the playtest button on MZ it will always load the game on nw.js v0.44.5 (unless you modified MZ files). So if you're using a new different version you need to deploy your game and apply the version you want before continuing.

Create a file called steam_appid.txt on your project folder and put your game’s appid inside of it. You can find this ID on the Steamworks page (it usually ends with a zero). This file is only needed for testing purposes, when you send your game to steam’s servers, you don’t need to include it.

Everything should be ready now. Run the game and your steam status should indicate that you’re running your game. If it is, then everything is working.

If things didn't work

  1. Make sure you have your own game on your steam library.  The connection will not work if you don't.
  2. Check the console for any errors, there's a list of possible errors below.
  3. Sometimes when you're running RPG Maker through Steam, it may not detect that you also opened your game, so you may need to test things with RM closed. Some other times it may successfully connect but using Rpg Maker's ID instead of your game's, in that case you'll not be able to activate achievements or use anything that is specific to your game.

Some possible errors and what files may be wrong.

(The instructions assume you're running things on a 64 bits windows PC, if that's not the case there may be some small differences where the OS or architecture is listed)


Cyclone-Steam.js:639 Error: Cannot find module './greenworks'
  1. Project/greenworks.js -> Missing

The greenworks.js file is either missing or in the wrong place.


Cyclone-Steam.js:639 Error: Cannot find module ProjectPath/lib/greenworks-win64
  1. Project/greenworks.js -> Confirmed OK
  2. Project/lib/greenworks-win64.node -> Missing

Make sure that the file you downloaded from the greenworks server is inside your project's lib folder.


Cyclone-Steam.js:639 Error: \\?\ProjectPath\lib\greenworks-win64.node is not a valid Win32 application.
  1. Project/greenworks.js -> Confirmed OK
  2. Project/lib/greenworks-win64.node -> Invalid

You probably downloaded the wrong thing from greenwork's servers.


Cyclone-Steam.js:639 Error: The specified module could not be found.
  1. Project/greenworks.js -> Confirmed OK
  2. Project/lib/greenworks-win64.node -> Most likely OK
  3. Project/lib/steam_api64.dll -> Maybe wrong
  4. Project/lib/steam_api64.lib -> Maybe wrong
  5. Project/lib/sdkencryptedappticket64.dll -> Maybe wrong
  6. Project/lib/sdkencryptedappticket64.lib -> Maybe wrong

Cyclone-Steam.js:639 Error: The specified procedure could not be found.
  1. Project/greenworks.js -> Confirmed OK
  2. Project/lib/greenworks-win64.node -> Maybe OK, Maybe Not
  3. Project/lib/steam_api64.dll ->  Maybe OK, Maybe Not
  4. Project/lib/steam_api64.lib ->  Maybe OK, Maybe Not
  5. Project/lib/sdkencryptedappticket64.dll ->  Maybe OK, Maybe Not
  6. Project/lib/sdkencryptedappticket64.lib ->  Maybe OK, Maybe Not

When this happens the most likely problem is that file 2 is not compatible with the files 3, 4, 5 and 6. That means the Steam SDK version you downloaded is not compatible with the greenworks version you downloaded. If you download again and the error is still there, try a different SDK version. Sometimes it's possible the greenworks download page is listing the wrong SDK version.


Cyclone-Steam.js:645 Greenworks failed to initialize.
  1. Project/greenworks.js -> Confirmed OK
  2. Project/lib/greenworks-win64.node -> Confirmed OK
  3. Project/lib/steam_api64.dll ->  Confirmed OK
  4. Project/lib/steam_api64.lib ->  Confirmed OK
  5. Project/lib/sdkencryptedappticket64.dll ->  Confirmed OK
  6. Project/lib/sdkencryptedappticket64.lib ->  Confirmed OK
  7. Project/steam_appid.txt -> Maybe missing?

If you got to this, then every lib file was loaded properly, but there's still something in the way. The possibilities are:

  • steam_appid.txt file is missing?
  • steam_appid.txt file has the wrong game ID?
  • Steam is not running?
  • You don't have the game on your steam library?

A Steam feature is not working as it should.

Achievements

Make sure you've saved and published the achievements on the Steam App admin.
Try running the following code on your game's console:

CycloneSteam.achievementCount

This should display the exact number of achievements available in your game. If the count don't match, the problem is on Steam App Admin.

The command below will display the name of every achievement available:

CycloneSteam.greenworks.getAchievementNames()

Cloud Saves

I have not implemented cloud backup on the MZ plugin yet, please wait a little longer.

Something else

You can check the greenworks project to see if anyone had any similar problem to you. Any piece of code displayed there can be run on the plugin by replacing greenworks.methodName with CycloneSteam.greenworks.methodName

Commands Available

CycloneSteam.screenName

Returns your Steam name.

CycloneSteam.uiLanguage

Returns the name of your Steam UI Language.

CycloneSteam.gameLanguage

Return the name of the language your game is configured to run on.

CycloneSteam.achievementCount

Return the number of achievements configured on your game's App Admin.

CycloneSteam.running

Returns true or false, indicating if steam is running.

CycloneSteam.overlayEnabled

Returns true or false, indicating if Steam overlay is enabled for your game.

CycloneSteam.dlcCount

Returns the number of DLCs configured on your games's App Admin.

CycloneSteam.friendCount

Returns the number of friends you have on steam.

CycloneSteam.cloudEnabled

Returns true or false indicating if your game has Steam Cloud enabled on the App Admin.

CyloneSteam.userCloudEnabled

Returns true or false indicating if the player has Steam Cloud enabled for your game.

CycloneSteam.activateAchievement('ACHIEVEMENT_NAME')

Activates the specified achievement for the player.

CycloneSteam.getAchievement('ACHIEVEMENT_NAME')

Returns true or false indicating if the player has already activated the specified achievement

CycloneSteam.clearAchievement('ACHIEVEMENT_NAME')

Deactivates the specified achievement for the player.

CycloneSteam.activateGameOverlay()
CycloneSteam.activateGameOverlayToWebPage('https://www.google.com')

Opens the specified web page on Steam Overlay

CycloneSteam.isDLCInstalled('DLC_NAME')
CycloneSteam.installDLC('DLC_NAME')
CycloneSteam.uninstallDLC('DLC_NAME')
CycloneSteam.getStatInt('STAT_NAME')
CycloneSteam.getStatFloat('STAT_NAME')
CycloneSteam.setStat('STAT_NAME', 10)
CycloneSteam.storeStats
CycloneSteam.isSubscribedApp('APP_ID')