Developer

Google Play Game Services: The bad, the good, and the great

Android developer William J. Francis provides first-hand tips for using Google Play Game Services.

googleplaygameservicescnetjamesmartin070314.jpg
 Image: James Martin/CNET

For those of you who have teenagers, you probably know that sometimes it can be hard to relate to each other. My son is sixteen, and there aren't a lot of things that I'm interested in that he is also keen on and vice versa. An exception is a few years ago we discovered we both have a love for building video games. It is how we find some common ground, usually at the coffee shop on a Sunday afternoon.

Last week we released a brand new game for Android called Melodious (and I'm not ashamed to say he did most of the heavy lifting). I've previously written about the merits of gamifying an app and some of the features of Google Play Game Services (GPGS). This most recent project gave me an ideal opportunity to do a deep dive into GPGS. While it was still fresh in my mind, I decided to share some observations with my fellow Android developers.

The bad

It's not cross-platform in practice.

What's this? Doesn't it say right on the GPGS home page "build games for Android and iOS"? It does. From a technical perspective, GPGS is cross-platform — but it hinges entirely on a user's Google+ account, which is why the iOS version of Melodious uses Apple Game Center (AGC). Let's face it, you're not going to get an iPhone owner to install Google+ on her device just so she can compete on a leaderboard — not when all her other games and friends are on AGC.

The most difficult part of setting up GPGS is linking your app and creating the IDs for it.

I'm not sure why, but this seems to be common with Google APIs, particularly when it comes to application IDs and SHAs. There is a long-winded tutorial that will guide you through the process. Just be aware you'll have to follow it from start to finish with an attention to detail, and even then you may find yourself starting over a couple of times.

Almost everything you create in the GPGS console will live forever.

This was one of the most frustrating parts of the process in my opinion. There seems to be no way of resetting scores, achievements, etc. after you do your testing besides creating entirely new leaderboards and achievements — at least through the web console. This is a feature officially requested nearly a year ago, but I was unable to find any evidence of progress by the GPGS team.

The good

Once everything was set up on the console, integrating GPGS into the app went really fast.

With both a rest API and a native Android SDK, adding achievements and leaderboards into the app was fairly painless. I was quickly able to set and get high scores, as well as unlock player achievements.

GPGS takes care of a lot of state management for you.

The GPGS backend is pretty smart about ignoring extraneous calls. If, for instance, you send a user's score to a leaderboard that is lower than that player's current high score, it will simply get ignored. The same is true when unlocking achievements that have been flagged as only unlockable one time in the console.

In some cases, GPGS means you won't need a backend server.

I'm using GPGS as a means to sync player data across multiple devices. With free features like Cloud Save, in many cases, you'll find with GPGS that you don't need any server backing your app. I consider this a huge benefit for indy developers.

The great

The built-in UIs are pretty usable right out of the box.

You can create your own custom user interface (UI) to display leaderboards and to alert the user when he unlocks an achievement. The interface components the library can display without any customization are pretty decent looking. And unlike some of the previous Google components I've used, the designers have done a nice job of choosing neutral colors and semi-translucent backgrounds so that things tend to blend quite nicely.

If you use the built-in UI components, be sure you're calling the methods that present them (for instance when unlocking an achievement) on the UI thread; otherwise, they may not show up for your user.

Final thoughts

GPGS has some room for improvement. However, having used both GPGS and AGC recently, I definitely found it easier to work with Google's implementation; in particular, I was impressed with some of the UI components I got for free from the library.

It's too early to tell how much of a difference including GPGS in my new app will make in terms of overall usage and retention, but in my initial beta testing, leaderboards and achievements proved to be two of the most liked features.

Figure A

androidgpgsleaderboard070314.png

GPGS leaderboard overlaid on my app.

Figure B

androidgpgsachievements070314.png

GPGS achievements overlaid on my app.

Figure C

androidgpgsunlocked070314.png

Unlocking an achievement in my app.

About

William J Francis began programming computers at age eleven. Specializing in embedded and mobile platforms, he has more than 20 years of professional software engineering under his belt, including a four year stint in the US Army's Military Intellige...

Editor's Picks