Google Play Games Services Multiplayer and Backend - android

I am thinking about using Play Game Services, with turn-based multiplayer, to power my Android game.
I need to save the outcome of any game to my backend (here, Google App Engine) : mainly the winner and the score, for accounting purposes. However, I don't find any mention of a custom server in Play Games docs.
How can I combine GPGS multiplayer with a backend ? More specifically, how can I check if said user is effectively logged in to GPGS ?
Maybe the clients can send this data to the server, but I fear the data can be tampered with. And because it's a 1v1 battle, there is no way to check with other users if the data is correct.
Thanks for any clues.

I have developed a multiplayer game using GPGS and I used the service 'Cloud Save' (now it has been changed to Google Play Games Saved Games service) to store the scores of each player. It is saved for each account, so the data can be loaded/saved from different devices.

Related

Play Game Services, can we know when we pass another hiscore?

I am using Play Game Services, for leaderboards and achievements. Is it possible to know when the player beats one of his friends' highscore? (Like in Candy Crush).
In general, I can't find extensive API documentation for Play Services APIs, where can I find it?
The general information about Play Game Services is at https://developers.google.com/games/services/.
You should consider developing your own backend server to perform the check of passing a friend since you need to keep track of the relative positions of players over time.
At a high level, the steps would be:
Call Players.loadConnectedPlayers. This will return a list of players that have played your game and that are connected to the current player. You'll need to send this list of player ids to the server.
Get an auth code from the client using Player. using Games.getGamesServerAuthCode(googleApiClient, “your_server_client_id”).
Pass this code to your backend web server application.
Then on the server:
List item
Exchange the auth code for an access token.
Use Scores.listWindow to list the scores around the player's score.
Compare the scores of the connected players to the new score.
An optimization would be only do this if the player gets a new high score.

Is it possible to use Google Play Leaderboards and Achievements to track consumable IAP-s?

I'd like to design an Android game that has an in-game currency (coins) that can be earned by playing the game or can be bought with real money. This currency can then be spent on different upgrades.
Obviously I need to store the players' number of coins and the list of the upgrades they bought online, not to lose this information if they decide to uninstall the game. However, I don't have access to a server so I'd like to use the Google Play Services to store this information in hidden achievements / leaderboards.
My idea is to have two leaderboards set up: one for the total ammount of coins earned + purchased and one for the total ammount of coins spent. These leaderboards would be updated whenever the player earns coins or buys them with a consumable IAP (which is consumed immediately after the purchase so they can buy it again later), or whenever the player decides to spend some of their coins on upgrades. The upgrades themselves would be stored as achievements so if they buy something, the specific achievement would unlock.
This way all of the purchase information would be stored online and if the players reinstall the game, they wouldn't loose any progress: the list of purchased upgrades is stored in their unlocked achievements and the amount of their remaining coins is just the difference between the two leaderboards' scores.
This method also seems more secure than storing the information locally or establishing a connection to a custom server. And since the Play Services cache the data when offline and sync it later, the Store could be used without internet connection (apart from buying coins with IAPs of couse). The only downside is that it enfroces the Play Games sign-in so I'd have to check that before any transaction. Basically the entire "Store" menu would start with a Google Play Services sign-in.
My question is that do you see any problems with this solution? Is it possible to realize it or am I misunderstanding any of the concepts (I only have worked with non-consumable IAPs so far and the way to track consumables is a bit unclear for me). Is it breaking the Play Services terms of use (I also intend to create some traditional leaderboards and achievements so not everything would be hidden) ? And lastly, is there a simpler way to do this without using a server?
Thank you in advance :)
Peter
This idea sounds inflexible. Why don't you just use the Saved Games API from Google? This will do essentially what you want to do with a proper API instead of using the leaderboard/achievement API. You can define any class to save your data to the cloud and sync across devices.
Plus, Google has some default UI for showing the leaderboards and achievements. If you want to use real (unhidden) leaderboards or achievements you'll have to write your own UI and filter out the hidden ones.

Sign in multiple player at the same time or store login-cookie for Google play games services

I wonder if it is possible to sign in multiple player at the same time or store the login-info somehow for Google play games services. I developed a scorepad app and would love to sync games from different devices with the PlayGames-Accounts of the players. They are all present and play with one device. So it would be useful if different players can stay logged in on this device. Is this possible? Actually they dont have to be logged in at the same time, but it would be nice if they would only have to enter their login-data once on each device.
What do you think?
Thank you for your thoughts
Frank J.
It's possible to sign in and out of an account associated with Google Play Games on an Android device. The separate accounts will have private leaderboard scores, achievements, cloud saves, and so on.

Combining Google Play Game and Google App Engine access in an Android app

I have used Google play games to create an Android game with achievements, leaderboard, and realtime multiplayer play.
I now would like to include some server related stuff, planning on using google app engine. My understanding is that a Google Play Game backend instance is built atop an app engine instance? How would I combine using the google game play API (extending BaseGameActivity for its login management and have access to achievements, etc) and still use the google app engine for other services exposed via servlets?
My main concern would presumably be sharing the authentication- I could envision simply making a separate Game play server and a separate app engine server, but then the user would somehow have to log in to each separately, right, being rather annoying.
I have tried to search for how to do this, expecting it may be fairly common, but have turned up only a few references that are not exactly what I need, talking obliquely about Auth tokens and such. If those are actually what I need, I may need a step by step guide as to how to take the info from the google play game APIs, and how to send it to the app engine server calls appropriately, so the user only sees the single "google play game" login.
Thank you
Rob

Turn based android game with Google Play Game Services and IntentService

Imagine a multi player game for android which is turn based (multiplayer like ruzzle):
The user should get invitation, accept, send finished game to other players, etc at any time, even if the game/activity is not open. Each game last more than a day.
At the I/O google mentioned that Google Play Game Services will support "turn based multiplayer" gaming experience as well. What do they mean by this?
When I was reading about it on developers website, I did not see "turn based" anywhere. Also the title of the page was:
Developing a Real-time Multiplayer Game in Android
Can what I need be accomplished using google play game services and an IntentService? What would the drawback of this be compared to using GoogleCloudMessaging?
Can I hook up onActivityResult to an IntentService so invitation, game messages, etc will be handled by the IntentService if the game/activity is not running?
If I understand you correctly, you are thinking about developing an asynchronous game. This has been previously discussed here e.g.
https://stackoverflow.com/questions/17423461/example-of-google-play-service-for-creating-a-turn-by-turn-asynchronous-multip
Google Play Game Services is not well-suited to this type of game at the moment.
Of course, you can write your own intent service, but to make it work (e.g. maintaining "connections" between devices across power downs) you will effectively have to write your own version of Game Services.
Re. reconnecting to a room (assuming Google's back end has not "housekept" the room due to inactivity):
Google gaming services, obtain list of rooms
Today I read Google Play Services 4.1 and it looks promising. I wanted to share this with whoever stumbles upon this question.
Turn Based Multiplayer
Play Games now supports turn-based multiplayer!
Developers can build asynchronous games to play with friends and
auto-matched players, supporting 2-8 players per game. When players
take turns, their turn data is uploaded to Play Services and shared
with other players automatically.
TurnbasedMultiplayer

Categories

Resources