How to make an achievement system fast

Baggy & Maggy

One of our goals when making Baggy & Maggy was to include an achievement system: it is a nice feature that is not commonly seen in game jams, therefore could be a very valuable feature for the game. But how to make it fast?

Well, let me show you! Everything was done in C# for Unity, and the whole system took me about 1 hour and 30 minutes to make, a real quick-win for a game jam! After that, actually putting and configuring the actual achievemnets in the game maybe took another hour and a half.

Components

AchievementContainer

AchievementContainer is a class used to store info about all of the achievements in the game. It contains a list of all the achievements, each achievement being described with: * A name, used in the game UI. * A type, as an enum, identifying the achievement. * A description, also used in the game UI.

TutoAchievement1.png

This AchievementContainer is only used by the AchievementManager to display achievement UI elements.

AchievementManager

The AchievementManager is the brain of the AchievementSystem. Any piece of code in the project can access it and ask it to unlock an achievement, and it does the rest. This would be a little bit too permissive for a large-scale project, but a game jam is about saving time, and this is very fast to use.

The role of the AchievementManager is to store all achievements that were unlocked, and to display the achievement notification when an achievement is unlocked.

TutoAchievement2.png

Then, the call flow is pretty easy. Take the example of the GAMER achievement, unlocked when the game is finished: 1. The GameManager detects that the player has reached the end of the game. 1. It calls the AchievementManager to make it unlock the GAMER achievement. 1. The AchievementManager checks that the GAMER achievement has not been unlocked (we'll see just next how that would be possible). 1. As the GAMER achievement was never unlocked, the AchievementManager registers it as unlocked, and display the achievement panel to notify the player. 1. At the end of the game, the ending screen will ask the AchievementManager for a list of all unlocked achievement to show the player how he did.

ZoneAchievementTriggerer

The AchievementManager can be unlocked as explained before, or via a ZoneAchievementTriggerer, simple object that triggers an achievemnet when it touches the player.

TutoAchievement3.png

The ZoneAchievementTriggerer object can simply be configured with a specific AchievementType, and triggers it via the AchievementManager when touched by the player.

Tips

  • Have a very generic base system, then make as many achievements and ways to trigger them as you want. When the base is built, everything is fast to make and adds a lot of fun to the game.
  • Make the list that stores unlocked achievements static, so that everything is kept when the game is restarted.
  • Secundary features like the achievement system are very forgettable when you make a game. When you decide that you want achievements in your game, let it be one of the first things you develop. Then, you can add as many achievements as you can think of throughout the jam. If you plan to make the achievement system at the end of the jam, it is more than likely that you will prioritize other things and never do it. I tell you that because it happened during my last jam.

I hope that I helped you with this post, and if you want to see the Achievement System in action, come and try Baggy & Maggy!