Skip to main content
EOS Interfaces

Achievements

Video Tutorial is available

Achievements are defined in the Developer Portal (Game Services > Achievements). An achievement is either unlocked by your game directly, or automatically by EOS when one or more Stats reach a threshold.

Requirements​

  • A logged in user with a Product User Id (Connect login), see Authentication
  • The Achievements feature allowed in your client policy

Common Nodes​

NodeUse
EOS_Achievements_QueryDefinitionsDownloads all achievement definitions (names, descriptions, icons, thresholds)
EOS_Achievements_GetAchievementDefinitionCount + EOS_Achievements_CopyAchievementDefinitionV2ByIndexReads the downloaded definitions
EOS_Achievements_QueryPlayerAchievementsDownloads the progress and unlock state for a player
EOS_Achievements_GetPlayerAchievementCount + EOS_Achievements_CopyPlayerAchievementByIndexReads the player's achievements
EOS_Achievements_CopyPlayerAchievementByAchievementIdReads one achievement of the player by its id
EOS_Achievements_UnlockAchievementsUnlocks one or more achievements by id
EOS_Achievements_AddNotifyAchievementsUnlockedV2Called when an achievement was unlocked, also for stat based unlocks

Typical Flow​

  1. After login, call QueryDefinitions once and cache the result.
  2. Call QueryPlayerAchievements for the local player to show progress.
  3. Unlock achievements with UnlockAchievements, or ingest the stats they depend on with EOS_Stats_IngestStat.
  4. Listen to AddNotifyAchievementsUnlockedV2 to show a notification in game.
tip

Stat based achievements are not unlocked right away. EOS processes ingested stats on the backend, the unlock can take a few seconds.

Example​

Unlocking an achievement​

Unlock an achievement

The UnlockAchievement event unlocks ACH_FIRST_WIN for the local player. Achievement Ids is an array, so you can unlock several achievements in one call.

Getting notified about unlocks​

Achievement unlocked notification

Call BindAchievementNotifications once after login, for example from the Game Instance. EOS_Achievements_AddNotifyAchievementsUnlockedV2 then calls OnAchievementUnlocked for every unlock, both for achievements you unlock yourself and for stat based achievements that EOS unlocks on the backend. Keep the returned Notification Id if you want to remove the notification later with EOS_Achievements_RemoveNotifyAchievementsUnlocked.

Reading player progress​

Query player achievements

The QueryPlayerAchievements event downloads the achievements of the local player and prints the id and progress of each one:

  1. EOS_Achievements_QueryPlayerAchievements downloads the progress. Use the same id for Local User Id and Target User Id to read your own achievements.
  2. EOS_Achievements_GetPlayerAchievementCount returns the number of achievements.
  3. The For Loop reads each one with EOS_Achievements_CopyPlayerAchievementByIndex. Progress goes from 0 to 1, and Unlock Time is set when the achievement is unlocked.

Online Subsystem​

The EOSCore Online Subsystem also implements IOnlineAchievements, so the engine's Write Achievement Progress and Cache Achievements nodes work as well.