Skip to main content

Configure advanced filter for content browsing

Last updated on May 13, 2024

Overview

With so much content being created, either by developers as official content or by players as user-generated content (UGC), browsing content can become difficult and time-consuming. AccelByte Gaming Services (AGS) offers a way to let players choose and filter content based on their needs, so the player can choose content that reflects their personality, preferences, and style.

In this guide, you will learn how to implement tags, types, and subtypes to content, and also use them to filter content from the game client.

browsing content sample image 01 browsing content sample image 02

Goals

The goals of this guide are to explain how to:

  • Configure predefined tags, types, and subtypes.
  • Add tags, types, and subtypes to content.
  • Implement content filtering.

Prerequisites

You will need access to:

Content tags, types, and subtypes

You can create Types and Tags that can be used to categorize UGC. For example, a custom design for a car might have Vehicle as the Type and Body or Wheels as the Subtype. Tags could also include Car, Vehicle, or Body.

Configure predefined tags

  1. In the Admin Portal under Game Management, click UGC Management and open the Configurations menu.

    navigate to UGC configurations menu for tags

  2. In the Configurations menu, switch to the Tags tab and click New Tag.

    click to create a new tag

  3. Input the Tag Name. When you're finished, click Add.

    enter tag name and click add

  4. The new Tag will be added to the list.

    list of created tags

Configure predefined types and subtypes

  1. In the Admin Portal under Game Management, click UGC Management and open the Configurations menu.

    navigate to UGC configurations menu for types and subtypes

  2. In the Configurations menu, click New Type.

    click to add new type

  3. Input a name for the new type in the Type Name field. When you're finished, click Add.

    enter tag name and click add

  4. The new type will be added to the list. You can also add a subtype by clicking View in the type’s Action menu.

    list of created types, click view to add subtype to created type

  5. In the Subtypes section, click the New Subtypes button.

    click to create new subtype

  6. Input the Subtype Name. When you're finished, click the Add button.

    enter subtype name and click add

  7. The new Subtype will be added to the list.

    list of created subtypes

Add tags, types, and subtypes to content

  1. In the Admin Portal, go to UGC Management and click the Contents menu.

    navigate to UGC management contents

  2. Search for the content you want using the provided filters.

    search for content

  3. Click View under your selected item’s Action column.

    click view next to content to add tags, types, or subtypes

  4. On the Content Details Page, click the Edit button next to Type or Subtype.

    click to edit type or subtype

  5. Select the predefined type and subtype on Edit Type and Subtype screen.

    edit type and subtype screen

  6. Click Save to confirm the changes.

  7. Click Add More on the Tag field.

    click to add more on tag

  8. Write your new tag, or select from the predefined list.

    add new tag screen

  9. Click Save to confirm the changes.

    click save to confirm adding the tag

Add tags, types, and subtypes to content using the Client SDK

You can use the following function to set the player content metadata, such as tags, types, and subtypes while creating the content:

FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();

FString ChannelId = "YourChannelId";
FAccelByteModelsCreateUGCRequestV2 UGCRequest = {};
UGCRequest.ContentType = "application/octet-stream";
UGCRequest.FileExtension = "bin";
UGCRequest.Name = "Custom sports body";
UGCRequest.Type = "Vehicle";
UGCRequest.SubType = "Body";
UGCRequest.Tags = { "Red", "Sporty"};

ApiClient->UGC.CreateV2Content(ChannelId, UGCRequest, THandler<FAccelByteModelsUGCCreateUGCResponseV2>::CreateLambda([](const FAccelByteModelsUGCCreateUGCResponseV2& Result)
{
// Do something if CreateV2Content is successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if CreateV2Content has an error
}));

You can use the following function to update the player content metadata, such as tags, types, and subtypes:

FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();

FString ChannelId = "YourChannelId";
FString ContentId = "YourContentId";

FAccelByteModelsModifyUGCRequestV2 ModifyRequest = {};
ModifyRequest.Name = "Custom sports body";
ModifyRequest.Type = "Vehicle";
ModifyRequest.SubType = "Body";
ModifyRequest.Tags = { "Blue", "Sporty", "Body"};

ApiClient->UGC.ModifyV2Content(ChannelId, ContentId, ModifyRequest, THandler<FAccelByteModelsUGCModifyUGCResponseV2>::CreateLambda([](const FAccelByteModelsUGCModifyUGCResponseV2& Result)
{
// Do something if ModifyV2Content is successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if ModifyV2Content has an error
}));

Content filtering

Content filtering is the process of finding, sorting, and displaying UGC based on various criteria, such as tags, keywords, types, etc. Content filtering also helps players to discover and enjoy UGC that matches their preferences, interests, and skill levels.

Search content by name

You can filter the content using its name. Do this with the following function:

FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();

FAccelByteModelsUGCFilterRequest Filter = {};
Filter.Name = "Content Name";

ApiClient->UGC.SearchV2Contents(Filter,
THandler<FAccelByteModelsUGCGetPaginatedUGCContentsResponse>::CreateLambda([](const FAccelByteModelsUGCGetPaginatedUGCContentsResponse& Result)
{
// Do something if SearchV2Contents is successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if SearchV2Contents has an error
}));

Use tags to filter content

Advanced tag filtering supports & as an AND operator, | as an OR operator, and parentheses () for priority. E.g:

tags=sporty
tags=sporty&red
tags=sporty|red
tags=sporty&red|classic
tags=sporty&(red|classic)

The precedence of the logical operator is AND > OR, so if there are no parentheses, the AND logical operator will be executed first.

Allowed characters for operand: alphanumeric, underscore _ and dash - \ Allowed characters for operator: & | ( ) \ The tags=sporty&red|classic also equals to: tags=sporty,red|classic and tags=sporty&tags=red|classic

You can use this function to filter the content using tags:

FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();

FAccelByteModelsUGCFilterRequest Filter = {};
Filter.Tags = { "Sporty", "Red|Classic" };

ApiClient->UGC.SearchV2Contents(Filter,
THandler<FAccelByteModelsUGCGetPaginatedUGCContentsResponse>::CreateLambda([](const FAccelByteModelsUGCGetPaginatedUGCContentsResponse& Result)
{
// Do something if SearchV2Contents is successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if SearchV2Contents has an error
}));

Use types and subtypes to filter content

You can use this function to filter the content using types and subtypes:

FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();

FAccelByteModelsUGCFilterRequest Filter = {};
Filter.Type = "Content Type";
Filter.SubType = "Content Subtype";

int32 Limit = 1000;
int32 Offset = 0;

EAccelByteUGCContentSortBy SortBy = EAccelByteUGCContentSortBy::CREATED_TIME_DESC;

ApiClient->UGC.SearchV2Contents(Filter,
THandler<FAccelByteModelsUGCGetPaginatedUGCContentsResponse>::CreateLambda([](const FAccelByteModelsUGCGetPaginatedUGCContentsResponse& Result)
{
// Do something if SearchV2Contents is successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if SearchV2Contents has an error
}), Limit, Offset, SortBy);

Sort the content

You can use the sorting field to customize how you view the UGC in the game. AGS supports sorting the list of content based on the like count, created time, download count, and content name.

Here is the list of supported sorting options:

  • createdTime, createdTime:desc, createdTime:asc
  • download, download:desc, download:asc
  • like, like:desc, like:asc
  • name, name:desc, name:asc

For example, if you want to see the most recent UGC, you can use createdTime:desc to sort by the creation date in descending order. If you want to see the most popular UGC, you can use like:desc`` to sort by the number of likes in descending order. If you want to see the UGC in alphabetical order, you can use name:asc` to sort by the name in ascending order. You can also use download to sort by the number of downloads.

You can use this function to sort the content:

FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();

FAccelByteModelsUGCFilterRequest Filter = {};
Filter.Name = "Content Name";
Filter.Type = "Content Type";
Filter.SubType = "Content Subtype";
Filter.Tags = { "Sporty", "Red|Brown" };

int32 Limit = 1000;
int32 Offset = 0;

EAccelByteUGCContentSortBy SortBy = EAccelByteUGCContentSortBy::CREATED_TIME_DESC;

ApiClient->UGC.SearchV2Contents(Filter,
THandler<FAccelByteModelsUGCGetPaginatedUGCContentsResponse>::CreateLambda([](const FAccelByteModelsUGCGetPaginatedUGCContentsResponse& Result)
{
// Do something if SearchV2Contents is successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if SearchV2Contents has an error
}), Limit, Offset, SortBy);