- Home /
Best way/method to implement a basic achievement/mission system
I have a racing game and need a basic mission/goal system. Mission complete if u pass 3 police cars in 20 secs or drive top speed for 10 seconds or pass 5 white cars in top speed in 10 seconds etc. What can be the best method to create a system for this? I dont need a code example something (but would be nice if any available), I just need a guidance that what kind of methods and structure should I use for this?
Answer by Tomer-Barkan · Nov 16, 2018 at 02:03 PM
Personally I like using an "AchievementManager" that has a "counter" and two main APIs:
IncreaseAchievementCounter(achievementId, count)
SetAchievementCounter(achievementId, count)
The former will be used by examples such as "pass 3 cars", and increased by one every time you pass the car with a value of 1.
The latter will be used for values that can go up and down, for example "reach 3rd place" - and every time your position in the race changes, you call it with your current position.
Both of these will save the "count", and check the value against the required value (which you should pre-configure), and if the required value is reached - grant the achievement. Both the current count and required count use dictionaries of course.
Answer by RoofL1zard · Nov 26, 2018 at 02:02 PM
I found a very nice example that can work for this kind of need. But it is little bit old example written in Actionscript for Flash. I am trying to implement in Unity C#. More or less same methodology. It should be fine.
Your answer
![](https://koobas.hobune.stream/wayback/20220612182234im_/https://answers.unity.com/themes/thub/images/avi.jpg)