Sonstiges: Developer Diary - The Creation of a 3DS/Switch Game
Michael Grönert, am 26.12.2016, Seite 17 von 17
Part 17: Statistics
Today we are going to focus on the numbers, but do not worry, it will not be very mathematical. It's time to memorize all sorts of data so we can evaluate it for different things later. The focus here will be put on the achievements because these often do not depend on just one special event but need a certain number of one or more events. In addition, numbers can give more expression to the player’s efforts, so we want to show him the collected statistics directly.
Skill must be rewarded
Achievements should serve as an incentive to play games more often or longer and not just to have the main goal in mind. Just like with a trophy collection, taking pride in your accomplishments you can boast with as well as the urge to collect play an important part. But if I get an award for having scored 100 points, these must also be counted, of course. And when I start the game again it should not have to count again from the beginning, so these numbers must be included in the save game.
As always, we want to benefit from reusability. That's why we initially define a few actions that we want to count in each minigame:
1. How many times has the mini game been opened? (e.g. turned on the GameGuy)? (n)
2. How long has the game been open? (t)
3. How long has the game been played (not paused, not in the menus)? (t)
4. How many games were played? (n)
5. How many games have been won? (n)
6. Achieved points (across all games)? (n)
To do that, I've noted down what kind of number it is so we know what type of data we can store. (n) for a natural number and (t) for a time in seconds or milliseconds. So we create a list of numbers that are incremented by the corresponding actions. These must then be written regularly in the save game and read again at the next start. Currently our score can only be saved or loaded manually by clicking on a button. Should GameMaster support automatic saving later, you still have to consider how often this data should actually be written. Since such processes take some time, writing changes after every little adjustment is completely out of the question. Instead, it shoudl happen after certain intervals or following certain actions.
These general statistics are joined by those that depend on the respective mini game. For example, for our card game Pairs from the last diary entry, the number of revealed card pairs is a good idea. The "points" mentioned above can be used for something different for each game. In this case, it would be the number of matched pairs of cards. In Gong, it's the amount of "goals shot". Then we can create the new achievements, including pictures and short descriptions. For example, with Pairs we can give out an achievement for the first pair found but also count and give out another for the first 100 found pairs.
Two of the achievements of Pairs have been unlocked
Easy on the eye
As previously stated, we want the player to be able to see all the statistics themselves. For this purpose, a new menu sub-item was created again. However, this time it is a small button with a diagram icon to the right of the previous buttons in order to make it look less overwhelming. Besides, you probably check this one less often than the other sub-menus. On the statistics page we will find the numbers with short descriptions. So you can always check how much more you need of something to get certain achievements, provided you know what you need which you can tell from the yet-to-unlock achievements. In order to make everything look a bit more impressive, I wanted to offer diagrams. So I have allowed myself to implement a pie chart first. Of course, related values lend themselves much better for such a chart, such as the number of games played and the number of games won. At this point it should be mentioned that I deliberately decided not to record the number of lost games. We do not want to remind a player how bad they once were. ;) On that note, I should point out that games which weren't won don't necessarily translate to lost games. They may have resulted in a draw or the player just intentionally quit out of them. Negative tallies like that also usually provoke the player to quit the game when they see they can't win anymore, lest they get permanently etched into their statistics. This would be inappropriate, especially in multiplayer games.
Labeled pie chart
Easy as pie
The pie chart was actually the only, albeit minor, mathematical challenge here. But I also wanted to try out if I could just do it. Fortunately, our Unity 3D development environment already provides the ability to circularly "fill in" displayed images. There are several fill functions that are meant for things like life or progress bars. This also includes this circle section variant - only a percentage (0 to 1) must be specified. All that remains to be done is to calculate the percentages of each portion and to rotate the circular cutouts so that they form a full circle. To illustrate this with the screenshot above, we won two out of three games. So there is a section with 33.3% and one with 66.6%. The second section must then be rotated by the percentage of 360° of the first. If the red is 33.3%, the second one has to be turned by 33.3% (one third) of 360°, ie 120°. A third section would then have to be rotated by the proportions of the first two and so on. Quite a bit more complicated is the calculation of the positions and orientations of the small captions, which can also be seen in the screenshot. But I do not want to bore you with more calculations.
That's it for today. It will be fishy the next time - the third mini game is coming up. See you!
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!