Social Service in WaveEngine

This article will give you an idea of how the new WaveEngine extension could be used in your existing WaveEngine game.

We will make use of an already finished game to integrate with Google Play, but you will require no more coding efforts at all to get Game Center up a running, other than what we are about to do for Google Play.

Let’s go into depth in the new Wave Social Engine extension.

Our goal is to integrate Google Play in SuperSquid, one of our quickStarters (

The game consists of a squid you control with the accelerometer and your goal is to catch as many stars as possible, avoiding evil octopuses and dodging obstacles.

It is a perfect example for adding a leaderboard panel and connect all your scores with your Google Play friends.

We will make the appropriate changes to this quickstarter to achieve our purpose.

Let’s start adding some code, the first step is to instantiate the SocialService

private void InitializeAndRegisterSocialService()
    var socialService = new SocialService();

Next is to log in into Social Service.

To start SuperSquid you need to press the play button of the Main Screen, it will be at that time when the Google Play log in process would take place.

Modify the click event handler of the MainMenuScene play button and add the following code snipped.

play.Click += async (s, o) =>
    var logIn = await WaveServices.GetService<SocialService>().Login();

Once we are logged into Google Play we can start playing and get more stars.

SuperSquid has a GameOver screen displayed when the squid hits any obstacle, it will be at that point when we have to capture its current score and send it to the leaderboard.

Fortunately, we already have a block of code that is responsible for storing our high score so we just have to add a call to the appropriate social service method.

In the CreateScene() method you will see an “if” statement which checks whether the score achieved in the last run of the game is greater than the score you achieved in that moment.

Therefore it is only necessary to add one more line within this “if” statement to send our score to the leaderboard.

await WaveServices.GetService<SocialService>()
    .AddNewScore(LeaderboardCode, this.gameScene.CurrentScore);

The last code addition to achieve our purpose is to show the leaderboard panel, the most appropriate moment for this is right after submitting our new score to Google Play.

With this little line the Google Play leaderboards panel will show up with all associated leaderboards of our game.

await WaveServices.GetService<SocialService>().ShowAllLeaderboards();

This is all from the code point of view. It does not matter if you would end up using Google Play or Game Center, all of this code will be shared JIn the case you choose to go with Google Play there would still be three steps to follow.Register our game on Google Play

For this process we need to setup our app’s package name in the Visual Studio project’s properties.

Once this is done, enter your Google Play Developer Console account and check you have already created your Android application.

Remember to enter the same Application name and Package name you chose previously on the project’s properties.

Register a new Game Service associated with our game

In this step we need to create a new Game Service.

We provide its name and click continue.

Once completed we get our game appid, which is required to be in our game manifest.

<application android:icon="@drawable/Icon" android:label="SuperSquid">
	<meta-data android:name="" android:value="@string/app_id" />
	<meta-data android:name="" android:value="@integer/google_play_services_version" />

As shown, the value of metadata references the app_id field defined in the resource file string.xml

<?xml version="1.0" encoding="utf-8"?>
  <string name="app_id">53593810874</string>

The next step is to link our game, again, providing the same package name.

We set up the package name and the name of our app.

Beware you will need to provide the “Signing certificate fingerprint” of the certificate used to sign your game’s apk, in SHA1 format.

Have a look at this article, if you need to find the appropriate SHA1 fingerprint of your game when you run it in debug mode, (,_testing,_and_metrics/MD5_SHA1/)

The steps are as follows:

With this process we will link our app with the Game service.

SetUp a new Google Leaderboard

 In this step we create and obtain the leaderboard ID to use in our game.

In our newly created service game, select the Leaderboard tab and add a new one.

Once created, the panel provides the Leaderboard code that we need to use in our game.

Then, in the piece of code that sends the new score you will be missing the LeaderboardCode. The corresponding value is in the ID column.

The SuperSquid quickstarter with all the modifications described in this article can be found in Github (

As always, if you get into troubles, you have questions or want more from us please post comments on this blog or in our forum.

Leave a Reply

Your email address will not be published. Required fields are marked *