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

Next battle is not recognized (stage counter simularity at 50%) #462

Closed HayanShiro closed 3 years ago

HayanShiro commented 4 years ago

Before opening an issue:

[x] I tested the latest release [x] I looked at other issues (even the closed ones) [x] I read the Troubleshooting Guide [x] I'll fill this template properly

Your issue will get closed/locked by the bot in case proper info isn't provided If you open unnecessary/dumb issues, you'll be rewarded with appropriate tags.

Describe the bug It doesn't recognize when 2nd battle starts when I use the "next battle>>" in the command maker (it uses normal command cards instead of set autoskill properties) but when I use "next turn" it recognizes the next battle and uses the set autoskill properties. Stage counter simularity is set to 50% for better recognition but it doesn't work.

Screenshots

Video

Device Info (please fill at-least 'Device model'):

Device model: Samsung Galaxy S20+ Screen size: 6.7 inch Android Version: Android 10 RAM: 12GB

salmonrumpnova commented 4 years ago

I'm getting the same issue. You're encountering it only on the Finals - Garden node right? It must be the weird lighting in the background or something messing with the battle counter. I'm getting a similar issue where Battle 1, turn 2 triggers the battle 2 autoskills. If I'm able to one turn everything, there's no issues. But if Battle 1 takes more than one turn, then there's a chance the battle 2 stuff gets triggered and screws everything up.

Chikara1010 commented 4 years ago

I'm getting the same issue. You're encountering it only on the Finals - Garden node right? It must be the weird lighting in the background or something messing with the battle counter. I'm getting a similar issue where Battle 1, turn 2 triggers the battle 2 autoskills. If I'm able to one turn everything, there's no issues. But if Battle 1 takes more than one turn, then there's a chance the battle 2 stuff gets triggered and screws everything up.

Exactly what's happening to me. I tried changing battle counter similarity to no avail and tried installing older versions of FGA with no success either so I have to assume it has to do with the lighting on the stage. I turned on debug mode and saw it check the stage counter and even though it was 1 it'd activate my skills for 2 which then leads to wave 2 activating all my final wave skills.

reconman commented 4 years ago

Sadly it doesn't look like it's fixable.

salmonrumpnova commented 4 years ago

Sadly it doesn't look like it's fixable.

Could you explain why? Maybe we can offer some ideas. I would think gathering more frames on the battle counter could improve the accuracy, even if the background is messing with it.

reconman commented 4 years ago

@salmonrumpnova What I'm seeing is that the lights take about 3 seconds to pan. You would have to compare 100s of images then.

svuong-dev commented 4 years ago

@reconman What about using the fade-to-black transition battle screen as the trigger?

balthanon commented 4 years ago

I was seeing this happen as well and was about to open another issue. Would it be possible to have an optional setting for a battle to check for the intermediate screen between waves or something instead of relying solely on the turn counter in the upper right corner? (Another possibility that might be more surefire is letting the user set up an image of the enemies in the waves to trigger knowledge of when you've transitioned. That would likely be hard to handle as a quick fix though.)

Assuming those aren't possible, is it possible to work around this (or at least reduce the chance of it occurring) by increasing the threshhold for the stage counter image recognition? (Already set to 85%, so I'm guessing this may not work. Going to try 95% though. Edit: Nope, doesn't work.)

devilhunter84 commented 4 years ago

I noticed the same thing on the Finals-Garden Stage.

The script which let the party facecard the first Wave to build gauge and then NP'd W2+W3 worked at the first few tries then suddenly not anymore. It seemed to randomly work again then jump to other parts of the battle actions.

The script suddenly choose the actions for Wave 2 on Wave 1 after the first turn and didn't wait for W2. I have been trying find out what i did wrong, but it seems people here also had this problem, so i also think the jumping pillar placement and the moving lights behind the Wave number counter mess this up.

Chances are good that if you don't NP nuke W1 + W2 and facecards can't finish it, it will load in the actions for the next Wave in the current one.

Campyre commented 4 years ago

Also getting this issue on Finals Arena where FGA activates the script for wave 2 despite being on wave 1. The stage counter similarity is at 95%. It might be the background of the stage that is triggering this bug.

MathewSachin commented 4 years ago

@HayanShiro is on KR server and from their other issue #461, their problem is not configuring the regions properly.

For the NA guys, the background animations varies a lot in Gilfest Finals nodes, so, you're better off either using 3T comps or just farming manually if you want to go for RNG comps. I have a few workarounds in mind but none of them are simple enough to be get done before Gilfest ends.

HayanShiro commented 4 years ago

My side of the issue is fixed by making FGA full-screen just like FGO. Should I keep this open or closed?

MathewSachin commented 4 years ago

Since the NA folks have taken over this issue, I'll just leave this open.

potchy commented 4 years ago

I'm running 70% similarity with a comp that's a bit RNG and it's working well. Here's the video. I usually don't 3T stuff because I want to prioritize Mystic Code and Bond EXP.

Anyway, the point of this setting is to control how similar the saved stage counter screenshot should be when compared to the actual screen for the script to consider that the stage has changed. It's kinda counterintuitive, but the higher you set it, the less tolerant the script will be. By setting it to 95%, you're expecting a near perfect match, so if the background of the quests changes even so slightly, the script will think the stage has changed, which is the opposite of what you want. Therefore, you should set it to a value lower enough for the script to disregard minor background changes but still high enough for the script to detect actual stage changes. There isn't a 100% effective bullet-proof value you can use for all quests, so a little experimentation to find one that works for you is to be expected.

MathewSachin commented 4 years ago

@potchy I don't really know since I mostly 3T, but many people have told me that they tried values from 50-70 but didn't work well. Some people even said it's not failing consistently, which I think is possible since the background fluctuates heavily in this round.

I'm thinking of picking up the white pixels from the screenshot for Battle counter and only use them for matching. Not sure if that'll be any better, but I guess it's worth a try.

balthanon commented 4 years ago

Anyway, the point of this setting is to control how similar the saved stage counter screenshot should be when compared to the actual screen for the script to consider that the stage has changed. It's kinda counterintuitive, but the higher you set it, the less tolerant the script will be. By setting it to 95%, you're expecting a near perfect match

I was wondering if I had reversed those, but hadn't gotten around to trying the opposite. First try at 60% didn't recognize the transition into Wave 3, but the second at 70% looks to be running fairly well.

I'm only running into this on an account that I play around with which is pure support characters, so I don't really have any pure 3T comps since I have no characters with damaging NPs . :) If I have a few failures on the runs, I'll live with that-- I think the comp I have should power through without dying when it happens, it's just going to take considerably longer. And if I'm running it through Automata that shouldn't really matter much.

I'll take the quality of life improvement that Automata represents even with uncertainty over trying to run manually. :)

MathewSachin commented 4 years ago

Hmm, using only white pixels for detection does seem to work well (at least on this node) Have been tuning it since yesterday and I think it's in a good state at least for this Gilfest node. I don't think I'll finalize this before Gilfest ends since I need to test this out on different nodes to see how effective this is.

Here's the build if anyone wants: https://github.com/MathewSachin/Fate-Grand-Automata/actions/runs/270940199 This can be installed side-by-side with the PlayStore version. The Stage Counter Similarity fine-tune setting is not used in this build.

forgehe commented 4 years ago

Ran into the same issue, tried with 95% and 99% similarity, but found it was using wave 2 and 3 skills on wave 1. I'm currently running it with 75% similarity and it's working well for me. Just ran my autoskill ~ 2 ties using the CI build and it worked well using the default settings.

Device model: Samsung S8

EDIT: Further testing with the CI Build. Did notice very rarely it wouldn't use the wave 2 skills. Changed the Similarity to 95% and testing it right now. Currently working well for 60 runs.

balthanon commented 4 years ago

Just tested the new build and it didn't recognize the transition to Wave 2 for me. I turned on debug mode and from what I can tell, it wasn't looking at the full round value-- (i.e. instead of highlighting the 2/3, it just highlighted the 3)--though it was very quick, so it's possible I misinterpreted. I'm using Nox, so I don't think there's a full screen mode to activate, plus the Google Play version was recognizing waves.

jochuan commented 4 years ago

I think i have the same problem, in the battle script my chacha should use her NP in the third wave but sometimes she uses it in the second wave and when this happen i usually lose the battle and this is happening in the Finals-Garden Stage too.

MathewSachin commented 4 years ago

I made further improvements in picking just the white pixels from the stage counter snapshot by cropping out the black regions around the white pixels.

Currently using Agartha - Great Underground River (Jungle Voyage) for benchmarks (#408) since Gilfest is over now. And, that change seems to be working fine and distinguishing waves with good enough similarity values too. Latest build: https://github.com/MathewSachin/Fate-Grand-Automata/actions/runs/293738304

If anyone knows of a node with more background animation near the stage value, do let me know.

hibikikuze4dan commented 4 years ago

Okeanos - Isle of Wyverns and the pirate ship are where I ran into this problem other than Gilfest. It doesn't happen as much as Gilfest maybe like 1/15 times as opposed to Gilfeststs 1/5 when going on default settings. Best of luck, you've really made something great here.

GoatHead commented 4 years ago

NP Spam setting is not working on the second wave in the Oni Land food court. In the first battle of wave, there is a bug that clicks on space with NP, but after the second battle of the same wave does not click NP, but only selects cards. I'm not sure, but I think it's because of a similar cause.

jochuan commented 3 years ago

I think that i getting the same problem in this Christmas event, sometimes the servants don't use the NP in the last wave

jochuan commented 3 years ago

Also sometimes they use the NP in the second wave instead of the third wave

tuananh131001 commented 3 years ago

Also sometimes they use the NP in the second wave instead of the third wave

I have the same problem in Christmas event

Wizzdom1 commented 3 years ago

Wasn't sure if this is the proper issue to reply on, but I'm facing a similar issue running the Enma-tei event, except I suspect it's different than an issue with image recognition:

I have scripts setup to run through the different "Task" stages for the event. They're not 3T setups. Instead they prioritize Art cards for the first 2 battles then spam NP on the 3rd. For battle 1 and 2, I select different targets for servants to pick off first. As an example, I have a setup for Abby, Hokusai, and Nero Bride that looks like this:

g3,#,i3t1,#,abdefh3j456

Basically using a skill in battle 1, targeting an enemy and using a skill for battle 2, and using all skills + NPs in battle 3. When I load the app for the first time, go into battle, and start the script, it will successfully go through the quest without missing a beat for at least 3 runs, where the script promptly stops when it hits the AP refresh screen.

However, if I refresh AP myself, repeat the quest, and tell the script to run again, it will always commit the 1st battle's setup in the 1st turn and the 2nd battle's setup in the 2nd turn, regardless of which wave it's in.

I had switched on Debug mode to see what was happening. When the app is loaded up initially and the script runs, the output seems to be correct (green boxes on the correct battles, red boxes when the battle has changed).

I recorded a couple videos to show their behavior (they were too big to upload so I threw them unlisted on Youtube):

https://youtu.be/oCjv6-6wvYg This video shows a full round that works properly; this was the first script run since the app had loaded.

https://youtu.be/aiZfrnAHf00 This video was taken after choosing to repeat the quest manually, then running the same script again. It shows the incorrect behavior with skills being used in wrong battle turns. I let it finish the quest and auto-repeat to show that it works correctly in the second quest.

I'm guessing the battle counter isn't resetting properly once script goes off? I tried looking at the code myself but I'm not proficient in Kotlin.

I'm using Bluestacks with Oneplus 3T profile. I had this behavior in both the regular release version and the newest canary version.

potchy commented 3 years ago

@TheErwin what similarity value are you using? (More options -> Fine-tune -> Stage Counter Similarity (%)

I'm running 70% and it seems to be doing okay.

Wizzdom1 commented 3 years ago

@potchy I tested it with 70% and it seems to be the same result. I've worked around it by closing the app and relaunching it anytime I want to restart a script. Thankfully I only have to do it if the script uses skills/NPs in between battles.