The Bytecode Club
Log inJoin the club
Video Game Reverse Engineering

Deadbase Search

Started by AtoZ · Jan 4, 2015

37 replies492,886 views
Jan 4, 2015#1

@dinobot

Your private message is disabled. LOL.

@Everyone
Dinobot sent a lot of images to update zombiesearch so I need testers for the 3 imagesets. It's time consuming for me to test all images LOL and I'm busy atm so I need help.

https://www.dropbox.com/s/176gt5qipvu950h/ZSearch%204jan15%20%20IMAGESET%20ABC.rar?dl=0

Must add this screencapture to villagesearch func like this:

				  If ZombieSearch() Then
					 SetLog("~~~~~~~Dead Base Found!~~~~~~~")
					 ExitLoop
				  Else
						SetLog("~~~~~~~Not dead base, skipping~~~~~~~")
					Local	$Date = @MDAY & "." & @MON & "." & @YEAR
					Local	$Time = @HOUR & "." & @MIN
						_ScreenCapture_CaptureWnd(@ScriptDir & "\SkippedZombies\" & $Date & " at " & $Time & ".jpg", $hWnd)
					 Click(750, 500) ;Click Next
					 
				  EndIf

;-------------------
;Must add this at the top:
DirCreate(@ScriptDir & "\SkippedZombies\")
;------------------

Take note guys which set or settings are more prone to hang.

$ZSexclude values will depend on your TH level. Basically every step excludes a collector based from the lows and fills.
Recommended settings TH9= 2-3, TH8=1-2, TH7=0-1.

SETA = Original PLUS NEW images (Thanks to Dinobot): Collectors 6 and up are now included.

SETB= 2 side cut imgs

SETC= Condensed SetB imgs, less loops.

All sets must have varying tolerance in order to work. I haven't tested SET A and B because SET C I think has the most efficient design.

Recommended Tolerance:
SET A = 90 (Probably because just added images)
SET B = 65 (This worked on SET C)
SET C = 65 (80 above gives false positives (FP). 70 some FP as well.
As long as you don't skip dead bases, you may lower tolerance.

For image testing you may use this:

#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))

Global $ZC=0,$ZombieCount=0;, $E
Global $SearchZombie=0, $ZombieCount=0

Global $ZombieFileSets=5 ;Variant Image to use organized as per Folder
Global $Tolerance=70
Global $ZSExclude=3 ;Exlude lowest collector level for ZombieSearch. LowestCollector: $ZSExclude=0 means Search Lv6 up. Recommended Th9 = 2-3 (Start Elixir Lv9)

Global $Lx[4]= [ 0, 400, 0, 400 ]
Global $Ly[4]= [ 0, 0, 265, 265 ]
Global $Rx[4]= [ 460, 860, 400, 860 ]
Global $Ry[4]= [ 325, 325, 590, 590 ]


Global $MatchCount=0, $match=0

Global $Area[11][4]
Global $IS_x[11][4], $IS_y[11][4], $E[5][11]
;   Global $Area[5][4], $IS_x[8][4], $IS_y[8][4], $E[5][11]


$E[0][0] = @ScriptDir&"\images\ELIX1\E6F9.bmp"
$E[0][1] = @ScriptDir&"\images\ELIX1\E7F9.bmp"
$E[0][2] = @ScriptDir&"\images\ELIX1\E8F9.bmp"
$E[0][3] = @ScriptDir&"\images\ELIX1\E9F9.bmp"
$E[0][4] = @ScriptDir&"\images\ELIX1\E10F8.bmp"
$E[0][5] = @ScriptDir&"\images\ELIX1\E10F9.bmp"
$E[0][6] = @ScriptDir&"\images\ELIX1\E11F8.bmp"
$E[0][7] = @ScriptDir&"\images\ELIX1\E11F9.bmp"
$E[0][8] = @ScriptDir&"\images\ELIX1\E12F7.bmp"
$E[0][9] = @ScriptDir&"\images\ELIX1\E12F8.bmp"
$E[0][10] = @ScriptDir&"\images\ELIX1\E12F9.bmp"

$E[1][0] = @ScriptDir&"\images\ELIX2\E6F9.bmp"
$E[1][1] = @ScriptDir&"\images\ELIX2\E7F9.bmp"
$E[1][2] = @ScriptDir&"\images\ELIX2\E8F9.bmp"
$E[1][3] = @ScriptDir&"\images\ELIX2\E9F9.bmp"
$E[1][4] = @ScriptDir&"\images\ELIX2\E10F8.bmp"
$E[1][5] = @ScriptDir&"\images\ELIX2\E10F9.bmp"
$E[1][6] = @ScriptDir&"\images\ELIX2\E11F8.bmp"
$E[1][7] = @ScriptDir&"\images\ELIX2\E11F9.bmp"
$E[1][8] = @ScriptDir&"\images\ELIX2\E12F7.bmp"
$E[1][9] = @ScriptDir&"\images\ELIX2\E12F8.bmp"
$E[1][10] = @ScriptDir&"\images\ELIX2\E12F9.bmp"

$E[2][0] = @ScriptDir&"\images\ELIX3\E6F9.bmp"
$E[2][1] = @ScriptDir&"\images\ELIX3\E7F9.bmp"
$E[2][2] = @ScriptDir&"\images\ELIX3\E8F9.bmp"
$E[2][3] = @ScriptDir&"\images\ELIX3\E9F9.bmp"
$E[2][4] = @ScriptDir&"\images\ELIX3\E10F8.bmp"
$E[2][5] = @ScriptDir&"\images\ELIX3\E10F9.bmp"
$E[2][6] = @ScriptDir&"\images\ELIX3\E11F8.bmp"
$E[2][7] = @ScriptDir&"\images\ELIX3\E11F9.bmp"
$E[2][8] = @ScriptDir&"\images\ELIX3\E12F7.bmp"
$E[2][9] = @ScriptDir&"\images\ELIX3\E12F8.bmp"
$E[2][10] = @ScriptDir&"\images\ELIX3\E12F9.bmp"

$E[3][0] = @ScriptDir&"\images\ELIX4\E6F9.bmp"
$E[3][1] = @ScriptDir&"\images\ELIX4\E7F9.bmp"
$E[3][2] = @ScriptDir&"\images\ELIX4\E8F9.bmp"
$E[3][3] = @ScriptDir&"\images\ELIX4\E9F9.bmp"
$E[3][4] = @ScriptDir&"\images\ELIX4\E10F8.bmp"
$E[3][5] = @ScriptDir&"\images\ELIX4\E10F9.bmp"
$E[3][6] = @ScriptDir&"\images\ELIX4\E11F8.bmp"
$E[3][7] = @ScriptDir&"\images\ELIX4\E11F9.bmp"
$E[3][8] = @ScriptDir&"\images\ELIX4\E12F7.bmp"
$E[3][9] = @ScriptDir&"\images\ELIX4\E12F8.bmp"
$E[3][10] = @ScriptDir&"\images\ELIX4\E12F9.bmp"

$E[4][0] = @ScriptDir&"\images\ELIXSNOW\E6F9.bmp"
$E[4][1] = @ScriptDir&"\images\ELIXSNOW\E7F9.bmp"
$E[4][2] = @ScriptDir&"\images\ELIXSNOW\E8F9.bmp"
$E[4][3] = @ScriptDir&"\images\ELIXSNOW\E9F9.bmp"
$E[4][4] = @ScriptDir&"\images\ELIXSNOW\E10F8.bmp"
$E[4][5] = @ScriptDir&"\images\ELIXSNOW\E10F9.bmp"
$E[4][6] = @ScriptDir&"\images\ELIXSNOW\E11F8.bmp"
$E[4][7] = @ScriptDir&"\images\ELIXSNOW\E11F9.bmp"
$E[4][8] = @ScriptDir&"\images\ELIXSNOW\E12F7.bmp"
$E[4][9] = @ScriptDir&"\images\ELIXSNOW\E12F8.bmp"
$E[4][10] = @ScriptDir&"\images\ELIXSNOW\E12F9.bmp"


ZombieSearch()

Func ZombieSearch()
   WinActivate ($HWnD)
   $SearchZombie=0
   $ZombieCount=0
   $MatchCount=0
   $match=0
   For $i=0 to 3 Step 1 ;Search per area
	  IS_Area($i, $Tolerance)
	  $ZombieCount=$ZombieCount+$ZC
	  $MatchCount=$match
   Next

If $ZombieCount > 1 Then
   $SearchZombie=1
EndIf

MsgBox(0,"","$ZombieCount= "&$ZOmbieCount&", $SearchZombie= "&$SearchZombie&", $MatchCount= "&$MatchCount&@CRLF&"----------------FILE1 E6F9"&@CRLF&$Area[0][0]&","&$Area[0][1]&@CRLF&$Area[0][2]&","&$Area[0][3]&@CRLF&"----------------FILE2: E7F9"&@CRLF&$Area[1][0]&","&$Area[1][1]&@CRLF&$Area[1][2]&","&$Area[1][3]&@CRLF&"----------------FILE3:E8F9"&@CRLF&$Area[2][0]&","&$Area[2][1]&@CRLF&$Area[2][2]&","&$Area[2][3]&@CRLF&"----------------FILE4:E9F9"&@CRLF&$Area[3][0]&","&$Area[3][1]&@CRLF&$Area[3][2]&","&$Area[3][3]&@CRLF&"----------------FILE5:E10F8"&@CRLF&$Area[4][0]&","&$Area[4][1]&@CRLF&$Area[4][2]&","&$Area[4][3]&@CRLF&"----------------FILE6:E10F9"&@CRLF&$Area[5][0]&","&$Area[5][1]&@CRLF&$Area[5][2]&","&$Area[5][3]&@CRLF&"----------------FILE7:E11F8"&@CRLF&$Area[6][0]&","&$Area[6][1]&@CRLF&$Area[6][2]&","&$Area[6][3]&@CRLF&"----------------FILE8:E11F9"&@CRLF&$Area[7][0]&","&$Area[7][1]&@CRLF&$Area[7][2]&","&$Area[7][3]&@CRLF&"----------------FILE9:E12F7"&@CRLF&$Area[8][0]&","&$Area[8][1]&@CRLF&$Area[8][2]&","&$Area[8][3]&@CRLF&"----------------FILE10:E12F8"&@CRLF&$Area[9][0]&","&$Area[9][1]&@CRLF&$Area[9][2]&","&$Area[9][3]&@CRLF&"----------------FILE11:E12F9"&@CRLF&$Area[10][0]&","&$Area[10][1]&@CRLF&$Area[10][2]&","&$Area[10][3]&@CRLF)

EndFunc

Func IS_Area($i, $Tolerance) ;Search per area then search per file. If not succeed variant 1 proceed 2 else proceed 3.
   $ZC =0
   For $s=0 to ($ZombieFileSets-1) Step 1
	  For $p=0+$ZSExclude to 10 Step 1
		 If FileExists($E[$s][$p]) Then
			$Area[$p][$i]=_ImageSearchArea($E[$s][$p],0,$Lx[$i],$Ly[$i],$Rx[$i],$Ry[$i], $IS_x[$p][$i], $IS_y[$p][$i],$Tolerance)
			If $Area[$p][$i]>0 Then
			   $ZC=1
			   ExitLoop(2)
			EndIf
		 Else
			$Area[$p][$i]=0
		 EndIf
	  Next
;   MsgBox(0,"","$Area ["&$i&"] $ZC: "&$ZC&" $march="&$match&" ElixSet["&$s&"] = "&$Area[0][$i]&","&$Area[1][$i]&","&$Area[2][$i]&","&$Area[3][$i]&","&$Area[4][$i])
   ;If $ZC=1 Then
	;  ExitLoop
   ;EndIf

   Next
EndFunc

With the above code, you could  test your base if will return a false positive. A message will appear and you'll see the collector type hit. So as long as you don't have false positives you may increase tolerance.

It's also important to know if it will still hang for all sets.

Thank You!

Jan 4, 2015#2

@AtoZ
I am trying Imageset B.
Btw:
I added another line, so I could also check later in the screenshot whether the Attacked Zombie was a real Zombie.
Feel free to use it 😉

If ZombieSearch() Then
SetLog("~~~~~~~Dead Base Found!~~~~~~~")
Local $Date = @MDAY & "." & @MON & "." & @YEAR
Local $Time = @HOUR & "." & @MIN
_ScreenCapture_CaptureWnd(@ScriptDir & "\AttackedZombies\" & $Date & " at " & $Time & ".jpg", $hWnd)
ExitLoop
Else
SetLog("~~~~~~~Not dead base, skipping~~~~~~~")
Local $Date = @MDAY & "." & @MON & "." & @YEAR
Local $Time = @HOUR & "." & @MIN
_ScreenCapture_CaptureWnd(@ScriptDir & "\SkippedZombies\" & $Date & " at " & $Time & ".jpg", $hWnd)
Click(750, 500) ;Click Next

Add this to the very top of the script(important!!!):

DirCreate(@ScriptDir & "\AttackedZombies\")
Jan 4, 2015#3

@Cocsi

Thanks man! Don't forget this: DirCreate(@ScriptDir & "\AttackedZombies")

Jan 4, 2015#4

We have autoit syntax highlighting, try [code=autoit with the last ]

Jan 4, 2015#5

Recommended Tolerance:
SET A = 90 (Probably because just added images)
SET B = 65 (This worked on SET C)
SET C = 65 (80 above gives false positives (FP). 70 some FP as well.
As long as you don't skip dead bases, you may lower tolerance.

@AtoZ
Just a question whether I got it right.

The higher the tolerance, the higher the chance to attack an "zombie" even though it isn't one, right?

Jan 4, 2015#6

Very nice work AtoZ and dinobot. I have included new images in testing version (set b) and will post it in development soon.

Jan 4, 2015#7

Also this need to be changed as well right? Otherwise it will give subscript error

Global $Area[11][4], $IS_x[11][4], $IS_y[11][4], $E[5][11]
Jan 4, 2015#8

@Atoz what coc bot version should i paste this code? thanks nice update 🙂

Jan 4, 2015#9

@bushido-21
I am at Alpha 5.3.4 (the one where king,queen and CC is mostly working) but 5.3 is also fine as far as I know

Jan 4, 2015#10

Ran SetA for a couple of hours now with tolerance 90.
It seems that every single base it matches thinks it has zombies which is usually not the case.
I'll test some more and I'll attach all the screenshots and logs it has been through.
Will test next set soon.
Thanks!

edit: Oh and no hang after 4 hours of running though! Good stuff!

Got something to add?

Log in to post a reply.

Join the conversation