Using Mobile Service Achievements

Using Mobile Achievements to increase player engagement.

Choose your operating system:

Windows

macOS

Linux

Whether you are using them as goals to strive for, badges of honor, or simple story mile markers, Achievements are a great way to keep players engaged with your game.

iOS Game Center

Google Play

Configuration

See the appropriate platform-specific page below for details on configuring achievements for each platform:

Caching your Achievements

Cache Achievements will request from the platform's game service the list of achievements and the values the current player has for said achievements. You'll be able to use the Get Cached Achievement Value if this node returns successfully.

Note that it is a latent node, and thusly has a number of execution output pins. The top most is a "pass through," that works like any other execution output pin. The other two pins ( On Success , and On Failure ) will execute when the online service returns (or fails to return) a value. When the execution returns a success

In Blueprints:

The example below is from the Global Game Instance Blueprint in the Unreal Match 3 sample game. After the user logs into the device's game platform (Game Center, Google Play), we run the Cache Achievements node and actually halt execution (by not having anything execute off the top output execution pin) at this point to give the service time to return all the achievements:

cacheAchievements.png

Reading Values from your Achievements

The Get Cached Achievement Progress will return the progress of a given Achievement ID for the provided Player Controller , and only work if a Cache Achievements node was run earlier and returned successfully.

For iOS Game Center, this value is actually a floored float, as they store it as an integer. A float is received for Google Play Services.

In Blueprints:

The example below is from the Global Game Instance Blueprint in the Unreal Match 3 sample game. Once the achievements are cached, we run through a loop pulling achievement names, as well as their target scores, from arrays, and do a quick comparison to any offline values found. We then accept the higher value of the service or the local values:

readAchievement.png

Writing Values to your Achievements

The Write Achievement Progress will send a message up to the platform's achievement system to write a percentage (0.0% - 100.0%) based Progress to the provided achievement for the given user ( Player Controller and User Tag ). For "one off" achievements you will always pass in 100.0 for Progress , while for incremental achievements, you'll be passing in some lesser percentage until the user reaches 100.0 for that achievement.

For iOS Game Center, this value is actually sent as an integer, as they only have 1-100 incremental achievements. A float is sent for Google Play Services.

Note that it is a latent node, and thusly has a number of execution output pins. The top most is a "pass through," that works like any other execution output pin. The other two pins ( On Success , and On Failure ) will execute when the online service returns (or fails to return) a value. When the execution returns a success the Written Achievement Name , Written Progress , and Written User Tag will return non-null values equal to what you passed into the node.

In Blueprints:

The example below is from the Global Game Instance Blueprint in the Unreal Match 3 sample game. There's a loop that compares the current achievement value to the metrics required to increase that achievement, and if progress has been made, the Write Achievement event is called:

writeAchievement.png

This was done because latent nodes can't be used in Functions.

Showing the Platform Specific Achievement Screen

The Show Platform Specific Achievement Screen will show the achievements of the provided Player Controller for the current platform.

In Blueprints:

The example below is from the GameOverButtons Blueprint Widget in the Unreal Match 3 sample game. When the ShowAchievements button is pressed, the game will attempt to show the achievement screen for the current platform.

showAchievements.png

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss