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 24, 2014#381

Which version of BS that works? The latest one does not have the Developer Option section, thus cannot select the Force GPU thingy.

Dec 24, 2014#382

@Squrl: I just added a neccessary check in the code so it will work with any number of barracks (for ex. in the selection drop down if you have 3 barracks just choose troops for the first 3 and leave the other as Barrack 04, same for 2 barracks). It's the same links in first post
@goondar: I've been boosting barrack constantly (will add auto boost soon) and having no issue. So it was able to train normally and only misbehave after you boost? Spam clicking is actually because it misclick the barrack and continue to click on troop training (thus the repeated spam). There might be a slightly variation in y-axis that cause the bot to misclick barrack, can you try to move the main screen up (or down) after max zoom out to see if it can click on barrack?
I'd really appreciate any help. Actually coding is not hard for me, I'm having more problem with logic flow or error check. If you can suggest features or improvement (if you observe something can be done better I'll try to translate it to code). For now I need more input on attack strategy (troop composition, amount to drop, waiting time in between, ..). But the most important part is error reporting (best if screenshot provided :D) as I can only test on my own computer.

@Antidote yes it stopped working right after i gem boosted the racks. What i've noticed is that the bot is actually clicking on the barrack first, then he is unable to click on the "Train Troop" Button, maybe because with all the racks boosted you have one button less on the racks (if it's position dependent)

Best Regards.

Dec 24, 2014#383

@Squrl: thanks for your understanding. Trophy drop is quite feasible, but I need to be able to read Trophy value (for now all values reading is done by GkevinOD so we'll gonna have to wait). And the bot progressed much faster than I expected (just last weeks I thought it would take at least a few weeks to run continuously) so I didn't anticipate every aspects for newcomers. A guide would definitely be helpful 😉
@k3iroll: I'm not sure about that, maybe you can ask warrockblack. he managed to fix this issue
@goondar: yes the button is indeed position dependent. just now I noticed there was one button missing on boosted barrack, but the bot still manage to click on training (maybe it was the overlap). Can you provide a screenshot so I can take a look at the position?

Dec 24, 2014#384

I wrote a simple program flow so it's easier for everyone to know exactly what happens in each step

Program Start
Press Start
Bot check if screen is static
If static, press reload, wait for 6 second then check again
If detect screen changes, move on to zoom out
Press down button to zoom out until detect specific color in 4 pixels location (indicate max zoom out)
Check if barrack's location is set (not 0).
If barrack's location is set and selection is not Barrack 01,02,03,04, proceed to train troop (click on barrack, click train, click on selected troops 65 times, click close). If detect red color in barrack training (indicating full army camp, set $FullArmy to true)
Proceed with other barracks
If $FullArmy is not true, wait 30 seconds in train again
If $FullArmy is true, proceed to attack (press Attack, Find A Match, Break Shield)
Proceed to check search
If not detect gold value, wait for 0.2 seconds
If not detect gold value for 15 seconds, check if screen is static
If screen not static, press Next to proceed to next village
If screen is static (Out of sync error), press Reload and start from beginning
If resource value match search criteria, proceed to drop troops (clicking on troops then click along the edge)
After finish dropping troop, wait for battle end (detect if gold doesn't change for 30 seconds)
Click return home (or end battle, yes, return home)
Start over.

Dec 24, 2014#385

goondar wrote:

Antidote wrote:

@Squrl: I just added a neccessary check in the code so it will work with any number of barracks (for ex. in the selection drop down if you have 3 barracks just choose troops for the first 3 and leave the other as Barrack 04, same for 2 barracks). It's the same links in first post
@goondar: I've been boosting barrack constantly (will add auto boost soon) and having no issue. So it was able to train normally and only misbehave after you boost? Spam clicking is actually because it misclick the barrack and continue to click on troop training (thus the repeated spam). There might be a slightly variation in y-axis that cause the bot to misclick barrack, can you try to move the main screen up (or down) after max zoom out to see if it can click on barrack?
I'd really appreciate any help. Actually coding is not hard for me, I'm having more problem with logic flow or error check. If you can suggest features or improvement (if you observe something can be done better I'll try to translate it to code). For now I need more input on attack strategy (troop composition, amount to drop, waiting time in between, ..). But the most important part is error reporting (best if screenshot provided :D) as I can only test on my own computer.

@Antidote yes it stopped working right after i gem boosted the racks. What i've noticed is that the bot is actually clicking on the barrack first, then he is unable to click on the "Train Troop" Button, maybe because with all the racks boosted you have one button less on the racks (if it's position dependent)

Best Regards.

y it does not work with boosted barracks for me aswell 🙂

Dec 24, 2014#386

@goondar: yes the button is indeed position dependent. just now I noticed there was one button missing on boosted barrack, but the bot still manage to click on training (maybe it was the overlap). Can you provide a screenshot so I can take a look at the position?

Here u go:

Dec 24, 2014#387

G/E works fine 🙂
what resolution do you use? looks pretty big

for expample why skip this enemy ?

Dec 24, 2014#388

Minor suggestions,
A G+E+T option would be nice. If you attack someone with 33 trophies for example and fail you will only lose 17. It would allow you to stay in a higher league while you farm. Another somewhat related suggestion would be to add a trophy dropping option. It doesn't seem like it would be too hard to implement. It is basically the same as your attack except you only send one troop and click surrender immediately after. I would also suggest a more spread out attack pattern. One I haven't seen used by bots is essentially where you quickly circle the perimeter . It has the benefit of a four way attack but instead of spawning a large number of units on a side at once and looking like a bot it simply trails along the perimeter like a person mine do with one finger.

edit: Looks like someone already suggested the trophy dropping suggestion, my bad.

Dec 24, 2014#389

Confermed: as soon as the boost expired, bot is back training troops without issues.

A little new bug: sometimes the bot stop searching and freeze without outputting anything

Dec 24, 2014#390

Bot does not search villages

This discussion is closed.