Author Topic: C++ Bot, Color Problem (No .NET)  (Read 3339 times)

Offline Freddy

  • Owner
  • *****
  • Posts: 2614
  • Rep: 19
    • MSN Messenger - freddy1990@gmail.com
    • AOL Instant Messenger - Freddy199O
    • View Profile
    • Email
Re: C++ Bot, Color Problem (No .NET)
« Reply #15 on: December 13, 2009, 05:51:34 am »
256 colors might eb the answer for you, don't know, for most games and such it's not that useful

Freddy1990.com

Re: C++ Bot, Color Problem (No .NET)
« Reply #15 on: December 13, 2009, 05:51:34 am »

tvirusx1

  • Guest
Re: C++ Bot, Color Problem (No .NET)
« Reply #16 on: December 27, 2009, 12:03:25 am »
I finally found out why it didn't work properly.

It only scanned X:0-815, and y stayed always 0.
But heres another Problem, it takes about 517 seconds to scan the whole screen, because, it takes roughly 1 Second to Scan x: 0-815, once x reaches 815 y = y +1;
Is there any way to make it faster?

EDIT:
With cout it takes 517 without cout it takes about half the time (I think).
Slowly I am having my doubts that this method (BitBlt) which I am using is good, Is there any better way to Search for Colors?

I've already tried:
GetPixel() - too slow
BitBlt()    - too slow



An Idea:
Is there a way to save all pixel Coords and Colors into a variable and then compare all of the data to a single color at once?

« Last Edit: December 27, 2009, 12:22:55 am by tvirusx1 »

Freddy1990.com

Re: C++ Bot, Color Problem (No .NET)
« Reply #16 on: December 27, 2009, 12:03:25 am »

Offline Freddy

  • Owner
  • *****
  • Posts: 2614
  • Rep: 19
    • MSN Messenger - freddy1990@gmail.com
    • AOL Instant Messenger - Freddy199O
    • View Profile
    • Email
Re: C++ Bot, Color Problem (No .NET)
« Reply #17 on: December 27, 2009, 08:49:25 am »
GetPixel is indeed very slow, because it gets a single pixel and has to initiate new resources every time it is called... It's only worth using when you get a single pixel, or just a few at max.
BitBlt on the other hand is very fast and highly optimized, and irreplaceable unless you feel like writing a kernel mode driver :)

You can use CreateDIBSection and GetDIBits to get a pointer to the bits array of a bitmap, containing all pixel data. Might be a good idea to use scanlines, they're easy to use and pretty fast...

http://msdn.microsoft.com/en-us/library/dd144879%28VS.85%29.aspx

You might be able to pull something useful out of this: http://www.cplusplus.com/forum/windows/6353/

Basically Scanlines are arrays of colors, each scanline represents a row of pixels, so your index in the scanlines array should be your y value, then just the x value to get the color out of the scanline. The method used in that c++ thing is different from using CreateDIBSection, but does the same.

tvirusx1

  • Guest
Re: C++ Bot, Color Problem (No .NET)
« Reply #18 on: January 16, 2010, 12:31:15 pm »
I'll get a look into scanlines, sounds promising. :)
Posted on: December 27, 2009, 05:54:57 PM
Sorry about getting you into all this trouble... which was in vain. :(

I wanted to make a Similar Bot to RSBot only for Dark Orbit in C++. But I don't know how to do a Bot other than Color Search (which is difficult enough)
RSBot downloads all the Games data and uses it I have no idea how thats done... (how to download and use the data)

Is there a way you could download the Dark Orbit Data with SCAR and then let SCAR create a window which connects to the Dark Orbit Servers?
Like that I could get the Co-Ords of NPC's, Bonus Boxes ect. which is an advantage over Color Search.

I don't know if you plan on implementing something like that for SCAR in the future, but I hope you do.


My first step would be to download the data from the server, similar to runescape when it is loading.

Offline Freddy

  • Owner
  • *****
  • Posts: 2614
  • Rep: 19
    • MSN Messenger - freddy1990@gmail.com
    • AOL Instant Messenger - Freddy199O
    • View Profile
    • Email
Re: C++ Bot, Color Problem (No .NET)
« Reply #19 on: January 17, 2010, 05:30:08 pm »
It's unlikely, also, RSBot simply pulls data from variables inside of the RS client... Because of RS being made in java, this is a fairly easy thing to do...

Freddy1990.com

Re: C++ Bot, Color Problem (No .NET)
« Reply #19 on: January 17, 2010, 05:30:08 pm »

tvirusx1

  • Guest
Re: C++ Bot, Color Problem (No .NET)
« Reply #20 on: January 18, 2010, 06:18:59 am »
It's unlikely, also, RSBot simply pulls data from variables inside of the RS client... Because of RS being made in java, this is a fairly easy thing to do...

Yea that makes sense...

Seems like in the future I will have to reverse engineer the Dark Orbit Protocols with Winsock, which isn't an easy task.

You can close this thread if you want.

Freddy1990.com

Re: C++ Bot, Color Problem (No .NET)
« Reply #20 on: January 18, 2010, 06:18:59 am »

 

deductible-aliform