Add achievements¶
Overview¶
Achievements are a good way to motivate players to do certain things.
So, if you want to reward players for completing some task or simply want to guide the player in a specific direction, consider adding an achievement for that.
At the moment, achievements can only be added globally.
This means that if you unlocked an achievement in one course, you’ve unlocked it in all courses present on this server.
How to add an achievement¶
To add an achievement, you need to add it to the overworld and the overworld backend.
Overworld Backend¶
You have to do the following in the overworld backend:
Add the title of the new achievement to the
AchievementTitleenum, located atsrc\main\java\de\unistuttgart\overworldbackend\data\enums

Add all category keyword to the
AchievementCategoryenum, located atsrc\main\java\de\unistuttgart\overworldbackend\data\enums, if the keywords are not yet present

Add the achievement (with the
title,description, thename of the the imageto show, thecategoriesand anumberto reach) to the list in theupdatePlayerStatisticAchievementsin theAchievementServicelocated atsrc/main/java/de/unistuttgart/overworldbackend/service/and add it to theachievementRepository.

Overworld¶
If the achievement is tracked in the overworld, you need to additionally do the following:
Add the title of the new achievement to the
AchievementTitlescript located atAssets/Scripts/AchievementSystem.

How to track progress of an achievement¶
General¶
To update the progress of a player of the achievement, you need to send a PUT request to the overworld backend to /players/{playerId}/achievements/{achievementTitle} with an AchievementStatisticDTO body containing the progress.
You can find the AchievementStatisticDTO class in the backend under src/main/java/de/unistuttgart/overworldbackend/data/.
Overworld¶
If the achievement is tracked in the overworld, you can use the UpdateAchievementand IncreaseAchievementProgress functions of the GameManager singleton instance.
