SRL Archive - Research & Development Lounge

The future of Item DTMs and Bitmaps


Sir Ducksworthy

2012-06-26 12:11:42

Just a teaser <3
[YOUTUBE]G2I5dWGZn4g[/YOUTUBE]
Making a Database

Runaway

2012-06-26 12:12:50

Talk about a teaser; I can't load the video :p

nokkasiili

2012-06-26 12:26:16

From: leetsxc
Just a teaser <3
[YOUTUBE]G2I5dWGZn4g[/YOUTUBE]
Making a Database


Fixed video

Runaway

2012-06-26 12:30:52

Interesting… so this filters out points that are outside the x value of the first found black outline from each side? Cool concept. You'd be able to auto-update the bitmaps by grabbing a bitmap of the InvBox for items that aren't recognized, which would make it totally autonomous in theory, correct? :o

EDIT: I don't really use bitmaps so this is kind of a noob question, but is there bitmap shape tolerance? Specifically to deal with the annoying outline/shape changes Jagex is failing to throw off color bots with?

Sir Ducksworthy

2012-06-26 12:53:18

Lol ^ Sorry about that, I just wanted it to go Ninja 4 while.

Yeh so what it will do is filter it all out around the lines anything remaining, will just be flood filled.

The Bot will read the Up text and also create 3 Different Dtm's, just by Finding the black out line in each direction and then Finding the 3 Highest Color Counts and middle Tpa'ing them and adding different points in different parts to avoid the Jagex graphic failingness.

All of the Info will be stored into a .txt, I'll run it through the G.E when I have it working better the .txt can be read by the bot and used to Load the string bitmaps of your choice even from online.

Based Lord

2012-06-26 12:56:55

Seems like a fantastic idea, what are you going to do about the items changing though such as when the vial's top shortens ect.

Runaway

2012-06-26 13:01:45

From: leetsxc
Lol ^ Sorry about that, I just wanted it to go Ninja 4 while.

Yeh so what it will do is filter it all out around the lines anything remaining, will just be flood filled.

The Bot will read the Up text and also create 3 Different Dtm's, just by Finding the black out line in each direction and then Finding the 3 Highest Color Counts and middle Tpa'ing them and adding different points in different parts to avoid the Jagex graphic failingness.

All of the Info will be stored into a .txt, I'll run it through the G.E when I have it working better the .txt can be read by the bot and used to Load the string bitmaps of your choice even from online.


Awesome! This is a cool idea man! And eventually the txt file would be replaced with uploading the info straight to the db I'm assuming?

Question/suggestion though, why 3 DTM's? I personally think it would be more efficient to either do 2 or 4.

With 2: Get either the top color count or the top 2 color counts, set the N, E, S, W outlines to match the first color count, and the NE, SE, SW, NW outlines to match the second.

With 4: Get either the top color count or the top 4 color counts, find the N outline point and set 2 other points 10 degrees away from N (angle being measure from the center of color count). Then do that for E, S and W.

Just a suggestion, since DTM's using the outline color tend to be unreliable, it would be best to change the outline points more than the inner points to make sure an item can always be found.

Based Lord

2012-06-26 13:05:23

Ah scratch my questions you will have it check more than one :)

Master BAW

2012-06-26 15:15:34

Hey, this is a really cool idea!! I already thought of this one time but I didn't know how to make it :)

Are you also going to make BMP's and DTM's from the noted items?

Olly

2012-06-26 15:34:05

The deformed items will screw you over? Nice work none of a less.

Iambubbleman

2012-06-26 18:52:46

This is going to make scripting quite a bit easier :3

LordJashin

2012-06-29 16:34:37

Well the OUTLINE is like always black, and the same color. So you could just get the bounds of the outline (TPA it). Then do like TPAInTPA inside of the black outline, and compare. This looks pretty cool nice video u ninja'd it lol.

Runaway

2012-06-29 17:02:44

From: LordJashin
Well the OUTLINE is like always black, and the same color. So you could just get the bounds of the outline (TPA it). Then do like TPAInTPA inside of the black outline, and compare. This looks pretty cool nice video u ninja'd it lol.


Easier said than done :p There is no function for the "TPAInTPA" you're thinking of, and filling the area inside an outline is a lot harder than it sounds. I know cause I has proof!


function FillOutline(TPA: TPointArray; Vertical: Boolean): TPointArray;
var
Fill: T2DPointArray;
Bound, Temp: TPointArray;
P1, P2: TPoint;
lTemp, hBound, Res, Points, i: Integer;
Inside: Boolean;
begin
SetLength(Result, 0);
Points := 0;
Res := 0;
if (Length(TPA) > 0) then
begin
Bound := TPAFromBox(GetTPABounds(TPA));
if Vertical then
SortTPAByX(Bound, True)
else
SortTPAByY(Bound, True);
hBound := High(Bound);
for i := 0 to hBound do
begin

if Vertical then
begin
if Inside and (Bound[i].x > P1.x) then
Points := 0;
end else
begin
if Inside and (Bound[i].y > P1.y) then
Points := 0;
end;

Inside := (Points = 1);
if PointInTPA(Bound[i], TPA) then
begin
if (i + 1 < hBound) and PointInTPA(Bound[i + 1], TPA) then
Continue;
if Inside then
P2 := Bound[i]
else
P1 := Bound[i];
Inc(Points);
end;

if (Points > 1) then
begin
SetLength(Fill, Res + 1);
Fill[Res] := TPABetweenPoints(P1, P2, 1, 0);
Inc(Res);
Points := 0;
Continue;
end;

end;
Temp := MergeATPA(Fill);
lTemp := Length(Temp);
SetLength(Result, lTemp);
Result := Temp;
end;
end;

^ And it still has issues on quite a few items :(

TehNeonFishy

2012-06-29 17:28:20

Looks absolutely amazing :o

Joe

2012-06-29 21:15:12

You little tease, you!
Good work, looks sexy

LordJashin

2012-06-29 22:29:42

From: Runaway
Easier said than done :p There is no function for the "TPAInTPA" you're thinking of, and filling the area inside an outline is a lot harder than it sounds. I know cause I has proof!

^ And it still has issues on quite a few items :(


Mm, what about the TPA functions inside of here. I think most are ported from SRL/SIMBA, but I could be wrong. There is some TPAinTPA things in there.

I was thinking get all the black pixels that form the edge line into a TPA. I mean they are always the same color, and I don't think RS has any items with that color. Then you could use that TPA as the shape of the item (cuz you only got the border).

Runaway

2012-06-29 22:52:25

From: LordJashin
Mm, what about the TPA functions inside of here. I think most are ported from SRL/SIMBA, but I could be wrong. There is some TPAinTPA things in there.

I was thinking get all the black pixels that form the edge line into a TPA. I mean they are always the same color, and I don't think RS has any items with that color. Then you could use that TPA as the shape of the item (cuz you only got the border).


Yes, there are a few functions like that (and they are all from Simba), but their use is actually the total opposite of what you think it is ;)

For example, FindTPAInTPA() will search through both specified TPA's for matching points.

Thanks for posting this though, you've given me a new idea that might make mine way better :o

LordJashin

2012-06-29 23:02:51

The idea of exporting it, or using the outline as the shape? Or what? lols

Runaway

2012-06-29 23:09:28

From: LordJashin
The idea of exporting it, or using the outline as the shape? Or what? lols


Posting that list of functions :p I had totally forgotten about ReturnPointsNotInTPA… could possibly be the solution to all of my problems!

LordJashin

2012-06-29 23:43:49

From: Runaway
Posting that list of functions :p I had totally forgotten about ReturnPointsNotInTPA… could possibly be the solution to all of my problems!


Well the guy who ported those functions is using something like TPAinTPA for his Inventory Items. I don't know too much about all the TPA functions so I started making a utility for them. Maybe he made a new function for it, I'll check it out. This utility ain't much yet but its a start. Good idea for a delphi project, if I tried to learn them any other way I would just get bored.

EDIT: On that utility I did not steal that from ACA, made it myself actually, the Pixel zooming method.