ChilliConnectCloudSync
ChilliConnect is a multi-featured, connected, Live Game Management platform. It's available as an optional way to persist and view Game Foundation's data.
- Getting started)
- Setting up the API Access Controls
- Creating ChilliConnect Item Types
- Connecting Game Foundation to ChilliConnect
- Serializing in ChilliConnect
Getting started
- You will need a ChilliConnect account to use ChilliConnectCloudSync with Game Foundation. If you don't have an account yet, you can sign up here.
- After creating your account, you'll be asked to create your game in ChilliConnect: this creates your game token for connecting with ChilliConnect.
You can find your Game Token on your ChilliConnect Game page.
Setting up the API Access Controls
- In your ChilliConnect Game page, select API Access Controls from the menu bar.
- In the API Access Controls, select Edit API ACL. This opens the Edit API Access Control window. In the Edit API Access Control window, ensure that the last three items under Economy are checked: Add Inventory Item, Update Inventory Item, and Remove Inventory Item.
3. Scroll to the bottom of the window and select Update API Access Control to save your changes.
Creating ChilliConnect Item Types
You will need to create two Items in your ChilliConnect game: GF_INVENTORY and GF_ITEM.
These identify Inventory objects and InventoryItem.
- In your ChilliConnect Game page, select Connect and then Catalog from the icons on the left.
- In the Catalog Items window, open the Add Inventory Item window (menu: Add Item → Inventory Item).
- In the Name text box, type "GF_INVENTORY" and the select Add Inventory Item to save the new Item.
- Repeat steps 2 and 3 to create a second item named "GF_ITEM".
- After both items have been created, save them to your Catalog by selecting Publish at the top of the page.
Connecting Game Foundation to ChilliConnect
In Game Foundation, create a script with the following parameters:
using ChilliConnect; using UnityEngine.GameFoundation;
Use your ChilliConnect Game Token (found on your ChilliConnect Game page) in the script below. This logs you into ChilliConnect from your game.
public void Connect()
{
// Creates an SDK object
var conn = new ChilliConnectSdk("<my-app-token>");
// connects the player
var credentials = new LogInUsingChilliConnectRequestDesc(
"<chilliconnect-user-id>",
"<chilliconnect-user-secret>" );
// You can use the LogIn method of your choice.
conn.PlayerAccounts.LogInUsingChilliConnect(
credentials,
(request, response) =>
{
// Initialize Game Foundation using the connection object.
InitGameFoundation(conn);
},
(request, error) =>
{
Debug.Log("An error occurred while Login : " + error.ErrorDescription);
});
}
void InitGameFoundation(ChilliConnectSdk conn)
{
// Creates a Cloud Sync adapter with the connection object.
// Not that, in this state, the connection object IS connected.
// This is not the responsibility of Game Foundation is validate
// this object.
var adapter = new ChilliConnectCloudSync(conn);
// Initializes Game Foundation with the adapter.
GameFoundation.Initialize(adapter);
}
Serializing in ChilliConnect
Inventories
Game Foundation inventories are stored in a ChilliConnect item with the following parameters:
- ItemID (Name of the inventory)
- Name (GF_INVENTORY)
- InstanceData
InstanceData provides the following data:
- definitionId
- DisplayName
- GameItemLookUp
Items
Game Foundation items are stored in a ChilliConnect item with the following parameters:
- ItemID (Game Foundation item name)
- Name(GF_ITEM)
- Instance Data
InstanceData provides the following data:
- inventoryId (The name of the inventory this item is in)
- Quantity
- GameItemLookUpId
- DefinitionId