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 30, 2014#661

OK I will try:-)

Dec 30, 2014#662

@SAIPER It kind of takes a while to make an algorithm for each troop composition. I'm trying to make it as efficient as possible, but more algorithms will come out soon and later you may be able to create your own!

Dude you do not rush your job very happy I just said, it's very cool to work happy.

Muddied by steeper than other boats, we will wait for the update.
I will throw you a reputation online. 🙌 🙌

Dec 30, 2014#663

@GkevinOD You can create a separate topic on the site with your assembly on the bot?
What's to see all your updates?

Dec 30, 2014#664

@GkevinOD Good job bro and the settings you recommend is flawless, started around 100,000 gold and I'm at 1.6 Gold within an hour, to be honest it works better than those buggy as paid so called "bots" lol.

Thank you

Dec 30, 2014#665

heres my name sugestion

----CoC Commander---

just my sugestion

Dec 30, 2014#666

Hey GkevinOD, i got problem with the download site.
can you please update to mega site so i can download it? thx alot

Dec 30, 2014#667

heres my name sugestion

----CoC Commander---

just my sugestion

AU #3 (Hint au3)
Alpha Byte Club
Club au3

Dec 30, 2014#669

@GkevinOD
Some found the problem in the program lines , because once you get on the line 779 the bot continues to work more not put more lines. to be exact follows below:
Line 1         [02:32:52] ~~~~Welcome to COC Bot Pre-Alpha v005!~~~~
Line 2         [02:32:52] Bot is starting...
Line 3         [02:32:55] Zooming Out
Line 4         [02:32:59] Zoom Out Complete
.
.
.
Line 777         [04:13:45] Dropping first wave of Archers
Line 778         [04:13:53] Dropping second wave of Barbarians
Line 779         [04:14

the bot continues to function normally.

and another thing the bot does everything with no problems
Thanks, good job

Dec 30, 2014#670

I've been gone for just a day and it's more than 10 pages and a lot of versions being released already, LOL.

I started the TH reading code for the bully mode but couldn't make it accurate. I've compiled a lot big and small pictures (3x3 pixels) with varying tolerance but still without success. I guess it'll be 85% accurate. I thought it would be easy because TH image are big. But it wasn't accurate as reading the collectors. I also found out that the smaller img pixels, the smaller the tolerance should be in order to make hit. On the other hand, the bigger images should have greater tolerance to make it hit.

The code is simple and below is just for testing:

#include <ImageSearch.au3>
#include <MsgBoxConstants.au3>

HotKeySet("{ESC}", "Terminate")

Func Terminate()
    Exit 0
 EndFunc

opt("mousecoordmode",0)

Global $Title = "BlueStacks App Player"
Global $HWnD = WinGetHandle (WinGetTitle($Title))


;---------------TH IMAGESEARCH
Global $THfind[5],$THResult=0,$BullyAttack=0, $T[3][5]

Global $THTolerance=125;115;125
Global $THBully=7
Global $Bullymode=1
Global $THFileSets=3

Global $IS_thx[5], $IS_thy[5], $E[3][5]

$T[0][0] = @ScriptDir&"\THvar1\TH6.bmp"
$T[0][1] = @ScriptDir&"\THvar1\TH7.bmp"
$T[0][2] = @ScriptDir&"\THvar1\TH8.bmp"
$T[0][3] = @ScriptDir&"\THvar1\TH9.bmp"
$T[0][4] = @ScriptDir&"\THvar1\TH10.bmp"

$T[1][0] = @ScriptDir&"\THvar2\TH6.bmp"
$T[1][1] = @ScriptDir&"\THvar2\TH7.bmp"
$T[1][2] = @ScriptDir&"\THvar2\TH8.bmp"
$T[1][3] = @ScriptDir&"\THvar2\TH9.bmp"
$T[1][4] = @ScriptDir&"\THvar2\TH10.bmp"

$T[2][0] = @ScriptDir&"\THvar3\TH6.bmp"
$T[2][1] = @ScriptDir&"\THvar3\TH7.bmp"
$T[2][2] = @ScriptDir&"\THvar3\TH8.bmp"
$T[2][3] = @ScriptDir&"\THvar3\TH9.bmp"
$T[2][4] = @ScriptDir&"\THvar3\TH10.bmp"

THread()

Func THread()
$BullyAttack=0
$THResult=0 ;if error reading, prevents any attacks
For $s=0 to ($THFileSets-1) Step 1 ;loop for different filesets
   For $p=0 to 4 Step 1 ;loop for different th types th6-th10
		$THfind[$p]=_ImageSearchArea($T[$s][$p],0,0,0,860,720, $IS_thx[$p], $IS_thy[$p],$THTolerance)
	  ;Identify TH
	  If $THfind[$p] > 0 Then	  ;TH found
		 $THResult=6+$p
		 MsgBox(0,"",$T[$s][$p]&"  TH FOUND:"&$THFind[$p]&"  = TH"&$THResult)
	  EndIf
   Next
Next
If $THResult=0 Then
   $THResult=5
   		 MsgBox(0,"","TH not found :"&$THResult)
EndIf
	  ;Bully base?
	  If $Bullymode=1 then
		 If $THBully>=$THResult Then
			   $BullyAttack = 1
		 Else
			   $BullyAttack = 0
		 EndIf
	  EndIf
EndFunc

I already tried incorporating the code to my old ver003 and got a hard time doing it since i'm a novice. What I want it to do is to compare the value first, then if it's a go then identify if zombie, then if it's a go then attack. Alternatively if it's a zombie no go, then determine if bully attack based on max TH as specified by the user's. Well the code was to specify the maximum TH to attack instead of letting the bot determine by itself how to bully. The thing here is we can specify the degree of bulliness..

and here is the code that I tried to incorporate in func villagesearch():

 
Func VillageSearch()
   $SearchCheck = 0 
   While 1
	  Global $SearchCount = 0
	  If $RunState = False Then ExitLoop
	  CheckSearch()
	  If $RunState = False Then ExitLoop
	  ReadValue()
	  If $RunState = False Then ExitLoop
	  CompareValue()
	  If $RunState = False Then ExitLoop

	  While $SearchZombie = 0
		While $SearchCheck=0
			If $RunState = False Then ExitLoop
			ControlClick ($HWnD, "","", "left", "1", 715*$x_ratio, 405*$y_ratio) 
			If $RunState = False Then ExitLoop
			CheckSearch()
			If $RunState = False Then ExitLoop
			ReadValue()
			If $RunState = False Then ExitLoop
			CompareValue()
			If $RunState = False Then ExitLoop
		 WEnd 
			ZombieSearch();1st Run
			ZombieSearch();2nd Run to Reconfirm
			THread()
		 If $Zombie=0 And $Bullymode=0 Then
			$SearchZombie = 1
		 EndIf
		  If $RunState = False Then ExitLoop
			If $BullyAttack=1 Then
			   ExitLoop
			EndIf
			If $RunState = False Then ExitLoop

		 If $RunState = False Then ExitLoop
	  WEnd
	  If $RunState = False Then ExitLoop
	  GUICtrlSetData($Results, "Enemy Found!" & @CRLF, -1)
	  ExitLoop
   WEnd
EndFunc

@Antidote
I tried the zombie algorithym to a th8 account and found the same issue as yours. Before I only tested it only to a th9 account and did not notice its inaccuracy. So far havn't had a miss for th9.

Btw, what is a git? source something? I'm not familiar with a lot of terms. 🙂

@Kaz
Hey there! Nice to have more people to help.

@EVeryone
Btw, for the name.. CocByte? LOL Just kidding.

Loot was crazy. Was able to upgrade 4 Lv10 walls and a Lv7 AD even though wasn't running for 24 hours in a day while testing it.

Btw, for the TH reading, I have yet to complete the images but I will post the img files here soon.

This discussion is closed.