Problem with img search reaction

Ask gaming related questions (AHK v1.1 and older)
Ugropuz
Posts: 7
Joined: 02 Jun 2020, 07:59

Problem with img search reaction

Post by Ugropuz » 02 Jun 2020, 08:45

SO im using ahk for game to press left mouse button when yelow line got into white position
Image Broken Link for safety
and whole my problem that it reacts unstable (even when i try it on recorded version)
it recognize img change earlier and press on at right moment for like 80% of the time
but sometimes it actually press earlier or later(which is worse)
Spoiler
basically i used img search before i thought that maybe its just slow or something
then i start using lib for it same as another lib functions for mouse pressing

actual example
and whole my question is not about to make it faster im p sure that its fast af
but how to make it more stable
( or actually it is a ping thing or some shit but then idk why its acting the same in recorded version...)

like any idea may help

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Problem with img search reaction

Post by swagfag » 04 Jun 2020, 07:55

ure sampling a 5px wide region for changes.
due to frame rate, the yellow bar is most likely discontinuous in its movement as it traverses horizontally. in other words, one of 4 things will happen(the following assumes initial traversal from right to left):
  1. u detect the change at the earliest time possible, giving u ample time to initiate the trigger(but theres also a chance that u trigger it way too early, ie before the center of the yellow bar enters the white zone)
    Spoiler
  2. u detect the change while the yellow bar is mostly in the white zone, giving u probably enough time to trigger it(but theres also a chance that ull miss it, due to network/input delays, yellow bar moving too fast or whatnot)
    Spoiler
  3. u detect the change at the latest time possible. the yellow bar has already exited the white zone. u have no chance of triggering it now
    Spoiler
  4. u fail to detect the change at all. the yellow bar was moving so fast(or the white zone was so narrow), it "jumped" the gap from one frame update to the next. u have no chance of triggering it now
    Spoiler
to fix this, a better strategy would be sampling a larger(large enough to ensure 4. doesnt happen) area in front of the white zone
Spoiler
of course, its not sufficient that u detect the change, u also need to find out where it changed(ie locate the yellow bar) and delay the trigger click, as much as u have to, for it to occur while its inside the zone
my question is not about to make it faster im p sure that its fast af
how would u know? have u benchmarked it?
actually it is a ping thing or some shit
if u have a way to measure the ping, delay it by that amount. otherwise, theres nothing u can do about that
Last edited by swagfag on 04 Jun 2020, 12:11, edited 1 time in total.

Ugropuz
Posts: 7
Joined: 02 Jun 2020, 07:59

Re: Problem with img search reaction

Post by Ugropuz » 04 Jun 2020, 10:11

> how would u know? have u benchmarked it?
not me but the guy who made the lib
and i was thinking its mainly problem with framerate or google chrome OMEGALUL
whole problem that i thought about why its happening is that
baritself have shades on sides right and if you count them in its actually bigger then white zone itself
Last edited by Ugropuz on 04 Jun 2020, 10:23, edited 1 time in total.

Ugropuz
Posts: 7
Joined: 02 Jun 2020, 07:59

Re: Problem with img search reaction

Post by Ugropuz » 04 Jun 2020, 10:17

> of course, its not sufficient that u detect the change, u also need to find out where it changed(ie locate the yellow bar) and delay the trigger click, as much as u have to, for it to occur while its inside the zone
ye thats basically what i did first and checking zone was about 10px
i actually didnt know like whats better small zone or large since like you said
there 4 possible options what can hap[pen but if you make it bigger i think you would just increase the delay before click
cos at the same time it would be possible to be earlier or later but just checking earlier
whole zone row is about 600 px bar moving from left to right and its about 1 sec for 1 loop
(so when it pass to the end it just start from begining if you dont press anything)

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Problem with img search reaction

Post by swagfag » 05 Jun 2020, 12:12

not me but the guy who made the lib
did he bench it with your code? because if not, i dont see how thats relevant

baritself have shades on sides right and if you count them in its actually bigger then white zone itself
thats also irrelevant. for all we care the bar could have been defined as having its center located on the shade's leading left edge. the only difference that would make, is by how much ull have to delay/preempt sending the trigger

but if you make it bigger i think you would just increase the delay before click
which is why
swagfag wrote:of course, its not sufficient that u detect the change, u also need to find out where it changed(ie locate the yellow bar) and delay the trigger click, as much as u have to, for it to occur while its inside the zone

Ugropuz
Posts: 7
Joined: 02 Jun 2020, 07:59

Re: Problem with img search reaction

Post by Ugropuz » 05 Jun 2020, 18:12

https drive.google.com /file/d/1dXj2HqROfNmsXfOy8JnuIaCU9nMAUhhs/view?usp=sharing Broken Link for safety
20x5 capture size
https drive.google.com /file/d/10BaLSFPbDX_kzwzScBzBzDFrVQnUH8QS/view?usp=sharing Broken Link for safety
2x3
and whole point no matter how small or big this line is it actually fucked by timing offset
like it find out that color changed in exact position in proper time
but time when it press is different
and those vids tested on recorded version so there no possibility for ping delay or something
its not like its missing the tracking zone
like when i used img search yes it actually could miss and line just could pass by
here it always register
maybe only sometimes when its 1px width zone it may skip it

like im not sure about what exactly you want me to do cos im not expert in ahk somehow
but from what i understand i think that you thinking about wrong problem

so what i checked before already

if (snap.Compare(snap2) == 0)
{
SendMouse_rightClick()
;;SetTimer, RemoveToolTip, -1000

like it show tooltip as 0 when it actually trigger like find a change and its different from moment when it click

my actual thought was to make something like check when the line at the start of bar and just time when to press it but white zone may be in different place

ok after trying to bench it i actually got confused cos snapping was showing different times ( like about 0.10ms and then similar to generic pixelgetcolor which is huge 15-20ms)
and whole point that i understand is problem with win10 that you cant disable "desktop composition" on win10 for pixelgetcolor

Post Reply

Return to “Gaming Help (v1)”