- Creating a simple API to call.
- Creating up to date information using the real time activity service behind the scenes.
- Developers can call the Achievements Manager API synchronously without any extra strain on the service.
Features
The Achievements Manager provides the following features:- Simplified Achievements API
- Up-to-date achievement state and progress for each user
- Reduce number of calls to XBOX services
- This directly correlates to overall latency reduction in data acquisition
- Thread safe
- Efficiently keeping data up to date
Core Concepts
Achievements: An Achievement includes Gamerscore and other rewards such as digital artwork, new maps, characters, and stat boosts, as well as the current progress towards completion. To keep the state of a user’s achievements up to date, the function XblAchievementsManagerDoWork must be called every frame.On Windows there can only be one local user
API Overview
You will most frequently use the following key APIs. You can find a complete description of the Achievements Manager APIs in the XBOX Live API reference. You can also find the APIs in the XblAchievementsManager prefix documentation.Adding local users to Achievements Manager
- C API function: XblAchievementsManagerAddLocalUser
Getting the state of achievements for a user
- C API function: XblAchievementsManagerGetAchievements
Usage
Using Achievements Manager events
Achievements Manager tells you what happened, in the form of events. You can use those events to update your UI or perform other logic. C APIEvents returned
Local User Initial State Synced: Triggers when the achievements manager has completed fetching the current state of all of the current title’s achievements for the user.- C API: XblAchievementsManagerEventType::LocalUserInitialStateSynced
- C API: XblAchievementsManagerEventType::AchievementProgressUpdated
- C API: XblAchievementsManagerEventType::AchievementUnlocked
Additional details
Instead of fetching the state of achievements from the service frequently during the game loop, the Achievements Manager fetches the state of all of a user’s achievements when the user is registered with the Achievements Manager. Then the Achievements Manager receives events from the service detailing updates to a user’s achievements, which are then forwarded to the title as events returned by the * XblAchievementsManagerDoWork function. events is a list of XblAchievementsManagerEvent, and each XblAchievementsManagerEvent contains a change to an achievement that occurred during the last frame. More information can be found in the XblAchievementsManagerEvent API documentation.Register a user for whom to track achievements
In this scenario, you want to register a user to the achievements manager to begin tracking updates to that user’s achievements, and cache the state of all of those user’s achievements locally. C APIEvents returned
Local User Initial State Synced: Triggers when the achievements manager has completed fetching the current state of all of the current title’s achievements for the user.- C API: XblAchievementsManagerEventType::LocalUserInitialStateSynced
Additional details
The above example shows how to initialize the Achievements Manager for a user, and keep it up to date. In the game loop, the XblAchievementsManagerDoWork function processes and applies any updates made to users’ achievements.Retrieving a single achievement for a user
In this scenario you want to get the state of a single achievement for a user. C API- XblAchievement
- XblAchievementsManagerAddLocalUser
- XblAchievementsManagerIsUserInitialized
- XblAchievementsManagerGetAchievement
- XblAchievementsManagerResultGetAchievements
- XblAchievementsManagerResultCloseHandle
Events returned
Local User Initial State Synced: Triggers when the achievements manager has completed fetching the current state of all of the current title’s achievements for the user.- C API: XblAchievementsManagerEventType::LocalUserInitialStateSynced
Retrieving all achievements for a user
In this scenario you want to get the state all achievement for a user. C API- XblAchievement
- XblAchievementOrderBy
- XblAchievementsManagerSortOrder
- XblAchievementsManagerAddLocalUser
- XblAchievementsManagerIsUserInitialized
- XblAchievementsManagerGetAchievements
- XblAchievementsManagerResultGetAchievements
- XblAchievementsManagerResultCloseHandle
Events returned
Local User Initial State Synced: Triggers when the achievements manager has completed fetching the current state of all of the current title’s achievements for the user.- C API: XblAchievementsManagerEventType::LocalUserInitialStateSynced
Retrieving a subset of achievements for a user
In this scenario you want to get the state a subset of achievements for a user. C API- XblAchievement
- XblAchievementOrderBy
- XblAchievementsManagerSortOrder
- XblAchievementsManagerAddLocalUser
- XblAchievementsManagerIsUserInitialized
- XblAchievementsManagerGetAchievements
- XblAchievementsManagerResultGetAchievements
- XblAchievementsManagerResultCloseHandle
Events returned
Local User Initial State Synced: Triggers when the achievements manager has completed fetching the current state of all of the current title’s achievements for the user.- C API: XblAchievementsManagerEventType::LocalUserInitialStateSynced
Retrieving a subset of achievements in a specific state for a user
In this scenario you want to get the state a subset of achievements in a specific progress state for a user. C API- XblAchievement
- XblAchievementOrderBy
- XblAchievementProgressState
- XblAchievementsManagerSortOrder
- XblAchievementsManagerAddLocalUser
- XblAchievementsManagerIsUserInitialized
- XblAchievementsManagerGetAchievementsByState
- XblAchievementsManagerResultGetAchievements
- XblAchievementsManagerResultCloseHandle
Events returned
Local User Initial State Synced: Triggers when the achievements manager has completed fetching the current state of all of the current title’s achievements for the user.- C API: XblAchievementsManagerEventType::LocalUserInitialStateSynced
Updating an achievement for a user
Updates the progress of an achievement for a user. C API- XblAchievementsManagerAddLocalUser
- XblAchievementsManagerIsUserInitialized
- XblAchievementsManagerUpdateAchievement
Events returned
Local User Initial State Synced: Triggers when the achievements manager has completed fetching the current state of all of the current title’s achievements for the user.- C API: XblAchievementsManagerEventType::LocalUserInitialStateSynced
