Presenting RSWalker (RSW)
What is RSW?
- It can give you the pixel/point where you are standing (on the world map) with decent accuracy.
- It allows you to walk long distances as well as short once.
- It uses image-processing to locate your position (image cross-correlation) (color)
- It does not use reflection, and works without SMART.
- It can, if preferred scan through your memory to find a map-chunk of the area your are in (works in official client, as well as in SMART) this is used to speed it up.
- It's quite fast!
Motivation
First of SPS doesn't really work for OSR, and some has turned to use some proto-typeish code I wrote some time ago (the so-called SEWalker) which ain't that much better then SPS. Due to this I figured I had to try to make something that works well, and the fact that @Olly kept bugging me about writing a new walker weighted in a bit, I guess.
The performance was better than what I initially expected (before I started working on it): Every test I've ran seems to have been able to quite precisely pinpoint my position (we are talking off by a few tiles at worst), and if I recall correctly it used around 50-60ms on my computer to find my world-position (yes, with the whole world map loaded), tho all my tests are with memory scanning enabled, and that increases the speed and accuracy.
"Memory scanning"?
The idea was simple, many of us has used tools like Cheat-Engine to find stored values in a single-player games (then modify it eg to get a bit more money ingame). RSW uses the same technique as Cheat-Engine uses to search through the memory owned by any process for a particular value (it doesn't modify anything). This is quite straight forward, and I believe it's fairly safe to do so, you are just parsing through your computes own RAM, right (no fancy-schmacy stuff).
The steps we take:
- Search for a bitmap in the client using for example known information like the images size, then store it's address. This search must be insensitive to changes like reordering of class-fields.
- Grab your ingame minimap (the normal way), and cross-correlates that image to the chunk we grabbed from the clients memory.
-- Proceed to extract the best highest rated match from the cross-correlation. Call it our "local position",
-- This is quite useless by itself since it's varies. - We crop out a 200x200 bitmap around the "local position" from the chunk we grabbed (This gives us a nice looking ~200x200 bitmap around our player).
- Using that 200x200 minimap, we cross-correlate it with the "world map" (a map image loaded when you initialized RSWalker).
- -- Again, we proceed to extract the highest rated match. The result of this is our global position.
The the correlation of our new 200x200 minimap to the world map only happens every time the image in the clients memory is changed, this saves us a lot of time.
How to use in a script
So, version 1 and beyond will be specialized towards SRL, and requires a Simba 1.2 build which you just use instead of your regular Simba (place it in the same old folder).
delphi Code:
{$I SRL/OSR.simba}
{$I RSWalker/Walker.simba}
var
RSW: TRSWalker;
path: TPointArray;
begin
//How to init depends on your usage:
//* Default : RSW.Init('world.png'); { Automatic detection }
//* if SMART : RSW.Init('world.png', SMART.PID); { or whatever it's named in your include }
//* no memscan : RSW.Init('world.png', -1);
RSW.Init('world.png');
AddOnTerminate(@RSW.Free); // automatic free once script shuts down
//alternative setup (default works fine tho)
RSW.skipClose := 25; //how close to the target point before we try to click the next point.
path := [Point(4171, 3457), Point(4136, 3444)]; //some path
end.
Use it to get your world position
Should be quite simple:
1. initialize it with the world bitmap you have (there is one shipped with RSW: `world.png`)
2. call MyWalker.GetMyPos();
delphi Code:
{$I SRL/OSR.simba}
{$I RSWalker/Walker.simba}
var
RSW:TRSWalker;
t:UInt32;
begin
RSW.Init('world.png');
WriteLn('RSW is setup!');
// The first scan is a lot slower then the next scans, it's used to setup stuff..
t := GetTimeRunning();
WriteLn('I am here: ', RSW.GetMyPos(), ' used: ', GetTimeRunning()-t,'ms');
// scan again.. this time it will be pretty much "instant".. same for all of the future times.
t := GetTimeRunning();
WriteLn('I am here: ', RSW.GetMyPos(), ' used: ', GetTimeRunning()-t,'ms');
// one more time to prove my point..:
t := GetTimeRunning();
WriteLn('I am still here: ', RSW.GetMyPos(), ' used: ', GetTimeRunning()-t,'ms');
RSW.Free();
end.
You should keep in mind that the bitmap `world.png` is very large, you might wanna crop out a smaller part of that bitmap around where you want to use it, both to save memory, and to speed up initialization of your script. Tho it's not needed, I use the whole world map all the time
Other notes
- As of version 1, RSWalker requires you to use SRL
- MemScan only works on Windows (with 32bit Simba), and with Lape as your interpreter, and 32bit Java.
- Path making is done in the same way as with SPS. Open any SPS path-making tool, load your map, make a path, copy the path to your script... done.
- Supports "blindwalk" in the WalkPath function, so you can for example supply it a single point of where you want to walk to that's far away.
- There now exists handling for loading particular "map pieces" (like sps does). I have yet to document this.
- It's shipped with a script to grab world map pieces so you create your own custom maps, it's located in the folder `maps` under the name `MapGrabber.simba`.
- With mem-scanning enabled you must provide a map that's extra large, it has a 100px radius which will be "non-walkable", while without mem-scanning it has an extra 55px which is "non-walkable" (or there-about):
Your path must be outside the "none-walkable" area, if it's not, then you need a larger map.
Credits
A thanks to @Olly, he was the one who "manually" (using CheatEngine) parsed through the memory and came across the minimap-buffer, once he found it, and told me about it I started playing around with this idea; Make the search for it "automatic"... And after a little back and forward, some playing around and so on, this walker was created. I didn't really focus on writing pretty code, as it wasn't like super-interesting, just knew we needed something reliable.
Download, and install it
- Download it: https://github.com/slackydev/RSWalker/releases (Download the one tagged: Latest release)
- Extract it to your `Includes`-Folder (usually located in `C:\Simba\`)
A nice and useful path making tool: https://github.com/TheTS/SPSToolbox/tree/2