Game Progressions
Last updated
Last updated
Game progressions are all of the progressions defined for your game in the Web Console.
You can create as many progressions with as many tiers and rewards as your game needs, go wild!
This section shows you how to fetch progressions, tiers and rewards in your game.
string progressionKey = "mage";
LootLockerSDKManager.GetProgression(progressionKey, response =>
{
if (!response.success) {
Debug.Log("Failed: " + response.Error);
}
// Output the name of the fetched progression
Debug.Log(response.name);
});
Above is an example of how to implement retrieval of a single progression using blueprints in Unreal Engine. For an example you can copy and paste into your editor, look here.
Input
You need to exchange the trigger with an event that you want to trigger the flow. For example a button click or xp gain.
Progression Key is required for this node so connect it from a variable or remove the reroute node and hard code a value in the node.
Output
We recommend branching the completed event on the success flag, and if you do this you will probably want to add error handling in case the request fails.
The retrieved progression provides the id, key, and name of the progression as well as a boolean telling you if the progression is active or not.
LootLockerSDKManager.GetProgressions(response =>
{
if (!response.success) {
Debug.Log("Failed: " + response.Error);
}
if (!response.items.Any())
{
Debug.Log("Your game does not have any progressions, login to your LootLocker web console and create some");
}
// Output the name for all progressions
foreach (var progression in response.items)
{
Debug.Log(progression.name);
}
});
Above is an example of how to implement retrieval of multiple progressions using blueprints in Unreal Engine. For an example you can copy and paste into your editor, look here.
Input
You need to exchange the trigger with an event that you want to trigger the flow. For example a button click or level start.
Output
We recommend branching the completed event on the success flag, and if you do this you will probably want to add error handling in case the request fails.
The response is a list of progressions as well as pagination data (for information on how to use that see the section on it). The returned progressions contain the needed information on each progression that you may want to use for display or flow control.
Count can be used to limit the number of entries returned.
int count = 20;
LootLockerSDKManager.GetProgressions(count, response =>
{
if (!response.success) {
Debug.Log("Failed: " + response.Error);
}
if (!response.items.Any())
{
Debug.Log("Your game does not have any progressions, login to your LootLocker web console and create some");
}
// Output the name for all progressions
foreach (var progression in response.items)
{
Debug.Log(progression.name);
}
});
You can use "after" parameter to paginate if your game has many progressions.
int numberOfItemsPerPage = 10;
LootLockerPaginatedProgressionsResponse progressions;
void Start()
{
LootLockerSDKManager.StartGuestSession(_ =>
{
// Fetch the initial progressions list
LootLockerSDKManager.GetProgressions(numberOfItemsPerPage, response =>
{
if (!response.success)
{
Debug.Log("Failed: " + response.Error);
}
if (response.pagination.total == 0)
{
Debug.Log("You game does not have any progressions, login to your LootLocker web console and create some");
}
progressions = response;
});
});
}
void Update()
{
if (progressions == null) return;
// Fetch the next page if more progressions exist
if (Input.GetKeyDown(KeyCode.RightArrow) && progressions.pagination.next_cursor != null)
{
LootLockerSDKManager.GetProgressions(numberOfItemsPerPage, progressions.pagination.next_cursor, response =>
{
if (!response.success)
{
Debug.Log("Failed: " + response.Error);
}
progressions = response;
Debug.Log($"Paginating right, got {progressions.items.Count} progressions");
});
}
// Fetch the previous page if we are not on the first page
if (Input.GetKeyDown(KeyCode.LeftArrow) && progressions.pagination.previous_cursor != null)
{
LootLockerSDKManager.GetProgressions(numberOfItemsPerPage, progressions.pagination.previous_cursor, response =>
{
if (!response.success)
{
Debug.Log("Failed: " + response.Error);
}
progressions = response;
Debug.Log($"Paginating left, got {progressions.items.Count} progressions");
});
}
}
Above is an example of how to implement retrieval of multiple progressions supplying a count to limit the number of progressions to receive and supplying a cursor into the after parameter to paginate using blueprints in Unreal Engine. For an example you can copy and paste into your editor, look here.
Input
You need to exchange the trigger with an event that you want to trigger the flow. For example a button click or level start.
To use pagination you should supply a value to the after parameter and optionally a value to the count parameter. For an explanation, see below.
Output
We recommend branching the completed event on the success flag, and if you do this you will probably want to add error handling in case the request fails.
The response contains a list of progressions. The returned progressions contain the needed information on each progression that you may want to use for display or flow control.
The response also contains pagination data which you use as follows.
Usage example
Understanding pagination for the first time can be a challenge. So an example can help.
Say you have 50 progressions to receive. You can do this with pagination like this:
Trigger the GetProgressions node with a count parameter of 10.
Use the 10 progression items returned as you want (for example display in the UI). Note that out of your 50 progressions, these are progressions 1-10.
Save the returned pagination data to make the next request. The most important here is the "Next Cursor" property. This is the value that you need to submit to subsequent GetProgressions calls to "offset" the call to start at the next progression item after the ones you've already received.
Trigger the GetProgressions node again with a count of 10 but now also input the value "Next Cursor" into the after parameter. This tells the node to start off where it finished last time.
Use the 10 new progression items returned as you want. Note that this time it is progressions 11-20 of your 50 progressions.
Again, save the returned pagination data so that you can make subsequent requests.
Repeat step 2 with new values for "Next Cursor" until you have received all the progressions.
This is how you paginate. It may seem redundant in this example because you could just set Count to 50 and get everything at once. But imagine you have thousands of progressions with rewards of all kinds. Then this system is very valuable.
string progressionKey = "mage";
LootLockerSDKManager.GetProgressionTiers(progressionKey, response =>
{
if (!response.success) {
Debug.Log("Failed: " + response.Error);
}
// Output the progression tiers with levels, required points and rewards
foreach (var progressionTier in response.items)
{
Debug.Log($"Level {progressionTier.step} requires {progressionTier.points_threshold} experience points");
foreach (var assetReward in progressionTier.rewards.asset_rewards)
{
Debug.Log($"Reaching level {progressionTier.step} awards asset with id: {assetReward.asset_id}");
}
foreach (var progressionPointsReward in progressionTier.rewards.progression_points_rewards)
{
Debug.Log($"Reaching level {progressionTier.step} awards {progressionPointsReward.amount} points in {progressionPointsReward.progression_name} progression");
}
foreach (var progressionResetReward in progressionTier.rewards.progression_reset_rewards)
{
Debug.Log($"Reaching level {progressionTier.step} resets the {progressionResetReward.progression_name} progression");
}
}
});
Above is an example of how to implement retrieval of progression tiers using blueprints in Unreal Engine. For an example you can copy and paste into your editor, look here.
Input
You need to exchange the trigger with an event that you want to trigger the flow. For example a button click or level start.
Progression Key is required for this node so connect it from a variable or remove the reroute node and hard code a value in the node.
Output
We recommend branching the completed event on the success flag, and if you do this you will probably want to add error handling in case the request fails.
The response is a list of progression tiers (what points they are awarded at and some data on the tier) as well as lists of all the rewards (point rewards, asset rewards, and reset rewards).
The response also contains pagination data (for information on how to use that see the section on it).
Count can be used to limit the number of entries returned.
string progressionKey = "mage";
int count = 20;
LootLockerSDKManager.GetProgressionTiers(progressionKey, count, response =>
{
if (!response.success) {
Debug.Log("Failed: " + response.Error);
}
// Output the progression tiers with levels, required points and rewards
foreach (var progressionTier in response.items)
{
Debug.Log($"Level {progressionTier.step} requires {progressionTier.points_threshold} experience points");
foreach (var assetReward in progressionTier.rewards.asset_rewards)
{
Debug.Log($"Reaching level {progressionTier.step} awards asset with id: {assetReward.asset_id}");
}
foreach (var progressionPointsReward in progressionTier.rewards.progression_points_rewards)
{
Debug.Log($"Reaching level {progressionTier.step} awards {progressionPointsReward.amount} points in {progressionPointsReward.progression_name} progression");
}
foreach (var progressionResetReward in progressionTier.rewards.progression_reset_rewards)
{
Debug.Log($"Reaching level {progressionTier.step} resets the {progressionResetReward.progression_name} progression");
}
}
});
You can use "after" parameter to paginate if your progression has many tiers.
string progressionKey = "mage";
int numberOfItemsPerPage = 10;
LootLockerPaginatedProgressionTiersResponse progressionTiers;
void Start()
{
LootLockerSDKManager.StartGuestSession(_ =>
{
// Fetch the initial list of character progressions
LootLockerSDKManager.GetProgressionTiers(progressionKey, numberOfItemsPerPage, response =>
{
if (!response.success)
{
Debug.Log("Failed: " + response.Error);
}
progressionTiers = response;
});
});
}
void Update()
{
if (progressionTiers == null) return;
// Fetch the next page if more tiers exist
if (Input.GetKeyDown(KeyCode.RightArrow) && progressionTiers.pagination.next_cursor != null)
{
LootLockerSDKManager.GetProgressionTiers(progressionKey, numberOfItemsPerPage, progressionTiers.pagination.next_cursor, response =>
{
if (!response.success)
{
Debug.Log("Failed: " + response.Error);
}
progressionTiers = response;
Debug.Log($"Paginating right, got {progressionTiers.items.Count} progression tiers");
});
}
// Fetch the previous page if we are not on the first page
if (Input.GetKeyDown(KeyCode.LeftArrow) && progressionTiers.pagination.previous_cursor != null)
{
LootLockerSDKManager.GetProgressionTiers(progressionKey, numberOfItemsPerPage, progressionTiers.pagination.previous_cursor, response =>
{
if (!response.success)
{
Debug.Log("Failed: " + response.Error);
}
progressionTiers = response;
Debug.Log($"Paginating left, got {progressionTiers.items.Count} progression tiers");
});
}
}
Above is an example of how to implement retrieval of progression tiers supplying a count to limit the number of progressioniers to receive and supplying a cursor into the after parameter to paginate using blueprints in Unreal Engine. For an example you can copy and paste into your editor, look here.
Input
You need to exchange the trigger with an event that you want to trigger the flow. For example a button click or level start.
To use pagination you should supply a value to the after parameter and optionally a value to the count parameter. For an explanation, see below.
Output
We recommend branching the completed event on the success flag, and if you do this you will probably want to add error handling in case the request fails.
The response is a list of progression tiers (what points they are awarded at and some data on the tier) as well as lists of all the rewards (point rewards, asset rewards, and reset rewards).
The response also contains pagination data which you use as follows.
Usage example
Understanding pagination for the first time can be a challenge. So an example can help.
Say you have 50 progression tiers to receive. You can do this with pagination like this:
Trigger the GetProgressionTiers node with a count parameter of 10.
Use the 10 progression tier items returned as you want (for example display in the UI). Note that out of your 50 progressions tiers, these are progression tiers 1-10.
Save the returned pagination data to make the next request. The most important here is the "Next Cursor" property. This is the value that you need to submit to subsequent GetProgressions calls to "offset" the call to start at the next progression tier item after the ones you've already received.
Trigger the GetProgressionTiers node again with a count of 10 but now also input the value "Next Cursor" into the after parameter. This tells the node to start off where it finished last time.
Use the 10 new progression tier items returned as you want. Note that this time it is progression tiers 11-20 of your 50 progression tiers.
Again, save the returned pagination data so that you can make subsequent requests.
Repeat step 2 with new values for "Next Cursor" until you have received all the progression tiers.
This is how you paginate. It may seem redundant in this example because you could just set Count to 50 and get everything at once. But imagine you have thousands of progression tiers with rewards of all kinds. Then this system is very valuable.