IGX SDK and Moving Beyond Facebook Instant Games

Welcome to the Facebook Instant Games SDK Tutorials. This series of tutorials covers many aspects of using the Facebook Instant Games SDK.

In this tutorial we will take a look at moving games from Facebook Instant Games to others platforms with minimal of fuss and cost.

Introduction

When I first started developing Facebook Instant Games a couple of years ago, I was so excited that I dove straight in and all sense and sensibility went out of the window. I didn’t care about things like making money from the games elsewhere or putting the games onto other platforms. It was only after developing many games and earning very little from them that I realised that I had built a catalogue of games that were essentially stuck on the Facebook Instant Games platform. My games were integrated into the platform services and used platform specific features which would make porting them elsewhere a huge task.

After much deliberation I decided that I could write my own version of the Facebook Instant Games SDK and mirror its functionality using other services such as Xtralife, PayPal, Google Analytics etc.. and with this the IGX SDK was born. Using this approach I could deploy my games elsewhere keeping as much or as little as the platform features as I felt appropriate for the game.

What is the IGX SDK?

The IGX SDK is a free open source replacement for the Facebook Instants Games SDK which allows developers to deploy their game to web, various web portals and even native mobile without changing any code or as little code as is needed (depends on what features you want to cull or add).

When I say replacement, the IGX SDK has gone further than a simple replacement and now provides additional features depending on which web portal you deploy to and what back-end you use to provide the services.

IGX uses a system of modules that can work together or independently to provide various features. For each module you would like to use you need to instantiate it using the following format:
[sourcecode language=”js”]
new ModuleName("vendor_name");
[/sourcecode]
Where module name is the name of the module you would like to create, for example GameService would create the game service module. vendor_name is the name of the vendor that you would like to provide the implementation of the GameService module, for example xtralife. An example set up may look like this:
[sourcecode language=”js”]
new GameService("xtralife");
new StorageService("xtralife");
new UserService("xtralife");
new LeaderboardsService("xtralife");
new MessagingService("xtralife");
new ReferralService("xtralife");
new ShareService("generic");

new AnalyticsService("google");
new AdsService("crazygames");
new PaymentsService("paypal");
[/sourcecode]
This looks a bit long winded so a utility function is provided to add the first 7 modules allowing the above 7 lines of code to be replaced with:
[sourcecode language=”js”]
FBInstant.createDefaultServices("xtralife");
[/sourcecode]
This sets up xtralife as the default back-end for all game related services.

Its worth mentioning a little something about Xtralife at this point. Xtralife is a great gaming back-end service provider that provides a lot of cool back-end features that are super easy to use. These features can be used to extend your games functionality across server and clients without you having to write a single line of back-end code! At the time of writing Xtralife offers one million MAU free accounts which is more than enough to handle a number of games simultaneously. This is one of the many reasons that I chose Xtralife as the default back-end for IGX.

Basic Integration

The most basic integration with IGX SDK will get your game up and running on web instantly. You simply need to link to the IGX SDK instead of the Facebook Instants SDK then add a single line of code at the start of your onload:
[sourcecode language=”js”]
FBInstant.createDefaultServices(‘none’);
[/sourcecode]
And that is it, your game should now run on web. Of course you will not get all of the Facebook Instant Game features because here we opted for no services, well actually “none” means minimal services which include local storage for player data and sharing. To get additional services you will need to create a different service or set of services and set them up.

What Features are Available?

Features vary depending on where you would like to deploy your game. A full list of IG features include:

  • Initialisation including entry point data via the url
  • User login / management (anonymous, credentials, Facebook and shortcode logins)
  • User data persistence on server
  • Facebook sharing
  • Leaderboards
  • Interstitial and Rewarded adverts
  • Analytics
  • Payments

IGX also includes additional functionality that is available outside of the Facebook Instant Games API, these features include:

  • Login status
  • User registration
  • Account conversion
  • Password management
  • Profile query and modification
  • Add / remove / find friends
  • Real time user to user messaging
  • User chat
  • Referral system
  • Sharing on Twitter and other networks

Obviously all features are dependent upon where you want to deploy your game.

Getting Started

You can download the IGX SDK from Github at https://github.com/mrmop/IGX.

I have also written a fairly comprehensive Wiki to help guide users through using the SDK which is located at https://github.com/mrmop/IGX/wiki.

A Facebook community group is also available for at https://www.facebook.com/IGXSDK/

Leave a Reply