Fate-Grand-Automata / FGA

Auto-battle app for F/GO Android
https://fate-grand-automata.github.io
MIT License
1.49k stars 274 forks source link

Support selection is not done from top to bottom but is random #63

Closed reconman closed 4 years ago

reconman commented 4 years ago

When selecting a preferred Servant or CE, a random matching one is chosen instead of the one at the top of the current screen.

So if there are 2 Merlins with Chaldea Lunchtime on the screen at the same time, a random one gets picked.

This is counterintuitive, even if it saves performance.

TryBane commented 4 years ago

Assuming it is directly translated from the fgo-lua, then this should not be the case. Instead, it will first cycle through all Merlin images in order that they're created. For example, Merlin4, then Merlin3, then Merlin 2, then Merlin1. Say the Support Selection shows:

Merlin2 image Chaldea Lunchtime image

Merlin4 image Chaldea Lunchtime image

And say the app has Merlin4 input first in the support selection list of images, then Merlin 2 after, then it will search for Merlin 4 in all slots before searching for Merlin2 in all slots. It'll click on the first one it finds, whether on top or bottom.

reconman commented 4 years ago

No believe me, it's truly random. I've already debugged the code.

TryBane commented 4 years ago

Then it doesn't seem to be a direct port of the OG script, since that's not the other scripts behavior (I've tested it myself)

MathewSachin commented 4 years ago

Oh @TryBane is here 👋

It still picks Merlin4 followed by Merlin3, 2 and 1, but if 2 Merlins of in the same ascension come at the same time, it can pick any of them, not necessarily the top one.

It's not the script's behaviour, it's of the custom framework (kind of) I made. Lua scripts behaviour depended on the Silkuli framework used by AnkuLua. This app has a custom libautomata framework which I wrote without knowing about Sikuli (just using OpenCV which is also used by Sikuli anyway).

I wrote searching for multiple images at once in a region to pick the one with the highest score first, this turns out to be much more efficient than top-down search in my opinion. Since the points surrounding the best match also have high enough similarity to cross the matching threshold, they can come up as redundant points. To avoid them we'll have to search for all matches in the images and then sort them top-to-bottom which didn't seem efficient to me. And, this algorithm is working very accurately at this stage. I tried to change it to top-down search but always something messes up or performance suffers, so I gave up on it.

I personally don't think it is much of an issue since the user tells that it can pick Merlin or even some attacker and that does get picked even if not the one with the highest ATK stat if sorting by ATK. The setup should be that much accommodative anyway for automation. And, there are options for Friend selection, Max skills and max ascension when people want to be extremely choosy.

TryBane commented 4 years ago

Yeah, I see what you mean. I can agree that it probably doesn't matter a whole lot.

MathewSachin commented 4 years ago

Seems like a few points about inefficiency I said were already solved when floodFill was tweaked. Sorting top-down doesn't seem like any noticeable difference in performance now. I'll put up a PR soon.