Roukys / HHauto

GNU General Public License v3.0
43 stars 45 forks source link

Improved PowerCalc #1225

Open UncleBob800 opened 6 months ago

UncleBob800 commented 6 months ago

Hi, @deuxge Today I learned about the existence of a better script for calculating the probability of success in battle, which takes into account the upgrade of the opponent’s skills. This greatly improves the chances of attacking an advantageous opponent without running into the dreaded “You lost!” Script called is "Hentai Heroes Battle Simulator v4" (for some reason Japanese very much like long titles) Here link on this script: https://github.com/rena-jp/hh-battle-simulator-v4 I watched this script and can note that it predicts better than the same part in HH++ BDSM and HH++ OCD. And the most important thing is that this script is completely dedicated exclusively to Sim battle Nothing superfluous, on the contrary, there is a useful function of predicting which combination of boosters will be more effective at the moment (also available for each opponent individually). I think it would be very useful if your script could interact with this script if it is installed. As I noticed, this script can auto-embedded into the installed HH++ BDSM, which suggests that in theory you could implement its use as a plug-in. Can you try to make your script work with this script? At the moment I noticed that if this script is active, then your script starts using the Power variable instead of Sim (I already checked the log), ignoring even Sim from HH++ BDSM. This may be due to the fact that this script is auto-embedded in HH++ and replaces the Sim from HH++ BDSM, thereby your script no longer sees the Sim value.

I would also like to remind you of my previous idea of trick with same sorting method in ascending order for any auto-attack. At the moment, if Sim from HH++ BDSM is turned off, then your script starts using Power and attacks the opponent who has the lowest Power. That is to say, sorting in ascending order, from smallest to largest. At the same time, if Sim is enabled, then your script begins to attack the opponent whose Sim value is the highest, i.e. reverse sorting, sorting in descending order, from largest to smallest. But what if your script will be use same sorting in ascending order? I mean, what if the script also searches for the smallest number, but uses the formula 26 - <sim value> to read the Sim value? At the output, the script will also get the smallest number. For example, we have some opponent whose average number of points received will be 23.54. Your script begins to read the value of the Sim and processes this value through that simple formula. 26 - 23.54 = 2.46. This way your script will still use the same sorting as if Sim was turned off and the script was using the Power value. It seems to me that this is a win-win option, your script will always strive to choose the opponent whose fight will bring the maximum profit. At the very least, this will help avoid random moments when the script does not detect that the player has Sim enabled, starts checking the list of opponents based on the Power value, but at this moment another script replaces the Power value with Sim and your script mistakes value Sim for value Power and begins to attack an opponent whose Sim shows a value such as 5.94, thus putting the player at a disadvantage. The trick I wrote above will allow you to avoid such false positives. It would also be useful if in the settings we could additionally manually indicate which counting system your script needs to rely on. Simply put, in addition to the Use PowerCalc button, there should be a drop list with the following items:

The logic is simple, if the player selects auto-detection in the settings, then your script will also automatically determine which scoring system is currently in use (that is, the way it works right now in your script). Other options are designed for fine adjustment, so that your script waits for another script to fully load, periodically checking whether the sim values have appeared or the third-party script is still loading, and only then begins to attack opponents. This would help avoid situations where the player has Sim enabled, but your script is still using Power values because another script didn't load before timed out of waiting in your script.

deuxge commented 6 months ago

Hi, I have to disagree with you in one point. The bot is using power value if you do not select option "Use powercalc" from the league menu. If you select it, it compute Sim internally and use it.

Then, following your idea, as stated already before I can't make all scripts in the world compatible with our bot.

This is already a lot of time required just to ensure the bot keeps working. If you follow you can see the get salary is still not working fine. There is some tickets with good ideas, some features to include but the time is missing. I understand the idea seems simple. But to integrate it, it will take so much times...

In case hh++ocd or hh++bdsm provide an update I need also to update to ensure it is still compatible. Sorry but I don't have enough time to ensure the compatibility with everything...

On the other hand, I agree, this "new" script seem to provide good features.

Rena script and HH++ BDSM are not compatible together, they both place the sim result in the same column. Our bot looks to the value shown. If Rena script override value from BDSM in the page, the bot is not able to use it. In such cases, the bot back up to the intern option, power value if available (most probably not anymore) or the internal Sim is option is active.

If you want to propose an update of the bot and ensure to maintain it, feel free, I'm open to review the changes and include it. This is why the code is here on github.

I will keep this script in mind and look to it. Maybe if it really simple I can think about it only for league. It will not be my prio.

UncleBob800 commented 6 months ago

@deuxge That’s when I proposed the trick where your script, in cases of detecting an activated Rena script, would apply the formula written above to turn a larger value into a smaller one, and a smaller value, on the contrary, into a larger one, then your script would always attack according to the same logic - looking for the smallest value. And as I said earlier, you can do manual switching instead of automatic detection. In other words, I myself would choose between Power or Sim in the settings. In fact, it seems to me that this will be the simplest and most universal solution for optimizing your script to work with a third-party script. Your script will still rely on the smallest number in the power column, but if I use the Rena or HH++ BSDM script, then all the values ​​from the power column will be processed through the formula 26 - <taken value from power column> (of cource, if I change switch on Sin instead Power in setting your script). This way the script will attack just as effectively. I wouldn't create this thread and write so much text if it wasn't necessary. Unfortunately, because Kinkoid tends to make the combat system insanely complex, your script's built-in Sim gets it wrong most of the time. I often see this in Season battles. Your script shows some odds, Sim HH++ BDSM and Sim Rena shows other odds that are more correct. When your script makes an auto attack in Seasons, it often chooses to attack an opponent whose Sim HH++ BDSM and Sim Rena show a significantly worse chance of winning, while the built-in Sim of your script shows a very good chance of winning, but in the end the battle is lost. My proposal to support the Rena script was not out of capricious whim, but for the reason that the built-in Sim in your script is often wrong (because it's outdated) and we need an alternative. It seems to me that the option of trying to integrate support for a third-party 100% working script will be less time-consuming work than making your own new Sim, which will also calculate the chance of winning well. Is not it so? If it is easier for you to write a new built-in Sim than to integrate the Rena script, then I will be only happy.

If you want to propose an update of the bot and ensure to maintain it, feel free, I'm open to review the changes and include it.

And it seems to me that I would not waste time on all this text if I knew JS and could personally write the code to support a third-party script. In fact, this would have been ready a long time ago if I understood JS and this code would have been provided here a long time ago. But it so happens that I do not understand this programming language.

Therefore, one open question remains: what is easier and more effective for you? Make a new PowerCalc that takes into account the current PvP realities with girls' equipment and god damned skills? Or resort to using someone else's code from people who have already been able to create an effective system for calculating the chances of winning and getting points in all aspects of battles? P.S. I accidentally misinformed you a little when I said that Ren's script is only for the League, in fact it works for all battles: for seasons, leagues, villain and pantheon. Don't get me wrong, I don't want to bother you in any way, but the situation is that we need a working Sim so that your script can make the right attacks instead of the script continuing to attack over and over again the opponent who has all 10 lvl mythic girls' equipment and completely improved skills, at a time when there is always a really weak opponent nearby, but which is ignored by your script due to incorrect calculation of the chance of victory.

deuxge commented 6 months ago

The issue with your idea is about the way script put values into the power column (HTML structure). This is not always the same. So for the bot to take the value it need to be aware or at least compatible with all options.

I have an idea that should make everyone happy without too much maintenance work.

Instead of "use power" powercalc, I change to select (a bit like you proposed), but without all the script options. image image

There is 3 options for the "sorting" meaning the way bot choose the next opponent. Default option is the same as today "Use power", it use the game power value. Third option is the same as the "use power calc" it use our interal sim powercalc feature (mainly based on HH++ OCD). First option is the "new one". But is not sorting any opponent. But use the first one in the list (that can be attacked) As the game remember what you choosed for sorting (power or sim or anything), it will use it. As usually we sort by the best opponent (ie the weeker) on top, it should fit everyone prefered option of scripts. image (PS: I will rework the texts)

I still do not recommand of using other script as it can have impact on the bot features.

I will test a bit this functionality and update after. My initial test with both HH++ script are promising.

For Villain (Troll) I don't really think an updated version of the sim is needed. As even in the start of the game we can win them easily. Also the bot choose on other condition not the sim value. In pantheon, there is only one fight option (we can only play with the team or the booster) so there is no need of bot update. For season I will need to think a bit more how we can do.

Dimka2010 commented 5 months ago

damn.. and which parameter better will be? no clues, no tips..

ok. i will say with another words - which method is new, which is old? i am do prefer new from UncleBob, which i must pick?

UncleBob800 commented 5 months ago

@Dimka2010 Displayed order but this not work correctly.

UncleBob800 commented 5 months ago

@deuxge As I assumed when I read your message, your method will not work. But unfortunately, I didn't have any free time to write an answer... until now. I’ll explain the reason: when you go to the League page, HH++/Rena SIM calculates the chances. After the odds have been calculated, these scripts show us how many points we will receive. Sorting is done by POINTS number. Not by percentage chance of winning. Although even if the sorting was based on the percentage of chances, it would not change anything in the end. You must understand that in order to show us the best option on the top line, need to sort in descending order. In other words, the league page will show us the highest value. But there is just one significant problem. If we go to the main page (or any other page) and then return to the League page back, then yes, the descending sorting will remain... but the game will sort not by the SIM value, but by the value... POWER... And as we know, those who have A LOT OF Power give the least amount of points. I have now checked this and my fears have been confirmed. Rena's SIM was included. And auto-attack was made against the player with the highest POWER and as a result of the battle I received... 7 points. I didn’t even have to dream about 25. No matter how quickly user-script loads, the game will still sort by POWER value. Therefore, relying on an opponent in the highest string in the table was a very bad idea. And to tell the truth, I don’t understand why you so strongly ignore what I offered you. After all, in fact, this method is truly universal. I don’t know if in JS there is such a thing as a mathematical module (this is when any negative value always becomes positive, for example we have the value -213658, but after using such an operator we get the value 213658). But if such a function exists, then the algorithm is absurdly simple. The value is taken from the POWER column (it doesn’t matter what is displayed there, power or sim, after using the formula the player will win in any case) and this value is processed through the formula that I have already written to you many times. Yes, yes, I'm talking about 26 - <value>. And the result of these simple mathematical calculations is further processed through the mathematical module operator. I just searched on Google, this is the function Math. abs(). Simply put, if a player shows Power with the value 161976, then when processing that formula we get 26 - 161976 = -161950, then we use Math. abs() and the previously obtained value -161950 is converted to 161950. Result: the smallest Power will remain the smallest. But if the Power column was replaced by SIM and this player now has a value of 23.95 Points instead of 161976 Power, then the same formula will work as follows: 26 - 23.95 = 2.05 and applying to the resulting value Math. abs() we will still have the value 2.05. Result: the player with the most points on your list will have the LEAST value for your script compared to the others. Thus, your script can always attack players with the LEAST value, but at the same time your script will be adapted to any conditions, be it Power or SIM by HH++ or by Rena. By the way, if you replace 26 - <value> with 101 - <value>, then this formula can be used for the value that is used for the percentage chance of winning. And at the same time, this formula will still work for both Power and SIM. I have voiced this simple formula many times, but I don’t understand why you refuse to try such an implementation. Maybe I don’t know some subtleties that you know? I would be grateful if you could explain why this method will not work, if it is true. In general, I'm interested in how your script generally behaves during an auto-attack in the League. Does the script create a temporary list inside temp storage, or does the script scan the list each time and each time again look for a suitable candidate for attack? If the second option turns out to be correct, what will be the performance impact of using a simple subtraction and conversion formula to a positive number? My experience in programming was limited to writing simple programs in rather outdated programming languages (unfortunately, where I studied, they don’t really keep up with the times, but they trained me well to think in algorithms, because where I studied, they were very are convinced that the ability to build algorithms is much more important than knowing a programming language, arguing that it is possible to adapt to any programming language, but without knowing how to build algorithms, a programmer will not be able to adequately write program code). And yet, such simple calculations used for large amounts of data never affected performance and were performed almost instantly in my jobs.

UncleBob800 commented 5 months ago

Regarding the percentage of the chance of winning, I wrote in a previous message to ask to add an additional option for auto battles in Seasons, where the script looked not at the number of Mojo points, but at the highest chance of winning. This is relevant during Seasonal events, where you need to attack a lot in Seasons. When I reach lvl 63 in Seasons, I no longer need to chase high Mojo. At this point in time, I will need to win often in order to progress in the Seasonal Event. And therefore, it is more important to be able to specify the priority in the script settings: Mojo or Percentage of chance of winning.

deuxge commented 5 months ago

Regarding the percentage of the chance of winning, I wrote in a previous message to ask to add an additional option for auto battles in Seasons, where the script looked not at the number of Mojo points, but at the highest chance of winning. This is relevant during Seasonal events, where you need to attack a lot in Seasons. When I reach lvl 63 in Seasons, I no longer need to chase high Mojo. At this point in time, I will need to win often in order to progress in the Seasonal Event. And therefore, it is more important to be able to specify the priority in the script settings: Mojo or Percentage of chance of winning.

I could review that. Or even change automatically when level is above 63.

deuxge commented 5 months ago

@deuxge As I assumed when I read your message, your method will not work. But unfortunately, I didn't have any free time to write an answer... until now. I’ll explain the reason: when you go to the League page, HH++/Rena SIM calculates the chances. After the odds have been calculated, these scripts show us how many points we will receive. Sorting is done by POINTS number. Not by percentage chance of winning. Although even if the sorting was based on the percentage of chances, it would not change anything in the end.

In the first message you never mentioned percentage of winning, you always talked about the points.... Also Rena's do not display percentage but only points.

You must understand that in order to show us the best option on the top line, need to sort in descending order. In other words, the league page will show us the highest value. But there is just one significant problem. If we go to the main page (or any other page) and then return to the League page back, then yes, the descending sorting will remain... but the game will sort not by the SIM value, but by the value... POWER...

This is not true with HH++ OCD. And the test I made with BDSM was fine. But I agree I did some retest and didn't work, sorry for that.

And to tell the truth, I don’t understand why you so strongly ignore what I offered you. After all, in fact, this method is truly universal. I don’t know if in JS there is such a thing as a mathematical module (this is when any negative value always becomes positive, for example we have the value -213658, but after using such an operator we get the value 213658). But if such a function exists, then the algorithm is absurdly simple. The value is taken from the POWER column (it doesn’t matter what is displayed there, power or sim, after using the formula the player will win in any case) and this value is processed through the formula that I have already written to you many times. I have voiced this simple formula many times, but I don’t understand why you refuse to try such an implementation. Maybe I don’t know some subtleties that you know? I would be grateful if you could explain why this method will not work, if it is true.

This is what You don't understand in my previous comments.

The issue is not about the algorithm "26-value", yes this operation is simple and can be put in place. The issue is how to get the value:

This is the game power column image This is HH++ OCD (not in power) image This is HH++ BDSM image And this is Rima's image

The HTML structure is really different (owned by the scripts). There is NO universal command to take the value. The closest function is jquery ".text()" but is not enough (not compatible with BDSM). So making compatibility mean understand the script structure for good, neutral and bad option to parse it and take numbers. And your option is not compatible with OCD as it is not into the POWER column. I agree Rena's one is the simpler.

There is already 3 differents way to take values if we talk about vanilla game and both HH++. I'm in favor of adding more complexity by adding support to another script with additionnal parsing. No-one can guarantee this scrutcture will not change in future, or additional script can change it.

If you want something universal then displayed order seems to be the best option. But it still needs works.

It is possible to make compatibility with every script yes. But not as easy as you mentioned.

In general, I'm interested in how your script generally behaves during an auto-attack in the League. Does the script create a temporary list inside temp storage, or does the script scan the list each time and each time again look for a suitable candidate for attack?

If you select internal sim powercal, script save the result in storage for about a minute. About the user sorting, this is always done at each league page display.


To summarize, the new option only works with OCD as they are doing a refresh of the opponent sorting on page display. The other script don't. (It also works without scripts) So Yes for you it doesn't work. I can trigger two "click" on the selected column to ensure sorting is done. I'm not sure this is the best... I will try to see if it can works

If not I will review...

UncleBob800 commented 5 months ago

@deuxge

Also Rena's do not display percentage but only points.

Sorry, I forgot to say that the Rena script has additional settings that appear if the HH++ BDSM script was active. image image Actually, that’s why I wrote earlier that the Rena script has the ability to integrate into the BDSM script, replacing SIM BDSM with SIM Rena. Moreover, Rena is now on the HH++ BDSM server in Discord, just like -MM-, the developer of the HH Leagues++ script. image Simply put, these three scripts are optimized for each other and don't cause any glitches. I think that you can rely on the Rena script, since the game does not yet foreshadow any changes in the combat system. And since the script does not have unnecessary functions and is intended solely for calculating the chances of defeating an opponent in battles, it seems to me that supporting only the Rena script looks more logical. Moreover, as you yourself noticed, the Rena script has a simpler display of data in HTML than other scripts (at least if the player did not enable the Add Chance display option)

The HTML structure is really different (owned by the scripts).

Thanks for this clarification, now I understand more clearly what the problem is.

It is possible to make compatibility with every script yes.

And based on your entire message, I am increasingly inclined to think that the best option would be to abandon HH++'s SIM support and leave only Power, your internal SIM (PowerCalc, if I understand correctly) and Rena, since this script is only for battles and doesn't add anything extra, as in the cases of HH++, in which many different things are added. This way there will be less headaches with regards to trying to optimize your script for every third-party script. SIMs of other scripts always show less accurate results than the Rena script, so I see no point in further supporting SIM from HH++. Fortunately, both HH++ have an option to disable their SIM. I'm also wondering how realistic it is to copy the calculation method from the Rena script to replace the current built-in SIM? Because the built-in SIM (based on what I see in Seasons) is very wrong in the calculations and needs to be replaced/upgraded.

deuxge commented 5 months ago

You see, it is even worth when you activate option and the HTML change again....

I just saw Rena also change the inner game variable (opponents_list[0].power). For me this is not good method. But it help us in this case. (Value stays even with percentage activated)

Ie: I can use what you said and read the inner game variable. It will support in game power hh++BDSM and rena, maybe others... I will review and test this. image

But again, in case the script changes it can break everything. I do not add Rena scripts into official supports...

And based on your entire message, I am increasingly inclined to think that the best option would be to abandon HH++'s SIM support and leave only Power, your internal SIM (PowerCalc, if I understand correctly) and Rena, since this script is only for battles and doesn't add anything extra, as in the cases of HH++, in which many different things are added. This way there will be less headaches with regards to trying to optimize your script for every third-party script.

Remove support of one script is not something easy to put in place. There is many users of our bot who do not come here and will not see such change. They will not understand why there is such a big change. Also I can't remove support of one part of the script and keep the rest, it doesn't make any sense...

HH++ OCD will stay in the supported list and his functions has to be compatible. For the league, the displayed order (no sorting by the bot) is the support of HH++ OCD and there is no additional work.

UncleBob800 commented 5 months ago

@deuxge loool... image Big brother is watching us... 🤣

deuxge commented 5 months ago

Finding your name on github and your posts is easy ^^

UncleBob800 commented 5 months ago

Finding your name on github and your posts is easy ^^

Provided that you know 100% that such a user really exists on github and that he has published posts somewhere. In fact, I was a quiet observer there and nothing more, this is my first post there, so... this person already knew that I was on github. But that's not the point. My concern is that Zoo or Rena may not want to make changes to their script because of this post. Honestly, these changes would be very useful even without the participation of your script, at least for the normal operation of sorting. And your script can work without transferring the SIM from Power to Challenge. I was rather interested in this option because such changes could help everyone, both us with your script, and others who are forced to double-click on the SIM header in order to sort correctly. Simply put, everyone would benefit. But Tom's publication may diminish the interest of Zoo and Ren, because they are not interested in Kinkoid assigning them the status of unapproved scripts if Kinkoid considers their update to help our script work. Yes, a stupid reason for this, but God knows what's going on in the head of a game developer... it would seem that your script does not provide a game advantage, no matter how many times I check, but I was always convinced that automation would never help me to win in the League or Contests, only manual labor wins there, but despite this, the game developer still considers your script unacceptable. And this is very sad, in the same Korean games, auto combat is a gameplay mechanic within the game. This feature doesn't help you win, it just keeps the game not idle and gives people more time for their personal lives.

Dimka2010 commented 5 months ago

Again. After all the changes, which of the three methods is best to use now. and why are there three of them left? if, according to my noob logic, there was 1, they added a 2nd one. So why are there three methods of finding partners to choose from?

deuxge commented 5 months ago

and why are there three of them left? if, according to my noob logic, there was 1, they added a 2nd one. So why are there three methods of finding partners to choose from?

There was one setting but two behavior (settings off or on). Use powercalc or not => use power value or use internal sim power calc. New option use nothing to sort.

After all the changes, which of the three methods is best to use now.

Then for what to use, it depends on your usage. I guess you use hh++ ocd. Then on league, click on the right colomn to get the sorting you want. And select no sort from the bot settings. If you want to use one of the two other scripts, then select power value. if the internal sim is fine for you, use the last option.

Dimka2010 commented 5 months ago

so.. if i use only our bot without OCD? which i need to use?

second. i cannot see any persentage when using only our bot without any OCD type scrip

deuxge commented 5 months ago

Without OCD, the best option would be image The one in the right, is to display the internal percentage on the league page.

Dimka2010 commented 5 months ago

but.. i dont see any persentages Screenshot_17 Screenshot_18 Screenshot_19

and no button - refresh opponent list it was before

deuxge commented 5 months ago

Regarding the percentage of the chance of winning, I wrote in a previous message to ask to add an additional option for auto battles in Seasons, where the script looked not at the number of Mojo points, but at the highest chance of winning. This is relevant during Seasonal events, where you need to attack a lot in Seasons. When I reach lvl 63 in Seasons, I no longer need to chase high Mojo. At this point in time, I will need to win often in order to progress in the Seasonal Event. And therefore, it is more important to be able to specify the priority in the script settings: Mojo or Percentage of chance of winning.

Algo is now changed after lvl63 percentage is more important than mojo

deuxge commented 5 months ago

but.. i dont see any persentages

I was not able to reproduce this... Can you retry with latest version ? can you share the error message in browser console if any ?

Dimka2010 commented 5 months ago

Screenshot_21

deuxge commented 5 months ago

The last issue mentioned is fixed in 7.8.2 but is not linked to the changed done here.