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.
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.
Map.FullSearch¶
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();