Advanced achievement UI grouping and filtering
Overview
The achievement service included with AccelByte Gaming Services (AGS) allows you to add tags to your achievement configurations. Tags will be used to group the achievements, and you can use that to filter the achievements you want to display within your game. By presenting the achievement in a structured and organized grouping, it can give your players the best experience, as they'll easily see the relevant information.
In this guide, you will learn how to utilize achievement tags for grouping and filtering.
Goals
- Provide an understanding and overview about achievement configurations.
- Explain how to utilize achievement using AccelByte SDK.
Prerequisites
- Access to the AGS Admin Portal.
- AccelByte Unreal or Unity SDK, including the permissions:
- Client ID
- Client Secret
- Access to AccelByte Achievement API documentation.
- Access to the AccelByte Statistics API to configure the required information (optional).
Group achievements by tags
You can utilize tags in achievement configurations to group your achievements. You can add tags in your achievement configurations by following the steps below:
In the AGS Admin Portal, go to the Game Management section and select the Achievement menu.
In the Achievement window, click the Add Achievements button.
The Add New Achievements form will appear and you will be required to fill the mandatory field such as Code, Name, Description, and Icons.
For grouping, you can add the contextual information related to the achievement in the Tag field. These tags will be used to query your achievement configuration.
備考You can input up to five tags.
Click Add to complete. Your new configuration will be added to the list.
Filter achievements by tags
To retrieve a list of all achievements in the related namespace with a specific tags that you already set, you can use the following function:
- Unreal Engine
- Unity
FString Language = FString("en");
EAccelByteAchievementListSortBy SortBy = EAccelByteAchievementListSortBy::LISTORDER;
int32 Offset = 0;
int32 Limit = 50;
FString TagQuery = TEXT("kill,totalwin")
bool bIsGlobal = false;
FRegistry::Achievement.QueryAchievements(Language, SortBy, THandler<FAccelByteModelsPaginatedPublicAchievement>::CreateLambda([](const FAccelByteModelsPaginatedPublicAchievement& Result)
{
// Do something if QueryAchievements has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if QueryAchievements has an error
UE_LOG(LogTemp, Log, TEXT("Error QueryAchievements, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}), Offset, Limit, TagQuery, bIsGlobal);
var achievementApi = AccelBytePlugin.GetAchievement();
var language = "EN";
// tag1|tag2
var tagBuilder = TagQueryBuilder.Start("tag1");
tagBuilder.Or("tag2");
achievementApi.Query(language, AchievementSortBy.NONE, result =>
{
// do something
}, tagBuilder: tagBuilder);
Further reading
After you set up the achievement configurations, you can use it to integrate with your game. You can follow the documentation below:
Achievement service is also able to cover some other use cases other than progressive achievement. Please find the other documentation below to explore other use cases: