The complexity of creating a leaderboard in Google Play
Sun, 27 Mar 2022 22:39:06 +0100

Answering the "why not for Android?" question

I often get asked why don't I release my indie iOS games for Android as well. The short answer I give recently is simply "I only have one life". I hope they can infer from my answer that releasing for another platform is not as easy as pressing a button. And between starting a new project, or keep working endlessly in something that you've already released (once), the former is obviously more fun.

I program my games natively for iOS using Swift, because I love Swift, but also because in my professional experience using Unity things weren't as smooth as one would expect. Unity is a game engine that makes multiplatform development easier. But even when we were targeting Android in my old job, many times I ended up exporting the project to iOS and use the Xcode debugging tools because those tools either worked better, or simply because they worked (GPU profiling for different mobile vendors is not fun, and sometimes the tools don't work at all).

But even if I had made my games in a game engine and I just needed to "press a button" to get the Android build, there are other things that are quite cumbersome: reading legal agreements, creating accounts, handling different ways of integrating things into the respective ecosystems, taking screenshots, creating video materials, debugging, and testing. Today I'm going to touch just one of the integration aspects: creating leaderboards for Google Play.

Godot changed my mind

I wasn't planning to port any of my games to Android because, as I said, it's not fun. The game is finished. I just want to move on. But I started playing with Godot and I found it quite fun to work with.

That motivated me to create something with Godot. But instead of starting with something new, I got one of my word puzzle games and started porting it to Godot. I'll write my impressions in a separate article, but the main conclusion is that it was fun! 😃

But the game is already released for iOS, so what could I do with the Godot version? Oh... that... 😅 Let's attempt to release it for Android.

Then the fun died... 😅

Leaderboards hell

The client code for Game Center leaderboards, the leaderboards from Apple, is a bit complicated, but I reuse the same code in all my games. So I usually don't spend too much time adding leaderboards. Perhaps a couple of hours, because you still have to prepare icons for each leaderboards and also translate it to all the languages you support (I usually do the 4 languages I speak).

Suppose that you've created a game and that you are new to Apple, and you are now preparing things to release it for iOS. The first thing you want to do is to add some leaderboards. Roughly, these will be the steps from scratch:

  1. Create Apple ID. If you are making games on your own, you will use this Apple ID for everything.
  2. Sign to Apple Developer with your Apple ID.
  3. Add App entry for your game in App Store Connect.
  4. Add Leaderboard in Game Center section of your game. You will need some icons and translations for this.
  5. Implement Game Center and leaderboard access in game. You only need to add your Apple ID to Xcode and use the leaderboard ID from the code.

Let's now do the same for Google Play:

  1. Create Google account (A)
  2. Sign to Google Play with your Google account (A)
  3. Add Game entry for your game in Google Play.
  4. Sign to Google Cloud Platform with your Google account (A)
  5. Go to Create OAuth consent screen (A)
  6. You get prompted to register your company. By following the registration process, a new Google Cloud account (B) gets created.
  7. Authorize your domain by adding a TXT entry to the DNS server of your website.
  8. Go to Google Search console to check that your domain is verified.
  9. Go to Create OAuth consent screen (B). Not sure what happened with (A).
  10. Write Privacy Policy and Terms of service documents for your game.
  11. Add "scopes" games, games_lite, and drive.appdata (no idea what I'm doing... just reading tons of guides online...)
  12. Deal with error, The following scope(s) were not added because they are invalid. Please update or remove these scopes: games, games_lite, and drive.appdata.. Go to APIs, and enable Google Play Game Services. Now you should be able to find the 3 scopes.
  13. Add test user.
  14. Go back to Google Play Console (A), to the dashboard of your game. Click Refresh on Credentials in the Play Games Services configuration. Nothing happens. I suspect I need to link account (B) to (A).
  15. Repeat steps 7 to 13 for account (A) -- and good luck deleting account (B)... (I haven't managed to yet...)
  16. Now Google Play Console lets you continue. You now have to create Android and Game Center credentials (I'm starting to get lost, in case you didn't notice 🙈).
  17. Create OAuth client for Android credential, and for web (not sure why I need the web one, but that's the one I need to use to initialize the services from the game... 🤷‍♂️)
  18. Use the Keytool utility to get the SHA1 fingerprints you need for the credentials.
  19. Create upload and keystore in Android Studio (consult "known issues" doc to resolve multiple errors).
  20. Upload APK signed with the upload key -- only to find out that APK are no longer supported and you need an AAB, with target SDK 30. That means that the only Android device I own, a Samsung Galaxy S7 from 2017, is no longer supported... (on iOS I still release games compatible with iPhone 4s, from 2011...)
  21. Once you have the right AAB file, Google creates and signs the app for you (how nice and easy! thanks! 😂), with the app signing key. Get the fingerprint for that app signing key from the Google Play Console and create a new OAuth client in the Cloud console. That will be used by the final release of the game.
After a couple of days, you have 1 leaderboard with half the functionality that you get in Apple's Game Center (although that could be partially the fault of the Godot plugin I'm using... A disadvantage of not programming natively).

Wrapping up

Making games in Godot may be fun, but releasing a game is never fun. It's not fun for Apple's App Store, but even less fun for Android. I haven't released it yet, although I've readied the final release build and all the marketing and legal materials. Several things are under review now. Whatever that means 🤷‍♂️

In App Store Connect everything needed for the release is in one place, but in Google Play Console you have to click many menus and checklist-type of navigation to do things. I expected Google Play to be as painful as Apple's, and that was a reason to avoid it. I didn't expect it to be even worse...

If you are interested in using the latest technology in a particular platform, you better use the native tools for that platform. That was my main motivation when I started with Xcode and Swift. But if you've created a game in a multiplatform engine like Godot, you may as well try to release it in different platforms. But be prepared for the pain. The leaderboards are just the beginning... 🙈

I hope this sheds some light as to why I haven't released anything for Android (yet).


Newer|Older

Previous year

Next year