⬆️ ⬇️

Is Dripstat a performance monitoring service for a JVM or MMO game?

Greetings, habrazhiteli!



Today I want to tell you about the service that I found just recently - Dripstat . It allows you to install a special java-agent on the local JVM, which collects the statistics of the application server and sends it to the site, where you can learn more about it.



- Well, what are the monitoring services? Today is Saturday! - you will say, and you will be right. Moreover, I will even support this idea and in this article I will tell just about the reverse, entertaining, side of the medal, and a little bit about JS programming.

')





So, I invite you to finish reading those who are interested.



Immediately follow the link to the game page - dripstat.com/game . Over the interface, developers did not bother, but this is for the best - everything is intuitive and you can figure it out in 5 minutes.

Spending a little time clicking on the cup and dropping the client into the “purse” (capacity) and looking around the interface, the main goal of the game is to “drip” more memory. On the right you can see the orange progress-bar, which shows the current goal, but do not be afraid of such a large number; all participants are working on achieving it (below you can see a small rating and activity diagram), and not just one player.



But to drip on 1 byte is not interesting. What do we have to pump over? As the training is completed, the means that allow you to generate memory for you and improve the manual generation indicators become available.

I will not duplicate information and list them all - it’s better to see for yourself (they are all listed in the right pane, the first line is the available improvements, and the subsequent lines are a list of the memory generators themselves).



Well, that's all about the toy itself.



But I did not stop at that, because the programmer's instinct began to play inside and demanded the continuation of the banquet. So I decided to still try to automate the process.



1. A superficial analysis of the messaging protocol between the server and the client showed that the substitution of messages will not work - the server has internal verification mechanisms. There was no desire to pick one in more detail, so I went a different way - from the client.



2. You can of course get by with an auto clicker, but this is not so interesting, and the browser should be constantly in focus, plus in addition to a cup of coffee, you need to click on other elements of the page. The first thing that came to mind was a cheap and effective solution - userscript (well, firebug is natural, because without it, it’s much harder to look at the insides of a page). I will not talk about how to install the necessary plug-in and run the script itself, this information is full on the Internet and on the habr too. But by the script itself, of course, I will share it.



The main idea was as follows:

0) Click-click-click!

1) Try to buy upgrades, because they give as much as 10% of the power for the generator.

2) Next, look for the most expensive generator and buy it. At first, the order was reversed and the constant purchases of the cursor were very sluggish to progress, so the order was changed.

3) If 90% of the memory is acquired, then reset it expanding capacity. This item is performed in the case when everything that could be bought has already been purchased and for further purchases you need a bigger wallet. For example, both generators and upgrades have already exceeded capacity at the price and the only thing left is Drip Memory.


Implementation:

// ==UserScript== // @name dripstat_clicker // @namespace x_lab.ice // @include https://dripstat.com/game/ // @version 1 // @grant GM_openInTab // ==/UserScript== unsafeWindow.document.hasFocus = function () {return true;}; //         , //            ,     (function (window, undefined) { if (window.top != window.self) { return; } //      iframe window.addEventListener("load", LocalMain, false); //        function LocalMain() { setInterval(function() { Shopping(); }, 10000); //     1   10  setInterval(function() { Clicker(); }, 10); //     100    // (  ,   JS    ,     ) } function Clicker() { $('#btn-addMem').click(); //     if(localStats.byteCount > localStats.memoryCapacity * 0.9) { //     90%    $('#btn-addGlobalMem').click(); //   capacity } } function Shopping() { //    var evt = document.createEvent("MouseEvents"); //    evt.initEvent("click", true, true); var upgrades = document.querySelector('#upgrades'); //      var upgChildren = upgrades.childNodes; for(var j=0; j < upgChildren.length; j++) { //        var upgChild = upgChildren[j]; if(upgChild.className == 'upgcontainer') { //           upgChild.dispatchEvent(evt); //     -  } } var store = document.querySelector('#powerupstore'); //      var children = store.childNodes; for(var i=(children.length-1); i >= 0; i--) { //     var child = children[i]; if(child.className == 'storeItem') { // ! child.dispatchEvent(evt); // ! } } } })(window); //     :) 


At the moment (the net time of the clicker is not so much), my result is

Statistics




The algorithm is not perfect, but it was not the goal. The main pleasure, and brains kneaded.



Ida arrange a tournament between AI!



PS Say no cookies! (if someone did not know - orteil.dashnet.org/cookieclicker )

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



All Articles