SRL Archive - Help and Support

DTM Partial Accuracy?


Heysus

2009-12-15 17:48:39

I don't think this is possible but…

What I need is a function that can find a DTM even if it can only find 8 out of the 10 points.

Blumblebee

2009-12-15 17:53:12

try a DDTM with some if..then statements, or a case statement in conjunction with some parameters?

Gu3st...

2009-12-15 17:54:13

Why have the two last points? :)
You could try to make your own DTM by using FindColorsTolerance on MainPoint and checking distance and stuff with the SubPoints and then checking how many points that were found

Heysus

2009-12-15 18:01:50

From: Blumblebee
try a DDTM with some if..then statements, or a case statement in conjunction with some parameters?


That would work if I just had a few points. But if i have like 10+ if would lag a lot. and atm i'm using 64 points


From: Zyt3x
Why have the two last points? :)
You could try to make your own DTM by using FindColorsTolerance on MainPoint and checking distance and stuff with the SubPoints and then checking how many points that were found


The problem is i don't know which points are the ones that aren't being found.
Its a DDTM that is being made during runtime. Sometimes drop dots and player dots get in the way.

Gu3st...

2009-12-15 18:13:50

From: Heysus
The problem is i don't know which points are the ones that aren't being found.
Its a DDTM that is being made during runtime. Sometimes drop dots and player dots get in the way.

function FindDTM2(var x, y : Integer; MainPoint : TPoint; SubPoints : TPointArray; MainPointCol : Integer; SubPointsCol : TIntegerArray; x1, y1, x2, y2, Tol : Integer): Boolean;
var
TPA : TPointArray;
H1, H2, I1, I2, D : Integer
begin
Result := False;
if not FindColorsTolerance(TPA, MainPointCol, x1, y1, x2, y2, Tol) then Exit;
H1 := High(TPA);
for I1 := 0 to H1 do
begin
H2 := High(SubPoints);
for I2 := 0 to H2 do
begin
if GetColor(MainPoint.x+abs(MainPoint.x-SubPoints[I2]) = SubPointsCol[I2] then
Inc(D);
end;
end;
WriteLn(IntToStr(D));
end;
or something like that.. I haven't tested it, I did not use SCAR to write the code, and I am extremely tired so it probably wouldn't work, but I hope you get my point.. That is how I would have done it, but I am sure there is other, better ways

Heysus

2009-12-15 18:45:53

From: Zyt3x
function FindDTM2(var x, y : Integer; MainPoint : TPoint; SubPoints : TPointArray; MainPointCol : Integer; SubPointsCol : TIntegerArray; x1, y1, x2, y2, Tol : Integer): Boolean;
var
TPA : TPointArray;
H1, H2, I1, I2, D : Integer
begin
Result := False;
if not FindColorsTolerance(TPA, MainPointCol, x1, y1, x2, y2, Tol) then Exit;
H1 := High(TPA);
for I1 := 0 to H1 do
begin
H2 := High(SubPoints);
for I2 := 0 to H2 do
begin
if GetColor(MainPoint.x+abs(MainPoint.x-SubPoints[I2]) = SubPointsCol[I2] then
Inc(D);
end;
end;
WriteLn(IntToStr(D));
end;
or something like that.. I haven't tested it, I did not use SCAR to write the code, and I am extremely tired so it probably wouldn't work, but I hope you get my point.. That is how I would have done it, but I am sure there is other, better ways


Interesting idea, i'll see if i can make it work

noidea

2009-12-15 21:53:34

I'm like 100% sure you can cut down those 64 points to like at least 20 if this is rs related.

What is the for?

Heysus

2009-12-15 22:35:30

From: noidea
I'm like 100% sure you can cut down those 64 points to like at least 20 if this is rs related.

What is the for?


Its supposed to make a DDTM of the minimap and then find the DDTM on a pre-made bmp to get my characters location.

64 is probrably a bit overkill but i was using 16 before and 64 is more accurate.

Quickmarch

2009-12-16 05:12:03

Why not divide the point indexs by 8, then it would spread them evenly over the object and you wouldn't have so many sub-points.

The Claw

2009-12-16 06:24:46

Thats a pretty good idea, although the colours change quite a bit with each area-load. Keep us posted on how it goes

Baked0420

2009-12-16 06:40:13

I was thinking of making a DDTM to find my characters location on a pre-made bmp too, I wasn't sure how I was gonna search my bmp though, and not RS, I didn't try anything yet, was just thinking about it.

mixster

2009-12-16 17:40:45

DDTM then loop through it increasing one points tolerance to over 9000 or 422 (422 is the highest tolerance if memory serves). Simplest method to do it - making your own DTM-like functions will be incredibly slow compared to Scar's. The best shot of making a faster implementation though would be to not use D/DTM's and just assume near direct north or turn them into north based co-ordinates then make use of FindColors functions to allow you to get all the main points first then search for ones with enough points rather than trying to find with all points, then one missing, then two missing etc.

Heysus

2009-12-16 18:26:29

From: mixster
DDTM then loop through it increasing one points tolerance to over 9000 or 422 (422 is the highest tolerance if memory serves). Simplest method to do it - making your own DTM-like functions will be incredibly slow compared to Scar's. The best shot of making a faster implementation though would be to not use D/DTM's and just assume near direct north or turn them into north based co-ordinates then make use of FindColors functions to allow you to get all the main points first then search for ones with enough points rather than trying to find with all points, then one missing, then two missing etc.


Actually it wasn't that slow. But your right it is a lot slower than scars.

I think i'm just going to have to edit all the NPC dots and symbols out of my bitmap and use the regular dtm functions.

marpis

2009-12-22 20:43:34

I actually once wrote my own DTM system to see if I could make it faster than the current one, and I ofcourse failes :rolleyes: What was better in mine was that you could declare AreaWidth and AreaHeight rather than AreaSize, but those weren't actually rotated while the subpoints were so the search area was distorted if the DTM was very skewed. But it worked! Too bad I lost it when my computer broke, I could have simply made it result the amount of subpoints found… I could rewrite it but I don't feel like it atm. Maybe some day :)