PDA

View Full Version : MM to MS demo



Citrus
05-12-2015, 11:00 PM
edit: I replaced minimap.pointsToMainscreen() with this in my PC script and it's a massive improvement. It's accurate ~90% of the time.
Got bored and started messing around.


https://www.youtube.com/watch?v=nqddsumPLBk
(sorry for garbage quality vid)

I'm manually changing the compass angle while the script is running to show how it tracks at any angle.

This function should work pretty well on flat land. I haven't made a non-manual calibration process yet (and probably never will).

function TPoint.MM2MS(): TPoint;
var
a, b, c, d, e, f, g, h: extended;
x: TExtendedArray;
begin
x := [
3.41898284234469, // a = fixed scale factor in X direction with scale Y unchanged.
-0.842020268789697, // b = scale factor in X direction proportional to Y distance from origin.
-2101.27407475151, // c = origin translation in X direction.
-0.0150738403260808, // d = scale factor in Y direction proportional to X distance from origin.
2.58817766359727, // e = fixed scale factor in Y direction with scale X unchanged.
-162.127294292026, // f = origin translation in Y direction.
-0.000237848858259821, // g = proportional scale factors X and Y in function of X.
-0.00286437539759803 // h = proportional scale factors X and Y in function of Y.
];

a := x[0]; b := x[1]; c := x[2]; d := x[3];
e := x[4]; f := x[5]; g := x[6]; h := x[7];
result.x := round((a*self.x + b*self.y +c)/(g*self.x + h*self.y +1));
result.y := round((d*self.x + e*self.y +f)/(g*self.x + h*self.y +1));
end;


This is where I got the method from:
http://www.corrmap.com/features/homography_transformation.php

Obscurity
05-12-2015, 11:10 PM
What about lower camera angles/different levels of zoom?

Citrus
05-12-2015, 11:19 PM
What about lower camera angles/different levels of zoom?

Nah. Low camera angles would be hard to make accurate and different levels of zoom would require more effort than I'm willing to put forth :p

Olly
05-12-2015, 11:19 PM
code? :p

Citrus
05-12-2015, 11:29 PM
code? :p

Half of it is in MATLAB, so I still have a lot of work to do before it's a single file

Sin
05-13-2015, 12:27 AM
Great work, looking forward to seeing the code :D

The Mayor
05-13-2015, 04:47 AM
Very nice!

cosmasjdz
05-13-2015, 05:08 AM
Nice. But there is a huge problem with this as it is rought especially when in action while rotating camera for example camera angle shifts to lower and espcially in bigger screen likes 1366x768 or 1920x1028 it isnt even close to accurate. As i only use this method to save computer resources scanning expanded box from the projected point instead of scanning whole screen. In lower distances like papayas collecting to remember spots you clicked i just used rotation and translation matrices, no perspective and it was accurate enough and camera angle shift wasnt significant at short distances but at long ones it has serious problems, cant rely only on mmtoms transformation also because pixels tend to be shifted from their actual possition on the minimap too. And the bigger the screen the higher innacuracy apears compared to using mainscreen objects. But if they arent possible or accurate enough then this method is totally worth trying.

Iv used this method to lower search boxes in qbd script as i runned in fullscreen and high resolution. Also used vector determinant to tell if i am in the water or on the land regardless of camera angle. And some other vector stuff to dodge firewall while ranging. Tried to grab qbd using solely mmtoms transformation wasnt succesfull enough because the bigger the screen the higher innacuracy apears even with very low camera shifts, and shifting it up every time you rotate camera is bottish. So came back to color functions but decreasing search area is extremely benefitial computer resources wise.

And i think i used 3.378 for x shift, other constants close to yours. might have been my problem with innacurate counting of those constants, might try urs ones maybe will work better :). Would like to see how you got those estimations. Also if i remember correctly i had different constants calculated using different resolutions somehow, not sure now, as that is abandoned few months now as having really hard exams atm.

Citrus
05-13-2015, 05:43 AM
...

It's only meant to work at the highest camera angle, zoomed all the way out. I pretty much never move the camera in any of my scripts, so it's good enough for me. My only use for it currently is my PC script, which was previously using the SRL version. It was pretty inaccurate so I made my own. I might use it in the future if I'm too lazy to pick colors or something.
You'd probably have to recalibrate it at different resolutions. I use SRL, so my setup is always the same.

I calibrated it by dropping an item on the ground and positioning myself and the camera such that the object was in the corner of the mainscreen. From there you can easily get the tpoints for the object on both the mainscreen and the minimap. Repeat this for each corner then solve the system to get the scaling factors.

Zyt3x
05-13-2015, 09:56 PM
Good work! :) That's pretty cool

Clarity
05-14-2015, 02:38 AM
Aww I got excited at the title...still good work though. Thanks for sharing :)

Taric
05-14-2015, 03:25 AM
Aww I got excited at the title...still good work though. Thanks for sharing :)

Shouldn't you already have something like this for your dungeoneering script? *COUGH COUGH NUDGE NUDGE* :p

Clarity
05-14-2015, 03:57 AM
Shouldn't you already have something like this for your dungeoneering script? *COUGH COUGH NUDGE NUDGE* :p

I did mess around with zmon's 3D projection for a solid 72 hours before giving up, with the correct constant camera angle/full zoom out it is very powerful. Unfortunately in my OGL scripts (and DG specifically, since you asked) I am rotating the camera/changing zoom constantly, so I need something that is compatible with any camera angle or zoom level. I have not had the time to learn the math necessary for that, and haven't been able to find something already on the forums.

And yes, you do need to rotate the camera/zoom in a DG script that is believably human/at a tolerable efficiency. The south portion of a room, in particular, the door, is always obstructed from view by the southern wall. One could hover the mouse randomly until it finds some overtext I suppose but that's a pretty silly alternative to me...that would scream botting.

Hence my excitement in thinking all my problems were solved :)

Olly
05-14-2015, 04:30 AM
I suppose i will add this to srl-6 soon.. :p

Citrus
05-14-2015, 04:33 AM
And yes, you do need to rotate the camera/zoom in a DG script that is believably human/at a tolerable efficiency. The south portion of a room, in particular, the door, is always obstructed from view by the southern wall.

Wouldn't compass rotation alone be enough though? I wouldn't think you'd need compass, mainscreen, AND zoom adjustments.
Although I can't really talk since I've been putting off a DG scripts for quite some time now.. I'll do it someday


One could hover the mouse randomly until it finds some overtext I suppose but that's a pretty silly alternative to me...that would scream botting.

I do this all the time :p I'm really lazy about picking colors

Obscurity
05-14-2015, 08:53 PM
Wouldn't compass rotation alone be enough though? I wouldn't think you'd need compass, mainscreen, AND zoom adjustments.
Camera height, rotation, zoom, and client size all need to be considered if you're looking for accuracy.

Olly
05-14-2015, 10:23 PM
It depends what accuracy you want though, Personally I just use mmtoms to give me a tiny search box to search something in (like a 60x60 box). And is more than perfect for that.

You may not even be able to get it accurate 100% with ogl (with the right hooks) because jagex shift the minimap dots slightly so they're not aligned from mm tile to ms tile (atleast they used to, there is a thread on here somewhere).

imalama101
05-02-2022, 12:00 AM
Resolved.