FGA Documentation

Auto-battle app for F/GO Android

2,400 stars Kotlin Kotlin 1 file · ~14,939 tokens #accessibility#android#fate#fgo#kotlin#mediaprojection#opencv
RAW Doc

Technical Documentation: Fate-Grand-Automata/FGA

ℹ️ Provenance: Multi-Tier Ingestion · CodeWiki Reference

Overview (README.md)

Fate/Grand Automata

Auto-battle app for FGO (Android 7 or later, no need for root on phones).

Download from our website

This is a Kotlin port of FGO-Lua as an Android app with UI for configuration and without a time-limit on use.
It doesn't tamper with the game in anyway and works by looking at the screen and tapping things just like a normal user would do.
It's not made to do the story for you, but to automate the mundane farming.

Having Trouble? See the Troubleshooting Guide first.

Video Guide by @reconman

How to Use?

  1. Install from the link given above and launch the app.
  2. Click on Start Service and give all the permissions it asks for.
  3. Open FGO. Now, you can see a button with play icon on it floating on screen.
  4. Go to the node you want to farm.
  5. Press Play to start. The same button can be pressed to pause/stop later.

Check the Troubleshooting Guide first if you face any problems.

How to make/use images of Servant/CE/Friend?

See the wiki page for Support Image Maker.

What about other scripts like Lottery and Friend Gacha?

When you click on the PLAY button, the app detects which script can be run on the current screen and presents it to you.

How does it work?

This is a native Android app written in Kotlin.
We use OpenCV for image recognition,
Media Projection for taking screenshots
and Accessibility Service for clicking/swiping.

Contributing

If you want to contribute, read the Contribution Guide.

Acknowledgements

Like the project? Want to support us?

Code/doc contributions are surely welcome!

Translations should be edited via https://poeditor.com/join/project/67PXOyBGI0


Agents README (`docs/agents/README.md`)

Agent topic guides

The path-specific half of this repo's AI-agent guidance; the always-loaded half is
AGENTS.md at the repo root. These files are the single source of
truth — keep them provider-neutral (plain prose, no frontmatter, no tool names, no
@-imports) so any agent can read them, and never copy their prose elsewhere.

Three layers point at them, so an agent only pulls in a topic when it is relevant:

Layer Files Mechanism
Universal AGENTS.md router section Every agent reads the root file; each entry names a trigger and the guide to read.
GitHub Copilot .github/instructions/*.instructions.md applyTo: glob, applied when a matching file is in context.
Claude Code .claude/rules/*.md paths: glob, loaded when the model touches a matching file.

The vendor files are stubs: a glob, a one-line reason, a pointer here. Adding a guide means
a stub in each vendor directory and a trigger line in the root router; adding an agent
(Cursor's .cursor/rules/*.mdc, Windsurf's .windsurf/rules/) means copying a stub and
renaming the glob key.


Donations (`wiki/Donations.md`)

You can donate over at Ko-Fi. Your support will help keeping the project alive.

Past supporters:

Vítor Martins Salustiano R$ 100.00 BRL
Fred Hong $ 50.00 USD
Ji Hoon Kim $ 10.00 USD
Nathan Farrar $ 5.00 USD
Federico Rapetti € 3.00 EUR
William Lu $ 20.00 USD
@sleeping-player $ 100.00 USD
Riya $ 10.00 USD
Roman Furman $ 5.00 USD
Georges FANG $ 10.00 USD
Rysu $ 25.00 USD
Golemming $ 5.00 USD
Oscar Ezeigbk $ 10.00 CAD
1993 $ 10.00 USD
--- $ 10.00 USD
@Whatwaq Discord Nitro for a month
Miles Chan $ 5.00 USD
Matthew Uy $ 5.00 USD
Viet Hong Vu $ 5.00 USD
Zane $ 10.00 USD
Brian R $ 10.00 USD
Zhenjue Huang $ 10.00 USD
Jelsin $ 5.00 USD
Peng Xia $ 6.00 USD
Hermann Probst $ 10.00 USD
赫 王 $ 1.00 USD
SHENKAI $ 1.11 USD
严​明 $ 10.00 USD
Jürgen Blume € 55.55 EUR
Ibrahim Jadoon $ 15.00 USD
Meemoo . $ 10.00 USD
Frederic Baudoin $ 5.00 USD
Michael Allen $ 20.00 AUD
Billy Jaya $ 20.00 USD
Lê Trung Quân Lê Trung Quân $ 3.00 USD
Thinh Ha $ 10.00 USD
Vincent Tam $ 10.00 USD
--- $ 57.25 USD
itscakebuffet $ 50.00 USD
Trung $ 3.00 USD
--- $ 10.00 USD
Rafael Stolarczyk $ 11.12 USD
Junhao Zhu $ 5.45 USD
Cipher $ 4.00 USD
Kenneth Burcham $ 10.00 USD
--- $ 50.00 USD
Javier Alejandro Bahena Nuñez $ 4.57 USD
Amir Fuhaira Bin Mohd Fuad $ 10.00 USD
William Lu $ 20.00 USD
ZenMagus $ 5.00 USD
Eikel Perez $ 5.00 USD
Willard McDougal $ 50.00 USD

Fine Tune (`wiki/Fine-tune.md`)

First things first, before reporting any issues, try resetting these to defaults.
The defaults should be good enough. Don't be too dumb when setting the values and complain to me that things don't work. Ideal values will vary between phones and potatoes.

Wait after clicking (ms)

Delay after each click/tap unless clicking repeatedly. Some time is needed for the game's animations to finish.

Click duration (ms)

Every tap/click is like a hold and release performed quickly. This sets the time difference between the two.

Multi-click delay (ms)

Delay between individual taps/clicks when doing so repeatedly like at the end of battles, friend point summon and lottery script.

Wait after swiping (ms)

Wait after all swipes.
Right now, it is only used when searching for friend supports and in Gift Box script, but will also be used for cases where any other swipes get added in future. Some time is needed for the game's animations to finish.

Swipe duration (ms)

Time taken to swipe. Swiping faster will scroll more, slower will scroll less.

Support Swipe Multiplier (%)

The distance of each swipe is scaled by this. Use it along with swipe duration to tweak it to your needs.

Wait Multiplier (%)

Scales every wait and delay. Raise it to slow the whole script down, lower it to speed it up.


Friend Point Summon (`wiki/Friend-Point-Summon.md`)

Friend Point Summon script won't do the daily free summon. You have to do the daily free summon yourself.

It can start after you've done the daily free summon:

Or, you can also start it from the summon results screen:

This script won't start on Saint Quartz summon screen as a safeguard, unless you start from the summon results screen.


Game Area Detection (`wiki/Game-Area-detection.md`)

How FGO should look with wide-screen update

JP, CN, KR, NA: Should fill the entire screen including the notch.
TW: Turn ON More options/Advanced/Ignore notch calculation if FGO doesn't leave the notch area black.

Only use Ignore Notch on TW servers, otherwise it has no effect.

There should be no black bars on the screen.

FGO looks different on my phone

CASE 1: Borders around FGO are black

On some devices, FGO isn't covering the full screen. This could be because of system settings or because of Android 12 Gesture Navigation.

This is an example which causes problems for FGA:

If your device is made by Huawei, LG, Samsung or Xiaomi, you can fix the black bars with System Settings.

Fullscreen settings per manufacturer:

Manufacturer Guide
Huawei Open Settings app
text
Go to *Display & brightness > More display settings > Full-Screen Display*
    Turn ON the switch for FGO |

| LG | Open Settings app
Go to Display > App scaling
Set FGO to Full Screen |
| Samsung | Open Settings app
Search for and select Full screen apps
Turn ON the switch for FGO |
| Xiaomi | Open Settings app
Go to Display > Fullscreen mode
Turn ON the switch for FGO |

If you have any other device, try switching to 3-Button Navigation (Triangle, Circle, Square). If that doesn't work or you want to keep using Gesture Navigation Mode, check the Custom Game Area megathread.

CASE 2: Your phone has borders around FGO even at the bottom of screen

LGv60 Google Pixel 4L

The black border are for gesture navigation.

To get rid of them:

  • Go to Settings > System > Gestures > System Navigation.
  • Change to 3-button navigation.

If that doesn't work, check the Custom Game Area megathread.

CASE 3: Your phone is Android 7 or 8 and has a notch

Notch detection is only possible on Android 9 and above. Either update your phone or find a way to disable notch in your phone's settings.


Gift Box (`wiki/Gift-Box.md`)

Gift Box script is just for receiving all Silver and some Gold embers from your present Box.


"Max Gold ember set size" setting explanation:


0 = For no gold ember (will only pick silver embers)
Any number more than zero, will pick Gold embers that are lower or equal to the selected number.

E.g. Based on the images posted above,
FGA will select Gold (and silver) embers that are equal to or less than 10.


Home (`wiki/Home.md`)

Welcome to the Fate-Grand-Automata wiki!

WIKI IS UNDER CONSTRUCTION

Things we're absolutely against

This app is only meant to automate repetitive farming battles.
We don't plan on supporting things that could possibly lead to the creation of bot accounts which need no supervision from users OR things that will be blatant violation of FGO's ToS.

We won't provide support for:

  1. Re-rolling scripts
  2. Automatically logging in at the reset times
  3. Doing the story for you
  4. Messing with the game data or network connections
  5. Playing with screen turned OFF or FGO not in foreground
  6. Playing offline (someone did DM me for this if you're wondering)

Privacy Policy (`wiki/Privacy-Policy.md`)

We don't store your data. PERIOD.
We don't even have a server to store them.

What you do on your phone stays only on your phone or with the cloud backup providers you setup.

The app doesn't have INTERNET permission either.

For the crash reports on Google Play, we only get the Device model and the place in the code the error occurred and no other personal information that could be used to track you.


Running On Emulators (`wiki/Running-on-Emulators.md`)

Nox

On Nox, FGA needs Root to work since MediaProjection doesn't seem to work.

  • Make sure you're using an Android 7 instance of Nox.
    Use MultiDrive for managing/creating Nox instances.
  • Go to More options in the app and turn ON Use Root for Screenshots.
  • You also need to enable Root from Nox's settings. See How to root Nox.

Bluestacks

These settings are tested, some other may also work:

  • Install Bluestacks X
  • Start the Multi-Instance Manager as Admin and create a 64-bit Pie instance in the
  • DON'T use root for screenshots
  • Change to High Performance mode:
    • Open Bluestack's settings
    • Go to Performance tab.
    • Set Performancer mode to High Performance (For some installations, this breaks Bluestacks as soon as you start the FGA service and you need to enable Compatibility mode instead)
    • Save settings and Restart Bluestacks.
  • Install FGA from the Play Store, not from Github
  • In order to start the FGA service, rotate the screen to portrait mode first. See this comment for more details.

MEmu

  • Enable Root Mode in the MEmu's Engine settings
  • Enable Use Root for Screenshots under More options -> Advanced

LDPLAYER

  • Works without needing any changes to ldplayer settings

Troubleshooting (`wiki/Troubleshooting.md`)

Step 1

Force-stop FGA or restart your phone and see if that works.
This is a quick-fix for battery optimization issues.

Other screen recorders

Don't use other screen recorders with FGA, if you do, force-stop FGA if it doesn't work properly.
When recording for bug-reports for FGA, use the inbuilt recorder from More options/Advanced/Record screen.

Where's 'Script Mode', Lottery, FP, Support Image Maker?

The app automatically detects which script can be run on the current screen.
It will show the relevant option when you click on the PLAY button.
Support Image Maker shows up as a button on the bottom-left corner of the popup if you click on the PLAY button on the support screen.

Where's the PLAY button?

The PLAY button only appears when you switch your phone to horizontal mode, for example when you start FGO. If it still doesn't appear you can try a combination of stopping and starting accessibility and force-closing FGA until it appears.

If the button disappears overnight or when you lock your screen, then battery optimization is at fault. See #314.

The PLAY button is in the way when I watch videos

On the FGA notification, press the arrow in the top right, then click Stop.
If you want to enable the play button again, open the FGA app and start the service

See Example

Having trouble on Emulators?

See Running on Emulators

Can I run FGA on Apple devices?

No, the app uses Android-only code. There are some auto-clickers for Apple, but it won't have the intelligence of FGA.

If you still want to use FGA, run it on an emulator or use normal auto-clickers.

Video guide for creating auto-clicker rules with voice controls: https://www.youtube.com/watch?v=JSFiys-j0JM

Why are newer FGA versions a different app on my phone?

Starting with June 2023, the app is published under the package io.github.fate_grand_automata on Github and the Play Store.

This means you'll have to transfer your settings from the old com.mathewsachin.fategrandautomata app manually.

The package change was required so I can publish the app as beta-only in the play store. Google doesn't allow me to publish the old app as beta unless I also make it publicly available, which attracts users who refuse to read instructions and leave 1-2 star ratings.

The Play Store version allows user to use the Accessibility Service feature without restrictions and to update FGA automatically.

I'm trying to use FGA for the first time and I can't click OK after clicking on the PLAY button

You need to select a battle config on the left to use.

Where did the "Stop after CE drop" feature go?

It's now part of the window appearing after pressing the PLAY button in FGO and allows you to set it to stop after X amount of CE drops

Can I migrate my settings from the Quick icon version to the Buster icon one?

No, such a functionality was not implemented, but you can do it yourself:

  • Install the Buster version from the play store, but keep the Quick version for now
  • Export all battle configs in the Quick app
  • Import them to the Buster app
  • Transfer the rest of the settings manually by checking all settings in the old app and configuring the new app the same way

Will I get banned for using FGA?

FGO's Terms of Service contains this line, so everything could be banworthy to them:
(17) Any other act which Aniplex considers inappropriate.

However, nobody got banned yet for using 3rd party apps. They mainly ban for account trading.

Do I need root mode for FGA? My phone is not rooted.

You don't need root, but you can't record videos of FGA in Android 13 without it.

Some emulators need root mode to work and if you have a rooted phone, you should enable root mode because you'll get fewer issues.
See https://youtu.be/iIjZPjDcZeM for how to record on android 13 and up without root

Can you use FGA to do story nodes?

No, because of several reasons:

  • FGO requires you to search for and select the next story node on the map, which requires complicated swiping and tapping. There's no way a computer knows where to find it and how to navigate to it.
  • Starting with Camelot, Story chapters become difficult and can't be beaten with Level 120 Servants consistently. At that point you'll have to look up enemy patterns and build specialized teams.
  • The SKIP button in the top right can't be detected reliably, so FGA will get stuck at dialogue options (top or bottom answer)

IMPORTANT: Make sure the game looks as FGA wants it to

If you're having trouble, this is mostly related.
See Game Area detection

Clicking on PLAY doesn't open the popup to start scripts?

Game booster/Game mode or other app blocking notifications/popups when a game (FGO) is running.
Turn them OFF. Known to happen on some LG, Samsung and Motorola.

For LG:
Turn OFF Game Tools since it has the feature to prevent ALERTS from showing up.
This prevents the dialog which lets you pick AutoSkill config from showing up.
https://www.lg.com/us/support/help-library/lg-g7-thinq-gaming-tools-CT10000027-20150726480680

On other phones, if you have something like a Game Booster that blocks alerts from other apps when playing a game, turn it OFF.
Instructions would vary depending on your device, so Google.

Worked before, doesn't work now

See #314

Keeps asking for Accessibility even after turning it ON

See #314

Uses skills on the wrong servant or doesn't use skills at all

Do you have skill confirmation ON in FGO?
If so, either turn that OFF or turn ON More options/Skill confirmation in FGA.

Not picking NP/cards on Attack screen OR Got stuck in some info screen

Is it just your phone lagging badly? If so, either get a new phone or try increasing the delays in More options/Fine-tune.

Doesn't work on some screens

  1. Check that you're not placing the PLAY button in a weird place.
    See Where should I place the PLAY button?

  2. Is there some overlay on your phone/emulator screen that can screw up image matching?
    For example:

Where should I place the PLAY button?

Bottom-left corner is ideal. While you can drag the button around to other places, there is a possibility of screwing things up if it comes in the way of image matching.

Why is FGA opening Servant details at the start of the battle?

That's an intended feature for detecting which face cards belong to which Servant.

Every time a new Servant enters the field, FGA will also open up their details to take a screenshot of their face.

It can be disabled in More Options, but you won't be able to use several features relying on face card matching.


Privacy Policy - License - Donations

Google Play and the Google Play logo are trademarks of Google LLC.

Fate/Grand Order is Copyright Aniplex Inc., DELiGHTWORKS, Aniplex of America and Sony Music Entertainment (Japan) Inc. All images and names owned and trademarked by Aniplex Inc., DELiGHTWORKS, Aniplex of America and Sony Music Entertainment (Japan) Inc. are property of their respective owners.



Agents Automation Scripts (`docs/agents/automation-scripts.md`)

Writing automation logic

How a script run is wired (Hilt)

Two long-lived services: ScriptRunnerService (foreground service owning the overlay,
notification, and ScriptManager) and TapperService (AccessibilityService providing
gestures).

Each run gets its own Hilt component: ScriptComponent (@ScriptScope, child of
ServiceComponent, built via ScriptComponentBuilder with the live ScreenshotService
bound in). ScriptManager builds it, pulls the chosen EntryPoint out through the
ScriptEntryPoint Hilt entry point, runs it on its own thread, and tears the component
down at exit (including explicitly closing the Tesseract OcrService). Consequences:

  • ScriptScope singletons (Locations, ScriptAreaTransforms, ScreenshotManager,
    FgoAutomataApi, …) are recreated per run, so screen-geometry values are computed once
    per run and cached.
  • Adding a new script mode means: entry point class in scripts/.../entrypoints/, a getter
    on ScriptEntryPoint, a ScriptModeEnum value, and a branch in
    ScriptManager.getEntryPoint.
  • Bindings for a run live in app/di/script/ (LibAutomataModule for libautomata
    interfaces, ScriptsModule for FGO-level ones).

Script structure

Entry points extend EntryPoint and implement script(): Nothing. ExitManager implements
stop/pause by throwing ScriptAbortException from inside wait/click primitives, which is why
script() never returns normally — exit and errors surface through scriptExitListener.

The dominant pattern (see AutoBattle.loop()) is a map of screen detectors to
handlers
, evaluated in order inside useSameSnapIn { }, one action per iteration, then a
short wait. Order matters: earlier entries win. Detectors must be cheap image/color checks,
not stateful logic.

Mix in IFgoAutomataApi (delegating to an injected FgoAutomataApi) to get prefs,
images, locations, messages, plus the Region/Location extension DSL:
images[Images.Menu] in someRegion, region.exists(pattern, timeout),
region.waitVanish(...), location.click(), duration.wait().

  • useSameSnapIn { } caches one screenshot for the whole block. Any group of checks
    that must agree on a single frame has to be inside it; without it every exists takes a
    fresh screenshot (slow, and racy across animations).
  • User-facing text never goes in scripts/ (no Android R). Emit a
    ScriptNotify/ScriptLog through messages: IScriptMessages;
    app/util/ScriptMessages.kt maps it to a localized string, toast, or notification.
  • Never hardcode wait/similarity magic numbers casually — PlatformPrefs exposes
    user-tunable minSimilarity, waitMultiplier, swipeMultiplier (the Fine-Tune screen).
    Explicit similarity arguments in Region.exists should be rare; anything under ~0.65
    means the template image is wrong.

Agents Coordinates (`docs/agents/coordinates.md`)

The two coordinate systems (most common source of bugs)

Two resolutions are in play at once, and mixing them up is the most frequent bug in this
repo. CONTRIBUTING.md has a step-by-step guide for measuring new coordinates in an image
editor; the essentials:

  • Image matching happens at 720p grayscale. Screenshots are captured at native
    resolution, converted to grayscale, scaled to 720p, cropped to the game area
    (letterbox/notch bars removed), then cropped to the search region. Template images
    added to app/src/main/assets/ must be 720p
    and are grayscaled unless matched inside
    useColor { }.
  • Coordinates are expressed at 1440p (scriptDimension 1440p, compareDimension
    720p; Scale converts between script/screen/image space). Origin is the top-left of the
    game area, not the physical screen.
  • Y ranges 0..1440; the right edge X depends on aspect ratio, so absolute X is almost
    always wrong. Use the IScriptAreaTransforms helpers — xFromCenter(), xFromRight(),
    yFromBottom() — on both Location and Region. isWide (wider than 18:9) selects
    alternate coordinates for many UI elements; follow the existing if (isWide) … else …
    style in locations/.
  • Coordinates belong in scripts/.../locations/*.kt as named vals on the Locations
    graph, not inline in modules.

Agents Dependencies (`docs/agents/dependencies.md`)

Build configuration and dependency bumps

Toolchain pins

  • JDK 21 is pinned as a Java toolchain for all modules in the root subprojects block,
    so it doesn't matter which JVM launches Gradle (Studio's JBR, a system JDK, CI's temurin
    21). Don't accept Android Studio's offer to generate gradle/gradle-daemon-jvm.properties
    (updateDaemonJvm): the toolchain is the pin, and that file forces a ~525 MB JBR download
    that drifts from the CI JDK.
  • Emitted bytecode stays at Java 11 in every module — from jvmTarget in the root
    subprojects block for libautomata/scripts, derived by AGP from compileOptions for
    app/prefs. Toolchain and bytecode target are separate knobs; raising the latter means
    checking D8 desugaring against minSdk 24. The one exception is :scripts's test
    compilation, pinned to 17 in scripts/build.gradle.kts because JUnit 6 requires it — test
    code runs on the toolchain JVM and never reaches Android.
  • AGP 9 compiles Kotlin itself. app and prefs must not apply
    org.jetbrains.kotlin.android — AGP 9 rejects it outright. Their Kotlin output lands in
    build/intermediates/built_in_kotlinc/, not build/tmp/kotlin-classes/, and the root
    block's tasks.withType<KotlinCompile> no longer reaches them: per-module compiler
    settings belong in that module's android { kotlin { compilerOptions { } } }.
  • compileSdk is 37 while targetSdk stays 36 — recent androidx libraries force
    the compile level, but nothing opts into new runtime behavior. Keep the two decoupled;
    bumping targetSdk is a separate, user-visible decision.
  • OpenCV is pinned to 4.11.0 and Renovate is told to leave it alone. Every release bundles
    ARM's KleidiCV; 4.11.0's (0.3.0) never calls its SVE kernels, 4.12.0's and later do. BlueStacks
    Air on macOS advertises HWCAP2_SVE2 without implementing SVE, so those later builds die with
    SIGILL — at first image match on 4.12/4.13, and at System.loadLibrary on 4.14, where a
    static constructor probes the vector length with rdvl. Vetting a bump means checking whether
    an SVE instruction is reachable, not whether one is present: 4.11.0 contains rdvl too, just
    with nothing calling it. strings libopencv_java4.so | grep 'Custom HAL' only reports the
    KleidiCV version, of which 0.3.0 is the known-good one — and note that stock objdump cannot
    disassemble these files (architecture UNKNOWN), so a grep over its output silently finds
    nothing for every version.
  • The 4.11.0 AAR's libc++_shared.so is 4 KB aligned while Play requires 16 KB, so
    app/build.gradle.kts extracts the 16 KB aligned copy from a separately pinned
    opencv_aligned_libcxx_version and packages that instead. Bump it by hand: both catalog entries
    are the same Maven coordinate, so the Renovate rule that pins opencv_version silences it too.
  • Build types: debug, release, and ci (initWith(release), debug-signed, ARM-only
    ABIs). The ci type must exist in every Android module (app, prefs).
  • CI's Gradle cache comes from gradle/actions/setup-gradle, not setup-java's
    cache: 'gradle' — don't re-add the latter, it would cache the same directories twice
    with worse invalidation.
  • release builds need app/fgautomata.keystore (GPG-decrypted in CI) and KEYSTORE_PASS.
    Play Store deploys are CI-only, through fastlane (fastlane/Fastfile, lanes deploy
    and download_apk).

Bump order

Renovate runs monthly for Gradle and opens one PR per bump (Kotlin/KSP grouped), but the
Android toolchain bumps are interlocked, so a renovate::minor label can hide an AGP
migration. The constraints run in one direction —
bump along it and most failures never happen:

text
AGP + compileSdk ──▶ Gradle
       │
       ├──▶ Kotlin + KSP + Compose compiler ──▶ Hilt
       │
       └──▶ androidx + Compose BOM
  • AGP and compileSdk lead. androidx AARs declare a minimum AGP and a minimum
    compileSdk in their metadata, so both usually have to move before any androidx bump
    resolves at all.
  • Gradle follows AGP, never leads it. Gradle removes internal APIs the installed AGP
    still calls, so a wrapper bump ahead of AGP fails at plugin-apply time; AGP separately
    declares a minimum Gradle. Move them as a pair, AGP in front.
  • Kotlin, KSP and the Compose compiler move as one unit, and after AGP — AGP compiles
    Kotlin itself.
  • Hilt is pinned from both sides: it declares a minimum AGP, and its bundled
    kotlin-metadata-jvm caps the Kotlin metadata version it can read. So Hilt cannot lag
    Kotlin, and neither can precede AGP.
  • androidx and the Compose BOM come last, when what's left is source-level API churn
    rather than resolution failures.
  • Test-only dependencies sit outside the chain. They resolve against the test
    compilation's jvmTarget (Gradle's org.gradle.jvm.version attribute), not the app's, so
    they can outrun it — but Kotlin aborts unless compileTestKotlin and compileTestJava
    agree on that target, even with no Java test sources.

The chain can also be dragged forward transitively: any dependency pulling a newer
kotlin-stdlib re-triggers the Kotlin/Hilt constraint from a PR that looked unrelated.
dependencyInsight on kotlin-stdlib names the culprit.

When a bump fails, read the checkAarMetadata output first — it names the required AGP
version and compileSdk directly, much faster than bisecting versions.

Dependabot PRs here only touch Gemfile.lock (fastlane) and are often already behind
master; check before applying one.


Agents Servers And Assets (`docs/agents/servers-and-assets.md`)

Game servers and assets

app/src/main/assets/{En,Jp,Cn,Tw,Kr}/ hold per-server template images, named by Images
enum entries (scripts/.../Images.kt). ImageLoader looks up the current server's folder
and falls back to En when the file is absent, so only add a server-specific copy when
the art actually differs. IFgoAutomataApi.findImage additionally tries the En image on
JP to support TranslateFGO. assets/Support/ holds user-provided servant/CE images;
assets/tessdata/ the OCR data. Template images must be 720p — see the coordinates guide.

docs/reference-images/{En,Jp,Cn,Tw,Kr}/ holds device screenshots, usually contributed by
users, that the per-server templates were cut from. Keep the screenshot a template came from
so a later fix can be re-cut and checked against the same source. They never ship in the APK.

Store them at 720p, scaled so the game area is 720px tall — on a screen with letterbox
bars that leaves the image itself taller. That is the resolution matching runs at, so a crop
taken from a reference image is exactly the pixels the script compares, with no resampling in
between. Downscale a contributed screenshot before committing it.

Server choice and app language are independent: a user can run the JP server with the app's
UI in English, or the EN server in Korean. Don't assume they're coupled when reading prefs or
adding server-specific behavior.


Agents Translations (`docs/agents/translations.md`)

Localization

app/src/main/res/values/localized.xml holds the English source of every translatable
string — add and edit them there, in the source tree. values/strings.xml is only for
translatable="false" values (app name, server names, links, language labels).

The translated values-*/localized.xml files are synced from POEditor, so translations are
normally not edited in-repo; touch them only as a deliberate exception. The
MissingTranslation lint errors that follow are the expected steady state.

The POEditor sync

POEditor exchanges strings with the repo through the dedicated translations branch —
never with master directly. Only the GitHub user reconman can trigger an import or an
export from the POEditor website.

Both directions follow the same rules:

  1. Bring translations up to date with master first, so POEditor sees the current source
    strings and the export cannot revert unrelated changes.
  2. Trigger the import (source strings from the repo into POEditor) or the export
    (translations from POEditor back into the repo) on the POEditor website.
  3. Review every export for lost translations before merging — the export is lossy in
    practice. Pay particular attention to <string-array> entries, which are the most
    frequent casualty.

Default support images carry translated names

app/src/main/assets/Support/servant/<Name>/ and app/src/main/assets/Support/ce/<Name>.png
ship the default servants and craft essences. Those English names are the identity of a
support entry — they are the keys written to preferences and the names matched against the
extracted image files — so never translate them in place. The UI shows a translated label
instead, resolved through SupportNameResources
(app/src/main/java/io/github/fate_grand_automata/util/SupportNameResources.kt), which maps
each servant folder name and each CE file name (minus the extension) to a string resource.

Adding, renaming or removing anything under assets/Support therefore takes three edits:

  1. the asset — a folder under servant/, or a .png under ce/;
  2. a servant_name_* / ce_name_* entry in values/localized.xml;
  3. the matching line in servantNameResIds or ceNameResIds.

A missing entry fails silently: the lookup falls back to the raw English name, which is also
how user-added custom supports are meant to display. A rename that skips step 3 breaks the
mapping the same quiet way, so the existing translation just stops being used. New strings
reach the other languages through the POEditor sync above like any other source string.

Looking up official names

Take translated servant and CE names from the game data on Atlas Academy
rather than translating them by hand. The language folders map to servers: values-ja → JP,
values-b+zh+CN → CN, values-b+zh+TW → TW, values-ko → KR.

  • Search by English name: https://api.atlasacademy.io/basic/NA/servant/search?name=<name>.
    For an entry that isn't on NA yet, or to look up many at once, download
    https://api.atlasacademy.io/export/<region>/basic_servant.json (CEs: basic_equip.json).
    Find the ID by its JP or NA name, then read the other regions' names under that same ID.
    Keep only type normal/heroine (servants) or servantEquip (CEs).
  • One JP name can belong to several servants (Jalter Avenger and Berserker, Skadi Caster and
    Ruler). Choose by class to match the asset.
  • If the ID is missing from a region's export, the servant or CE isn't released there yet.
    Leave the string out; the app then falls back to English.
  • Short names a region uses in battle are in the nice endpoint
    (/nice/<region>/servant/) under ascensionAdd.overWriteServantBattleName.

Servant labels stay short, at most 15 characters, like the English ones:

  • Use the first name alone when no other servant shares it (マシュ, not マシュ・キリエライト).
  • Add the class in parentheses when the asset is one of several versions of a servant:
    クロエ(アヴェンジャー), 克洛伊(Avenger), 클로에(어벤저).
    CE names stay in their full official form.

Scripts Battle (`wiki/scripts/Battle.md`)

Introduction

First and foremost, if you are new to FGA - you have come to the right place.

This battle section is strictly for FGA Battle Configuration.

Video Introduction

Please be warned it is a bit outdated, but it should give you a general idea of how to setup FGA for yourself.

FGA Tutorial - Build 1437

Battle Configs

Assuming you have watched the video introduction, this section will go more in-depth tutorial on setting up a battle config.

This in-depth tutorial will cover on creating scripts that will use 'Skills', 'NP', 'Command Cards' and 'Pick Supports'.

Step 1 - Enter the Battle Configs menu

Find the below icon and label and select it.

Step 2 - Create new script with the floating action button.

Create new script by tapping this icon

Step 3 - Give your script a name

You can also add a special note (optional) to your script.

The note can be anything like which servants are apart the team you use this script on and so on

Step 4 - Edit the command

This is where you'll create your commands that FGA will use in battle.

Commands

Party Mapping

When creating a battle script, you have to remember that servant positions are important.

Each servant in your party will be given a number from 1 to 6, first to last.

Skills mapping

When creating scripts 'Skills' and 'NP', you create by basing on your servant positions with each skill is represented by a letter on the command
creator.

Targeting

Skills that are targetable will use the servants position number to apply the skill to them

Special Skills

Due to the nature of some skills, they will have a different/additional command mapping to accommodate them.

After clicking on a skill in the command builder, FGA will show buttons at the bottom to deal with the special skills.

Kukulkan/UDK-Barghest

Kukulkan

Kukulkan's First Skill and Third Skill are self-targeting skills which can gain optional effects by paying crit stars.

Use Option 1 if you don't want to use critical stars.

Use Option 2 if you want to use critical stars.

You can click on the Kukulkan button below to replace the button labels with more helpful ones.

Note: You don't have to always click it when using certain servants, this is only for visual purposes.

Battle


The Second Skill is a targetable skill which can also gain an additional effect by paying crit stars.

Use Option 1 if you don't want to use critical stars or Option 2 if you want to. Afterwards, choose a Servant to target.

Battle

UDK-Barghest

UDK-Barghest's Third Skill can optionally turn her NP from an AoE to a Single Target Noble Phantasm.

To choose between AoE and Single Target, first click Choices (2) and then click Option 1 for AoE or Option 2 for Single Target.

You can click the UDK-Barghest button at the bottom to change the button descriptions to more fitting ones.

Emiya/BB Dubai

Emiya and BB Dubai can change their NP to 1 of 2 variants with their skills. After clicking on a 3rd skill in the command builder, NP Type (2) will appear at the bottom and needs to be picked for those Servants.

Only use the "NP Type(2)" option if you're using an Emiya with a fully upgraded third skill.

Note: FGA doesn't have the capability to detect if the skill is fully upgraded or not, but you can use preferred friends to ensure that you get the right support.

After clicking, NP Type (2), you'll see 2 Options. Click on the buttons at the bottom to see the effects of each Option for Emiya and BB Dubai.

Note: You don't have to always click it when using certain servants, this is only for visual purposes.

Battle

Space Ishtar

Space Ishtar's Second Skill can also change her NP type, but she has 3 options to choose from: Quick, Arts and Buster

After clicking on a 2nd Servant Skill, NP Type (3) will appear at the bottom, which will lead you to a new screen where you can select one of 3 options. You can check what would the skill at that option do by pressing the buttons below.

Note: You don't have to always click it when using certain servants, this is only for visual purposes.

Battle

Mélusine/Ptolemaios

Mélusine's Third Skill at Ascension 1 and 2 and Ptolemaios's Third Skill change the Servant's Ascension
forms in the middle of the battle.

Use the Transform option to both account for the long animation and for the changed face cards. Otherwise, Servant Priority will be broken for the rest of the battle.

Battle

Warning about the Mélusine option.

After using Mélusine's third skill at ascension 1 and 2, any succeeding use of third skill
should use the normal third skill. So if Mélusine is in the 1st position, use c.

If you're already starting the battle with Mélusine in Ascension 3, there's no need to use
the Transform option since she won't change forms.

With Ptolemaios you will need to keep using the Transform option as he changes forms on every
use of his third skill.

Soujuurou/Charlotte/Hakuno/Van Gogh Miner

Some Servants have special skills with 3 choices, which requires clicking the Choices (3) button in FGA.

  • Soujuurou's 3rd skill can change the command cards after one turn
  • Charlotte's Upgraded 3rd skill can have different effects depending on the choice you choose.
  • Hakuno's 3rd skill can increase damage for 3 turns.
  • Van Gogh Miner's 1st skill can increase card effectiveness for 3 turns.

You can check what would the skill at that option do by pressing the buttons below.

Note: You don't have to always click it when using certain servants, this is only for visual purposes.

Battle

Enemy Targeting

Like your servants, enemies also have a number and can be targeted too.

Like in FGO, you can only select one enemy at a time.

Noble Phantasm (NP) Order

Noble Phantasm (NP) use your servants position.

Note: NP can be used in any order.
Keep in mind, they will be used in the order you choose them.

Cards before NP

If you ever need to use cards before NP, you can select the following options.

Master skills

Master skills is handled the same way for all 'Mystic Codes' with an exception to the Plugsuit.

Master skills - Plugsuit

The l command should not be used when using the Plugsuit mystic code. Instead, the Plugsuit order change command should be used with

This will trigger the Plugsuit order change menu.

Command Spells

The CS button on the main Skill Maker screen adds a command spell that fully charges one servant's
NP gauge. It asks which servant to charge, the same way skill targeting does. The NP charge is the
only command spell FGA supports - the HP restore is not available.

The number on the button is how many command spells the command has left to spend. You can hold at
most three command spells at a time, so a single battle config can use at most three. Deleting a
command spell entry gives one back. At zero the button only opens a notice.

That number counts the command spells in the command, not the ones on your account - FGA has no
way to read how many you currently hold. If the game has none left when the script reaches the
command, the script stops with "Ran out of Command Spell(s)".

Next turn in the same wave, and Next wave

This step will cover both wave and turn options.

Next Wave

A wave or battle that's displayed in the top right corner

After settings your skills or NPs for a wave you can switch to the next wave by pressing this "Next Wave" button.

Take note of the symbol above. This will indicate that you've skipped to the next wave.

By wave skipping, you're telling FGA that you don't want do anything else until you're on the next wave.

Be warned that if you use the next wave button then any skill you use after that will only activate during the next wave so make sure you
double-check your script to see if you have made any mistakes.


Next Turn in the same wave

Turns are indicated by this symbol


Wave and Turn Indicator

With the recent update as of FGA Build 2382. You're now able to track the current
wave and turn in your command.


Raid Battle

Raid Battles can sometimes only have 1 wave.

In those cases, you must select the Next turn in the same wave option.


Additional Battle Config (optional)

Materials

Materials can be used when you want to farm a specific material.

Any Selected Material will be shown at the top of the list.

After selecting the material and pressing OK, you'll see a summary of the first 3 selected materials.

Spam

How the spam option works

https://github.com/Fate-Grand-Automata/FGA/issues/510

Server

If you play in multiple servers you can make your scripts only show up only for that specific server in the pop up menu when you're in-game.

Party Selection

You can assign one of the party slots to your scripts so that whenever you start FGA, it will check if your last use party is on the right slot and
switch to the right one if it's not.

Card Priority (optional)

Card Priority is an optional feature.
Please note, you do not have to set them everytime you're making a new script.


Card Priority explanation

Card Priority is used to tell FGA how to handle face cards.

With cards in the high will have priority usage over cards on the low end

Symbols used in Card Priority

  • WB = Weak Buster
  • WA = Weak Art
  • WQ = Weak Quick
  • B - Buster
  • A - Art
  • Q - Quick
  • RB = Resist Buster
  • RA = Resist Art
  • RQ = Resist Quick

Cards can be changed around for different use case eg:

  • For Buster cards priority:

  • For charging NP with face cards (Arts cards priority):

  • For stars (Quick cards priority):

If you want to have different card priority for different waves, then you can add more waves and rearrange the card priority to your liking.

Otherwise, the default will be used throughout all waves, so if you want the same priority, you will only need to just setup the wave 1 priority
option OR leave it as it is.

Hence, there is no reason to add more if you're not gonna use it for something different.


Servant Priority

Servant priority takes higher priority over card priority.

In order to activate the servant priority you must turn it on.

Then you can now select the servant you want to prioritize.

Follow the positioning on the Party Mapping


Brave Chain

There are only 3 options for brace chains unless you use Servant Priority.


Rearrange Cards

When you pick 3 face cards in FGO, the position of the card determines the damage and effect of the card.
For example, Quick cards generate more stars, Arts cards generate more NP, and Buster cards deal more damage.

At the same time, the 1st card will determine the bonus effect applied to all face cards. For example, if a
Buster card is picked first, all face cards get a damage boost.

The Rearrange Cards feature orders the 3 strongest cards so the 2nd strongest is used last.

If default card priority is used, FGA will pick these 3 cards when the Rearrange Cards option is enabled:

  • Jeanne Archer Buster (strongest card)
  • Castoria Buster (3rd strongest card)
  • Jeanne Archer Arts (2nd strongest card)

instead of

  • Jeanne Archer Buster (strongest card)
  • Jeanne Archer Arts (2nd strongest card)
  • Castoria Buster (3rd strongest card)

Support Selection

Class Selection

If you do not select any class, FGA will pick support from the current class that is showing in the screen.

Be sure to click on the class that you want to select.

If you want to check the All option toggle this button.

:warn: This feature does not work reliably for users who have not cleared Solomon. The "Start Quest" button
will become unresponsive until you manually click the Back button in the top left.

Support Selection Options

There are 3 ways to select support.

  1. First

    FGA will pick the first support that shows up in the support selection screen.

  2. Manual

    FGA will exit and you must manually pick the support. After picking up the support, Run the FGA again.

  3. Preferred

    FGA will pick the support that matches the settings in support selection in that order.

Preferred Selection

If you want to specify which support you want to use, you can use the preferred selection.

In order to set the preferred settings, you must click on the preferred selection option.

Then, you can set the preferred settings.

Preferred Selection - Preferred Servant

Click on the Preferred Servants option to show a dialog where you can select your wanted Servants.

Then you can select if you want the preferred servant to be max ascended and which skills to be max level

Note: FGA can only reliably detect if the skill level is max level Lvl. 10 or not. FGA can't detect the current skill level.

Preferred Servant - Preferred CE

Click on Preferred CE and select the wanted CEs.

Then you can select if you want the preferred CE to be max limit broken.

However, for events it's easier to use the in-game CE filter instead of creating event CE images
with the Support Image Maker.

Preferred Servant - Preferred Friends

Enable this option if you want to use Support Servants from specific friends.

This is useful if level 90 NP1 Servants are not strong enough for the farming quest. Since FGA can't detect
Servant Levels, NP levels and Append Skill levels, this allows you to filter for those using friend names.

Of course, FGA won't be able to select non-friend Servants who would fulfill those criteria.

If there are no images in the support -> friends directory, it will look like this:

Once you have created images via the Support Image Maker, you can select your friends.

Final Look

Fallback

If the preferred support is not found, FGA will refresh the support list according to the settings in
More Options -> Advanced -> Fine-Tune -> Support.

After the limit was reached (e.g. number of refreshes), FGA will act depending on what is set in the fallback option.


Scripts Lottery (`wiki/scripts/Lottery.md`)

WARNING: Better avoid using the Lottery script on Boxes 1-10. If you don't have enough tickets, it can reset the box as soon as you receive the Grand Prize.

To make lottery script work, 2 images are needed per server

  1. lottery.png

  2. StopGifts.png


Scripts Support Image Maker (`wiki/scripts/Support-Image-Maker.md`)

Default Images

The app comes with images of a few common Support servants and CEs like Waver, Castoria, Lunchtime, etc.

They should extract automatically after selecting the Support Directory shortly after installing FGA.
If that's not the case or some are missing, you can manually extract them in 'More options/Storage'.

Where to put Servant/CE images?

Assuming FGA is the folder you chose for storage.

Under the FGA/support/ folder, put:

  • Servant images in servant folder
  • CE images in ce folder
  • Friend name images in friend folder

If you want to use any servant or CE other than the default ones provided with the app, you'll have to
create their images using the Support Image Maker mode.

Instead of having to select multiple ascension images for a servant, you can put all the images of a servant in a folder and select the folder in
settings.

Here's what a typical directory structure looks like:

text
FGA/
-- support/
-- -- servants/
-- -- -- ozy4.png
-- -- -- melt4.png
-- -- -- Merlin/
-- -- -- -- merlin1.png
-- -- -- -- merlin2.png
-- -- -- -- merlin3.png
-- -- -- -- merlin4.png
-- -- -- -- merlin_c.png
-- -- -- Waver/
-- -- -- -- waver1.png
-- -- -- -- waver2.png
-- -- -- -- waver3.png
-- -- -- -- waver4.png
-- -- ce/
-- -- -- kscope.png
-- -- -- black_grail.png
-- -- friend/
-- -- -- mathew.png
-- -- -- recon.png

How to use Support Image Maker?

Support Image Maker automatically creates images from the Support screen that can be used with the script.
You can also use it from the Friend List which is easier since you don't have to keep refreshing till the desired Servant/CE shows up.

  1. Start the FGA service.

  2. Open FGO. Go to support selection or friend list screen and ensure that the Servant/CE you want is visible (It is important that the complete
    Servant + CE region is visible).

  3. Click on the PLAY button. A dialog shows up.

  4. Click on Support Image Maker on the bottom-left corner of the dialog.

    Support Selection screen:

    Friend List screen:

  5. The script will take a screenshot and show you the images it found.

    Servant & CE

    CE & Friend

  6. Check the images you want to keep.

    Type a name for the image (NO NEED for file-format like .png).

    For servant images, you can use a folder like: Nero/asc1. This will save an image named asc1.png in FGA/support/servant/Nero folder.

    By grouping in a folder, you can pick a single entry in settings to match with all ascensions and costumes.

  7. Click on Done. The selected images are saved to the correct folders.

  8. You can now use the images in your battle configs.


Scripts Sidebar (`wiki/scripts/_Sidebar.md`)

Home > Scripts


--- METRICS ---