Disclaimer: This guide was originally written by Andy Reitberger. It has been published here with his consent. If yo want to access the original article you can do it clicking here.

Important: Add the “Cocoon Play Games” plugin to your project (you must have installed the Cocoon Construct2 plugin).

Upload your game

In order to use the Google Play Games Function in your game you must have uploaded an apk file to the Play Store (beta phase).

First visit your Google Play Developer Console. If you don’t have an account yet, create one.

gpg_button

The fee for a new account is 25$. This is a one-time payment. After that, there are no recurring payments to made like on the ITunes Store.

Build your game

In order to upload an apk file to the store you must compile it first.

build_button

Create a new project

If you already have created an app at your Google Play Dev. Console you can skip this step.

cio_cPlay_new_app

Click on “All Apps” and then on “+ Add new App”.

cio_cPlay_new_app_title

Enter the title of your game and click on “Upload APK”.

cio_cPlay_apk_beta

Now switch to the ‘BETATEST’ tab and choose “Upload first APK-File in Betaphase”.

cio_cPlay_apk_beta_upload

If the upload was successfully it will take awhile till your app is reachable via the test link.

Create a Game Service

Go to the tab “Game Services” and click on “+ Add new Game”.

cio_cPlay_game_service_new

Then enter the details of your game. It’s recommended to use the same name that you used on your game.

cio_cPlay_game_service_new_details

Click on “Next” and go to the tab “Associated Appsand select the platform you want to associate with the current game service.

cio_cPlay_game_service_new_platform

In this example we want to add an Android game, so I choose Android as platform.

cio_cPlay_game_service_new_associate-1024x536

Important:

  • You find your ID in the header below the name of your game (marked in the blue rectangle). This is your Google Play Game ID. If we use later this term then we refer to this ID.
  • In order to select your recently added game you must have uploaded an apk file before (note that it may take awhile till your game is shown here).

Copy your Google Play Game ID and change to your Cocoon cloud account.

cocoon_compiler_button

Then select your Project (if you have none, create one) and click on the tab “Plugins” and select “Cocoon”, search for the Plugin “Google Play Games Social API” and click “Install”.

cio_cPlay_cc_install_plugin-1024x379

The installer will create automatically a parameter called APP_ID. Insert here as value your Google Play Game ID.

cio_cPlay_cc_add_ID

Then save your settings.

Important: Do not use the CocoonGooglePlayGames & Cranberrygame’s CordovaGame plugin at the same time in one project. This will cause build errors.

Compile

You can now compile your game!

build_button