Intro
One of the challenges of using a game creation engine –even one as scriptable as RPG Maker– is interacting with various external social gaming software. In our case, getting Achievements to work in Steam was very difficult. The Steam API is written in C++, while RPG Maker games (VX, VX-A) run in Ruby.
Once we finally got everything working, we decided to release our library to the community, so that other developers will have an easier time getting Steam Achievements into their games. We called this project “Alistel”, and although it was intended for RPG Maker games, it should also work just fine if called from games written in other languages like Python, Perl, or Javascript.
Download and License
The source code for Alistel is located here:
https://bitbucket.org/sethhetu/alistel
…and the latest compiled DLL is here:
https://bitbucket.org/sethhetu/alistel/downloads/Alistel.dll
Alistel is provided under the open-source BSD license:
https://bitbucket.org/sethhetu/alistel/downloads/LICENSE.txt
…with the additional request from White Giant RPG Studios, LLC:
“Please only use Alistel to manage achievements for games that you have developed. Please don’t use it to meddle with achievements in other Steam games.”
Keep in mind that, as a Steam developer, you will also be bound by whatever agreement you signed with Steam (which is a lot stricter than the BSD license).
How To Use It
Download Alistel.dll and put it in your game’s main folder. You will also need a plain text file called “steam_appid.txt” that contains your game’s APPID. Finally, you’ll need “steam_api.dll” from the Steam Workshop page:
https://partner.steamgames.com/downloads/
(from the .zip, it’s in sdk\redistributable_bin\).
Now, open up your game in RPG Maker. Open the Script Editor (F11), and go down to the final script, called “Main”. At the very top (before the “begin” main loop), add the following:
FnSteamInit = Win32API.new("Alistel.dll", "steam_init", "v", "i")
FnSteamAchievement = Win32API.new("Alistel.dll", "steam_sync_achievement", "p", "i")
FnSteamNumEarnedAchieves = Win32API.new("Alistel.dll", "steam_get_num_earned_achieves", "v", "i")
FnSteamInit.call()
Next, add an event with the following event code:
Script:
amt = FnSteamNumEarnedAchieves.call()
$game_variables[1] = amt
Message Box:
Your game has \v[1] achievements.
Run the game, and you should see the immediate results:
If you see “0”, then:
1. Make sure Steam is running.
2. Close and re-open the game.
a. The very first time you load the game, Steam might take some time to cache the achievement data. Just close and re-open the game.
Next, add another event, with the following event commands, but replace “MyAchievement1” with the name of an actual achievement in your game:
Script:
FnSteamAchievement.call("MyAchievement1")
Wait: 1 frame
Message Box:
You got an achievement!
Run your game, and you should see:
Pretty simple, right?
If things just aren’t working, try looking at the file “steam_log.txt” in your game’s project directory. Alistel will (try to) write helpful debug messages here.
Building from Source
If you want to add more functionality to Alistel, you’ll need to build it from source. To do that, you’ll need to clone the repository:
git clone git@bitbucket.org:sethhetu/alistel.git
…or, if you don’t want to install git, you can just click “Download Repository” from the project page, and unzip it:
https://bitbucket.org/sethhetu/alistel/downloads
You’ll also need Visual Studio Community Edition, 2015 or later:
https://www.visualstudio.com/vs/community/
Finally, you’ll need the latest Steam API, from:
https://partner.steamgames.com/downloads/
Extract the “sdk” folder from the .zip file into “Alistel/steamworks”.
Now, double-click “Alistel.sln” to open the project. At the top of the screen, you’ll see “Debug” or “Release”, and “x86” or “x64”. Make sure it says “Release” and “x86”, like so:
You can click on “Build -> Rebuild Solution” to get a new DLL in “Alistel/Release”.
Moving On From Here
Hopefully, this is enough to get you started adding a simple set of achievements to your game. For RPG Maker games, there’s lots of scripts that can make Achievements look even nicer in-game. And the Steam API has a lot of additional functionality that you could add to Alistel.
We at White Giant RPG Studios, LLC would encourage you to donate your tools and libraries to the community, in the same way that we’ve donated Alistel. Developing games is less frustrating if we work together!
Share