[Request] MM Feature Request - Load and recognise image icon

Discuss, ask for help, share ideas, give suggestions, read tutorials, and tell us about bugs you have found with MicroMacro in here.

Do not post RoM-Bot stuff here. There is a subforum for that.
Forum rules
This is a sub-forum for things specific to MicroMacro.

This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
Post Reply
Message
Author
zer0
Posts: 213
Joined: Sat Feb 16, 2008 11:55 pm

[Request] MM Feature Request - Load and recognise image icon

#1 Post by zer0 » Thu Jan 15, 2009 7:13 am

This feature would be very handy indeed, the ability to load graphic image files (I need it for type .tga files), and be able to scan for that image in a given section of the GUI.

For example, party member icons on mini-maps: looking in the mini-map section and looking for party member icons. It would return the pos_x, pos_y relative to the area being scanned in.

Now this is what I plan to use it for, in Shaiya when you create a party it looks for other party members and tries to move to the closest member. This would be extremely handy, for example I could have a Virtual Machine running a healer, and have them follow the party, healing whenever required.
It would also have advantages with AoE groups and mayb even PvP. :)

Here are my function prototypes that may be handy:

Code: Select all

-- loads icon.
-- path of image file.
-- return icon resource.
loadIcon(path)

-- scan a rectangle for the icon specified.
-- @param hadc handle device context.
-- @param point x and y coords of screen offset.
-- @param rectangle width and height of rectangle to be scanned.
-- @param icon resource to be scanned.
-- @returns a table of x,y coordinates of icons found, false otherwise.
scanRectForIcon(hdc, point, rectangle, icon)
What do u guys think?

edit:
It would be good if it supported images that were sprite sheets.

And if this was implemented it could maybe even get character recognition working for Bitmap-based fonts. ^_^

User avatar
3cmSailorfuku
Posts: 354
Joined: Mon Jan 21, 2008 6:25 pm

Re: [Request] MM Feature Request - Load and recognise image icon

#2 Post by 3cmSailorfuku » Thu Jan 15, 2009 9:03 am

zer0 wrote:This feature would be very handy indeed, the ability to load graphic image files (I need it for type .tga files), and be able to scan for that image in a given section of the GUI.

For example, party member icons on mini-maps: looking in the mini-map section and looking for party member icons. It would return the pos_x, pos_y relative to the area being scanned in.

Now this is what I plan to use it for, in Shaiya when you create a party it looks for other party members and tries to move to the closest member. This would be extremely handy, for example I could have a Virtual Machine running a healer, and have them follow the party, healing whenever required.
It would also have advantages with AoE groups and mayb even PvP. :)

Here are my function prototypes that may be handy:

Code: Select all

-- loads icon.
-- path of image file.
-- return icon resource.
loadIcon(path)

-- scan a rectangle for the icon specified.
-- @param hadc handle device context.
-- @param point x and y coords of screen offset.
-- @param rectangle width and height of rectangle to be scanned.
-- @param icon resource to be scanned.
-- @returns a table of x,y coordinates of icons found, false otherwise.
scanRectForIcon(hdc, point, rectangle, icon)
What do u guys think?

edit:
It would be good if it supported images that were sprite sheets.

And if this was implemented it could maybe even get character recognition working for Bitmap-based fonts. ^_^
Perhaps you would be able to read the Chattext or anything with OCR methods, but I doubt you can follow party members efficiently with getting Bitmap data and match it. Though you could do this also by making an own GetPixel CRC method.

Anyway, for Elverion GetDibits might be an interresting function. It's supposed to be faster.

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: [Request] MM Feature Request - Load and recognise image icon

#3 Post by Administrator » Thu Jan 15, 2009 3:41 pm

The problem with these kinds of things is that they don't work all that well. Especially in newer games where all sorts of effects are applied (scaling, translating, rotating, blending, lighting, stencils, etc.). It would only give some decent results on games that are software-rendered and don't use libraries such as FBlend. Plus, it would be very, very slow.

This really sounds like more of a job for memory reading as it can be done, literally, millions of times faster.

zer0
Posts: 213
Joined: Sat Feb 16, 2008 11:55 pm

Re: [Request] MM Feature Request - Load and recognise image icon

#4 Post by zer0 » Thu Jan 15, 2009 8:02 pm

I always thought that speed might be an issue.

Well the thing is in Crysis most of the AI was gone into creating eyes and ears for the Enemies. And since your effectively trying to mimic a human, it would make sense to enable the visual recognition of objects. With effects you may be right, though for icons? I've taken a look at all the Shaiya icons and they don't seem to have change at all, mayb the brightness may be affecting the colour I'm not too sure. Pixel-based art usually doesn't have most of the effects you listed as it makes it end up looking terrible.

I could do it with just pixel colors I suppose however that can generate false positives, as I have been experiencing.

Problem with memory addresses is they are subject to change on every version release.

Mayb much later on I will code something like this for experimental purposes. ;)

User avatar
3cmSailorfuku
Posts: 354
Joined: Mon Jan 21, 2008 6:25 pm

Re: [Request] MM Feature Request - Load and recognise image icon

#5 Post by 3cmSailorfuku » Fri Jan 16, 2009 6:57 am

zer0 wrote:I always thought that speed might be an issue.

Well the thing is in Crysis most of the AI was gone into creating eyes and ears for the Enemies. And since your effectively trying to mimic a human, it would make sense to enable the visual recognition of objects. With effects you may be right, though for icons? I've taken a look at all the Shaiya icons and they don't seem to have change at all, mayb the brightness may be affecting the colour I'm not too sure. Pixel-based art usually doesn't have most of the effects you listed as it makes it end up looking terrible.
That's wrong. Crysis doesn't work by "Visual recognition". You should take a look at the DNA or whatever the name was for the C# Class to make games, they havea nice video presentation of how a structured AI works. Now if Crysis would use such thing it would be HARD to make the game run fluent at all with the amount of enemies. It's a misconception to believe that Crysis would have an AI like a real person, because the Strategylevel of an AI ALWAYS knows where you are. Based on that, multiple factors will trigger an alarm for the AI like gunshots etc. Those will be registered as Event, and execute a predefined pattern like _Search for the enemy_.
Like Elverion said, trying to find a reliable check on the memory is easier than that.

However, if you are hot to make a Sprite Regocnition like for Spells or anything that can't be easily done with Memory poking or GetPixel, I'd suggest you writing a directx hook. It's way easier, and you never have to update it except when the size of it changes. I can show you something similiar for Runes of Magic,
basically I'm logging what Materials are cached around my character and see what Texture it has loaded to sort them as Brass Vein, Balsa etc.;
http://www.bilderkiste.org/show/origina ... rommat.jpg
Like that, it is possible to see if a button, menu, animation, etc has been triggered or is visible.
You can also remove the blending on things, aslong it's not hardcoded.
zer0 wrote: I could do it with just pixel colors I suppose however that can generate false positives, as I have been experiencing.

Problem with memory addresses is they are subject to change on every version release.

Mayb much later on I will code something like this for experimental purposes. ;)
Loading & Matching a Bitmap isn't any different from GetPixel. Infact, every pixel gets loaded into the memory and matched on whatever you wish for.
I'd rather create a own CrC function for this, eg. Get 5 Pixels in a defined rectangle and hash them together. That is way faster, and you can have a little of tolerance.

Also, memory adresses aren't such a big deal either. Pattern Matching can solve this, after that you can use the old & new adress to recalculate all old adresses to work with the latest version.

zer0
Posts: 213
Joined: Sat Feb 16, 2008 11:55 pm

Re: [Request] MM Feature Request - Load and recognise image icon

#6 Post by zer0 » Fri Jan 16, 2009 8:34 am

I didn't mean that Crysis actually used monitoring the gfx, I guess it was a bad example. :D

Most of what you have said is beyond my knowledge, I don't even know how to write and inject DLL's. :P

Pattern matching I understand is implemented in the latest MM release and I haven't taken a look at that yet.

I understand a little about the image matching bitmap part with a CRC, that's a good idea but I wouldn't have the foggiest in how to implement it. ;)

I've already coded a match_pixels_in_rect function which is pretty much the same as pixelSearch except that it returns all matching pixels. I've tested the time, it was pretty slow for a 130x130 rect it takes around 3s give or take 1s.
Otherwise it doesn't work too bad so far, though the accuracy has to be around 5, which may generate false positives.

For Shaiya how would you locate the pointers of your party members, any ideas?? :/
If I could do that it would be best but it's a matter of locating memory and mayb reading a bunch of ASM which I'm not very good at.

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: [Request] MM Feature Request - Load and recognise image icon

#7 Post by Administrator » Fri Jan 16, 2009 2:11 pm

I'm pretty sure that Shaiya's party list is going to contain pointers to each player in the party. You should, then, be able to find a pointer to the player by targetting him and using the player's target. Now search for that pointer while this player is in your party, and one of the results should come from the party list. I haven't actually tested this, but it seems like it should work.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests