Share via


Implement player achievements in your game

This article describes how to implement player achievements. They're a system-wide mechanism for directing and rewarding players' in-game actions consistently across all games. Designing this correctly helps guide players to experience the game at its fullest and extends the game's lifetime.

Implement player achievements using GDK and title-managed events

Implementing player achievements by using title-managed events in the Microsoft Game Development Kit (GDK) involves a combination of retrieving achievement definitions, tracking progress, awarding achievements, and managing asynchronous operations. To implement player achievements use the following steps.

To implement player achievements

  1. Initialize Xbox services: use the XblInitialize function.
  2. Configure achievements in Microsoft Partner Center.
    1. Select your title, and then select Xbox services > Gameplay settings.
    2. To go to the Achievements section for your title, select Achievements .
    3. Select New achievement, and then complete the form by adding achievement details such as its name, a description, an image, a gamerscore, and the visibility.
  3. Use the achievements APIs to get and set the player's progress for achievements.
    1. Retrieve the list of achievements and the player's progress in those achievements:
      Use the XblAchievementsGetAchievementsForTitleIdAsync API to retrieve the list of achievements for a specific title ID. For more information, see Getting title-managed Achievements.
    2. Get the player's progress in a specific achievement:
      Use the XblAchievementsGetAchievementAsync API to get the progress of a specific achievement.
    3. Update the player's progress in an achievement:
      Use the XblAchievementsUpdateAchievementAsync API to update the value of the player's current progress for the achievement. Percent completion is from 1 to 100. If the new value is == 100, the achievement is unlocked. For more information, see Updating title-managed Achievements.

Note

Achievement definitions are configured in Microsoft Partner Center.

Access to Partner Center requires an account. For information about how to set one up, see Step 2 - Create an account in Partner Center.

See also

The GDK documentation is the best source of up-to-date information. For more information, see the following articles and sample.