Does anyone know where I might be able to see a decision tree or AI algorithm? I'd love to analyze the code to learn how to make AI for future games.
I apologize if this request breaks any rules of this forum.
Xif, please move this to hacking.
SA is currently working on exactly that, but there is a rough hierarchy for AI decisions.
1. Remove Golem
2. Put unit into critical or worse (status effects that add KO status count too)
3. Adding Slow > Charm > Frog = Chicken > Don't Act > Stop > Sleep > 0 CT to enemies and Golem > Haste > Defend > 100 CT to self.
4. Attack charging/Don't Acted units
5. Heal Self/Ensuring survival of allies/run if in critical health
6. Remove KO status from others
7. Heal Others
8. Unevadable attacks
9. AoE/Ranged attacks
10. Normal Attacks > Breaks > Stat Breaks (Other than CT)
11. Charged Attacks (Damage takes precedence over Charge Time)
12. Stat Boosts
Exceptions: When the AI only has one non-crystallized unit left alive, the AI will never run, even if in critical health
Exceptions: Units with statii like sleep/charm/stop will be ignored until the status is just about to wear off.
Exceptions: Death Sentenced units will be completely ignored.
Exceptions: If the AI sees a multi-unit combination that can end the match, the AI will override healing.
Movement behavior:
Will try to move into range and attack the enemy. If multiple squares are possible, the AI picks the square that minimizes the target's evasion and the number of units that can hit the attacker. This latter behavior is observed even when the attacker is not in range. Certain maps also affect behavior.
If berserk, movement will be full.
Teleport will occasionally teleport beyond the movement limit.
Unit will always retreat after healing HP. Units may occasionally retreat or not move after removing negative status or adding positive status.
Units moving after charging or performing will always move in an inhibited manner.
Flaws:
Tries to remove Golem at all costs.
Does not see evasion except in the roughest sense of 0% vs. not 0%. Wrongly assumes all attacks always hit, so evasion is only used to determine whether an unevadable attack should be used.
Does not see counter abilities.
Wrongly assumes multi-status spells always inflict every status mentioned.
If a unit's spells do not add a KO or inhibitory status, the unit is not considered an MP user even if the spells cost MP.
Considers units PA/MA/MP dependent based on skillset alone rather than considering skillset + weapon.
Considers poison and regen to be equal to damage and healing, respectively.
Considers haste to be the only positive status effect worth casting when a unit isn't wounded.
As long as allies are not wounded to critical or worse, does not assess net damage. (This means the AI will kill/status an enemy even if nearby allies took more damage.)
If a unit is due to die in a few turns and cannot save himself and is not in range to heal others or midcharge the incoming cast, the AI will pick the attack that has the biggest effect, not the one it can actually use before the cast would resolve.
Wow, FFT is stupid.
Does this apply to Allied and Guest AI, as well as Enemy?
(This really needs to be posted somewhere more visible if it's not already on wiki considering I've been wondering about some of these for a while.)
Ironically, despite sussing out a great many of these myself over the years and being annoyed with some of the more visible flaws,
FFT has fewer problems than I thought. This gives me a rather...odd sense of hope.
You should probably note, under Exceptions, that AI won't target a Confused unit either unless it can do < 50% of its HP in one attack. Hence why that dumb-ass Loss strategy worked for SSC and SSSC challenges; I am not proud that I had to use that against Adrammelech as a solo Summoner...
and it worked.
Also maybe that the (enemy) AI will literally
never use Invite even if that's all it has.
Quote from: Pickle Girl Fanboy on April 16, 2012, 03:32:52 pm
Wow, FFT is stupid.
Does this apply to Allied and Guest AI, as well as Enemy?
I'm pretty sure this applies to all AI, including Allied and Guest ones. I mean, we've all seen how dumb Mustadio at Zaland can act and how Alma & Ovelia prioritize Mbarrier/Aegis over literally everything else. So even though I can't answer "officially", I can't imagine how Allied & Guests would differ from Enemies from what I've seen.
This belongs on the wiki
-Seconded
I'm glad to see that this is being shown such interest. I would like to know, however, where did this information come from? Has someone found the game engine code and looked at it, or has it just been a bunch of trial and error?
I'd be very interested in seeing some visual representation of this logic, like in the form of a decision tree. Does anyone know if something like this is available?
I don't think anyone's fully deciphered the actual AI code, most of what we know is from trial and error and the various AI tournaments we've had.