Implement Progression

The Progression methods allow you to store, recall, and update player data at any time within the game, unlocking personalized player experiences.

General Custom Progression Game Scene Flow

  1. Create keys in Developer Console for PlayerData and/or InGameItems namespaces

  2. From client, retrieve player data using GetProgressionUserData at any time, prior, during, or at end of match play

  3. Call SubmitScore at the conclusion of the match

  4. Call UpdateProgressionUserData to update player data

  5. Present the player with the custom progression scene

  6. Call ReturnToMiniTon to return to the MiniTon BOT

Progression API

Namespaces

There are three namespaces used to segment Progression data:

  • DefaultPlayerData

    • For read-only player data and is game-specific. Keys such as games_played, games_won, install_date, and more are found here.

  • PlayerData

    • For player data and is game specific. Store and retrieve custom player statistics and other custom progression-related data here.

  • InGameItems

    • In-game items are shared across all games in the publisher's portfolio. Store and retrieve virtual goods and global custom progression-related data here.

INFO

In order to store data in the PlayerData and InGameItems namespaces, you must first create your custom keys via the MiniTon Developer Console. Remember to publish your keys to Production when you are ready to distribute your game builds that contain Progression.

Get Progression User Data

Retrieve data for the current user. The GetProgressionUserData method requires callback methods that allow you to handle success and fail scenarios.

public static void MiniTonCrossPlatform.GetProgressionUserData(string progressionNamespace, List<string> userDataKeys, Action<Dictionary<string, ProgressionValue>> successCallback, Action<string> failureCallback)

Parameters

progressionNamespace One of the namespace string constants

  • ProgressionNamespace.PLAYER_DATA

  • ProgressionNamespace.DEFAULT_PLAYER_DATA

  • ProgressionNamespace.IN_GAME_ITEMS

userDataKeys String key list of desired fields.

successCallback Action delegate to handle successful callback. The method must be defined in the implementation.

failureCallback Action delegate to handle failed callback. The method must be defined in the implementation.

Sample Implementation

MatchController.cs
using MiniTonSDK;
using UnityEngine;
using System;

public class MatchController : MonoBehaviour

    // Define list of keys to look up within the target namespace
    List<String> keys = new List<String>()
    {
        "games_played",
        "games_won",
        "average_score"
    };

    // Handle success response
    void OnReceivedData(Dictionary<string, MiniTonSDK.ProgressionValue> data)
    {
        Debug.LogWarning("Success");
        // Do something with the data, such as populate a custom Progression scene

        // Example manipulation of the returned data
        // Printing each key/value to console
        foreach(var kvp in data)
            Debug.LogWarning("Progression default player data key: " + kvp.Key + ", value: " + kvp.Value.Value);
    }

    // Handle failure response
    void OnReceivedDataFail(string reason)
    {
        Debug.LogWarning("Fail: " + reason);
        // Continue without Progression data
    }

    public void GetData()
    {
        MiniTonCrossPlatform.GetProgressionUserData(ProgressionNamespace.DEFAULT_PLAYER_DATA, keys, OnReceivedData, OnReceivedDataFail);
    }

Update Progression User Data

Write data for the current user. The UpdateProgressionUserData method requires callback methods that allow you to handle success and fail scenarios.

INFO

The DefaultPlayerData namespace is read-only, and cannot be used with this method.

NOTE

This method can update up to 25 elements per invocation.

public void MiniTonCrossPlatform.UpdateProgressionUserData(string progressionNamespace, Dictionary<string, object> userDataUpdates, Action successCallback, Action<string> failureCallback)

Parameters

progressionNamespace One of the namespace string constants

  • ProgressionNamespace.PLAYER_DATA

  • ProgressionNamespace.IN_GAME_ITEMS

userDataUpdates Dictionary of key/value pairs to be updated.

successCallback Action delegate to handle successful callback. The method must be defined in the implementation.

failureCallback Action delegate to handle failed callback. The method must be defined in the implementation.

Sample Implementation

MatchController.cs
using MiniTon;
using UnityEngine;

public class MatchController : MonoBehaviour

    // Define list of keys to update
    // Must match keys created in the Developer Console!
    Dictionary<String, object> updateDict = new Dictionary<String, object>()
    {
        { "achievement_level", 5.5 },
        { "combos_attained", 10 },
        { "character_color", "orange" }
    };
    // Handle success response
    void OnSentDataSuccess()
    {
        Debug.LogWarning("Successfully updated!");
    }

    // Handle failure response
    void OnSentDataFail(string reason)
    {
        Debug.LogWarning("Fail: " + reason);
    }

    void UpdateData()
    {
MiniTonCrossPlatform.UpdateProgressionUserData(ProgressionNamespace.PLAYER_DATA,updateDict, OnSentDataSuccess, OnSentDataFail);
    }

Default Player Data

These are automatically updating, read-only statistics from the MiniTon platform

For use with GetProgressionUserData

INFO

Default Player Data values are calculated with completed matches that have a result. In progress games that have not yet matched with another player are excluded, and do not update the values.

Progression Room Entry Point

Configure Progression Room Entry Point

  1. Configure your Entry Point within the Developer Console by clicking on Progression -> Entry Points. Be sure to complete all required fields. Hit Save to immediately see your room in Sandbox. Publish & Assign is used to share your entry point with your players in production. You can create dynamic text in the Title and Subtitle fields by inserting your progression keys names directly into the input box. Example: You have ${Custom_Key_Name} challenges remaining!

  2. Implement OnProgressionRoomEnter from MiniTonDelegate interface to load your progression scene

  3. Call ReturnToMiniTon to return to the MiniTon BOT

Implement Progression Room

For Unity, you need to implement the MiniTonMatchDelegate interface as a regular C# class. This will be instantiated when launching MiniTon later.

MiniTonGameController.cs
using MiniTonSDK;
using UnityEngine.SceneManagement;

public sealed class MiniTonGameController : MiniTonMatchDelegate
{
    private const string GameSceneName      = "Level1";  // Your game scene name
    private const string StartMenuSceneName = "StartMenu";  // Your menu scene (optional)
    private const string ProgressionSceneName = "PlayerProgress"; // Your progression scene

    public void OnMatchWillBegin(Match matchInfo)
    {
    }

    public void OnMiniTonWillExit()
    {
    }

    public void OnProgressionRoomEnter()
    {
        // Load your progression scene here
        SceneManager.LoadScene(ProgressionSceneName);
    }
}

Last updated

Contact us

Telegram

Šī¸MiniTon 2023