nopeAnon / Automated-HoloCure-Fishing

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

suggestion: add pixel scanning after detecting to trigger scanning #19

Closed mindforger closed 1 year ago

mindforger commented 1 year ago

scanning areas takes a bit of time and if the target is alread 90% on the scan region, it might miss and the next scan might miss the target completely when moving too fast

to make the scanning more reliable use a fast pixel scanner along the "line" to trigger the actual scan to have a higher hitrate and maybe even guess the speed of the pattern by calculating the distance between the pixel and the pattern location to perfectly hit the target with a second pixel trigger and timed delay, since we prepared the button we will only have to check for any change on the pixel and not check over a number of colors

mindforger commented 1 year ago

also just for good measure ... i measured execution time using autogui and bare pyscreeze and pixelmatch vs locate grafik

on a 4k display, using a screenshot of the games hit area and the actual 720p hit area pattern

pixelcheck is random

PPS: pixelMatchColor alread has a tolerance parameter, so you do not even have to match up exactly, could be very helpfull to pull the trigger more precisely

nopeAnon commented 1 year ago

maybe even guess the speed of the pattern

It is possible, but lag, fps drops and the frequency of screenshots might mess up the timing. I'm not too keen on implementing this, but I'll look into it.

since we prepared the button we will only have to check for any change on the pixel and not check over a number of colors.

Good idea. The only problem I could think of is rain hitting the hit area or npcs walking across it (assuming they aren't in the ideal spot). But I think we can mitigate this by searching for white pixels in the center of the hit area.

Thank you for your tests. With that, I'll use pyautogui.pixelMatchesColor for detecting when to hit. Since it won 2 times out of 3

I'll start working on this tomorrow

mindforger commented 1 year ago

is rain hitting the hit area or npcs walking across it

the line for the minigame is intransparent and on top, you could use a pixel right where the line hits the hit area, then add a slight delay before pressing the button (or maybe the execution delay covers that already)

for debugging, you could open a simple tkinter widget and draw the a captured image on hit to it to adjust the pixel position in regards to the detected area (make it bright red or sth in the image) ... and don't use a fixed color value, better scan the pixel color at the begin of the minigame and check for changes

nopeAnon commented 1 year ago

This isn't really relevant anymore with the recent changes