Image Map¶
This file is responsible for the TImageMap positioning system. It’s heavily based on slacky’s original TRSWalker and while it might look different the logic related to positioning should be the exact same.
The way it works is that you load it with an image (.png or .bmp) and you can retrive your position on that image by finding the most similar place to your Minimap on the image.
EPositionMode enum¶
EPositionMode = enum(SPEED, ACCURACY);
Enum representing the modes that Image Map can use.
The default mode is EPositionMode.SPEED.
EPositionMode.ACCURACY gives you between 0-30% more accuracy at the cost of
almost half the speed and is generally not worth while unless you really are
having positioning issues.
Use ImageMap.DebugPosition and plan accordingly whether this is worth using or not.
TRSMapSample¶
Record used to customize the sample retrieved from the minimap for TRSMap.
TRSImageMap¶
Record responsible for positioning.
ImageMap.Setup¶
procedure TRSImageMap.Setup(path: String; downscale: UInt32 = 8);
Sets up a TRSImageMap.
ImageMap.ScaledSearch¶
function TRSImageMap.ScaledSearch(img: TImage): TPointArray;
Internal TRSImageMap method used to get an initial TPointArray of possible positions.
This is performed in a downscaled map with a downscaled minimap.
This is very innacurate by itself but by ruling down most of the map in a downscaled search before doing a full sized search speed has a dramatic boost.
You probably won’t ever need to call this directly.
ImageMap.FullSearch¶
function TRSImageMap.FullSearchEx(const template, map: TImage; position: TPoint; scale: UInt32; out match: Single): TPoint; static;
function TRSImageMap.FullSearch(template, map: TImage; position: TPoint; out match: Single): TPoint;
Internal TRSImageMap method used to get the player position.
This is used by ImageMap.Position to determine how likely is the
position passed in, our actual position.
This likelyhood is returned with match which ranges from 0.0 to 1.0.
You probably won’t ever need to call this directly.
ImageMap.Position¶
function TRSImageMap.Position(): TPoint;
Returns the players current position on the loaded map image.
Example:
WriteLn(ImageMap.Position());
WriteLn(ImageMap.Similarity); // Check to see the match percentage if needed
ImageMap.DebugPosition¶
function TRSImageMap.DebugPosition(): TPoint;
Debugs the player position in the currently loaded map image.
Example:
Map.Setup(...);
while True do
Map.DebugPosition();