Sonstiges: Developer Diary - The Creation of a 3DS/Switch Game
Michael Grönert, am 26.12.2016, Seite 10 von 13
Part 10: Achievements & Notifications
Last time we familiarized ourselves with the most important menus and the experience system. Today we will take a look at achievements. Each of our mini games will offer a few achievements which should be unlockable. If one is activated, a small pop-up notification will appear on the screen. From this point onwards, the achievement will be shown in a separate menu of the respective mini game.
We do not want to block these pop-ups
Let's start with the pop-up messages. Depending on the context they are also known as "growl" or "toast" messages. When activated, they should be displayed for a few seconds at the right edge of the screen. There is a maximum number of messages that can be displayed at the same time - even if it is rather rare that several are activated at once. They are displayed from bottom to top beginning with the newest one. If the maximum number is exceeded, the oldest message is immediately removed. Each has its own countdown after which the message fades out. Another way to make a message disappear prematurely, for the impatient among us, is clicking or tapping the message. Alternatively clicking could trigger something like opening the achievement list of the game, in this case.
A pop-up notification shows the unlocked achievement
For the implementation of the messages, we first need a kind of container directly above the user interface. So I created another canvas in Unity, a kind of UI slide, which is put on top of it all just like I did it for the inventory. In this case, the draw order has to be observed - it must be determined which slide is in front of which. I assign this canvas to an area in which the messages are stacked vertically. I wanted to make new messages as easy as possible. The result is to call a method that expects an image and text and does the rest completely automatically. Now we can already inform our player about all possible events.
Goaaaal! What an achievement!
As you can see in the picture above, I decided to make a pretty simple first achievement. As soon as you score the first point in our first mini game Gong, the “first goal” will be unlocked. You can see that the text of the notification actually consists of different parts. There is the fixed line of text "Unlocked achievement," which can remain the same for each achievement, and a specific part with the name of the achievement. Actually I do not only pass the translated text to our new pop-up but the keywords used to map the text to certain language sets. The advantage of this is that the pop-up can translate itself when changing the language of the game while it is displayed. Sure, you can argue about whether this is necessary with a text that is displayed only for a few seconds but I would like to make everything perfect. ;) And since there are, as I said, two text sections, even a special kind of pop-up had to be created, which includes two texts. Still, pictures say more than a thousand words, so we want to create meaningful images that represent the achievement. The first thing that came to my mind was a soccer goal with a "1." However, I decided to do something that directly reflects the current game, even if it does not seem as intuitive. You can see the results yourself.
The achievements are game progress just like the level and want to be saved. But I will not go into saving and loading here because we already had a separate diary entry about that. When building the achievement you have to pay attention to a few subtleties. For example, making sure that it is only activated if a person has actually scored this point and not the computer opponent or a player in a game of AI against AI. Everything should be as simple as possible here as well: A call of
enableAchievement("firstGoal");is enough to activate our achievement and store it in the save file. Finally, I would like to be able to see my achievements at any time and this will be realized by the menu item "Achievements" of each game. Here we can find a list of all available achievements of the game, including those that have not been unlocked yet. However, the images are only visible for the ones we already obtained. At this point, there are still possibilities for optimization. For example, instead of the names we can display notes that provide tips for finding the achievements.
Achievement list from the first mini game "Gong"
So much for Achievements. Next time we want to deal with the in-game clock, day changes and the weather in the game to bring some change to our overworld.
Do you prefer to read this diary in the developer's mother tongue? Then click here to read this diary entry in the original German language!