BHBot icon indicating copy to clipboard operation
BHBot copied to clipboard

Future of BHBot

Open ilpersi opened this issue 5 years ago • 19 comments

As some of you may already know, Flash is approaching the end of life and it will be decommissioned at the end of 2020. Part of this process is already happening in major browsers and that is why we are currently sticking with Chromium V69.

BHBot is completely dependent on the Flash player as all the graphic cues are taken from it. As time approach I believe it is wise to start to address this even tough we all like to add new amazing features to the current bot. 😝

I was thinking of the possible ways and I identified the following:

  • a partial rewrite using the steam client and WinAppDriver by Microsoft. I've played a bit with that and it seems to be working even tough I found an important bug with it (I reported it in February with no feedback, maybe you can bump it to speed up the process).
  • a full rewrite, always using the steam client, in C# using the native windows API to interact with windows. I am not in C# and so this is also an opportunity to learn something new (I was not in Java before BHBot...)

Both solutions require time and effort so I would like to hear feedback from other people of possible alternatives or better ideas that is why I am writing this.

Let me have your ideas. 😄

ilpersi avatar May 30 '19 06:05 ilpersi

Welp, I didn't realise they were phasing it out so soon..

My preference would be the first option, I'm not a huge fan of Java but we already have all of the code in place, if we can just replace the screenshot engine portion it'll be a much easier job than rewriting the rest. Also we should wait to see what the devs/kongregate announce, maybe they will port the game to HTML5, or go mobile only..

Fortigate avatar May 31 '19 12:05 Fortigate

I did some tests for option 1 and switching to Steam + WinAppDriver would also mean to recreate from scratch all the cues.

We would probably have to do this anyway.

Maybe, as I get some time, I can polish the code a bit and publish it for you to play with it.

ilpersi avatar May 31 '19 13:05 ilpersi

As long as we can have the app run minimized, I'm fine with option 1 :) My BHBot instance runs on a shared computer, and if it is visible it usually get closed.

eschwim avatar Jun 01 '19 18:06 eschwim

We'll have to test this as it is a completely new scenario. :)

ilpersi avatar Jun 03 '19 12:06 ilpersi

I've created a new branch where to test with this and pushed my very first unstable commits.

To make it work:

  • install Steam
  • manually run Bit Heroes (the bot can start BH, but right now it is not managing Steam updates or waits in between so it is safer to run it manually)
  • manually run WinAppDriver in an Admin elevated CMD with this command winappdriver.exe 127.0.0.1 4723/wd/hub
  • run the code in debug

Right now, for testing purposes, only the news pop-up dismissal is working.

I can confirm that:

  • BH windows must be in foreground for this to work
  • BH must not be minimized for this to work

ilpersi avatar Jun 06 '19 22:06 ilpersi

I wonder if we could instead use the android app and control it via selendroid/appium?

eschwim avatar Jun 09 '19 03:06 eschwim

Why would you do that? Is it to make it run on background?

I had a quick look at the documentation and I guess you are thinking of doing that on virtual android device. Am I correct? I don't know how much effort is required to install and run that and I would like the bot to be usable also by non techie users.

I haven't tested this option yet, but technically, running Steam on a different windows user, should be a workaround for the need of having it as the foreground window.

ilpersi avatar Jun 09 '19 08:06 ilpersi

Both to make it run in the background as well as take advantage of the mobile ads (which have more reliable cues). If worst comes to worst, I can just run the app foregrounded inside a hyperV instance :)

eschwim avatar Jun 11 '19 00:06 eschwim

Another option that I am exploring is to use Java JNA to call native window functions. Right now I am able to take screens of backgrounded windows. I had no time to play with mouse clicks though.

I'll keep you posted.

ilpersi avatar Jun 11 '19 07:06 ilpersi

I've been able to replace Selenium + WinAppDriver with Windows Native API calls. This turned out to be quite interesting as it is now possible to:

  • run the Steam application in background
  • hide the Steam application (move it outside the desktop)

and the bot will still work fine.

It is not possible to run it with a minimized window and this can be easily worked around using the hideWindowOnRestart ini setting. As long as you hide the window and the focus is out of it you can also do other stuff in the PC with no issues so far.

Right now only the news pop-up dismissal is working cause all the cues have to be updated, but this is not an issue as the core logic is working fine! 🔝

Next step I would like to update the cues to at least have the bot running raids: is there any idea/feedback on this?

ilpersi avatar Jun 22 '19 19:06 ilpersi

I've forgot to mention: if anyone wants to test this last build, you only have to install the steam version of BHBot and do the first login, after that the bot will take care of everything.

ilpersi avatar Jun 22 '19 20:06 ilpersi

An update to everyone following this thread: on the official discord channel the developers shared that they will move Bit Heroes to Unity. As details of this move are not yet clear we stopped working on the Steam port as the risk of voiding all the work is too high.

ilpersi avatar Jan 02 '20 16:01 ilpersi

Where is the download ill test it if needed? i aint a coder but i can mention if it fails somewhere

E7t7t7 avatar Jan 16 '20 20:01 E7t7t7

There is a dedicated branch on git for this and no download.

After we found out about the Unity announcement we decided to stop working on this project so the git branch is completely outdated.

ilpersi avatar Jan 17 '20 00:01 ilpersi

I see. any word on when the game is getting moved over? I would assume soonish since flash is dying in a sense.

also do you have a discord for the bot or is it just devs?

E7t7t7 avatar Jan 17 '20 10:01 E7t7t7

My comment won't be very helpful but I do urge you to support the web version instead of only Steam. This is for compatibility purposes with Linux machines.

If I need a VM with Steam running, I can't use steam on my machine with the same account and have both running at the same time.

Some quick googling suggests this is possible by putting the second Steam library in offline mode, but I worry this will cause update issues for the game.

Even if the updated bot is Windows only as it is now, that wouldn't be a huge problem. It being a Steam only bot will.

Edit: I understand I am in the minority here, just wanted to highlight this potential conflict.

MugenEnzan avatar Jul 01 '20 01:07 MugenEnzan

As of today there is no decision on what will happen when Unity update is out. When this thread was created, the decision to go with Unity was not published yet by Kongregate.

As Unity is out, it will take us a while to update to it (weeks if not months to have all the functionalities back).

ilpersi avatar Jul 01 '20 12:07 ilpersi

I did some tests for option 1 and switching to Steam + WinAppDriver would also mean to recreate from scratch all the cues.

We would probably have to do this anyway.

Maybe, as I get some time, I can polish the code a bit and publish it for you to play with it.

I recommend the Kartridge first, it is Kon's application and still use Flash player. After BH has port to Unity, we can odserve how situation is then decide which way to commit.

tengen-toppa avatar Dec 02 '20 04:12 tengen-toppa

@tengen-toppa Kartridge is nothing else than a shrank and repacked version of Google Chrome (if you are interested, the technology behind it is Electron JS) so as Unity port will be there, this will be fully transparent for Kartridge.

The main point is not the tool we focus on (Steam, Chrome, Chromium, Kartridge,....) or the BHBot logic: it is all about the graphic cues used to build the logic. Currently we have about 520 of them and it took years to get them. This will be most time consuming part when Unity will be released.

ilpersi avatar Dec 02 '20 15:12 ilpersi