The Bytecode Club
Log inJoin the club
Video Game Reverse Engineering

Developing Bot

Started by Antidote · Dec 5, 2014

1,033 replies21,297,466 viewsLocked
Dec 16, 2014#81

First to train Tesseract you'll need the following files: (for training with supercell magic font and naming the new language 'coc')

coc.supercell-magic.exp0.tif (image file containing letters/numbers/symbols you need to train Tesseract with)
coc.supercell-magic.exp0.box (containing location of each characters inside the tif file and its translation)
coc.font_properties
coc.words_list
coc.frequent_words_list

@Antidote, thanks for the details explanation. I'll give a try tonight. Initially, I though we only need to teach tesseract to understand 0 to 9 only. Given an example "123 456 gold", a coding is required to loop 7 times to recognize 7 digits including the space.

Dec 16, 2014#82

Got these errors:
Tesseract Open Source OCR Engine v3.02.03 with Leptonica
row xheight=8.66667, but median xheight = 12.4762
FAIL!
APPLY_BOXES: boxfile line 0/0 ((101,3183),(117,3200)): FAILURE! Couldn't find a matching blob
FAIL!
APPLY_BOXES: boxfile line 1/1 ((126,3184),(133,3201)): FAILURE! Couldn't find a matching blob
FAIL!
APPLY_BOXES: boxfile line 2/2 ((142,3184),(154,3201)): FAILURE! Couldn't find a matching blob
FAIL!
APPLY_BOXES: boxfile line 3/3 ((163,3183),(176,3201)): FAILURE! Couldn't find a matching blob
FAIL!
APPLY_BOXES: boxfile line 4/4 ((184,3184),(199,3201)): FAILURE! Couldn't find a matching blob
FAIL!
APPLY_BOXES: boxfile line 128/6 ((101,3161),(115,3178 )): FAILURE! Couldn't find a matching blob
FAIL!
APPLY_BOXES: boxfile line 129/9 ((117,3160),(130,3178 )): FAILURE! Couldn't find a matching blob
FAIL!
APPLY_BOXES: boxfile line 130/7 ((139,3161),(151,3178 )): FAILURE! Couldn't find a matching blob
FAIL!
APPLY_BOXES: boxfile line 131/0 ((153,3160),(169,3177)): FAILURE! Couldn't find a matching blob
FAIL!
APPLY_BOXES: boxfile line 132/7 ((178,3161),(190,3178 )): FAILURE! Couldn't find a matching blob
FAIL!
APPLY_BOXES: boxfile line 133/1 ((192,3161),(199,3178 )): FAILURE! Couldn't find a matching blob
FAIL!
APPLY_BOXES: boxfile line 271/1 ((101,3138 ),(108,3155)): FAILURE! Couldn't find a matching blob
FAIL!
APPLY_BOXES: boxfile line 272/2 ((110,3138 ),(122,3155)): FAILURE! Couldn't find a matching blob
FAIL!
APPLY_BOXES: boxfile line 2876/9 ((116,2700),(129,2718 )): FAILURE! Couldn't find a matching blob
FAIL!
APPLY_BOXES: boxfile line 2877/5 ((131,2700),(143,2718 )): FAILURE! Couldn't find a matching blob
FAIL!
APPLY_BOXES: boxfile line 2878/9 ((153,2700),(166,2718 )): FAILURE! Couldn't find a matching blob
FAIL!
APPLY_BOXES: boxfile line 2879/9 ((168,2700),(181,2718 )): FAILURE! Couldn't find a matching blob
FAIL!
APPLY_BOXES: boxfile line 2882/9 ((221,2700),(234,2718 )): FAILURE! Couldn't find a matching blob
FAIL!
APPLY_BOXES: boxfile line 2885/9 ((273,2700),(286,2718 )): FAILURE! Couldn't find a matching blob
FAIL!
APPLY_BOXES: boxfile line 2887/9 ((311,2700),(324,2718 )): FAILURE! Couldn't find a matching blob
FAIL!
APPLY_BOXES: boxfile line 2888/9 ((327,2700),(340,2718 )): FAILURE! Couldn't find a matching blob
APPLY_BOXES:
  Boxes read from boxfile:    2892
  Boxes failed resegmentation:      21
  Found 2871 good blobs.
TRAINING ... Font name = supercell-magic
Generated training data for 925 words
My tesseract is reading better than before even with the errors above. Thanks Antidote for the automated Tesseract training 🙂 I almost did the manual.

I'm also thinking, can we edit the tiff file so that the font will look white and the background green?

Dec 16, 2014#83

Guys , LF is not using tesseract but. Glyph algorithm, Hehe try that ! ITS easyer

Dec 16, 2014#84

Right, i'm also experimenting glyph recognition algorithm, and i get almost 100% success. And it's way easier than using Tesseract, although it requires to make png files of each displayed number (but in a matter of minutes you get this done using Gimp or Paint.net).

Dec 16, 2014#85

Do you guys have tutorial link for glyph?

Dec 16, 2014#86

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.
Dec 16, 2014#87

This is great! Once we have the techniques to 100% recognition of the gold and elixir, we can progress to the auto raid functions and such. I'm at school right now and I will take a look at the Image Recognition technique later.

Dec 16, 2014#88

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.

Nice that was brief.. Thanks! It just sounds easy man but I feel like I'm heading for a brick wall just thinking about coding it (for a novice like me). Still no luck for me in tesseract training. More accurate but same issues. I've been trying to extract the numbers by string manipulation just before removing the empty spaces and numerating it thereafter But the script keeps on closing while I'm testing it. I'm still looking for the error.

Dec 16, 2014#89

Hello everyone. I'm not a coder, but I was wondering if you guys have produced any bots, and if you have could I have the link. Also, when I've tried to use bots in the past, everything works until I click "start". Nothing happens. I couldn't find anything online to help. If anyone could explain how to use a bot and give me a link to one, I'd be very grateful.

Dec 17, 2014#90

Hey guys. This is my first post on The Bytecode Club. I am a freshman college student with some coding knowledge in C/C++. I believe that it may actually be possible to completely bypass the image recognition step which has proven to be both inaccurate and inefficient. Rather, can we try to intercept at the transport level by wiresharking the packets sent between Bluestacks and the CoC Server?

This discussion is closed.