Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed drag to place cards #19

Open
NomadCHK opened this issue Nov 13, 2024 · 8 comments
Open

Failed drag to place cards #19

NomadCHK opened this issue Nov 13, 2024 · 8 comments

Comments

@NomadCHK
Copy link
Contributor

NomadCHK commented Nov 13, 2024

image
image

This screenshot is an example. Maybe it's the starting position, or the timing. Or the problem could be the straight motion, maybe we need to add some curve.

It would be nice if someone could join me in figuring this out. I've added a new debug window to the refactor branch of the fork repository. #18

@AdriaGual
Copy link
Owner

I’ve noticed that the issue seems to be related to both speed and distance. Let me explain:

Depending on the card’s position, moving it to a bench position can require either a longer or shorter distance. During testing, I observed that cards with a longer distance to travel were more likely to be successfully played.

I think we should consider an approach that takes both factors into account: the card’s position and the position of the bench.

Hope this helps!

@TerpToke
Copy link

@NomadCHK @AdriaGual My knowledge is limited but I'm very tech savvy and adore learning these kind of things. The learning aspect comes easy. If there's ever anything I can do to help this process, let me know!

@AdriaGual
Copy link
Owner

@TerpToke You can help in a lot of ways if you want, this days I felt like people would appreciate having a discord server to share knowledge, like a FAQ so people can start using the bot it easily, maybe also an instalation tutorial would be nice.

Another thing that came to my mind is taking captures of the same images that we use in english but for other languages, that would help moving a step further to the multilanguage bot.

If you wanna code, I would tell you to wait a bit, not for anything but @NomadCHK is working on an amazing refactor of the whole code structure #18

This refactor changes a lot of stuff (it's an amazing work), but I feel it will be easier for you when all this is merged!

Also you can contribute with ideas (stuff you would like to have on the bot)

All help is super helpful ❤️

@NomadCHK
Copy link
Contributor Author

NomadCHK commented Nov 14, 2024

I’ve noticed that the issue seems to be related to both speed and distance. Let me explain:

Depending on the card’s position, moving it to a bench position can require either a longer or shorter distance. During testing, I observed that cards with a longer distance to travel were more likely to be successfully played.

I think we should consider an approach that takes both factors into account: the card’s position and the position of the bench.

Hope this helps!

I will try to make some adjustments today, the problem happens mainly when putting the rightmost card in the leftmost bank, it is as if it does not catch the card and passes the stroke through the hand while going to the left. I would like to make it go first in the Y direction and then in the X direction (a multi-point drag), but it is not simple via ADB. We can record actions with ADB (like a macro file), but it will require recording many times. each hand size - number of cards and each movement of each card position (8, 7, 6) for each bench (4) in each hand size. so I do not know yet

@NomadCHK
Copy link
Contributor Author

NomadCHK commented Nov 14, 2024

@TerpToke You can help in a lot of ways if you want, this days I felt like people would appreciate having a discord server to share knowledge, like a FAQ so people can start using the bot it easily, maybe also an instalation tutorial would be nice.

Another thing that came to my mind is taking captures of the same images that we use in english but for other languages, that would help moving a step further to the multilanguage bot.

If you wanna code, I would tell you to wait a bit, not for anything but @NomadCHK is working on an amazing refactor of the whole code structure #18

This refactor changes a lot of stuff (it's an amazing work), but I feel it will be easier for you when all this is merged!

Also you can contribute with ideas (stuff you would like to have on the bot)

All help is super helpful ❤️

@AdriaGual About this, I think it's easy to change the language to English, and English is very common among most users. My ideas are to focus on integrating it on more devices (I need to improve the similarity calculation to handle different resolutions) and also automatically scale the coordinates that are hard coded. I've already done some tests with this and managed to run it on my phone well, I had some problems finding some images like the timer in a different resolution, but I think it's possible to do.

But before we do that, maybe we need to make the game stable with the following:

Game state tracking: make it count energy and track the field better (less redundancies, track hp, points, etc.).
Improve actions: confirm actions (maybe we can use/read the battle log), curved swipe (drag on multiple points to improve card positioning).
And then finally:
AI (decision tree or others): start making the bot smart, with it playing by the rules and some strategies.

I think the most hard now is to make game state tracking work well..

@TerpToke One idea:
If you want you can try working on a class that reads and maintains the battle log in the app. After having that we can use it to check actions and game states. I think the idea is read the battle log at each turn start, and maybe with each action on bot turn

@NomadCHK
Copy link
Contributor Author

So, just to make a small update, the latest changes have improved a bit, but the problem still persists when trying to place a card that is too far to the right on the left bench.

@AdriaGual
Copy link
Owner

AdriaGual commented Nov 16, 2024

Yeah, this is the bug, as you say, it can't play the card from right to the left bench

image

Also seems that tries to play misty as if it was a pokémon to the bench?
image

@NomadCHK
Copy link
Contributor Author

@AdriaGual take a look at this:
https://github.com/dtmilano/AndroidViewClient/blob/master/examples/helper/swipe

maybe the android view client can solve the dragging issues, that way we can do the Y movement first to place the cards. Let me know if you think it's worth switching from pure adb to this. I'll do some tests...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants