nopeAnon / Automated-HoloCure-Fishing

Automated Holocure Fishing Bot
GNU General Public License v3.0
68 stars 33 forks source link

more improvement if we can assure opencv is present #25

Closed mindforger closed 1 year ago

mindforger commented 1 year ago

this issue is based on the MSS branch https://github.com/nopeAnon/Automated-HoloCure-Fishing/blob/e0b828915c7e949a4cb00b5e3fc6f31df21f52bc/holocure_fishing.py#L135

if we can detect if opencv is present there is another improvment to the image caching

https://github.com/asweigart/pyscreeze/blob/eeca245a135cf171c163b3691300138518efa64e/pyscreeze/__init__.py#L197

pyscreeze will convert pillow images every time if they are not already converted using pyautogui and subsequent pyscreeze, grabbing the image using the built in funtion already provides the adequate output format, when providing the images as pillow we waste that optimization

mindforger commented 1 year ago

to be honest pyscreeze itself looks a little bit unfinished to me, a nice tool but i think instead of working around it's flaws and lack of caching in the tool, we might collaborate with them to improve it on the base ?! since it works so well here right now

mindforger commented 1 year ago

there is also an intersting fork of pyscreeze https://github.com/asweigart/pyscreeze/compare/master...AntonioConsiglio:pyscreeze:master

it adds scaled patters, eliminating resolution checking (probably at a pretty high cost of execution time so not perfect)

nopeAnon commented 1 year ago

https://github.com/nopeAnon/Automated-HoloCure-Fishing/blob/e0b828915c7e949a4cb00b5e3fc6f31df21f52bc/holocure_fishing.py#L135

I took that line from the mss docs. Honestly, this code is only relevant for debugging, so it shouldn't affect the performance.

if we can detect if opencv is present there is another improvment to the image caching

The current way we cache images is through opencv. I can't really think of a better way of caching images that would also work with opencv template matching.

As for further improvements, the only thing I could think of is changing the hit_area to be more to the right at speed levels < 6. But even without that improvement, that only problem we would face is a slow start. Which isn't really relevant to my ideal holocure fishing bot, which is consistent fishing combos that can run endlessly. Which is current achieved by switching to mss

For collaborating with pyscreeze, I think that is a good idea, and it's great to improve existing technologies. But it's beyond the scope of this project, what I want to do, and the time I have left before college starts again.

working around it's flaws and lack of caching in the tool

The task of improving pyscreeze so that we could improve the fishing bot is, for me, not worth the trouble.

mindforger commented 1 year ago

i just forked the pyscreeze and was tinkering around with caching, but PIL is not good for hashing by design

cacheing really only makes sense when using opencv, so a basic check if the "cv2" module is available like in pyscreeze "_useOpenCV" would be helpful

other case it might fail if somebody can not or does not want to install it for reasons and starts complaining in the issues i guess :)

mindforger commented 1 year ago

to be more preceise on the original issue then

add a check for presence of cv2 and store the images as numpy.ndarray instead of PIL.Image to improve performance even further