Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Felgo Crash Course Lesson 6 - How to add Facebook & Game Center sharing to your game

In the last lesson you've learned how to add achievements and leaderboards to your game to increase player retention. Today we'll have a look at how you can increase your game downloads and increase player retention even more!

Add Facebook Connection To Your Game

One of the biggest benefits of Felgo Game Network is the built-in Facebook connection. Although your players can also achieve highscores and achievements without connecting to their Facebook account, they get the following benefits after connecting with Facebook:

  • Players can compare their highscores with their friends in the Friends section of daily, weekly and all time leaderboards. Thus players know which ranking they have within their friends also playing your game, and not only in the overall leaderboard list.
  • Highscores and achievements are automatically posted to your players timeline. This increases player retention, i.e. your players return more often to your game thanks to the open graph stories that are created. Also, this will bring you new downloads for your game, because the stories are also visible to all your player's friends not playing your game, yet!
  • Challenges only work between Facebook friends.
  • Syncing the player's data across devices and platform is only possible if the player connects with the same Facebook account from multiple devices. After the initial connect from multiple devices, the player can sync all Felgo Game Network data: highscores, achievements, challenges and WebStorage data.

In your game, it is advisable to communicate these benefits to your players. You can do so by checking the facebookConnectionSuccessful property at app startup, and ask the player to connect to gain these benefits. In the ProfileView, a part of the default GameNetworkView, we also have communicated the benefits as you can see in the following picture. Based on the facebookConnectionState, a different text is displayed. In the image the player did already connect with Facebook, thus he is shown information what he gains from this connection and when he should use the disconnect functionality.

Facebook Stories that Are Posted to the Players Timeline

If the player connects with Facebook, the highscore progress and unlocked achievements are automatically posted to the timeline. These graph stories are visible to all of your player's friends and thus will bring you new downloads: If the player clicks the story in the mobile Facebook app, this will directly open your game!

As Felgo Game Network internally uses the Score API (where the following image is taken from), this story is posted automatically on your player's timeline if he reaches a better highscore:

If an achievement is unlocked, this is also posted in the player's timeline. The following image shows common stories that are visible in the player's Activity Log:

If one of these graph stories is clicked on a mobile device, your app is started from the Facebook native application. If it is clicked in a web browser, the canvas page is shown which serves as an advertisement page for your game.

Step-By-Step Tutorial How to Add Facebook to Your Mobile Game

Adding Facebook to your game with Felgo Game Network can be done in less than 5 minutes!

Here I have prepared the steps required to add it to your game:

Go to the Tutorial

If you do not have a game implemented yet, you can start with the sample code in <Qt5-SDK>/Examples/Felgo/examples/GameNetworkTestSimple for full source code with the Facebook connection, and follow the above tutorial to create your own Felgo Game Network game in the GameNetwork Web Dashboard and then create your own Facebook app for it.

Add Game Center Connection

Players like to brag about their game progress and compare with their friends in their favorite game network. On iOS this clearly is Apple's Game Center which is pre-installed on every iOS device. Felgo Game Network allows your iOS players to compare each other both with their Game Center friends, but also with their friends on Android devices!

In this step we will add support for Game Center on top of Felgo Game Network support! So you are able to support both game networks, with just a single API call!

All you need to do for Game Center support, is to create a GameCenter item in your main qml file and connect it with the FelgoGameNetwork item like shown in this example:

 import Felgo 4.0
 import QtQuick 2.0

 GameWindow {

   // make sure to enable GameCenter for your application (developer.apple.com)
   GameCenter {
    id: gameCenter

    onPluginLoaded: authenticateLocalPlayer()

   FelgoGameNetwork {
    id: gameNetwork
    // created in the Felgo Web Dashboard
    gameId: 5
    secret: "abcdefg1234567890"
    gameNetworkView: myGameNetworkView
    facebookItem: facebook

    // by setting the gameCenterItem property, scores and achievements are also posted to GameCenter
    gameCenterItem: gameCenter

   // the Scene will follow here

 }// GameWindow

That's it! Felgo Game Network will handle the internal API calls for Game Center when you are calling reportScore(), unlockAchievement() or incrementAchievement() for the gameNetwork item. Sweet, isn't it? ;)


In this lesson you've learned how to increase your game downloads and player engagement, by using Felgo Game Network together with Facebook and Game Center.

If you have any questions about this lesson, just send us an email to support@felgo.com.

Cheers, Chris from Felgo

P.S.: Would you like to see Felgo Game Network in action in an app store game with GameCenter and Facebook connection, challenges and achievements? Then download Squaby or Chicken Outbreak 2.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded