The Bytecode Club
Developing Bot - Printable Version

+- The Bytecode Club (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 - odySSeys - 12-21-2014




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




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

I'm still learning everything from scratch like many of you guys here (luckily Autoit has very smooth learning curve), so mistakes are here and there and I'm constantly updating the code if I find better ways to do it. Anw since many people contribute now, is there anyway we can effectively collaborate without having to copy paste every time? Something like Github or Google Code?


RE: Developing Bot - AlexXxuTzZu - 12-21-2014

Good job Antidote for your work. I just tried your last bot and at the beginning it just trains the troops and then after it starts searching for a battle but without troops in the camps. Good luck again


RE: Developing Bot - kojometa - 12-21-2014




RE: Developing Bot - kojometa - 12-22-2014

I edited some stuff.
Most significant is the ReturnHome function.
I added a timer wich will run 150 Seconds (you can see the actual countdown in the GUI) and then return home.
Also it is always showing which function is called at the moment to recognise where potential errors are happening.

what i found out: if you pick goblins or giants in the comboboxes, it closes the script after developing because it seems to crash in AssignTroop.

http://pastebin.com/FTsnMPbT

Wink


RE: Developing Bot - vanadium - 12-22-2014

Rather detect gold and elixir change.


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




RE: Developing Bot - vanadium - 12-22-2014

It's not sufficient to detect When Home button appears: all troops and spells may not have been used for the battle. In this case, return home appears only after 3min timeout. Also, depending you get at least one star or not, the button is either "Surrender" or "End battle", with a prompt in the first case.

The best solution is to check gold + elixir change, and stop the battle after 30sec without changes. It works perfectly fine for me. It does not take that much cpu.

On my bot done in Java, i have a JSON config for:
- the army to train,
- the troops to deploy, in which order, how many, when to enable hero ability etc.

Sample army config:
Quote:{
"BARBARIAN": "108",
"ARCHER": "107"
}

Sample deploy config:
Quote:[
{
"@type": "ScootCorners",
"troop": "BARBARIAN"
},
{
"@type": "HoldOn",
"duration": "10",
"unit": "SECONDS"
},
{
"@type": "SendTroopCount",
"troop": "BARBARIAN",
"count": "30",
"distribution": "RANDOM"
},
{
"@type": "SendTroopCount",
"troop": "ARCHER",
"count": "30",
"distribution": "RANDOM"
},
{
"@type": "HoldOn",
"duration": "2",
"unit": "SECONDS"
},
...
]

It's very convenient to change the trained army, troop deployment because it does not require to change the code. But, hey, it's a hell easier in Java.


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

Make sense to me now since I tend to always use up all troops in battle I might overlook that. By detecting gold & elixir change, do you detect change in that screen region (pixelchecksum) or actually read gold & elixir to compare? How would it handle when you get 3 stars or battle end early (out of troops)?
Also I believe config file can be done in Autoit as well, requires very organized and flexible coding though. From what I see, your bot seems way ahead :D