From The Blog: New Google Play Games Services plugin available!

badge-google-playWe are pleased to introduce our new Google Play Games Services (GPGS) plugin, loaded with features and enhancements that far exceed the legacy plugin. Our engineers have been working hard to add all of the requested features and enhance this plugin as much as possible. Here is a rundown of what’s new and improved:

We support everything!

We have written an interface to every feature in GPGS. If it’s in the Android version of their framework, we support it — and iOS support is currently in development as well. We’ve done all of this while working to maintain backward-compatibility with the legacy plugin.

Real-time and turn-based multiplayer support

Real-time multiplayer is great if everyone is playing at the same time. There are many games, however, that are designed around players taking their turns when it’s convenient for them. The legacy plugin supported real-time multiplayer but not turn-based multiplayer. Now, both options are available to you as a Corona developer!

Google Play Cloud Save or “snapshots”

Many people want to save their game progress to the cloud and sync between devices. With GPGS snapshots, you can save the player’s progress at given points and they can easily continue their progress on another device later.

Show specific leaderboards

The legacy gameNetwork.show("leaderboards") API displayed all leaderboards — there was no way to get a specific leaderboard or filter by friends (only within a time range). The new GPGS plugin supports all of the leaderboard APIs offered by Google.

Support for incremental and hidden achievements

Almost every platform’s game networking service supports achievements. Of course, not all achievements are “all or nothing” and many accomplishments can be accrued over time such as “50 of 100 bosses defeated.” The legacy plugin only supported fully-completed achievements, but with the new GPGS plugin, you can record incremental progress.

The new plugin supports hidden achievements as well — you can track these achievements internally and reveal them when the player reaches a certain stage.

Profile image support

A frequently requested feature was access to the player’s GPGS profile images so that developers could download the images and use them in the game’s UI. That’s now possible and we support the full set of images including small profile icons, large profile images, and both portrait and landscape profile banners.

Google Play player stats

Using the new GPGS plugin, you can now retrieve various gameplay metrics for players. These include things like session length, days since the last session, number of purchases, spending probability, and more. You can use this information to create an engagement strategy that will drive more player activity.

In-game video recording and streaming

Many modern games let players record their sessions to share with their friends. This functionality is now included in the GPGS plugin — see the gpgs.videos node to learn how to implement it.

Event tracking

Google is big on analytics and their game services are as well. The new plugin supports recording of analytic data from your game to be stored on Google’s servers. You can now learn more about how players play your game, allowing you to fine-tune it to improve player experience. Examples include tracking exactly when a player uses a particular item or how fast they reach a certain level.

Quests

Tied in with event tracking, GPGS quests allow you to introduce time-bound challenges to your players that are based on the event data you’ve recorded with event tracking. You can use this to re-engage players by offering them an in-game reward if they complete the quest. You can even offer daily quests to keep players coming back.

Requests

This feature lets you add gifts and wishes to your game. Using this feature, you can improve social engagement by allowing players to send gifts/items or request them from other players in the game.

API summary

You can require() the new Google Play Games Services plugin with the gpgs namespace as in local gpgs = require( "plugin.gpgs" ).

This large library is then divided into nodes pertaining to the feature:

As usual, you will need to include the plugin in your build.settings and activate it in the Corona Marketplace. Then, proceed to the documentation for details on implementing these awesome new features.

IMPORTANT — If you want to upgrade to this new plugin, you should  remove the legacy plugin from build.settings, if you’ve included it. Although this new plugin is fully backward-compatible with the legacy API calls, you can not include both plugins inside your build.settings file.

Conclusion

On our feedback page, you cast over 1,700 votes across eight different requests for various Google Play Games Services improvements. We are happy to say that this new plugin addresses every one of those requests except iOS support (currently in development).

Join us in the Corona Forums to continue discussing this great new addition to Corona’s collection of plugins.

View the full article

This is awesome, no other 2D engine has this kind of service support for free, especially after the iOS version is released! Big thank you to whomever wrote and signed off on this plugin!

Technical questions:

Which Google Play Game Services API was used the create this plugin, C++ or Java?

Is the source open like the other Corona plugins?

Thank you!
Android plugin uses Java API.
No info on whether or not it’s going to be opensourced yet.

Good job, Lerg and thanks for the info!

Nice to see this progress. Is there anything I should change the code besides changing :

local gameNetwork = require( "gameNetwork" )

to 

local gpgs = require( "plugin.gpgs" )

or can I keep as it is when I’m building new apps ?

thanks.

I have not tried port an app from old to new but I believe

local gpgs = require( “plugin.gpgs” )

should be

local gameNetwork = require( “plugin.gpgs” )

If you plan on using the gameNetwork.show instead gpgs.show.

.show is off couse the old way of showing leaderboard.

There are two options.

local gpgs = require( "plugin.gpgs" ) local gameNetwork = require( "gameNetwork" ) -- OR -- local gameNetwork = require( "plugin.gpgs" )

When you require “plugin.gpgs”, “gameNetwork” becomes an alias to “plugin.gpgs”.
Also don’t forget to remove the old plugin from build.settings.

@lerg thanks for clarification on.

Thank you thank you! Perfect timing too!  :slight_smile:

Any news when the IOS integration for gpgs will be available?

I am pretty sure iOS support was added like 5 hours ago. I think multiplayer is the only thing (also live streaming(which won’t work on iOS) and push) not working.

yep stated in docs

https://docs.coronalabs.com/plugin/gpgs/index.html

I hope the documents get properly updated by corona. Very often the same document page shows different code methods or implementations. So which is correct, and which requires additional info if you want to use gigs for both android and IOS? Is below to be used…

[“plugin.gpgs”] =

{
publisherId = “com.coronalabs”,
supportedPlatforms = { android=true }
}

…or

plugins = {

[“plugin.gpgs”] = {publisherId = “com.coronalabs”}
}

…and what is the code after the id, is it always the same or is that code specific for that particular id?

googlePlayGamesAppId = “760035641580-8eho8p557gtaaa7alouh5a2qlhtruomq.apps.googleusercontent.com”,

CFBundleURLTypes = {
{CFBundleURLSchemes = {“com.googleusercontent.apps.760035641580-8eho8p557gtaaa7alouh5a2qlhtruomq”}},
{CFBundleURLSchemes = {“com.coronalabs.gpgs”}}
}

jacques1, documentation is a work in progress.
Now you don’t need to supply supportedPlatforms field.

Your values for googlePlayGamesAppId and URLs will be different. These values are just for reference how it looks like.

Thanks Lerg,

is there any sample app for reference since there is no documention on how to properly init and login for both android and IOS. Or can IOS devices use the same into and login code that android currently uses? Reason for asking is right now I have one function for android and one function for IOS (which previously init and logged into game center - can i remove this code for IOS?). 

Lastly, do IOS users need to install google play app on their devices if we simply use the gpgs api to grab data for our own generated leaderboard displays in game and not require it for showing the generic gpgs leaderboard displays.

The login code is the same on Android and iOS. This plugin is not GameCenter plugin, if you want to keep GameCenter in your app - you should leave the login code for GameCenter. If you just want to use Google Play Games Services only, then remove your old code for GameCenter.

There is no Google Play app for iOS, authentication is happening via Safari.

Yup that much I gathered, but any time frame on when sample documentation will be available so we can actually see how to implement gpgs  (other than the gpgs init code), instead of merely seeing a list of all the functions, events,and type names which have no explanation on how to use them?

jacques1, samples and documentation are being worked on. Since this plugin tries to reflect Google’s API, you can actually use their documentation to get more information on one thing or another.

Thanks for your time Lerg, will try figure it out.

This is awesome, thank you to all the Corona Staff for this wonderful plugin.