CPU Opponents
The AFT CPU is data driven, in the style of Street Fighter 6. Each frame, the CPU looks at the situation (neutral, opponent attacking, opponent jumping, punish...), picks one of the tactics written for that situation, and draws a card from that tactic's deck: a move of the fighter, possibly with its combo route, or a movement such as block, walk, dash or jump. Eight levels set how fast it reacts, how well it blocks, how cleanly it inputs its motions and how long its combos are.
- Designers write the tactics in a CPU Profile data asset, with the CPU Editor, and test them in headless matches without leaving the editor.
- Generate From Fighter writes a complete first version from the move list of a fighter.
- Programmers can replace the logic with a Blueprint or C++ brain.
How it runs
The CPU thinks inside the deterministic simulation, like the rest of the fight. It is rollback, sync test and replay safe, so a CPU side works in every mode, online included.
Each frame, for a CPU team:
perception -> brain -> orders -> executor -> pad inputs -> same command path as a player
- Perception: what the CPU sees (distance, heights, health, meter, frame advantage, wall distances, attacks and projectiles coming, opponent state...).
- Brain: decides. By default the Deck Brain, which plays the tactics of the profile.
- Orders: perform an action, hold a direction, block, wait, dash...
- Executor: turns the orders into pad inputs over the next frames, motions and charges included.
- The inputs go through the same command recognition as a player: motions, charges, buffers and cancel windows.
The CPU never sets the state of its fighter directly, so its execution mistakes are real input mistakes: a late button or a dropped motion step gives a normal or a jump instead of the special.
CPU Profile
The AFT CPU Profile asset (UAFTCpuProfile, Content Browser > Add > AFT Fighting) describes how a CPU fights.
Double-click it to open the CPU Editor.
| Property | Description |
|---|---|
Parent | Common profile this one extends. A tactic with the same Name replaces the parent tactic; the other tactics are added. |
Brain | Brain that plays the profile: pick a class, then set its settings (Instance Editable variables of a Blueprint brain). Empty = the parent's brain, else the Deck Brain. See Custom brains. |
Override Levels | Use the Levels of this profile. Off: the parent's levels. |
Levels | Behavior of the levels 1 (easiest) to 8 (hardest), see Levels. |
Tactics | The decks of the profile, see Tactics. |
Preview Fighter, Preview Opponent, Designer Notes | Editor only: fighter shown on the cards of the CPU Editor and used by its simulation, opponent of the simulation (empty = the preview fighter), free notes. |
Reset Levels To Default (Details panel) puts back the default level progression. Generate From Fighter (CPU Editor toolbar) builds tactics from a fighter's move list, see Generate tactics.
Which profile a CPU uses
The first match wins:
- The CPU Profile of the team in the match configuration (Match Tester,
FAFTTeamConfig), or of the arcade fight (FAFTArcadeFight): a boss AI for one fight. - The CPU Profile of the fighter (Fighter Data > Simulation | CPU > CPU Profile).
- Project Settings > AFT Core > Defaults > Default Cpu Profile.
- None: tactics generated at runtime from the fighter's move list (like Generate From Fighter > Complete), with the default levels. A new fighter is playable by the CPU right away.
The level comes from the match: the CPU level of the match options, the CpuLevel of the team or of the arcade fight, the
level of the training dummy. See Game Modes.
Template profiles
| Asset | Content |
|---|---|
/AFT/Data/DA_AFT_CpuCommon | 11 tactics without fighter moves: movement, defense, wake up and tag team, plus the default levels. The parent of the roster. Generated with Common Only. |
/Game/SomndusStudio/AFT/Fighters/Quinn/DA_Quinn_Cpu | Parent DA_AFT_CpuCommon, 9 tactics with Quinn's moves, the parent's levels (Override Levels off). Generated with Fighter Moves Only. Assigned to DA_Quinn. |
| Tactic | Profile | Situation | What it does |
|---|---|---|---|
| Approach | Common | Neutral | Far from the opponent: get closer. |
| Spacing | Common | Neutral | Mid or close range when no attack is drawn: footsies. |
| Guard | Common | Opponent Attacking | An attack is coming: block it. |
| Projectile Guard | Common | Projectile Incoming | Block the projectile or jump over it. |
| Air Guard | Common | Opponent Jumping | Block the jump-in when no anti-air is drawn. |
| Hold Guard | Common | Under Pressure | Keep guarding when the block stun ends, or get out. |
| Wake Up Guard | Common | Waking Up | Block, backdash or jump away. |
| Oki Approach | Common | Okizeme | The opponent is down: get close for its wake up. |
| Advantage Hold | Common | Advantage | Plus on block with nothing drawn: stay safe. |
| Tag Out | Common | Neutral | Tag team, level 3 and up: switch out a hurt point fighter from a safe distance. |
| Assist Call | Common | Neutral | Tag team, level 4 and up: call an assist at mid range. |
| Pokes | Quinn | Neutral | Mid range: long normals, only when they reach. |
| Zoning | Quinn | Neutral | Far: projectiles. |
| Close Pressure | Quinn | Neutral | Close: fast normals into their combo route, throws. |
| Jump-In | Quinn | Neutral | In the air above the opponent: air attack. |
| Anti-Air | Quinn | Opponent Jumping | Hit the jump-in with a move that covers the air. |
| Punish | Quinn | Punish | The opponent is recovering: the best route in range. |
| Links | Quinn | Combo | Level 4 and up: link a fast move while the opponent is still stunned. |
| Keep Pressure | Quinn | Advantage | Plus on block: fast normal or throw. |
| Meaty | Quinn | Okizeme | The opponent gets up: low, overhead or throw. |
Both were generated from the move list with Generate From Fighter (see How the template content was built). Generating again replaces the tactics with the generated names and keeps tactics with other names.
Clicking Generate From Fighter again replaces a tactic that keeps its generated name (Pokes,
Guard...). Rename a tactic you tune to keep your changes.
To give a new fighter its own CPU, make a child of DA_AFT_CpuCommon and generate its moves: see
Create the CPU of a fighter.
Situations
Each tactic belongs to one situation. The Deck Brain detects the situation every frame.
| Situation | When | Seen after the reaction delay | Chance scaled by |
|---|---|---|---|
| Neutral | Nothing special happens: spacing, pokes, approach, zoning. | No | Activity |
| Opponent Attacking | An attack of the opponent is in its startup or active frames, close enough to hit. | Yes | Defense |
| Projectile Incoming | A projectile of the opponent is coming toward the CPU. | Yes | Defense |
| Opponent Jumping | The opponent is in the air and coming in: anti-air or block. | Yes | Activity |
| Punish | The opponent is recovering from an attack (whiffed or blocked). | Yes | Activity |
| Combo | The opponent is still in hit stun and the CPU can act: links, juggles. | Yes | Activity |
| Advantage | The CPU recovers first, close to the opponent. Only for levels that read the frame advantage, else Neutral. | Yes | Activity |
| Under Pressure | The CPU is in block stun: what to do when it ends. Only for levels that read the frame advantage, else Neutral. | No | Defense |
| Okizeme | The opponent is knocked down or getting up. | Yes | Activity |
| Waking Up | The CPU is getting up: what to do on its first frame. | No | Defense |
| Any | Tried in every situation, after the tactics of the current situation. | - | - |
Tactics
A tactic is a deck of cards for a situation.
| Field | Description |
|---|---|
Name | Unique in the profile. A child profile replaces the parent tactic of the same name. |
Situation | When the tactic can be played. |
Conditions | All must pass for the tactic to be available, see below. |
Priority | The tactics of a situation are tried from the highest priority. |
Chance | Chance (%) to play the tactic when it is tried, scaled by the level Activity (or Defense in a defense situation). |
Min Level, Max Level | Levels that use the tactic. |
Enabled | Off: the tactic is ignored (handy to test without it). |
Cards | The possible plays, see Cards. |
Description | Free text, shown in the CPU Editor. |
Conditions
A condition passes when Min <= value <= Max (flags: when true). Invert makes it pass when the test fails.
| Type | Value |
|---|---|
Distance | Horizontal distance to the opponent (cm). |
Height Difference | Height of the opponent above the CPU (cm, negative below). |
Own Health %, Opponent Health %, Own Meter % | Percentages. |
Frame Advantage | Frames the CPU recovers before the opponent (negative: after). |
Own Distance To Wall, Opponent Distance To Wall | Distance between the fighter and the stage edge behind it (cm). |
Round Time Left (s) | Seconds left in the round (999 when the timer is off). |
Pressure | Pressure felt by the CPU, 0 to 100 (low health, cornered, blocking). |
Partners Available | Tag team partners that can come in. |
Opponent Airborne, Opponent Crouching, Own Airborne | Flags. |
Custom | Evaluated by the brain with its Custom Name, see Custom conditions. |
Cards
| Type | What the CPU does |
|---|---|
| Action | Inputs the command of a fighter action (motion included, with the level execution). |
| Block | Guards for a while. Guard: Auto (the height the opponent's attack requires, read right with the level Guard Accuracy), High (standing) or Low (crouching). |
| Walk Forward, Walk Backward, Crouch, Wait | Holds the direction (or nothing) for a while. |
| Dash Forward, Backdash | Dash input. |
| Jump Forward, Jump Neutral, Jump Backward | Jump input. |
| Tag, Assist | Tag team: switch to the next partner, call an assist. |
| Field | Description |
|---|---|
Action | Action cards: the action to perform. It must be in the fighter's move list: the CPU inputs its command. |
Follow Ups | Action cards: the combo route, actions performed one after the other when the previous one connects (cancels, target combos, links). The level Max Combo Length caps how many the CPU performs. |
Follow Up On Block | Also follow the route when the previous action is blocked (block strings). Off: only on hit (hit confirm). |
Require Range | Only drawn when the action can reach the opponent (hitbox or throw reach; projectiles reach the full screen). On by default. |
Min Frames, Max Frames | Timed cards (walk, crouch, jump, block, wait): random duration between the two. |
Weight | Relative chance to be drawn among the playable cards of the tactic. |
Min Level | Lowest level that plays the card (generated specials start at level 3, supers at level 5). |
Key Card | Signature play of the fighter: its weight doubles from level 4 and triples from level 7. |
The fields that do not apply to a card or condition type are greyed out, not hidden: the Unreal Engine 5.8 details panel can crash with conditionally hidden fields inside array elements.
How the CPU decides
- The Deck Brain detects the situation every frame.
- Reactive situations (Opponent Attacking, Projectile Incoming, Opponent Jumping, Punish, Combo, Advantage, Okizeme) are only seen after the level's Reaction Frames, and each occurrence is played once. Until then, the CPU plays Neutral.
- A block card and a combo route in progress continue on their own. Movement and waits stop when a new threat or opening is seen.
- In Neutral, the CPU waits Decision Cooldown frames between two decisions.
- The tactics of the situation are tried by priority: level range, conditions, then a roll of
Chancescaled by the level Activity (or Defense in a defense situation). - A card is drawn by weight among the cards the CPU can play right now (level, in range, enough meter, right stance), with the key card bonus.
- When nothing is played, the tactics of Any are tried. If still nothing, the CPU decides again after half the cooldown.
- For an action card, the CPU inputs the command with the level Execution. When the action connects (or is blocked, with Follow Up On Block), it continues the combo route, up to Max Combo Length follow-ups.
While it waits (Wait cards and between two decisions), the CPU may hold down-back when the opponent can reach it, with the level's Guard Instinct chance. Fast normals cannot be blocked on reaction: this is what blocks them.
Levels
Each profile has 8 levels (or inherits them from its parent). The defaults follow a Street Fighter 6 like progression; edit them in the Profile & Levels tab of the CPU Editor, or click Reset Levels To Default.
| Setting | L1 | L2 | L3 | L4 | L5 | L6 | L7 | L8 |
|---|---|---|---|---|---|---|---|---|
| Reaction Frames | 40 | 32 | 26 | 21 | 17 | 14 | 11 | 9 |
| Decision Cooldown | 30 | 24 | 18 | 14 | 11 | 8 | 6 | 4 |
| Activity % | 55 | 65 | 75 | 85 | 95 | 105 | 115 | 125 |
| Defense % | 15 | 25 | 40 | 55 | 70 | 80 | 88 | 96 |
| Guard Accuracy % | 30 | 40 | 55 | 65 | 75 | 85 | 92 | 98 |
| Guard Instinct % | 0 | 10 | 25 | 40 | 55 | 70 | 65 | 90 |
| Execution % | 55 | 65 | 75 | 82 | 90 | 95 | 85 | 98 |
| Pressure Mistakes % | 30 | 28 | 25 | 20 | 15 | 12 | 30 | 5 |
| Max Combo Length | 0 | 0 | 1 | 1 | 2 | 2 | 3 | 4 |
| Reads Frame Advantage | no | no | no | yes | yes | yes | yes | yes |
| Setting | Effect |
|---|---|
Reaction Frames | Frames before the CPU reacts to a new situation (attack startup, jump, whiff, knockdown...). |
Decision Cooldown | Frames between two decisions in neutral. |
Activity | Scales the chance of the offensive tactics (100 = as authored). |
Defense | Scales the chance of the defense tactics (Opponent Attacking, Projectile Incoming, Under Pressure, Waking Up). |
Guard Accuracy | Chance to read the guard height right on Auto block cards. |
Guard Instinct | Chance to hold down-back instead of standing idle when the opponent can reach the CPU. |
Execution | Chance to input a motion or charge command right. A missed input comes out late: a normal or a jump instead. |
Pressure Mistakes | Extra missed inputs at full pressure (low health, cornered, blocking): the CPU chokes. |
Max Combo Length | Follow-ups of a combo route the CPU performs (0: single hits). |
Reads Frame Advantage | Sees the Advantage and Under Pressure situations (else they count as Neutral). |
- Level 1 uses no specials: the generated special cards start at level 3.
- Level 7 has strong tactics but chokes under pressure on purpose (low execution, many pressure mistakes), as in Street Fighter 6.
Debugging
- The CPU Editor simulation plays headless matches and lists every decision.
- In C++,
FAFTBattleSimulation::SetCpuDebugSinkreceives oneFAFTCpuDecisionReportper decision: frame, team, situation, tactic, card, action, follow-up step and whether the input was missed on purpose. - The
AFT.Core.CpuandAFT.Editor.Cpuautomation tests check the determinism, the levels, custom brains, the simulation and the editor.