RSWalker icon indicating copy to clipboard operation
RSWalker copied to clipboard

Implementation

Open takelley1 opened this issue 4 years ago • 3 comments

Hi Olly,

I'm writing my own bot in Python and can't read Pascal or Simba code. I looked through your code and I'm still having trouble understanding the actual implementation. I'm curious as to how exactly you implemented locating the character on the world map so quickly.

Do you just take a screenshot of the minimap and find a match for it on the world map? How do you do it so quickly? What is the purpose of all the map chunk images? How do you find a match if the player is surrounded by other player characters and the minimap is crowded with white dots?

Thank you!

takelley1 avatar May 27 '20 18:05 takelley1

Hey, I never got a email about this issue, weird!

First off, it uses opencv's match template for the image matching.

It is "quick" because with the initial search both templates (world map & minimap sample) have been downsampled a lot (6x by default).

Once that initial search is done, a "normal" search with no downsampling is done around the location the initial search returned.

The purpose of the map chunks is because if your bot is only operating in varrock it's pointless scanning the entire world map so you can select chunk(s) to use as the world map.

Player dots are a problem, mostly only at the GE but RS walker can attempt to filter them out by locating the dots, and filling them with the nearest available color that isn't a dot. https://github.com/ollydev/RSWalker/blob/Simba1300/Utilities.pas#L135

ollydev avatar May 31 '20 15:05 ollydev

Hey Olly, thanks for getting back to me!

The info you provided is fantastic, just a few more quick questions:

It looks like you manually removed all the labels from the world map. This makes sense because the minimap doesn't have any labels, so template matching would cause issues if the player was at a location where there was a label on the world map. Did you do this in Photoshop? How did you determine the color of the tiles below the labels? (sounds like it took a lot of work!)

You also removed all the icons the world map (e.g. banks, mining spots, shop icons, etc.) -- this doesn't make as much sense to me. The minimap has these icons, so wouldn't template matching be improved by keeping them? If you're in a location with a lot of icons on the minimap, but the world map is missing all those icons in that location, wouldn't the template matching be a lot less accurate? Wouldn't you have to reduce the confidence in OpenCV a lot more than necessary in order to find a match?

takelley1 avatar May 31 '20 18:05 takelley1

The maps were dumped by reading the local map buffer in memory, this was pre runelite but now you can just use the instance map, or even dump the maps from cache. This is also why there is no symbols.

We don't care about confidence, RSWalker just blindly pick the best match. The confidence varys too much from location to location to have a steady "this is a good match" value.

ollydev avatar May 31 '20 21:05 ollydev