Skip to content

SDKs

Our SDKs provide an easy way to quickly integrate ChilliConnect in to your game. If the SDK you want is currently unavailable you can still call our HTTP API directly.

Unity

Download


The Unity SDK describes a C# API for ChilliConnect and comes bundled as a Unity Package which can be easily added to your project. The SDK is written entirely in C# and does not require any plugins. The following details how to install and use the SDK.

Installation

Follow these steps to include ChilliConnect in your Unity project:

  • Download the latest version of the SDK using the link above
  • Open your Unity project
  • Double click on the downloaded ChilliConnect Unity Package and the following window will open in Unity

  • Select 'Import' and the ChilliConnect SDK should appear in your project

Usage

The following describes the steps requested to setup ChilliConnect in your Unity project.

  • All ChilliConnect source is in the ChilliConnect namespace. Add the following to the top of your script:
using ChilliConnect;
  • On start up, create a new instance of ChilliConnectSdk. This is the central hub for access to all ChilliConnect functionality. Typically this will be created only once per app and persisted
var chilliConnect = new ChilliConnectSdk("<YourGameToken>", false);
  • All functionality in ChilliConnect is broken up into separate modules, such as PlayerAccounts, Leaderboards, etc. These modules are available as properties of ChilliConnectSdk
var playerAccounts = chilliConnect.PlayerAccounts;
  • Each module consists of a number of methods for making requests to the ChilliConnect servers. These methods are all asynchronous and receive their results though callbacks. This leads to each of the methods following a similar structure, consisting of 3 parts: the input request properties, the success callback and the error callback. The following demonstrates creating a player account.
Action<CreatePlayerRequest, CreatePlayerResponse> successCallback = (CreatePlayerRequest request, CreatePlayerResponse response) =>
{
    UnityEngine.Debug.Log("Successfully created a player: " + response.ChilliConnectId);
};

Action<CreatePlayerRequest, CreatePlayerError> errorCallback = (CreatePlayerRequest request, CreatePlayerError error) =>
{
    UnityEngine.Debug.Log("An error occurred while creating a player: " + error.ErrorDescription);
};

var desc = new CreatePlayerRequestDesc();
desc.DisplayName = "my first player"
playerAccounts.CreatePlayer(desc, successCallback, errorCallback);
  • ChilliConnectSdk implements the IDisposable interface, so the Dispose() method will need to be called when it is no longer needed. ChilliConnect cannot be used after this point.
chilliConnect.Dispose();

See the full API documentation for more information on the available modules and methods.

Unreal

Download


Installation

The ChilliConnect Unreal SDK is based on Blueprints and is distributed as source code that must be built for your version of Unreal and development platform. The steps for doing this depend on your Unreal project type, C++ or Blueprints:

C++ Projects

To use the Plugin in a C++ project, you must first copy the source files of the Plugin to your project, then build the Plugin. Follow the instructions below to do this.

  • If your project is currently open in Unreal or Visual Studio, close the project.

  • If it does not already exist, create a “Plugins” directory in the root of your existing Unreal Project:

  • Underneath this directory, create a “ChilliConnect” directory.

  • Extract the ChilliConnect SDK zip file to your local system.

  • From the extracted project, copy the contents of the Plugins/ChilliConnect directory to the Plugins/ChilliConnect directory of your own project.

  • Open your project in Unreal. You may be warned that the Plugin is not compatible and asked if you want to disable it. This is simply because the Plugin needs to be built first. Press “No”:

  • You will then be asked if you want to rebuild the Plugin. Press “Yes”:

  • Unreal will now compile the Plugin for your platform/architecture.

  • Once your project loads, open a Level Blueprint. Right Click on the Blueprint and search for “ChilliConnect”. The ChilliConnect SDK methods should now be listed as available:

Blueprint Projects

To use the Plugin in a Blueprint project, you must first build and export the Plugin from a C++ Unreal project for your platform. The simplest way to do this is by opening the SDK project itself and building from there.

  • Extract the ChilliConnect SDK zip file to your local system.

  • Open the ChilliConnect SDK project in Unreal

  • You may be warned that the Plugin is not compatible and asked if you want to disable it. This is simply because the Plugin needs to be built first. Press “No”:

  • You will then be asked if you want to rebuild the Plugin. Press “Yes”:

  • Unreal will now compile the Plugin for your platform/architecture.

  • Once your project loads, confirm the Plugin has build successfully by opening a Level Blueprint. Right Click on the Blueprint and search for “ChilliConnect”. The ChilliConnect SDK methods should now be listed as available:

  • Exit the Blueprint and return to the Unreal Scene editor. From the Edit menu, select the Plugins option:

  • Collapse the “Built-In” option and select the “Project” Plugins. Press the “Package” link on the ChilliConnect SDK and select a location on your computer.

  • Unreal will start packaging the Plugin for your platform.

  • Once the Plugin has been packaged. Close the sample project and also close your Blueprint project if it is open.

  • From the package Unreal created in the previous step, copy the Plugins folder to the root of your Blueprint project.

  • Open your project in Unreal. Open a Level Blueprint and search for “ChilliConnect” to ensure the Plugin has been installed correctly and the ChilliConnect methods are available:

Usage

The Unreal project containing the ChilliConnect Plugin also contains a sample level with a Blueprint showing how to call ChilliConnect to create a new Player account, Login to ChilliConnect, and add a Leaderboard score. To use the Plugin in your own project:

  • Create a new level and open the level Blueprint. Right-click on the Blueprint and search for "Game Token". This will find the Set Game Token blueprint node that is used to initialise the ChilliConnect SDK with your game token (available from your project dashboard) prior to making any requests:

  • All ChilliConnect functionality is split into modules (e.g. metrics, leaderboards, etc). When searching in the Blueprint actions browser, each request is prefixed by the module name:

  • Each module consists of a number of functions for making requests to ChilliConnect. These request functions are all asynchronous and receive their results through events. Each request follows a similar structure consisting of 3 parts - the input request properties, the success event and the error event. The following example shows how to issue a request to create a new player, and then login in with that player account:

Optional Properties

When constructing a request, any optional properties of the request can be set through a special "Optionals" object. The optionals object is then passed to specific methods to set any optional properties on the request. As an example, adding a node to call the the set Player Data method will show the below:

To set the optional properties of this request, first click and drag the "Optionals" property

Make a new CCSetPlayerDataRequestOptionalsDesc object, then click and drag the pin from the new object and expand the "Chilli Connect" item to see the list of available optional setters available for that request:

The Write Lock property for the Set Player Data request can be set like so:

Some properties in ChilliConnect responses can be also be optional and maybe returned from the server as null. These will be indicated as "(Optional)" in the response descriptor:

Before using the values of an optional response, you should check if the value has actually been set by ChilliConnect and has not just been initialised to the zero value for it's type. You can do this by dragging the response pin and expanding the "Chilli Connect" menu to see a list of "Has" methods for that request:

For example, in the Get Player Details call, we can check to see if ChilliConnect has returned a stored Platform for the currently logged in Player account:

Working with Multi Type Values

Many ChilliConnect API methods work with free form JSON rather than set request formats. The Multi Type Value object in the ChilliConnect SDK can be used to construct JSON structures through Blueprints. For example, if we wanted to store the below data against a player account:

{
    "Level1" : {
        "Status" : "COMPLETED",
        "Items" : [ 1, 2 ]
    }
}

We would do this by first creating a Map variable in Blueprint with String keys and MultiTypeValue values. We'd then set the "Status" key by using the "Create String" MultiType helper in the ChilliConnect SDK:

To create the Items array, we'd then create a new array of MultiType values Blueprint variable, and use the "Create Int" helper to add items to this array. The array can then be added to the "Level1" map using the "Create Array" helper:

Finally, the "Level1" data can be added to the JSON object using the "Create Map" helper:

This final Multi Type object can then be passed to the Set Player Data method to save this JSON against the player's account.

Multi Type values can be parsed and read using the "As" methods available on Multi Type responses. For example, the below Blueprint will load the player data set above and print the Status property of the Level1 object:

iOS

Download


The iOS SDK provides an Objective-C API for ChilliConnect that iOS developers should find easy to use. The following sections detail how to install and use the SDK.

Installation

Follow the below steps to add the iOS SDK to your project:

  • Download the latest version of the SDK using the link above
  • Unzip ChilliConnect.framework to your project directory
  • Drag ChilliConnect.framework into your project in Xcode

Usage

The following are the steps required to setup the ChilliConnect iOS SDK for use in your project.

  • Import ChilliConnect/ChilliConnect.h. This will include all public headers in the SDK. Optionally, large projects may want to avoid including the entire SDK in header files to reduce compilation times. This can be achieved by instead including ChilliConnect/ForwardDeclaration.h in headers and including the full SDK in relevant .m files.
#import <ChilliConnect/ChilliConnect.h>
  • Create a new instance of CCChilliConnectSdk, the central hub for access into all ChilliConnect functionalty. A CCChilliConnectSdk instance is created using the Game Token for your game which can be retrieved through the ChilliConnect dashboard. Optionally, verbose logging can be enabled - this will print the progress of each request in the console. Only one instance of CCChilliConnectSdk should be created per app, therefore something should hold on to it for the entire life of your application - for example, the AppDelegate.
CCChilliConnectSdk *chilliConnect = [CCChilliConnectSdk chilliConnectSdkWithAppToken:@"<YourGameToken>" verboseLogging:NO];
  • Functionality in ChilliConnect is broken up into different modules, such as PlayerAccounts, Leaderboards, etc. Access to each of these modules is provided through CCChilliConnectSdk:
CCPlayerAccounts *playerAccounts = chilliConnect.playerAccounts;
  • Modules provide a series of methods for making requests to the ChilliConnect servers. These methods are all asynchronous meaning they receive their results in callback blocks. This leads to each of the methods following a similar structure consisting of 3 parts: the input request properties, the successful response callback and the error callback. For example, the following demonstrates creating a player account.
CCCreatePlayerResponseCallback successCallback = ^(CCCreatePlayerRequest *request, CCCreatePlayerResponse *response) {
    NSLog(@"Player created with ChilliConnectId: %@", self.chilliConnectId);
};

CCCreatePlayerErrorCallback errorCallback = ^(CCCreatePlayerRequest *request, CCCreatePlayerError *error) {
    NSLog(@"An error occurred while creating a new player: %@", error.errorDescription);
};

CCCreatePlayerRequestDesc *desc = [CCCreatePlayerRequestDesc createPlayerRequestDesc];
desc.displayName = @"my first player";

[playerAccounts createPlayerWithDesc:desc successCallback:successCallback errorCallback:errorCallback];

For more information on the different requests available in each module, see the full API documentation.

HTTP

The easiest way to integrate ChilliConnect in to your game is to use one of our published SDKs. However, if the SDK you want is not currently available, all ChilliConnect functionality is exposed through an easy to use HTTPS API that you can invoke directly from your game.

The API is separated in to modules and exposed through two separate end points. Each API endpoint is also versioned, with the current version being 1.0. The following table describes the end point for each module:

Module Domain
Cloud Code https://connect.chilliconnect.com
Cloud Data https://connect.chilliconnect.com
Catalog https://connect.chilliconnect.com
Economy https://connect.chilliconnect.com
Leaderboards https://connect.chilliconnect.com
Messaging https://connect.chilliconnect.com
Player Accounts https://connect.chilliconnect.com
Push Notifications https://connect.chilliconnect.com
IAP Validation https://connect.chilliconnect.com
DLC https://connect.chilliconnect.com
Metrics https://metrics.chilliconnect.com
Live Ops https://connect.chilliconnect.com

The API for both Connect and Metrics follow a similar usage pattern. Use your GameToken, available from your ChilliConnect dashboard, to authenticate via one of the Connect login endpoints to obtain ConnectAccessToken and MetricsAccessTokens. You then use these AccessTokens on subsequent requests.

By default when Logging in to Connect both a ConnectAccessToken, and a MetricsAccessToken are returned, e.g. LogInUsingChilliConnect. If a MetricsAccessToken is not being returned to your login requests check your game settings in the Dashboard. Note that AccessTokens are not interchangeable between Connect and Metrics API endpoints.

To call a specific method on the API post the required JSON body to the URL indicated in the documentation below to the relevant endpoint whilst setting the Content-Type header to "application/json". For example, the below curl command shows how to call the CreatePlayer method:

curl \
 -H "Content-Type: application/json" \\
 -H "Game-Token: <YourGameTokenHere>" \
 -X POST https://connect.chilliconnect.com/1.0/player/create