b15
b15

Reputation: 2361

Does google play games support ranked matchmaking and leaderboards?

I've all but decided on using google play services to implement my real time multiplayer game for android and ios.

  1. I'm trying to figure out if I'll be able to manage player rank by increasing and decreasing their rank depending on game state information at the end of each game. Is this possible using the XP system they have?
  2. I need to be able to do matchmaking based on rank. (Create subsets of players that are eligible to play against one another)
  3. I need to ability to show the global leaderboard with all rankings and the corresponding usernames

Are these three things possible using google play games?

Upvotes: 0

Views: 263

Answers (2)

skymedium
skymedium

Reputation: 817

I'm trying to figure out if I'll be able to manage player rank by increasing and decreasing their rank depending on game state information at the end of each game. Is this possible using the XP system they have?

You can use their leaderboard for implementing a xp-system. Just save the current value as a score to the leaderboard. At the next xp-increase, you can load the players score and update the value. Here is a sample code for this task:

    private int myScore; // collect the new xp in a variable        

    ....

    // save it a specific time, e.g. game end
    if (mGoogleApiClient != null && mGoogleApiClient.isConnected()) {
        PendingResult<Leaderboards.LoadPlayerScoreResult> result = Games.Leaderboards.loadCurrentPlayerLeaderboardScore(mGoogleApiClient,leaderboardId,LeaderboardVariant.TIME_SPAN_ALL_TIME, LeaderboardVariant.COLLECTION_PUBLIC);        
        result.setResultCallback(new ResultCallback<Leaderboards.LoadPlayerScoreResult>() {
            @Override
            public void onResult(Leaderboards.LoadPlayerScoreResult loadPlayerScoreResult) {
                if(loadPlayerScoreResult != null && loadPlayerScoreResult.getScore() != null){
                    // update the xp value
                    Games.Leaderboards.submitScore(mGoogleApiClient, leaderboardId, loadPlayerScoreResult.getScore().getRawScore()+myScore);
                }
                else {
                    // never submited xp, do it a first time
                    Games.Leaderboards.submitScore(mGoogleApiClient, leaderboardId, myScore);
                }
            }
        });
    }

I need to be able to do matchmaking based on rank. (Create subsets of players that are eligible to play against one another)

You can achieve your goal with the method setVariant() from the RoomConfig Builder. Lets say we mark players with XP less then 100 with the number 1. For those people you will call roomConfigBuilder.setVariant(1) at the start of a new game. Only players with the same number are connected to each other.

Further information: developers google

I need to ability to show the global leaderboard with all rankings and the corresponding usernames

The leaderboard system provides a public and a social (friends only) list.

Upvotes: 1

Thanh Nguyen Van
Thanh Nguyen Van

Reputation: 1983

Yes, it does support!

Everything you need was documented here?

Coexisting with Game Center and Play Games Services

Upvotes: 0

Related Questions