Recently I’ve ported a lot of my Game Maker Studio games to Android an my friends of Shimiegames.com decided to sponsor them. I have been asked to implement some leaderboards/achievements system in order to engage more the audience and so we opted for Google Play Service, that uses players GPlus account for login and should be available on every Android device.
Here is a step-by-step tutorial on how to add Google Play Leaderboards and Achievements to your Game Maker games (target Android).
If you already know how to create Leaderboard and Achievements on Google Play Developer Console you can move straight to the second part of this tutorial about what to do on Game Maker Studio.
- GameMaker: Studio Professional with Android exporter.
- Google Play Developer Account (una-tantum fee of $25,00) or access to publisher’s Developer Console
- An Android device with Google Play Service installed and active (for testing)
Let’s start by setting up all necessary information on Google Play. In the Developer Console create a new application, name it and press “Upload APK“.
Now you need to upload your APK on the beta channel, even if the file uploaded is not ready to be published you are required to upload it once to link the File’s signature to the services we are going to activate.
We can now skip all the further steps since not necessary until pubblication and move to the Game Services part.
Let’s add a “New Game” and fill the data in the “I don’t use any Google APIs in my game yet” tab.
Now that we have created our listing we have to mark down the APP ID (we will need to enter this in Game Maker later on) and link it to the previously created App Store listing in the “Linked Apps” section. Select Android as a target. In the next window if you click on Package Name you all your Applications should appear in a Drop-Down window, select the right one, keep anti-piracy options OFF as default than Save and Continue. You will be prompted to Authorize you app, click Continue and then Create Client (SHA1 Key will appear, this should be the right one taken from your KeyStore file). We are now ready to create our Leaderboards and Achievements!
Select Leaderboards from side-menu and press Add Leaderboard!
You can now cutomize your ranking by selecting a name, score formatting (time, number or currency), provide a custom icon, select proper ordering and limits. Make your choices (for 90% of times defaults are the right ones) and press Save. We have now our leaderboard and its ID!
Google Play requires at least 5 achievements to make services work (leaderboards won’t work either without achievements). So let’s create some in a very similar way to Leaderboards. Select Achievements and then Add achievement. Just complete the fields with name, description and icon (can be completed later on as well).
We can have two different kind of achievements: regular one and incrementals. Incremental achievements are very nice for those numeric achievements like “Take 1000 coins” because you simply send a +1 everytime the event occurs and until the achievement is unlocked it will be shown as a nice progress bar. If we want to create and incremental thick the proper box and set the goal to unlock. Set point value and Save.
Don’t forget to add your account as a tester, otherwise you will not be able to test leaderboards and achievements before pubblication.
Once all the leaderboards and achievements are created on Google Play Developer Console we are ready to start with Game Maker Studio!