Skip to content

Profiles

Profiles introduce a dedicated section for creating and managing user profiles within Balancy.

User Profiles Screenshot

Creating a structured, singular profile for each user is advised to house all necessary data efficiently. This organization is crucial for maintaining well-structured data, crucial for game development and operations.

Creating Profiles

  • Unlimited Profiles: While Balancy allows the creation of unlimited profiles, a single, well-structured profile per user is recommended for simplicity and efficiency.
  • Data Types Supported: Supports all primitive data types (string, int, float, etc.), lists, and Data. "Data" refers to your custom Template with its own parameters, facilitating organized data management beyond simple key-value pairs.

Technical Limitations

  • First Layer Restrictions: Primitive data types cannot be added directly to the first layer of your Profile; only Data parameters are permitted here.
  • Data Size Limit: Each Data parameter, including all its nested parameters, must not exceed 150Kb. This constraint is particularly important to consider for parameters storing lengthy strings.

Best Practices for Profiles

Profiles are pivotal for storing comprehensive player progress and data. To optimize profile utility and efficiency:

  • Data Segmentation: Segregate stored parameters by their relevance and function. For instance, your profile might categorize data into QuestsProgress, GeneralInfo, Characters, Scenario, Level, etc.
  • Meaningful Organization: Structure your profiles to reflect the game's data architecture, enhancing clarity and accessibility of player information.

By adhering to these guidelines, you can leverage profiles to maintain a detailed, organized repository of player progress and preferences, facilitating smoother game development and player data management.

Visual Scripting

When you specify a profile, you can use it in Visual Scripting. For example, you can store the player's level, gold coins, attribution campaign, etc... in the profile and then use that data to segment players and decide which Offer you want to give to the player.

Screenshot

  • Wait Node awaits until the specified field in the profile reaches a specific value. For example, Gems > 33.
  • Get Profile Value returns the value of the specified field. For example, Level or Gems.
  • Set Profile Value changes the specified field's value in the profile.

Conditions

You can use the profile's parameters (aka User properties) in the conditions. For example, you can launch an event only for players who have at least 1000 Gems:

Screenshot

Section for programmers

It would be best to load the player's profile to make operations with it. Remember to generate the code every time you make changes in the structure of Smart Objects.

Balancy.Data.SmartStorage.LoadSmartObject<DefaultProfile>(responseData =>
{
    var profile = responseData.Data;
});

LoadSmartObject method has the last parameter DataSynchType, which determines where the data is saved.

  • Local data is saved every 5 seconds
  • Cloud data is saved every 20 seconds

If no data was changed, save is not called.

Best Practices

For optimal performance and consistency, it's highly recommended to initiate the loading of all SmartObjects only after the OnSmartObjectsInitialized callback is invoked. This method serves as a reliable trigger, ensuring that all preliminary processes have been settled.

Here's how to leverage this practice:

  1. Caching SmartObjects: Upon the trigger of OnSmartObjectsInitialized, load and cache all relevant SmartObjects. This consolidated pool of objects can then be conveniently accessed throughout your project, reducing redundant calls and enhancing access speed.

  2. Maintaining Data Integrity: The system is designed to recall OnSmartObjectsInitialized under specific circumstances, such as when a player switches accounts or when data discrepancies are detected. This re-invocation ensures that you have the opportunity to refresh and update the cached data, maintaining accuracy and consistency for the user experience.

  3. Resilience to Change: This practice safeguards against potential conflicts or data loss, as the callback provides a stable point of reference and recovery, ensuring that the most current and accurate data is presented post-resolution.

Implementing this approach streamlines data management within your project, bolsters stability, and ensures a seamless, reliable experience for your players.

Profile Reset

If you need to reset Smart Objects, including the System Profile, which stores all the Scripts, Events, Offers, A/B testing, Payments, and Segmentations, use Restart method:

Balancy.LiveOps.Profile.Restart();

This method is asynchronous. All the callbacks will be called once again after the Reset is complete:

//It's called at the game start, when the profile is ready, and after the Restart.
ISmartObjectsEvents.OnSmartObjectsInitialized();

If you clear any profile or restart the System Profile, update all the links to them in your game, reloading the Profiles.