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 22, 2014#211

@GkevinOD: glad you got it work for all values, speed is still superb. I tested it and managed to get all values correct. I have to tweak $x_default and $y_default a bit though, since 52,93 seems to work better for me. Anw, I updated the bot with your code and make sure to run all the neccessary check. I let it run since I left home this morning, teamviewer a few time throughout the day to check and it's still running when I got home. Quite surprisingly good loot. Since I tested it haven't found any wrong match (I was running into an issue where trophy wasn't showing for non-dark value but managed to fix that). This is like a low level tailor made OCR for this game lol. Are you successful in replicating it in other region? I'm not familiar with this but if you can guide me through the color sampling process I'm happy to help

@kojometa: your finding is so valuable man. I've been trying to figure out how to determine full army camp but never thought to look at barrack lol. This helps cutting down unncessary waiting time a lot since it will just train in a loop until full army is true. Your code placement is neat but I changed it a bit by adding a variable check since calling attack function straight from there might disrupt program flow. Check out the code 😉

@vanadium: thanks for the insight, actually I managed to do it in the latest code using GkenvinOD's function to monitor gold change. It works fine and doesn't need to differentiate on going battle and return home screen as it will just push the same button sequence.

@AtoZ: I understand how you do it but couldn't get it to work. I'll try to hand pick the coord and color again since this is quite an important check.

Dec 22, 2014#212

I updated the bot with GkevinOD's new code and implement kojometa's idea to check for full army camp. I also redesigned GUI a bit to make room for the additional dark elixir and trophy. Search function still use gold & elixir only as I haven't added dark and trophy yet. Error when searching for village and return home function is fixed as well. Haven't tested Giants again to see what cause the problem but I will do soon. Anw here's the script: Bot.au3, GkevindOD.au3 & pre-compiled Bot.exe for those just want to test and don't mind the exe

http://www25.zippyshare.com/v/20548746/file.html
http://www25.zippyshare.com/v/71348480/file.html
http://www25.zippyshare.com/v/25890047/file.html

Dec 22, 2014#213

Wooo 🙂 .. I'm impressed. I'm just out of 3 days (Business trip), so many update and progress. Specially thanks to @Antidote, @GkevinOD @kojometa and @vanadium

Since GkevinOD's code beat Tesseract, I shall stop and move to another stage. Where shall I step in? Any task that required my help?

Dec 22, 2014#215

@GkevinOD, your GetResource 3.0 function is excellent.. Solute you..
You might wanna GPL it before other bot took it for commercial use since other bot used "W"

@Antidote, don't get me wrong.. I don't mean your work is not appreciated. Your work definitely the pioneer of this thread that caused all the excellent people to participate. You deserve my solute as well.

Dec 22, 2014#216

@GkevinOD, your GetResource 3.0 function is excellent.. Solute you..
You might wanna GPL it before other bot took it for commercial use since other bot used "W"

I don't know if I did it right, I edited the pastebin. Can you check if it is correct because I've never done it before haha

Dec 22, 2014#217

@Antidote : The new GUI looks nice and i'm looking forward for dark elixir since my gold and elixir is maximum full 🙂
from my point of view there are some important things to deal with:

  1. getting random "out of sync" while looking for villages. i think some sleeps could solve that problem, since its just running 2 fast lol :D
  2. dont surrender a fight which might be still running. for me personally i still use the old gethome function because i dont really care if i idle 60 seconds even though the fight might be over already because the next fight will first start when troops are maximum. if the troops are trained while i'm idleing in my base or in the end-fight screen doesnt really matter to me^^
  3. some checks for "desync" "forced breaks". they're usually grey boxes that are easy detectable with pixelsearch like the maxtroops function. so if something goes wrong and the bot is in fight mode but you're in your base again a check could reset the bot to enter the main function again 😉
Dec 22, 2014#218

@GkevinOD: I saw that before but didn't try it since I was more concern with functionality. Also I'm not familiar with design, graphic things.. but I will improve GUI once the bot becomes usable :D
@odySSeys: haha don't worry bro I salute his work as well. He defitnitely has the capability to create things much more complicated than I do, I just happen to have lots of passion and time atm 😉

Dec 22, 2014#219

yes adding dark and trophy would be easy, I'm gonna do it soon. I noticed the out of sync too and still thinking of ways to deal with it. It's not easy to do with Autoit since it's not multithreaded, you can only execute one function at a time (the Start/Stop button things require special function to actively monitor the GUI and even then variable check has to be implemented throughout the whole code ($RunState). I'm still looking for ways to do it, otherwise we're gonna need another lengthy check. It'll be great if you can help me list all possible error message or random pop up in game so we know what to deal with
I personally don't like the gold change either, but it seems effective, you can try to vary waiting time to see what works best..
don't know why but for some reason pixelsearch seems inconsistent to me, many times color end up not matching.. I'm still finding a solution for max zoom out check..
If we can successfully implement all check, next step would be optimizing attack. After all the bot's main purpose is loot lol

Dec 22, 2014#220

Thanks for all the hard work, guys. The latest update via Antidote has a bug for me. While the bot is searching for a village to attack it will sometimes stop on a village and simply do nothing, but if i hit next it begins reading out gold elix de etc, for a couple of times and then stops again. The previous version did not have me experiencing this problem. Just wanted to throw that out there and see if anyone else has experienced this problem with this version.

p.s. What language is this written in? I have taken a couple of programming classes in school

This discussion is closed.