SRL Archive - Discussions and Debates

on a mission for perfect north


ruler

2007-02-16 12:44:08

I am working on algothrims to determine perfect north, in order to walk mroe accuratly. any suggestions?

tarajunky

2007-02-16 13:20:22

Most walls/buildings are oriented perfectly north, so using the white lines on the minimap is probably the best.

I guess there are two strategies.

1) Make the minimap perfectly north, and adjust regularly to keep it that way.

2) Make the minimap north-ish, then calculate how far from true north you actually are. Then use this offset calculation to change how you walk. In this case, you can simply check the offset reguarly and don't have to move the compass around.

In SCAR I would make a DTM of a straight line, then do a FindDTMRotated or something like that to determine the offset. This would only work if there is a wall on the minimap, but most destinations should have walls around.

I posted a makecompass function to make the lines perfectly straight here on the forum in the last couple of weeks.

http://www.srl-forums.com/forum/showpost.php?p=55506&postcount=8

ruler

2007-02-16 13:43:07

ok you look for minimap features like streight lines or dtms. So do you keep rotating until the condition is valid or do you calculate how much to rotate to validate the condition?

I got a way to count the number of visable exact tiles on the minimap. The count is the highest when the mm is perfectly aligned NORTH, SOUTH, EAST,WEST. The problem is have to rotate a little to grab data. Working on getting around that issue.

by perfect i mean the actual minimap not compass. The compass seems to have a much larger offset then i thought.

Starblaster100

2007-02-16 16:16:48

as tara said, we would use DTMRotated in SCAR. The beauty of this function is it also returns the angle at which the function had to rotate the DTM to actually match it up to about 8 decimal places. By knowing this angle, you can then rotate a perfect amount (In theory) to obtain perfect north

tarajunky

2007-02-16 16:24:37

From: Starblaster100
as tara said, we would use DTMRotated in SCAR. The beauty of this function is it also returns the angle at which the function had to rotate the DTM to actually match it up to about 8 decimal places. By knowing this angle, you can then rotate a perfect amount (In theory) to obtain perfect north


Yes, or you can use just add the offset to your anglewalking and not worry about making the compass "perfect"

ruler

2007-02-16 16:41:29

From: tarajunky
Yes, or you can use just add the offset to your anglewalking and not worry about making the compass "perfect"

i thought it was random and changed.


From: Starblaster100
as tara said, we would use DTMRotated in SCAR. The beauty of this function is it also returns the angle at which the function had to rotate the DTM to actually match it up to about 8 decimal places. By knowing this angle, you can then rotate a perfect amount (In theory) to obtain perfect north

how long does ti take for 2 decimal accuracry?

Starblaster100

2007-02-16 18:18:47

milliseconds…

ruler

2007-02-22 08:35:04

Arg about 1k lines wasted on solutions that failed to be effective.

I tried playing with dtms but i found them to hard to auto generate and reuse. Tried bitmaps, and HSL's.

Now following roads and finding colors in arcs.

Killerdou

2007-02-22 09:06:18

well what i did was the following, make where you have to walk to with radialroadwalk when your screen is about north, and then at the top of each walking procedure:
Angle := FindCompassAngle
and then with every RadialRoadWalk i used e.g. RadialRoadWalk(RoadColor, 100 - Angle, 110 - Angle, 60, 1, 1) it works perfectly:) but im pretty sure there was a function that found a line and gave the first and last coordinates, if these are above or next to each other, it is north/south/east/west, and you can use the FindCompassAngle to see which one it is… but i have no idea where to find that function, maybe others know that

ruler

2007-02-22 17:00:16

Does RadialRoadWalk make arc's ? If so then that is like my solution. In my solutions i also use if i am on a road what road can i reach. Also i select cloestest match on the road so it clicks on the center of the road instead of first road found.

I was able to count the Tiles on the screen, the problem was i had to rotate the minimap manually to get a accurate count. I tried rotating it by take a screenshot and rotating it in memory.

WT-Fakawi

2007-02-22 17:17:43

Could you rephrase that last post ruler? You haven't, at least to me, made a clear point. I am afraid I dont quite follow you…

Avaphi

2007-02-22 18:50:56

Ruler: I think I know a fantastic solution if anyone is up to the task. There is now definetly NO WAY you can align(perfectly like you want to) just by simply looking at the MM Compass. Instead you will need the script to find a Wall(White Line) or Ladder, and align them until they are perfect. TBH, I think I will be able to make a procedure based on a friends(but it got deleted -.-) that will align to a ladder, maybe ill make one that can align to a wall aswell. Be back soon….

Avaphi

Boreas

2007-02-22 19:24:13

From: Avaphi
Ruler: I think I know a fantastic solution if anyone is up to the task. There is now definetly NO WAY you can align(perfectly like you want to) just by simply looking at the MM Compass. Instead you will need the script to find a Wall(White Line) or Ladder, and align them until they are perfect. TBH, I think I will be able to make a procedure based on a friends(but it got deleted -.-) that will align to a ladder, maybe ill make one that can align to a wall aswell. Be back soon….

Avaphi


It's around somewhere, I don't remember where I saw it though.

ruler

2007-02-22 23:01:47

I wrote a procedure to align the map with north but the difficult was i it has to manually mvoe the compass around till it got the highest count of "tile masks".

Tile masks being a 4 pixle by 4 pixle bitmask and seperate masks 1pixle x 4 pixle on each site and bitmap anything's on the corner. So bascially a 6 pixle x 6 pixle box with about 5 pieces.

I counted the tiles and got the highest count when the compass was aligned with north,south,east,west.

The difficult i had i could not calculate accuratly the highest without actually moveing the compass, i tried grabbing the minimap and spinning and counting each angle's boxs.

This is what i currently due for now. Using arc's and roads.

The question is does RadialRoadWalk make arc's

Yakman

2007-02-23 10:18:42

RadialRoadWalk works with maths

one equation of a circle is.

x:= Sin(i) * Radius
y:= Cos(i) * Radius

for 0<i<360

the way we use it is choose the Start I and End I, then use a for loop to make an arc from that

this is a tutorial for how to use the RadialWalk functions
http://www.villavu.com/forum/showthread.php?t=372?t=452

there is also a Scar Script i made which shows how it works
its in SCAR 2.03IncludesSRLScriptsRadial Walking Aid.scar
it has a form (or GUI) and 3 edit boxes with a button that starts the drawing
read the comments in the script for a fuller explaination

this is what it would look like in java, except the Degrees/Radians convesion might be wrong

public static RadialWalk(int StartRadial, int EndRadial, int Radius) {

int x=0;
int y=0;
if( StartRadial > EndRadial) {
while(Radius > 4){
for(int i=StartRadial;i!=EndRadial;i--){
x= (int)(Math.sin(i/180*Math.PI) * Radius) + //Coordinate for Minimap Center x
y= (int)(-Math.cos(i/180*Math.PI) * Radius) + //coordiante for minimap center y
//minus sign because computer graphics start from the top
if( /*method for finding the road color*/){
//method for clicking mouse
//method for waiting for flag
return;
}
}
Radius = Radius - 4; //makes the arc radius smaller, until its less than 4
}
}else
if( StartRadial < EndRadial) { //same thing but reversed, allows for arcs in both direction
while(Radius > 4){
for(int i=StartRadial;i!=EndRadial;i++){
x= (int)(Math.sin(i/180*Math.PI) * Radius) + //Coordinate for Minimap Center x
y= (int)(-Math.cos(i/180*Math.PI) * Radius) + //coordiante for minimap center y
//minus sign because computer graphics start from the top
if( /*method for finding the road color*/){
//method for clicking mouse
//method for waiting for flag
return;
}
}
Radius = Radius - 4; //makes the arc radius smaller, until its less than 4
}
}
} //end of method

ruler

2007-02-26 16:53:28

does it just test red dots or does it test everything also between the red lines.

I am using arcs as a corner stone for walking and making systems on top of it. I can produce walking code using human input but it is still not flawless.

Yakman

2007-02-26 18:14:48

the RadialWalk in SRL only scans on the red lines
thats because at the end of each loop, the Radius is reduced by 4,
i dont know the reason but it was probably seen as overkill or something

that arc thing isnt just used in walking, theres a flag-waiting procedure which uses them to test the radius (therefore distance) and see if the red color is there, it only checks for red at that distance, instead of finding the flag then working the distance. its FFlag()

theres also a function which uses arcs to find items on the main screen, i think its called FindObjRadial

a find compass angle function also uses these arcs to find it, i cant remember if we still use it, but i think someone may have written a delphi plugin for a better FindCompassAngle

Avaphi

2007-02-26 18:59:53

I made a function called FindObjRadial :] We should come together and create one awesome Function… Although the question remains, is it to detectable to return to the same or near angle every time you run a script ?

ruler

2007-02-27 02:43:53

FindObjRadial
If your talking about game screen, we dont use any arcs, radials.

We use solely squares and densities.
http://rscheata.net/images/cluster.JPG

What would be the advantages of arcs?, i am guessing you are using MM locations to fine tune where a object should be on screen?

but why use those when one has abilities like toptext and menu text to assist?

Avaphi

2007-02-27 03:10:32

The way my function works is that it reverses the way that radial walk goes(It goes inwards out, in my function.) while scanning for colors, though ruler you may and probably are right about it merely scanning in boxes…

ruler

2007-02-27 09:44:12

I have solved walking.

http://www.rscheata.net/tp/index.php/topic,2691.msg25140.html#msg25140

Paths can be constructed without even logging into the game.

Avaphi

2007-02-27 20:01:44

Once again I will ask, how hard will this be to convert and will it require a plugin? Thanks ruler, it looks really nice :D

ruler

2007-02-28 06:15:28

nothing is hard but the issue is all these things would req access into the core of scar which hands off.

ruler

2007-02-28 06:55:43

well it can be written as a plugin, but then you have to write all your lower
level functions also. But their is the issue of it using parts of the java math library and graphics libs. So those equivlent features will have to be found and included in the plugins.