Blue Eye Logo

Blue Eye Macro

Automation is freedom
It is currently Thu Jun 21, 2018 11:36 pm

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Need help with pixel detection for multiple colors
Thanked: 0 time(s)  Unread post Posted: Fri Dec 29, 2017 10:49 pm 
New User
New User



Joined: Fri Dec 29, 2017 9:13 pm
Posts: 3
Been thanked: 0 time(s)
Has thanked: 1 time(s)
Contribution Points: 13
Greetings,

I'm having some issues with pattern detection utilizing a large number of Pixel Pattern macro's. I've thrown in the towel to recoup my mind - I've been working on this for about 10 hours a day for the last four days and I have only minimally been able to improve the situation. Let me explain what I am trying to do, and some (of many) ways I have tried to accomplish it.

    I am attempting to run a pixel pattern recognition macros for an open source Tibia server that utilizes Textual Effects.
    The game graphics can run in a number of different modes including 16 bit, 36 bit with Directx5, Directx9 or OpenGL.
    The Dev of this particular server has made a "mining" zone. When you strike boulders within this zone there is a chance for you to activate a "reward beacon". Beacons must be stepped on in order to get to a final "reward beacon". You must remain standing on the last beacon to "siphon" your reward to your inventory.
    These beacons are a series of graphical effects that are animated, change color, design and location frequently.
    The beacons themselves scrolls upwards a constant text - *Ore* - which changes color every second. The pattern remains the same.
    The final reward beacon always scrolls the same grey text (152,152,152). This color is also heavily used in the surrounding graphical landscape and thus I have been using a 36 pixel pattern recognition to map the entire *Ore* message as displayed to ensure no false positives.

Reward Beacons look like this:
Image



Let's talk colors...

The scrolling upwards text - *Ore* - utilizes a -1 value variant to the 216 Web Safe Colors List for all of it's changing color variations.
So, for instance gray would normally be 153,153,153 in the 216 Web Safe Colors List. As far as I can tell the scrolling text could be using all 216 colors. I have confirmed the -1 value variant with several other colors that have scrolled using the Investigator.

So... the overall object is to locate the pattern - *Ore* - no matter what color it is displaying and click the mouse on it. Since the scrolling text is "above" the reward beacon I also need to have a follow up command to click x number of pixels "down" to move the character into the proper position.


Below I can give you an example of a perfectly executing macro that will locate the grey scrolling text for the final reward beacon. This macro will execute continuously and ensure my character remains standing on the reward beacon to "siphon" the loot into my inventory until the beacon dissipates - which then it resumes the search for the grey - *Ore* -pixel pattern.
Code:
 when  Color.Pixel pattern can be located on screen near coordinate("152,152,152,0,1,152,152,152,0,1,152,152,152,0,1,152,152,152,0,1,152,152,152,0,1,152,152,152,0,1,152,152,152,1,-3,152,152,152,1,-1,152,152,152,1,-1,152,152,152,-1,3,152,152,152,1,1,152,152,152,-4,-2,152,152,152,-1,-1,152,152,152,-1,-1,152,152,152,1,3,152,152,152,-1,1,152,152,152,8,-2,152,152,152,0,-1,152,152,152,1,0,152,152,152,0,1,152,152,152,0,1,152,152,152,0,1,152,152,152,-1,-1,152,152,152,0,1,152,152,152,1,-4,152,152,152,1,0,152,152,152,1,0,152,152,152,1,0,152,152,152,0,1,152,152,152,1,0,152,152,152,0,1,152,152,152,-1,0,152,152,152,0,1,152,152,152,0,1,152,152,152,1,0,152,152,152,0,-1,152,152,152,-4,2,152,152,152,1,0,152,152,152,1,0,152,152,152,1,0,152,152,152,3,0,152,152,152,0,-1,152,152,152,0,-1,152,152,152,0,-1,152,152,152,0,-1,152,152,152,0,-1,152,152,152,1,0,152,152,152,0,1,152,152,152,0,1,152,152,152,0,1,152,152,152,0,1,152,152,152,0,1,152,152,152,1,-4,152,152,152,1,0,152,152,152,1,0,152,152,152,-1,-1,152,152,152,1,0,152,152,152,2,1,152,152,152,0,1,152,152,152,0,1,152,152,152,0,1,152,152,152,1,1,152,152,152,0,-1,152,152,152,0,-1,152,152,152,0,-1,152,152,152,0,-1,152,152,152,0,-1,152,152,152,1,0,152,152,152,1,0,152,152,152,1,0,152,152,152,0,1,152,152,152,1,0,152,152,152,0,1,152,152,152,-1,0,152,152,152,-1,0,152,152,152,-1,0,152,152,152,0,3,152,152,152,1,0,152,152,152,1,0,152,152,152,1,-1,152,152,152,2,0,152,152,152,1,-1,152,152,152,1,-1,152,152,152,-1,-1,152,152,152,-1,-1,152,152,152,3,-1,152,152,152,0,1,152,152,152,0,1,152,152,152,0,1,152,152,152,0,1,152,152,152,0,1,152,152,152,0,1,152,152,152,1,-3,152,152,152,1,-1,152,152,152,1,-1,152,152,152,-1,3,152,152,152,1,1,152,152,152", "0", "900", "500", "250")
     begin
          Macro.Pause all other macros()
     end
 begin
     Mouse.Move to pixel pattern("152,152,152,0,1,152,152,152,0,1,152,152,152,0,1,152,152,152,0,1,152,152,152,0,1,152,152,152,0,1,152,152,152,1,-3,152,152,152,1,-1,152,152,152,1,-1,152,152,152,-1,3,152,152,152,1,1,152,152,152,-4,-2,152,152,152,-1,-1,152,152,152,-1,-1,152,152,152,1,3,152,152,152,-1,1,152,152,152,8,-2,152,152,152,0,-1,152,152,152,1,0,152,152,152,0,1,152,152,152,0,1,152,152,152,0,1,152,152,152,-1,-1,152,152,152,0,1,152,152,152,1,-4,152,152,152,1,0,152,152,152,1,0,152,152,152,1,0,152,152,152,0,1,152,152,152,1,0,152,152,152,0,1,152,152,152,-1,0,152,152,152,0,1,152,152,152,0,1,152,152,152,1,0,152,152,152,0,-1,152,152,152,-4,2,152,152,152,1,0,152,152,152,1,0,152,152,152,1,0,152,152,152,3,0,152,152,152,0,-1,152,152,152,0,-1,152,152,152,0,-1,152,152,152,0,-1,152,152,152,0,-1,152,152,152,1,0,152,152,152,0,1,152,152,152,0,1,152,152,152,0,1,152,152,152,0,1,152,152,152,0,1,152,152,152,1,-4,152,152,152,1,0,152,152,152,1,0,152,152,152,-1,-1,152,152,152,1,0,152,152,152,2,1,152,152,152,0,1,152,152,152,0,1,152,152,152,0,1,152,152,152,1,1,152,152,152,0,-1,152,152,152,0,-1,152,152,152,0,-1,152,152,152,0,-1,152,152,152,0,-1,152,152,152,1,0,152,152,152,1,0,152,152,152,1,0,152,152,152,0,1,152,152,152,1,0,152,152,152,0,1,152,152,152,-1,0,152,152,152,-1,0,152,152,152,-1,0,152,152,152,0,3,152,152,152,1,0,152,152,152,1,0,152,152,152,1,-1,152,152,152,2,0,152,152,152,1,-1,152,152,152,1,-1,152,152,152,-1,-1,152,152,152,-1,-1,152,152,152,3,-1,152,152,152,0,1,152,152,152,0,1,152,152,152,0,1,152,152,152,0,1,152,152,152,0,1,152,152,152,0,1,152,152,152,1,-3,152,152,152,1,-1,152,152,152,1,-1,152,152,152,-1,3,152,152,152,1,1,152,152,152", "0", "no")
 end
 begin
     Mouse.Click("left")
 end
 if  Mouse.Button has been pressed within (ms)("left", "250")
     begin
          Macro.Pause("10")
     end
 begin
     Mouse.Move in direction("down", "60")
 end
 begin
     Macro.Pause("10")
 end
 begin
     Mouse.Click("left")
 end
 begin
     Macro.Pause("100")
 end
 begin
     Macro.Resume all paused macros()
 end



So what is the problem?

    Textual Effects can have up to 216 color combinations
    When creating more than 10 pixel pattern macros that all align to a specific color the detection starts to fall behind. By the time the grey pixel pattern detection kicks in it is several seconds behind and does not identify the *Ore* text fast enough.

So what have I tried?

I started with a sample of macros that covered 42? different color orientations for the same pattern. Running them concurrently did not work. Running them all under 1 master performed bad. Running them in sets of 5 with 1 master performed better, but still bad.

Here is my all-together Master macro code:
Code:
 begin
     Color.Flush screen dump cache()
 end
 begin
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 152,152,152", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,0,50", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,0,101", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,0,152", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,0,203", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,0,254", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,50,0", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,50,50", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,50,101", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,50,152", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,50,203", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,50,254", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,101,0", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,101,50", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,101,101", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,101,152", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,101,203", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,101,254", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,152,0", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,152,50", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,152,101", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,152,152", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,152,203", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,152,254", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,203,0", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,203,50", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,203,101", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,203,152", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,203,203", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,203,254", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,254,0", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,254,50", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,254,101", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,254,152", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,254,203", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 0,254,254", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 50,0,0", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 50,0,50", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 50,0,101", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 50,0,152", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 50,0,203", "no")
     Macro.Execute new("Ore Miner Final(2)", "Find Ore 50,0,254", "no")
 end
 


I changed:
    cache dump to 0, 25, 100 - no difference
    turned Directx capture on and off @ 200 - no difference
    applied manual screen dumps to the individual macros, master macro - no difference
    tried the macros using pixel pattern @ coordinates - no difference (usually made it worse; mouse would start in wrong location when running all concurrently)
    tried with only two master macro's; one for detection and one for movement - no difference
    tried throttling the macros to varying speeds from 10%-1000000% - no difference
    tried putting some of the detection and movements all in one macro - code got messy and did not work right
    tried adjusting image and object recognition values from 1-10 - no difference
    tried a bunch of different code configurations based on things I found on the forums, can't remember everything I tried.



My Rig:

i7-3.4GHz
16g Ram
MSI 960 Gtx 4gb card

I have no performance issues running all 43 macros concurrently - my processor hardly ever breaks 50% usage even with the game, firefox, BEM, and Gimp running.



Thoughts?

The one question I keep coming back to is whether a pixel pattern can have a variable assigned to it to recognize the (216) different color combinations that it could possibly have (in one macro; without a ton of code). I have never done a variable macro and couldn't get enough information (or at least understand it) off of the forums to do what I want to do. At the end of the day - the pattern is the same... the colors are constantly changing. I just need it to recognize the pattern, no matter the color.

Let me know what you think, any help is appreciated!


Top
 Profile  
Reply with quote  
 Post subject: Re: Need help with pixel detection for multiple colors
Thanked: 0 time(s)  Unread post Posted: Sat Dec 30, 2017 4:06 am 
Silver Contributor
Silver Contributor



Joined: Thu Aug 06, 2015 6:22 pm
Posts: 172
Been thanked: 57 time(s)
Has thanked: 14 time(s)
Contribution Points: 215
so is their like a number for those color beacons so u can play the game every time the game changes the color u take screenshot and take the pixel pattern of it
until u get them all or they always a different one.


Top
 Profile  
Reply with quote  
 Post subject: Re: Need help with pixel detection for multiple colors
Thanked: 0 time(s)  Unread post Posted: Sat Dec 30, 2017 4:13 am 
New User
New User



Joined: Fri Dec 29, 2017 9:13 pm
Posts: 3
Been thanked: 0 time(s)
Has thanked: 1 time(s)
Contribution Points: 13
GaNnOuT wrote:
so is their like a number for those color beacons so u can play the game every time the game changes the color u take screenshot and take the pixel pattern of it
until u get them all or they always a different one.


The beacons themselves are a very fast animation. I already tried to pixel pattern map a few of them and the animation happens too quickly for BEM to "see" it. That is why I am triggering off of the scrolling text above the animation - *Ore*. This text scrolls up for one second before changing to a new solid color as mentioned in my post above. The problem is that it can change into potentially 216 other solid colors, but the pattern remains the same.

Can't run 216 macro's to capture every color as BEM is lagging behind trying to sift through all of that before it can "see" the right color. I think I need a variable that can account for all possible solid colors relating back to the same pattern (since the text pattern never changes). I'm not sure how to go about doing this, if it is even possible. But if I can it will shrink everything down to one macro and should be easily executable.


Top
 Profile  
Reply with quote  
 Post subject: Re: Need help with pixel detection for multiple colors
Thanked: 0 time(s)  Unread post Posted: Sat Dec 30, 2017 4:24 am 
Silver Contributor
Silver Contributor



Joined: Thu Aug 06, 2015 6:22 pm
Posts: 172
Been thanked: 57 time(s)
Has thanked: 14 time(s)
Contribution Points: 215
is this ore text have even a little bit of color that never changes?


Top
 Profile  
Reply with quote  
 Post subject: Re: Need help with pixel detection for multiple colors
Thanked: 2 time(s)  Unread post Posted: Sat Dec 30, 2017 4:27 am 
Silver Contributor
Silver Contributor



Joined: Thu Aug 06, 2015 6:22 pm
Posts: 172
Been thanked: 57 time(s)
Has thanked: 14 time(s)
Contribution Points: 215
like in the picture can u just capture the black and pattern around the color blue of ore
like this https://ibb.co/gfPD1b


Top
 Profile  
Reply with quote  
 Post subject: Re: Need help with pixel detection for multiple colors
Thanked: 0 time(s)  Unread post Posted: Sat Dec 30, 2017 2:38 pm 
Partner / License admin
Partner / License admin
User avatar



Joined: Sun Oct 10, 2010 5:16 pm
Posts: 1783
Location: USA
Been thanked: 374 time(s)
Has thanked: 30 time(s)
Contribution Points: 16197
Any way you could capture a quick video of the ore text scrolling the colors...for testing purposes?

I would take a different approach to finding the changing colors. Since it seems to cycle through a known range of colors you could search for changes I would use something like this viewtopic.php?f=162&t=301 searching for a range of colors.

If it finds the color: use something like viewtopic.php?f=162&t=300 wait for the color to change...probably check that it changes a few times...then move on with mining or start the search over if it doesn't keep changing.

If it doesn't find the color: either use static groups of color ranges to look for or use variables like you mentioned to change the search parameters.

But nonetheless, using a range of colors would be much faster and efficient at finding the changing colors...so that's what I would try. If you post a video of the color changes, I'll test it out.

_________________
----------------------------------------Syrifina---------------------------------------------------
PM me for licenses and/or licensing information: Click Here
[Be sure to include and update your profile with your BE ID]

Forum Rules
Reminder of rules regarding Contribution points
Getting started in 1, 2, 3
Virtual Drivers; Manual Installers


Top
 Profile  
Reply with quote  
 Post subject: Re: Need help with pixel detection for multiple colors
Thanked: 0 time(s)  Unread post Posted: Sat Dec 30, 2017 3:42 pm 
New User
New User



Joined: Fri Dec 29, 2017 9:13 pm
Posts: 3
Been thanked: 0 time(s)
Has thanked: 1 time(s)
Contribution Points: 13
GaNnOuT wrote:
like in the picture can u just capture the black and pattern around the color blue of ore
like this https://ibb.co/gfPD1b


Thank you so much! I was getting so wrapped up in the changing colors that I did not even realize that there was a static border color for the text! Thank you given!


Syrifina wrote:
Any way you could capture a quick video of the ore text scrolling the colors...for testing purposes?

I would take a different approach to finding the changing colors. Since it seems to cycle through a known range of colors you could search for changes I would use something like this http://www.blueeye-macro.com/viewtopic.php?f=162&t=301 searching for a range of colors.

If it finds the color: use something like http://www.blueeye-macro.com/viewtopic.php?f=162&t=300 wait for the color to change...probably check that it changes a few times...then move on with mining or start the search over if it doesn't keep changing.

If it doesn't find the color: either use static groups of color ranges to look for or use variables like you mentioned to change the search parameters.

But nonetheless, using a range of colors would be much faster and efficient at finding the changing colors...so that's what I would try. If you post a video of the color changes, I'll test it out.



No need to dive into the complicated variables, as GaNnOuT pointed out above there is a static black border color around the text. I have confirmed by remapping to this border. I tweaked my code a little bit and now it is working flawlessly. Next step is to map the bot's pathing and rocks to mine, which will be a separate macro that gets paused when the detection macro is activated.

Thank you for your help as well! Once I get the entire setup complete I will share a video and if you want you can continue to play around with the color variables idea - something that would be good to know works anyways :)


Top
 Profile  
Reply with quote  
 Post subject: Re: Need help with pixel detection for multiple colors
Thanked: 0 time(s)  Unread post Posted: Sat Dec 30, 2017 10:04 pm 
Partner / License admin
Partner / License admin
User avatar



Joined: Sun Oct 10, 2010 5:16 pm
Posts: 1783
Location: USA
Been thanked: 374 time(s)
Has thanked: 30 time(s)
Contribution Points: 16197
Awesome! Glad you got it working and thanks to GaNnOuT :D

_________________
----------------------------------------Syrifina---------------------------------------------------
PM me for licenses and/or licensing information: Click Here
[Be sure to include and update your profile with your BE ID]

Forum Rules
Reminder of rules regarding Contribution points
Getting started in 1, 2, 3
Virtual Drivers; Manual Installers


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


You cannot post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group