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

Made with Slides.com