📜 ⬆️ ⬇️

Cloud for development companies: BadgeKeeper Achievement System Designer - Developer Service

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 from

It 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):


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 service

As 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:


Prototype for 2 months

In two months of free time, we managed to assemble a working service and a demo site with several features.


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 works

Now 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:

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:

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 client

For 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 like

At 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 games

Create 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 shops

Want 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.

Publishers

Planning 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.

Conclusion

Despite 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.

Source: https://habr.com/ru/post/269995/


All Articles