AmarSaini / Clash-Royale-AI-Card-Tracker

An application that trains 2 convolutional neural networks to be able to make predictions during a live match (real-time application), on the opponent's card deck, card cycle, and current elixir.
Apache License 2.0
51 stars 8 forks source link

Elixir bar on every game mode #2

Open warklp opened 5 years ago

warklp commented 5 years ago

All game mode now show the elixir bar, that means, isnt working anymore, telling wrong cards and not working couting elixir, you know how to fix it?

AmarSaini commented 5 years ago

It’s because Supercell updated the layout of the spectator mode. The AI isn’t looking at the right spots for the card locations. It needs to be updated to look at the right areas.

warklp commented 5 years ago

I fixed the layout, but i am having problem with the last card of the deck, maybe you can help me image

AmarSaini commented 5 years ago

It looks like you have the testCNN.png open, close the image and try again. (Permission denied to write since the file is open).

warklp commented 5 years ago

i'll see that, and another thing, sometimes i get this error and the script closes image

AmarSaini commented 5 years ago

Interesting, do you have any other cases of this happening?

warklp commented 5 years ago

When i start and my opponent already played 1 card and then he play that card again this always happens

AmarSaini commented 5 years ago

I want to say it has to do with the formatting still. Can you run the program and then close out of it during the game. Afterwards, go to your "testData" folder. This folder is where temporary crops of each of the 8 cards are saved. Maybe they aren't getting cropped right, check to see if the cropped images are indeed the cards.

warklp commented 5 years ago

Another error just happend, everything was fine, game was already on overtime.. image

AmarSaini commented 5 years ago

It looks like it's an error in the save function for the PIL library, give me a moment

warklp commented 5 years ago

Seems like its cropped just fine, but stop working for no reason image

AmarSaini commented 5 years ago

I see the problem here, try placing a r in front of the file path for any open/save function calls, and maybe use the absolute address. Check this out: https://stackoverflow.com/questions/39737448/random-errors-when-using-pil-on-windows "[Errno 22] invalid argument" usually relates to issues regarding file paths

warklp commented 5 years ago

all the cards cropped just fine and i get that error, saying that a card isnt in the list image

AmarSaini commented 5 years ago

As for this error, the opponent's hand isn't getting populated properly. Mind checking how the testData2 folder looks? It should be the areas slightly above the 8 cards.

warklp commented 5 years ago

it is above the 8 cards, but the layout now its different, maybe a little bit confuse for the script image

AmarSaini commented 5 years ago

I see the problem now. The old spectator background/layout was just brown, and it didn't show the elixir count. But now the layout has changed, it shows the current elixir in the brown background area. This makes the neural network think that cards are being placed when they really aren't, because it sees pink which was the old way of determining when a card was played. I would need to retrain this neutral network for it to have correct predictions. This would require a new set of training data, and it may require much more data to train, or perhaps a stronger training method (since the predictions are now harder: pink background with pink pop-ups).

warklp commented 5 years ago

True, that's probably why, thank you, i'll try to do something about it.

AmarSaini commented 5 years ago

Let me know if you think of anything! I see 2 options as of now, 1) retrain the 2nd neural network with new training data, or 2) find a new way to determine played cards.

warklp commented 5 years ago

Well, ive noticed that when the opponent play a card the card go 1 or 2 cm up for a second or less, maybe thats a opening for another way to determine cards played.

AmarSaini commented 5 years ago

That’s true, but that means your computer will have to be able to perform predictions a second each. I believe I choose the pink icon because it lasted longer. It’s worth a try though!

Amar Saini

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


From: warklp notifications@github.com Sent: Wednesday, March 27, 2019 10:00:04 PM To: AmarSaini/Clash-Royale-AI-Card-Tracker Cc: Amar Saini; Comment Subject: Re: [AmarSaini/Clash-Royale-AI-Card-Tracker] Elixir bar on every game mode (#2)

Well, ive noticed that when the opponent play a card the card go 1 or 2 cm up for a second or less, maybe thats a opening for another way to determine cards played.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/AmarSaini/Clash-Royale-AI-Card-Tracker/issues/2#issuecomment-477448689, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AYLePSNpFWcrfBahXAbXfB-dkLRmlg53ks5vbExUgaJpZM4cOs9x.

warklp commented 5 years ago

Another thing ive noticed, most of the times que program dont recognize the "golden cards" just like the last image i shared, do you have any idea of how to make the program recognize the 2 types of cards? golden and not-golden?

AmarSaini commented 5 years ago

Network would also need to be retained for that. Or maybe crop inside the card image (get rid of the gold border) that may work

Amar Saini

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

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


From: warklp notifications@github.com Sent: Thursday, March 28, 2019 9:48:17 AM To: AmarSaini/Clash-Royale-AI-Card-Tracker Cc: Amar Saini; Comment Subject: Re: [AmarSaini/Clash-Royale-AI-Card-Tracker] Elixir bar on every game mode (#2)

Another thing ive noticed, most of the times que program dont recognize the "golden cards" just like the last image i shared, do you have any idea of how to make the program recognize the 2 types of cards? golden and not-golden?

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/AmarSaini/Clash-Royale-AI-Card-Tracker/issues/2#issuecomment-477679160, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AYLePaQC_xFHElw5MkdMDVwVqMvOQmtHks5vbPJQgaJpZM4cOs9x.

warklp commented 5 years ago

Hello again, I'am still trying to fix the invalid argument issue, i don't know where to put the r, can you tell me in which lines?

AmarSaini commented 5 years ago

Hey,

Line 661 should be one. Anywhere you are accessing images for reading/writing. CTRL-F "imsave" for a few.

Amar Saini

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

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


From: warklp notifications@github.com Sent: Tuesday, April 2, 2019 7:31:02 PM To: AmarSaini/Clash-Royale-AI-Card-Tracker Cc: Amar Saini; Comment Subject: Re: [AmarSaini/Clash-Royale-AI-Card-Tracker] Elixir bar on every game mode (#2)

Hello again, I'am still trying to fix the invalid argument issue, i don't know where to put the r, can you tell me in which lines?

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/AmarSaini/Clash-Royale-AI-Card-Tracker/issues/2#issuecomment-479305699, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AYLePcv9UUhpeddmZErSXsYCy0uyp4Yaks5vdBJmgaJpZM4cOs9x.

ComputerApp1234 commented 5 years ago

Any chance for a fix by you, because of the most recent updates or was it just a personal project to deal with neural networks?

AmarSaini commented 5 years ago

Hey, @ComputerApp1234. Yea I noticed the game has updated, such as new spectator layout (different location of cards), elixir bar now shows while spectating if I remember correctly, new cards/some cards have been redesigned. I haven't been working on it too much, but I may make a revamped version that uses a different framework, such as PyTorch or even fast.ai (definitely go check them out!). Also, I may make it so you don't need to be using 1920x1080 specifically (make the card locations depending on max width/height, rather than hard-coded values of a 1920x1080 screen). I'll make an announcement/update to read me soon!

ComputerApp1234 commented 5 years ago

Thank you very much for the fast reply. Like this it would be possible to use other emulators instead of BlueStacks? And an update by you would be great!

AmarSaini commented 5 years ago

I'm not too sure about any other emulators, are you familiar with any?

ComputerApp1234 commented 5 years ago

I usually use MEmu to play Clash Royale.

AmarSaini commented 5 years ago

Ah interesting! Have you tried bluestacks as well? Which do you prefer/is more popular?

ComputerApp1234 commented 5 years ago

I've tried both, but i prefer MEmu, because it feels more stable in my opinion. But this could also be because of my settings. The main reason is i'm more used to MEmu.

AmarSaini commented 5 years ago

Interesting I'll check it out