Clash-Royale-AI-Card-Tracker icon indicating copy to clipboard operation
Clash-Royale-AI-Card-Tracker copied to clipboard

How can I run this on my pc?

Open andystevens94 opened this issue 6 years ago • 28 comments

I have downloaded the zip, how can I run the script? Thanks

andystevens94 avatar Sep 04 '18 20:09 andystevens94

Have Bluestacks running. Maximize blue stack window while keeping it in windowed mode. Make sure you have 1920x1080 resolution, as the images are cropped by hard coded pixels. Start the script. And wait for it to ask you for the starting elixir. Start a game on your phone, then on bluestacks, spectate that live game. Enter the starting elixir.

AmarSaini avatar Sep 04 '18 22:09 AmarSaini

I have installed numpy, keras and tensorflow but get these error any ideas what I can do?

pythonerrors

andystevens94 avatar Sep 08 '18 09:09 andystevens94

Make sure all of those packages are updated. Try using "pip install" for numpy, keras, and tf

AmarSaini avatar Sep 08 '18 09:09 AmarSaini

What scaling size % , did you use for your screen display? Bluestack version and aspect ratio + DPI setting? The app runs on my end , however the count elixir goes negative and card images start to shuffle after fifth card is revealed. I am using 1920x1080 resolution. I did noticed that the 8 images are being cropped not perfectly and that's affecting the percentage% on the script. I appreciate your incredible work.

eiby1993 avatar Nov 17 '18 01:11 eiby1993

Hey!

I believe I used a scaling size of 125%, 1920 x 1080 is definitely needed. As for blue stacks, try just maximizing it in WINDOW mode.

Attach some of those cropped images!

AmarSaini avatar Nov 17 '18 01:11 AmarSaini

I have Bluestacks maximized on window mode... It looks like the top bar of Bluestacks is taking more space than it should and it's pushing down the region size of the game. I'd take any advices at this point and hope these pics of cropped images (at the bottom of each) helps.
Note: I believe the percentage for each card on CNN1 should be 99.99% , it shows 50% when images are cropped incorrectly. I am using this an indicator when troubleshooting. cap1 cap2

eiby1993 avatar Nov 17 '18 03:11 eiby1993

Hmmmm I see what you mean!

By any chance do you know some programming? I can direct you to the area of the code, and we can try changing the y-value for the crop (perhaps shift it down).

I'll see what else I can find. Also, what scaling are you on? Maybe try 100%

AmarSaini avatar Nov 17 '18 03:11 AmarSaini

Yes !! I know some python. I'd appreciate if you can point me to the area of code ( line of code #). Last winter, I was learning about PIL library however i did a project nothing near yours. I tried using 100%, 110% , 125% and near values between those numbers ... None of them give me a solid and consistent behavior. Most of them, start to shuffle cards after fifth card is revealed and elixir count goes negative lol.

eiby1993 avatar Nov 17 '18 03:11 eiby1993

Sure I'll let you know what line asap,

Also if you want to debug more, check the "cropped" folders, they should hold individual images that are being cropped at every iteration.

Also, what kind of specs do you have on your cpu? I ask this because neural networks take some time to run, and you may want to have a somewhat fast CPU to keep up with each iteration of the images.

AmarSaini avatar Nov 17 '18 03:11 AmarSaini

Thank you so much ! I've been checking those "testdata" folders . I have a core i7 6700HQ 2.60Ghz and 16GB of RAM... Hope that's enough lol

eiby1993 avatar Nov 17 '18 03:11 eiby1993

Should be more than enough

AmarSaini avatar Nov 17 '18 03:11 AmarSaini

These test images are cropped for 2 different networks. (testData and testData2)

The first, testData, are for the actual cards. These go into the first neural network.

The second, testData2, are for the area above the cards. These are for detecting when cards are played. These go into the second neural network.

More info can be found in the pdf explaining the project.

As for the lines of code. The functions loadTestImages1() and loadTestImages2() are in charge of cropping the right areas of your screen. A screenshot of your screen is taken before these function, and saved as "testCNN.png". This all occurs in the while(True) loop of the main function: liveBothModelPredicts().

Anyway, see the attached images for where the images are cropped inside these 2 loadTestImage() functions.

The format arr[y1:y2, x1:x2] basically means what range of y and x values to crop from. Yes the y values are first

You would want to play with the y1:y2, or in this case, the "58:169" in loadTestingImages1(). And maybe the "58:88" in loadTestingImages2()

AmarSaini avatar Nov 17 '18 03:11 AmarSaini

Let me know if you have any questions in regards to that last email.

Be sure to check out that report to see some examples of how the images are formatted

AmarSaini avatar Nov 17 '18 04:11 AmarSaini

Thank you so much ! I'll play with those numbers and let you know how it goes.. Have a good day ! Note: I did read the report... it was a great document to use a reference. 👍

eiby1993 avatar Nov 17 '18 04:11 eiby1993

No problem!

AmarSaini avatar Nov 17 '18 04:11 AmarSaini

Hey also,

This may matter, what kind of battles are you playing? Friendly, ladder, challenges?

AmarSaini avatar Nov 17 '18 04:11 AmarSaini

friendly :S

eiby1993 avatar Nov 17 '18 04:11 eiby1993

Friendly battles show your opponent's elixir count. There'll be an elixir bar above the opponent's cards in spectator mode, causing the cards to be shifted down a little bit. This may affect the cropping !

AmarSaini avatar Nov 17 '18 05:11 AmarSaini

I didn’t pay attention to that detail . Thanks . It runs fine know ! ;)

eiby1993 avatar Nov 17 '18 05:11 eiby1993

Alrighty!

AmarSaini avatar Nov 17 '18 05:11 AmarSaini

Just a note on MacOS, had to change any of the tkinter lines to start with a capital Tk to get it to run.

mrtrick3737 avatar Nov 20 '18 20:11 mrtrick3737

Check this out

https://stackoverflow.com/questions/27563854/why-cant-the-import-command-be-found

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10


From: mrtrick3737 [email protected] Sent: Tuesday, November 20, 2018 12:26:02 PM To: AmarSaini/Clash-Royale-AI-Card-Tracker Cc: Amar Saini; State change Subject: Re: [AmarSaini/Clash-Royale-AI-Card-Tracker] How can I run this on my pc? (#1)

Getting the following when running the script. I have the packages installed as noted above.

./Clash_Royale_Helper.py ./Clash_Royale_Helper.py: line 1: import: command not found ./Clash_Royale_Helper.py: line 4: import: command not found from: can't read /var/mail/keras.preprocessing.image from: can't read /var/mail/keras.preprocessing.image from: can't read /var/mail/keras.utils from: can't read /var/mail/imutils from: can't read /var/mail/keras.models from: can't read /var/mail/keras.layers.convolutional from: can't read /var/mail/keras.layers.convolutional from: can't read /var/mail/keras.layers.core from: can't read /var/mail/keras.layers.core from: can't read /var/mail/keras.layers.core from: can't read /var/mail/keras from: can't read /var/mail/keras.preprocessing.image from: can't read /var/mail/keras.optimizers from: can't read /var/mail/keras.models ./Clash_Royale_Helper.py: line 29: import: command not found from: can't read /var/mail/PIL ./Clash_Royale_Helper.py: line 33: import: command not found from: can't read /var/mail/PIL from: can't read /var/mail/PIL from: can't read /var/mail/shutil ./Clash_Royale_Helper.py: line 39: import: command not found from: can't read /var/mail/random ./Clash_Royale_Helper.py: line 42: class: command not found ./Clash_Royale_Helper.py: line 43: @staticmethod: command not found ./Clash_Royale_Helper.py: line 44: syntax error near unexpected token (' ./Clash_Royale_Helper.py: line 44: def build(width, height, depth, classes):'

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://github.com/AmarSaini/Clash-Royale-AI-Card-Tracker/issues/1#issuecomment-440417753, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AYLePVWnCY3vzoJPcUnlbHIbTY54pf-9ks5uxGVagaJpZM4WZuHb.

AmarSaini avatar Nov 20 '18 20:11 AmarSaini

Is this expecting a particular version of python? I get it to run in 2.7 but not correctly yet. Can't get it to run in 3.x

mrtrick3737 avatar Nov 20 '18 21:11 mrtrick3737

Definitely Python 3

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10


From: mrtrick3737 [email protected] Sent: Tuesday, November 20, 2018 1:46:53 PM To: AmarSaini/Clash-Royale-AI-Card-Tracker Cc: Amar Saini; State change Subject: Re: [AmarSaini/Clash-Royale-AI-Card-Tracker] How can I run this on my pc? (#1)

Is this expecting a particular version of python? I get it to run in 2.7 but not correctly yet. Can't get it to run in 3.x

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://github.com/AmarSaini/Clash-Royale-AI-Card-Tracker/issues/1#issuecomment-440440820, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AYLePSvy2pjwvpQ-DU9pj6Yx07lRoT9cks5uxHhNgaJpZM4WZuHb.

AmarSaini avatar Nov 20 '18 22:11 AmarSaini

hey, i get this error message when i run the script: " import cv2 ModuleNotFoundError: No module named 'cv2' "

A-Koutiney avatar Jan 14 '19 03:01 A-Koutiney

Looks like you need to install the library for cv2, check out how to use pip to install it.

Amar Saini

B.S. - Computer Science & Engineering School of Engineering, University of California, Merced


From: Ayh0o0m [email protected] Sent: Sunday, January 13, 2019 7:58:23 PM To: AmarSaini/Clash-Royale-AI-Card-Tracker Cc: Amar Saini; State change Subject: Re: [AmarSaini/Clash-Royale-AI-Card-Tracker] How can I run this on my pc? (#1)

hey, i get this error message when i run the script: " import cv2 ModuleNotFoundError: No module named 'cv2' "

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://github.com/AmarSaini/Clash-Royale-AI-Card-Tracker/issues/1#issuecomment-453897396, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AYLePUxIG1oGJYVWMd0W6qnROKUIxstCks5vDABfgaJpZM4WZuHb.

AmarSaini avatar Jan 14 '19 03:01 AmarSaini

i did installed opencv and whenever i typed import cv2 in python environment, it says No module named 'cv2'

A-Koutiney avatar Jan 14 '19 04:01 A-Koutiney

My guess it hat you used "pip install opencv-python" would I believe is for Python 2.7, try using "pip3 install opencv-python"

Amar Saini

B.S. - Computer Science & Engineering School of Engineering, University of California, Merced


From: Ayh0o0m [email protected] Sent: Sunday, January 13, 2019 8:06:44 PM To: AmarSaini/Clash-Royale-AI-Card-Tracker Cc: Amar Saini; State change Subject: Re: [AmarSaini/Clash-Royale-AI-Card-Tracker] How can I run this on my pc? (#1)

i did installed opencv and when ever i typed import cv2 in python environment, it says No module named 'cv2'

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://github.com/AmarSaini/Clash-Royale-AI-Card-Tracker/issues/1#issuecomment-453898067, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AYLePXQsGaakrUiybSsRH48IMw4NC5asks5vDAJUgaJpZM4WZuHb.

AmarSaini avatar Jan 14 '19 04:01 AmarSaini