We continue to talk about the use of the Microsoft cloud for solution development companies (ISVs). In this issue, we present the story from the company Badge Keeper , creating the designer of the achievement system. Please leave your feedback in the comments.
Hello everyone, in this post I want to tell you how we wanted to add the achievement system to our application, and instead we made a separate service. What is “achievements” or “achievements”, for which they are used in applications, I don’t need to tell, so let's go straight to the story about the service and how we implemented its cloud version in Azure.
Where did the idea come fromIt all started with the fact that we needed to add to our application the mechanics of obtaining achievements. The application was developed by only one person in his spare time, there were many tasks to develop, as is usually the case. I didn’t want to be distracted by the addition of achievements for two reasons: lack of time due to higher priorities and a lack of understanding of how much achievement will be in demand by users. The last doubt was for the reason that the application was not a game where everyone was usually used to seeing achievements, but a “serious” application for managing the family budget. I also did not want to devote too much time to the support of mechanics after its introduction and force users to update the application every time something new or new is added to the conditions for achieving an achievement.
Search for ready-made solutions')
Thoughts flowed in the direction of making the logic of achievements from the application to a separate module or service. After a brief reflection, I wanted to see what ready-made solutions exist as a service. As a result, the search turned out such a list (perhaps the search was not perfect and I will be glad to receive information about other similar services):
- Google Achievements . It can be used for an application, even if it is not published on Google Play. What is embarrassing: a) Sharpening achievements for games, even when setting up an application, are asked to indicate the “name of the game” and “category of the game”. If a financial application is called a game, then the category is suitable except for “adventures” b) By the principle of using achievements, you didn’t like the fact that it is necessary to operate with achievement ID everywhere, which is not always convenient. C) When you first register on Google Play and pay a developer account, there was an incomprehensible problem with the payment, which the support service solved within a few days, which also played a role in continuing the search
- Apple Achievements . Impossibility to use on other platforms other than iOS SDK. This moment was important because I planned to release a web interface to my application, and then I would need to duplicate the logic of achievements manually.
- Steam achievements . Available for games that are published in the service Steam.
- Sony trophies . Available for games that are published in the Sony Playstation Store
- Hydra . Service interested in the description of the existing functionality, but currently is in a closed beta and could not see it.
- App 24 . The service came up according to the description, but the achievements were not its main functionality. Other unnecessary services were also provided, the interface is rather overloaded.
I also wanted to get some statistics on the use of the application in precisely those points to which it was supposed to deliver the issue of achievements. This is an important point in the implementation of the system of achievements.
We do not want to do it ourselves, we want a serviceAs you have probably already guessed, the desire to introduce the mechanics of achievement into your project was combined with the desire of any normal developer — to make your service. The main requirements were formulated:
- Platform independent. No matter what you develop, achievements are connected in the same way. You just need to use a ready-made SDK or work directly through the REST API;
- It does not depend on the type of application. It doesn't matter what you create - a game or some other application in which the achievements will help organize the gamification process;
- The application should connect quickly, without the need to re-read long pages of documentation;
- Easy to use. Adding new achievements should be as simple as possible and the application code should be as dependent on the service as possible.
Prototype for 2 monthsIn two months of free time, we managed to assemble a working service and a demo site with several features.
- Creation of projects and achievements available in it ;
- Tracking the events occurring in the application and determining the moment when it is necessary to issue an achievement. All logic is in service and is determined by a simple condition. The application needs only to transfer the updated value of the variable to the service. An example with pictures is below;
- Issuance of bonus points upon receipt of achievement . The application independently decides what to do with the received bonuses. The service only knows how many and what bonuses to issue if a specific achievement happens;
- Sandbox mode . This functionality suggests itself, it is very convenient to first test how difficult the achievement will be, changing the conditions of its receipt and only then publish the project. After the publication of the change in conditions of achievement is impossible.
It is worth noting that at the moment the service does not shine with ergonomics and design, since we devoted all the time to developing the viscera, after which we decided to write this review in order to get feedback from colleagues in the workshop.
How the service worksNow a few words about how we built the service.
Decision decided to develop in the cloud. The choice fell towards Microsoft Azure, and here's why:
- Already one solution working in Azure was successfully developed, respectively there was an experience;
- We did not want to be distracted by the administration, respectively, to take PAAS was the best solution;
- Microsoft has a great BizSpark program that gives both licensed software and some money to Microsoft Azure.
As for the architecture, we take into account that the service requires high performance, but to build a prototype, we decided to limit ourselves to a basic solution that does not use a shared cache (which, of course, will be done).
Total need:
- Backend, working on the Asp.Net Web API;
- Azure WebJob, paired with Backend;
- Frontend, working on Asp.Net MVC + AngularJS;
- SQL Database, to store basic information on customers, as well as to provide statistics to users;
- Azure Table storage, for fast write operations and data sampling (more on this below);
- Azure Queue storage, for deferred recording of analytical data on users.
Here is the general scheme in action:

Now a few words about why we started using Azure Storage (Table & Queue). First, we used SQL Database to write and read data. But after carrying out the load tests, we decided to look at other solutions. The fact is that Azure SQL is limited to DTU (Database Through Unit Unit), which was a critical moment for us. Azure Storage has completely different performance indicators when inserting and reading data. For this, of course, I had to think very well about the Partition Key & Row Key, however, after the transition to Azure Storage, the results became much better.
Azure Queue Storage is used for the task of collecting and delivering analytics. In our service, we plan to pay special attention to this issue and give customers the opportunity to receive reports such as "percentage of users with open / closed achievements", "rate of achievement achievement", "number of attempts to open achievement" and other useful statistics. Such reporting will allow you to check the specified conditions for obtaining achievements on the topic of their complexity and make edits before exiting in combat mode. As an option, all this could also be added to the Azure Table, only building flexible queries is even problematic. Therefore, in Web Job, we catch the moment when data is written to Azure Table storage and we add a job to the queue to write data to the SQL Database. Now we do not create additional delays for working in the main service, and the user receives the same statistics almost in real time. Of course, a small delay can be, depending on when the job responds, but it happens almost instantly, and there is no need to give analytics in real time.
How does the service from the clientFor each achievement, you must specify the condition of its receipt. We built the service so that the condition can be specified as a formula, for example,
scores > = 150 .
Scores is what the application sends a POST request. The request also comes a unique key client (application user). When we receive a request from the application, we check the value of the scores variable for this client, and if it is greater than the value specified in the condition of any achievement (one or more), the service will return an answer about the achievement achieved. You can set more complex conditions, such as:
level 5_ kills = 25 and level = 5 and ( health > = 90 and health <= 100)In this case, the achievement will open as soon as all the conditions in the formula are fulfilled. The values ​​themselves can be sent in a pack in one request, or they can be sent one by one. In any case, the values ​​of variables sent earlier are also checked.
To ensure the security of data transmissions and prevent possible data tampering, we are working to implement HMAC authentication.
What it looks likeAt the entrance to the system there will be a list of “projects”. For each application connected to the service, you need to create your project.

This is how the project looks from the inside. In each project, you can create a set of achievements with their own conditions of receipt.

And here is what one achievement in editing mode looks like.

On the
demo page you can see how it works on the demo project. To do this, we took the game "Snake" in JavaScript and connected it to the service.
What about those who do not develop games?Although this article describes an example of use in the context of video game development, it is worth noting that we see the use of the service in other areas as well. Here are just a few areas where our product can be successfully used:
Video gamesCreate an achievement system and use it in your projects on any device. Your customers can start using the iPhone app and continue on the iPad version while maintaining their open achievements.
Online shopsWant to add “gamification” to better retain customers? Thought about the possibility of charging bonus points to your customers? This is possible if your online store solution is integrated with the service.
PublishersPlanning to create another killer service Kongregate.com? Connect your platform to Badge Keeper and provide your customers with built-in tools for creating a cross-platform achievement system.
ConclusionDespite the availability of ready-made solutions, especially from such giants as Apple and Google, we believe that this service has the right to life due to simpler use, a smaller bundle of business logic of achievements with your application, as well as enhanced capabilities of the achievements themselves.
After this short development stage, we got a list of the "Wishlist" that we would like to see in the service. We are sure that we will have something to offer other teams, which also, like us, do not want to waste their precious time on auxiliary mechanics and concentrate on developing the main functionality of their application.
Before proceeding with the development, I want to get feedback and understand what else might be in demand, perhaps we have not taken something into account in our work. We are open to feature requests, if this does not go against the main ideology of the service. If you are interested in the service, but you did not find the required functionality in the description, then we will be glad to hear about it in the comments to the article or in the message on the
feedback form . If you like the idea of ​​the service and it would be interesting for you to follow the news of the project, then follow us on
Twitter to be aware of what is happening.
Thanks for attention! Any feedback, questions and comments will be appreciated.