The Bytecode Club - Reverse Engineering Forum
Developing Bot - Printable Version

+- The Bytecode Club - Reverse Engineering Forum (https://the.bytecode.club)
+-- Forum: Lobby (https://the.bytecode.club/forumdisplay.php?fid=1)
+--- Forum: Game Cheating, Botting & Reverse Engineering (https://the.bytecode.club/forumdisplay.php?fid=97)
+--- Thread: Developing Bot (/showthread.php?tid=155)



RE: Developing Bot - Obsoleet - 12-17-2014

(12-17-2014, 11:23 AM)TeebS Wrote:  ....Rather, can we try to intercept at the transport level by wiresharking the packets sent between Bluestacks and the CoC Server?

Between game and supercell servers?

Mayby u should read this first: https://www.digicert.com/TimeTravel/math.htm


RE: Developing Bot - Antidote - 12-17-2014

(12-17-2014, 12:42 AM)vanadium Wrote:  You don't even need a tutorial for that, it's pretty simple:
1. Make Pngs of numbers from 0 to 9,
2. Capture the part of the screen containing the numbers,
3. Use image search algorithm to find the position of the number by testing all of them,
4. Order the found numbers by increasing x-axis,
5. You have your number read by concatenating the ordered numbers.

It sounds quite easy to write the sequence but I'm having a really hard time handling images. Image Search's detection rate is extremely low for me, especially for animated in game graphic even with tolerance set to 100. It also doesn't have parameters for win handle so I can't get the exact coordinates for searching. I've looked around and tried findBMP, BMPSearch,... but none of them works. Since you got it all figured out can you guide me in the right direction?


RE: Developing Bot - Antidote - 12-17-2014

I've just updated the code with some minor improvement, currently ocr still relies on Tesseract as I haven't figured out the other method, but accuracy should be decent enough. Right now there's no image recognition so on first run it'll prompt you to manually click on each barrack to record positions. From then it can run on its own (train troop, wait, find opponents, attack, return home, repeat,...). However I cannot guarantee that it's stable enough to run continuously (a lot of error check I haven't implemented, just test run a few time) so just try it out a few times for fun (I lost so many trophies and elixir testing it lol). If anything go wrong just close it, I manage to get the GUI to response while inside the loop but Stop button's still a bit buggy.

http://www50.zippyshare.com/v/8211364/file.html
Unrar Bot.rar and run Bot.exe inside folder or compile from source code (must be run from same folder)
Source: http://pastebin.com/Rv4hGhNb

[Image: RHZHrvg.jpg]


RE: Developing Bot - AtoZ - 12-17-2014




RE: Developing Bot - Malosa - 12-17-2014

(12-17-2014, 12:42 AM)vanadium Wrote:  You don't even need a tutorial for that, it's pretty simple:
1. Make Pngs of numbers from 0 to 9,
2. Capture the part of the screen containing the numbers,
3. Use image search algorithm to find the position of the number by testing all of them,
4. Order the found numbers by increasing x-axis,
5. You have your number read by concatenating the ordered numbers.



You dont have to create they have done it

Check CFacelinesidewindows COC_EN or COC the files are already done !!!!!


RE: Developing Bot - AtoZ - 12-17-2014

I need a sample code for me to learn. It'll be hard for a non-coder like me. Anyone?

Question in mind: what if there are two or more images ex. 111_111? will image search detect more than one coordinates?


RE: Developing Bot - Antidote - 12-17-2014




RE: Developing Bot - Antidote - 12-17-2014

(12-17-2014, 06:49 PM)AtoZ Wrote:  I need a sample code for me to learn. It'll be hard for a non-coder like me. Anyone?

Question in mind: what if there are two or more images ex. 111_111? will image search detect more than one coordinates?

Here's the one I'm working on, it's quite long but very basic syntax, no high level stuff: http://pastebin.com/Rv4hGhNb
I don't know how imagesearch works, but it seems like they run through each image pixel by pixel, line by line to detect if there's a match, depending on tolerance level. So if you provide an image with number 1 in it. It will be detected 6 times with coordinates for each. You join it all by x coordinate and got yourself a number.


RE: Developing Bot - AtoZ - 12-17-2014

[Image: 84USdg.jpg]
;Global $Left = 54, $Top = 81, $Right = 745, $Bottom = 555
BS resolution=860x720

I used that coordinates for me not to have tesseract number bugs on the left.

I used scale=4 because sometimes tesseract failed to read the capture but it becomes too sensitive it generates more digits than scale of 2. But 2 is also good and less snowfall.

here is the result:
[Image: NoNIwa.jpg]
Use scale=2 but must indent the left properly because I didn't factor the left most errors to my string manipulation code I posted.


RE: Developing Bot - AtoZ - 12-17-2014

More result:
[Image: pFpJBh.jpg]
AND this is the Tesseract read Line BUG that has 0 in it probably due to snow falls:
[Image: kWVM6u.jpg]
The upper data of the msgbox is the tesseract reading. The lowest part is the result. I think these 2 pictures here I used scale=2.