LEVEL UP!

A better gaming experience with Play Games Services

Your speaker: +StefanHoth / @stefanhoth

Player 1 joined

Play Games Services

Inventory

#io13

#io14

C++

All (important) platforms

What's inside?

Leaderboards!

Achievements!

Cloud Save!

Multiplayer!

Quests!

Gifts!

Anti Piracy!

There's an app for that

Level 1

Press play to join

on Android

  • Android development environment ready (SDK, IDE, ...)
  • A device with Android 2.3+
  • Current Google Play Services installed on the device
  • Activated Google Play Developer account (US$25)

Step 0

Android SDK Manager > Extras >
install "Google Repository" & "Android Support Repository"

Step 1: Set up for gradle

dependencies {
    compile 'com.android.support:appcompat-v7:22.1.1'
    compile 'com.google.android.gms:play-services-games:7.5.0'
    
    //optional for "Nearby Players" matchmaking
    compile 'com.google.android.gms:play-services-nearby:7.5.0'
}

Add to build.gradle

Sync!

Step 2: Configure Proguard

https://play.google.com/apps/publish/

Step 3: Google Play Developer Console

Step 4: Add a game

Step 5: Link game

Step 6: Generate OAuth2 client ID

Setup complete!

Level 2

Rewarding players for their engagement

Achievements

States

Incremental achievements

Create an achievement

Check the ids

Code!

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest>
    <application>
        
        // Activities, Services etc go here
        
        <meta-data
          android:name="com.google.android.gms.version"
          android:value="@integer/google_play_services_version" />
        <meta-data
          android:name="com.google.android.gms.games.APP_ID"
          android:value="@string/app_id" />

    </application>
</manifest>

AndroidManifest.xml

Get a client instance


gamesApiClient = new GoogleApiClient.Builder(activity)
                    .addApi(Games.API)
                    .addScope(Games.SCOPE_GAMES)
                    .addConnectionCallbacks(this)
                    .addOnConnectionFailedListener(this)
                    .build();

Unlock normal achievement


Games.Achievements.unlock(getApiClient(), "my_achievement_id");

Increment achievement


Games.Achievements.increment(getApiClient(), 
   "my_incremental_achievment_id", 1);

Display achievements


startActivityForResult(
    Games.Achievements.getAchievementsIntent(gamesApiClient), 
    CODE_REQUEST_ACHIEVEMENTS);

Display achievements

Level 3

See your global rank or challenge friends

Leaderboards

Create a leaderboard

Code!

Submit a score


Games.Leaderboards.submitScore(
    mGoogleApiClient, 
    "leaderboard_fastest_id", 
    1337);

Display leaderboard


startActivityForResult(
   Games.Leaderboards.getLeaderboardIntent(
       mGoogleApiClient,
       "leaderboard_fastest_id"
   ), 
   REQUEST_LEADERBOARD);

Display leaderboard

Level 4

Track player success and (re)engange users

Events & Quests

Create an event

Create a quest

Reward data


{
    "bonusGems": 2134,
    "extraSeconds": 12
}

Code!

Submit an event update


Games.Events.increment(mGoogleApiClient, "event_games_won_id", 1);

Display available Quests


startActivityForResult(
   Games.Quests.getQuestsIntent(
       mGoogleApiClient,
       Quests.SELECT_ALL_QUESTS
   ), 
   REQUEST_QUESTS);

Shortcuts

Attention: Publish twice!

All ids in one go

All ids in one go

Magic?

Boss level

Publishing API

Create & Update

achievements + leaderboards

Management APIs

  • Reset scores, achievements, quests etc.
  • only for testers and unpublished games
  • after release: hide cheaters from leaderboards

Player Analytics

Secret bonus level

Google Tag Manager

https://youtu.be/AK342F1Hk84

GAME OVER

Questions

Play Games Services Docs

https://developers.google.com/games/services/

//TODO: Ropasc Lisc on GitHub

https://github.com/stefanhoth/ropasclisp

Thank You!

Stefan Hoth

stefan@novoda.com

@stefanhoth

+StefanHoth

stefanhoth

Sources

Sources

Droidcon Berlin 2015 // LEVEL UP! A BETTER GAMING EXPERIENCE WITH GOOGLE PLAY GAMES SERVICES

By Stefan Hoth

Droidcon Berlin 2015 // LEVEL UP! A BETTER GAMING EXPERIENCE WITH GOOGLE PLAY GAMES SERVICES

Developing games for mobile devices is certainly one of the most lucrative genres today. Google reflected this importance by splitting the "Games" section of the Play Store into sub-catogries to account for the growing market in that area. With Android TV Google even created a whole platform designed for gaming on Android and partners like Nvidia and Razer are joining the party. It's already hard enough to come up with a fresh idea for a new game, make it look good and work on all the target devices. But adding social features like leaderboards, achievements, multiplayer features to compete with friends and offering an easy way to continue a game phone that you started on your tablet is what can catapult a good app to a great one everyone knows. All these features and more you can get with the Google Play Games Services bringing you happier users, higher rentention rates and viral recommendations - all for free and with support for all major platforms. The talk will walk you through the different parts of Google Play Games Services, how to set them up and integrate them with your Android app, mention a few pitfalls and finishes off with a multiplayer live demo of these features - if the demo gods are playing nice. In the end you'll be ready to easily add those features to your app and make your users happy while still having time to focus on what's important: Your game.

  • 1,334