Note on “Fake critical”

So, we (field tests I’ve made as well as insight and review from Dokuride and MagicBottle) made a pretty big breakthrough today in the pursuit of solving the issue of “Fake Critical”. And by breakthrough we discovered what it actually is, and surprisingly, it has absolutely nothing to do with the critical AI routine, but rather, a quirk of the main AI routine and a concept called focus (this is a new term I came up with to distinct it with ability targeting, which is actually independent of this). The purpose of this rather long post is to explain it and open a discussion with the best way to deal with this moving forward. Before I focus on what’s causing the fake critical phenomenon, I need to first explain the two (yes, only two) main AI routines in the game: the default AI routine, and the critical AI routine. The critical routine is fairly simple and one that everyone should be familiar with. The unit runs from enemies using the retreat subroutine and focuses mainly on buffs and heals, occasionally doing an attack before running if able. It’s an easy to understand routine we all know and love and has absolutely nothing to do with “fake critical”. This routine is triggered by one of the AutoBattle options (“Run like rabbit”), and is also enabled on AI-controlled units when they have critical status and a healthy ally remaining (“But wait!” you might be thinking, “I know I’ve seen the last unit on teams before still run away from enemies, Nacho!” … don’t worry, I’ll explain this as well further down, hold your horses!).

Therefore, the bulk of what the AI does all comes from the same, default AI routine. That may surprise some of you, since there are four AutoBattle options in the main game. The default routine is fairly complex, and it has one optional parameter: the unit’s focus. Focus, in general, is what it sounds like: the AI will focus its actions on that one unit for the turn, doing everything in its power towards the goal of killing (or helping if its focus is a friend) that unit.

Once a Focus is determined and sent to the main AI routine, the logic is actually surprisingly simple… if a Focus is passed:
:here: If the Focus is too far away to do something to even after moving, [do the most valuable action available], then move closer to the Focus (usually trying to maintain a small distance between the two).
:here: If the Focus is in range to do something, calculate the [most valuable action available including that unit], move to the most optional place to execute this action, then execute it. This includes moving to the side or back of that unit before executing a regular Attack to lower evasion, and for AoE attacks, figuring out which is the best place to cast it where it will affect not only the Focus, but more of its allies. If there’s no Focus passed to the routine:
:here: Determine what the [overall most valuable action available] is from a space that unit can move, as well as the [most valuable action available from where the unit is currently standing].
:here: If the [overall most valuable action available] is “significantly more valuable” (how much more is still something we’re researching) than the [most valuable action available from where the unit is currently standing], move to the required space and do the action.
:here: If not, execute the [most valuable action available from where the unit is currently standing], then use the retreat subroutine to move away from enemies.

Before I continue, let me explain what the three other AutoBattle types actually are.
:here: “Fight for Life”, the AutoBattle type everyone’s usually obsessed with and asking me to include in FFTBG, is nothing more than the default AI routine with the player selecting one enemy to be the Focus. Notice how when this AI is used, while they can do other actions that don’t involve any other unit, they’ll actively try to advance on that unit and even if all they can do is use Throw Stone on it, they’d still rather do it than giving an Elixir to their dying adjacent comrade, instead.
:here: “Protect Allies”, is very similar, using the defualt AI routine with the player selecting one ally to be the Focus. While units under this mode can attack if the opportunity grants, they’d rather move towards their Focus and buff/heal them if possible.

:here: “Save Fading Life”, however is a bit different… it tells your unit to behave similar to an enemy-controlled unit: that is, the game will calculate the ideal Focus for that unit each turn! That’s right, as you’d expect, the AI is fully able to calculate its own Focus. This process is similar to the AI’s move/act decision making process and a lot of factors are considered… Is this unit targetable at all (are they immune to everything I have, are they in a position I cannot path to, should I ignore them because they’re Death Sentenced anyway)? How close are they (they’ll much more likely pick a focus they can damage this turn)? If they’re an enemy, how much damage can you do to them (can you finish them off)? If they’re an ally, how much peril are they in? This is a complex procedure, as you’d expect, but eventually, after evaluating each other unit on the board, it decides on the unit to pass to the main AI routine.

As I mentioned earlier, there are instances where the AI’s Focus-generating routine determines no Focus. If all enemies have DS, or they cannot path to a single enemy, or the unit is Don’t Acted, for example (we’ve seen this quite a bit over these six months). The final result from the default routine is when no Focus is found, from the above, the units simply retreat, occasionally doing actions like buffing or healing or canceling enemy moves (even though they can’t be focused, the enemy will still try to Silence a Death Sentenced enemy that’s casting a large spell, for instance). But here is the new revelation: In this Focus-determination routine, there’s a clause that Any unit determined to be in low HP will have no Focus, and this threshold is different than Critical: at 35% HP or less. Now I’m sure many will point out that there’s units in every battle still fighting at less HP than that and not acting in “fake critical”, and you’d be right, because there’s still valuable actions they can execute. This is also what causes the last unit in critical to retreat until an enemy unit comes into range of them, then strike. Because charging and attacking is way more valuable to the AI than buffing, these units will usually function similarly to units above 35% HP with a few quirks. These quirks being:

:here: The value of acting before moving is higher. This lack of unit focus is why units will Chakra or Murasame prior to moving despite enemies being adjacent (apparently, healing enemies isn’t sufficiently less valuable than moving first). Or why a Knight, normally wanting to move to the back of a unit to attack with less evasion, will decide instead to Attack from the front then back off. Or why a Samurai may decide to settle for a single-target Muramasa and move away rather than moving to a place where it could hit two targets, as it normally would.

:here: If there’s no enemies in range whatsoever, it will do some other action it finds valuable (healing, buffing, etc itself or an ally), then RETREAT. THIS is the source of “fake critical”. It also explains why certain units seem more susceptible to it…. High HP units have a larger range of HP between 20% and 35%. Also, low Move units and units with no ranged attacks because they’re far less likely to start a turn with no offensive action to take because the enemies are outside their ability to attack this turn. Once a unit gets in this state, it snowballs, since the unit moves even farther away from enemies, until an enemy moves close enough for it to attack. Also, remember earlier when I said I would explain last unit remaining? Since they’re under 35% by definition as well, they are using this behavior pattern as well. They aren’t using the critical status AI routine – they’re using the default AI routine with no Focus set! At the end of the day, I was thinking that “fake critical” was an error, possibly a rounding error or a difference of a < and <= somewhere in the code, but it’s not. The developers fully intended this “Cowardly” AI pattern when a unit’s HP was low but not quite in critical. My philosophy on changing the AI has always been that I want to fix obvious AI bugs, but not touch the AI’s behavior at its core. In other words, I usually don’t want to change something that was intended by the original developers. There’s a number of ASM out there that would make the AI smarter, but I’ve always felt the default AI is more approachable to fans of the original game, and far more exciting to watch. In contrast, FFT Arena’s AI modifications makes the AI lose the “soul” it has from the vanilla game.

Unfortunately, due to the lack of understanding of why it occurs and the frustration caused by watching one of your units stand back and doing nothing the whole fight, the “fake critical” problem leaves us in between a rock and a hard place. There’s three main options available: a) Remove the cowardly AI altogether by changing the < 35% requirement to < 20% requirement. This means it would completely overlap with normal critical, and would only be used when a unit is the last unit standing on a team. But it would also be removing an intended AI behavior of “strike and retreat” while at low HP. b) Do nothing, keeping it as it is, and learning to live with the Cowardly AI behaviors, quirks and all. This would be most in line with my previous AI quirks… if it was intended and not a bug, keep it. c) Find a way to change the code to preserve the intended Low HP behaviors within the AI, while trying to find a way to minimize its quirks (most notably, find a way to stop “fake critical” units from only retreating, and getting units even in this mode to move before using Chakra rather than giving the AI free HP). Thanks for reading this rather large explanation, and I look forward to the discussion on how viewers would most like to proceed in #suggestions .

Q: Can there be special units, such as Agrias or Zalbag? How about the Lucavi?

A: Unfortunately not, due to how these units are programmed in. To make up for this, many of these units’ skills have been added to other jobs – many Holy Knight skills have been added to Knight, Ramza’s unique skills have been added to Squire, Mustadio’s Arm/Leg Shots have been added to Thief, etc.

Q: Can Onion Knight or Dark Knight be added?

A: Like with unique characters, short answer is no. Many of Dark Knight’s abilities have been added to other classes, and Onion Knight is mostly a walking ball of stats and wouldn’t be particularly interesting to watch.

Q: Will there ever be 5v5 matches?

A: Also no – there is a hard limit of 9 sprite sets that can be loaded at once, so 4v4 is the max for balanced teams. The main game got around this limitation by having enemy teams double up on the same unit.

Q: Is this a mod or vanilla? Why not just use FFT Arena?

A: This is a mod with vanilla as a base. Some changes to add additional skills (such as modified Swordskills to Knights) and balance changes were made. As well as a few custom additions. Most of which were to make it as interesting as possible.

I (TKN) chose to not use FFT Arena, the fan-made mod designed for AI Tournament balance, because I felt that sticking to a mod more close to vanilla would be more accessible. But also, balance isn’t really needed in a battle of randomly-generated teams… broken combinations are what makes it exciting!

Still, a lot of the groundwork for Wizdaddy’s vanilla MP mod was done by those in the FFT Arena community. So if you are interested in PvP arena battles where you get to build your own teams to go head to head, check them out!

Q: Why are there two chats?

A: The chat in the stream is minus all the bot commands. A suggestion is to use a browser plugin such as BetterTTV to highlight or filter messages to make chat manageable and not miss time-critical bot responses.

Here are a few suggestions for BetterTTV

Highlight Keywords:
last updated 1/22/2021

"yourtwitchname" {Congratulations } {Kweh-kweh!!} {you close your eyes and strip your flesh away} {Betting is open} {The current track} {was victorious! Next match starting soon...} {Betting for} {Betting is closed} {You may now !fight} {the current track is:}

Blacklist Keywords:
last updated 1/22/2021

{<!fight>} {<!fight *>} {<!fight * *>} {<!fight * * *>} {!snub} {!bal} {!buy} {!drop} {!priority} {!lastskill} {<!fight * * * *>} {<!balance>} {<!bet>} {<!betf *>} {!bonus} {!last} {<!bet *>} {<!bet * *>} {<!allin *>} {<!allin>} {<!all in *>} {<!exp>} {<!allegiance>} {<!allegiance *>} {<!buyskill>} {<!skillbuy>} {<!skill>} {<!skills>} {<!drop>} {<!timeout>} {<!skilldrop>} {<!dropskill>} {<!music>} {<!item *>} {<!item * *>} {<!ability *>} {<!ability * *>} {<!class *>} {<!class * *>} {<!class * * *>} {<!map>} {<!map *>} {<!music>} {<!track>} {<!song>} {<!red *>} {<!red *>} {<!blue *>} {<!black *>} {<!brown *>} {<!white *>} {<!yellow *>} {<!green *>} {<!purple *>} {<!halfin *>}

Botting & Multi-accounting

I’m kinda saddened I had to add a section here but here we are.

Botting has a zero-tolerance policy. There is code in place to detect such bots, and I try to manually verify it myself before taking action, but if flagged you will be locked into Level 0 and will be unable to !fight. If only !bet botting, I will consider an appeal in a month’s time if it is your first offense. !fight botting will not be given a chance at an appeal.

The use of macros while you’re actually here is okay, but do so at your own risk.

Note that bet-botting isn’t prohibited if the bot is marked, and in fact, I’m quite interested in building a separate bot leaderboard at some point. So if you have developed or interested in developing a smart bot, join the Discord #development channel.

Multi-accounting (using more than one account to !fight with at the same time) is also forbidden, and could result in all accounts getting marked. It’s okay to have two people playing from the same location at the same time, provided that they are actually two different people.