Bots
Bots play a lane the way players do: they farm, trade, retreat when hurt and push when ahead. They defend their towers,
join a fight for the dragon or the stone guardian, group up after the laning phase and go home to buy. Every bot is an
AMobaBotController played by the StateTree ST_Moba_Bot, with no setup per champion: bots read each ability's bot
hints and each champion's recommended build. A match with empty seats fills them with bots, so one person can test a
full 5v5.
How a bot plays
A bot is a player without a person, on the server only. It has a player state like everyone, so a team, a champion, a level, gold and items, and it dies and respawns by the same rules. It plays its champion through the same orders and cast requests a player's controller sends, so the server checks them as it checks a player's.
It knows what its team sees, no more. A bot looks at the units its team can see within its Awareness Radius, and it notices an enemy champion only after its difficulty's reaction time. A champion that goes out of sight is forgotten, and noticed again when it comes back.
Ten times a second its StateTree looks at its situation, and the first state whose situation holds acts:
| State | When | What the bot does |
|---|---|---|
| Dead | its champion is dead | ranks up its abilities and waits |
| Retreat | below its difficulty's retreat share of health, or outnumbered by the enemy champions it knows of; until back above 80% | casts a Shield ability on itself, an Escape or Crowd Control ability at a champion closing in, recalls when no enemy champion is within 1500 cm and its health is below 75%, else walks back behind its nearest tower; heals in the fountain |
| Trade | an enemy champion it has noticed is within its attack range + 300 cm, and neither stands under an enemy tower | finishes it (Execute), opens (Engage), holds it (Crowd Control), hurts it (Damage), then attacks it |
| Defend | an allied tower of its own lane, a neighbouring lane or the base is attacked | walks to the nearest such tower and farms the wave under it |
| Objective | an epic objective within the Objective Join Radius is up, and an ally at its pit has hit a monster there, or an enemy champion it knows of is at the pit; only the team's nearest bots go | attacks the main monster with its ally, or stands guard 600 cm from the pit |
| Push | its wave outnumbers the enemy's by 2, or the enemy's is gone and a structure is in reach, and no enemy champion it knows of is within 1500 cm | attacks enemy minions, then an enemy structure with its minions at its foot |
| Farm | enemy minions are near | last-hits the minions its next attack kills, and holds behind its wave otherwise |
| Lane | always | walks to its lane, 350 cm behind its wave's front minion; after the laning phase, to the lane where most of its team stands |
In every state it spends ability points (the ultimate first, then the ability with the fewest ranks) and, standing in its fountain, buys its champion's recommended build in order.
- Going home to buy. While it lanes, farms or pushes, a bot whose gold buys the next item of its build recalls when no enemy champion it knows of is within 1500 cm and it does not stand under an enemy tower.
- The laning phase lasts until 14:00 of match time, or until the first outer tower of either team falls. Until then each bot holds the lane it took. After it, every 10 s a bot plays the lane where most of its living allies stand, so the team groups and pushes together.
- Neighbouring lanes. A bot defends the towers of its own lane, of the lanes beside it and of the base. On a three-lane map the middle lane has two neighbours and each side lane one.
- Lanes. A team's bots take the lanes in the Lane Fill Order, top, mid, bottom, bottom, top by default. A lane not in play is swapped for the nearest one that is.
Difficulty
A difficulty changes only how well a bot plays, never its gold, XP, stats or vision. Each is a Bot Profile Data
Asset; the plugin's three are in /PioneerMOBA/Bots:
| Field | What it does | Easy | Normal | Hard |
|---|---|---|---|---|
| Reaction Time | How long after an enemy champion comes into sight the bot answers it; never less than 0.1 s | 0.6 s | 0.35 s | 0.2 s |
| Last Hit Accuracy | The share of the last hits it could take that it times right | 0.5 | 0.75 | 0.95 |
| Skillshot Lead | How far ahead along a moving target's path it aims a skillshot: 0 where it stands, 1 where it will be | 0 | 0.5 | 1 |
| Retreat Health Fraction | Below this share of its health it falls back | 0.25 | 0.35 | 0.4 |
The profile's Map section, the same in all three:
| Field | What it does | Default |
|---|---|---|
| Laning Phase End | Until this match time each bot holds its lane | 840 s |
| Laning Ends With First Outer Tower | The laning phase ends sooner when the first outer tower falls | on |
| Tower Attacked Window | How recent a hit on a tower, or an ally's hit on an objective's monster, counts | 3 s |
| Objective Join Radius | How far from an epic objective's pit a bot comes to fight for it | 5000 cm |
| Max Objective Bots | How many of a team's bots go to an objective at most, the nearest | 3 |
| Objective Pit Radius | How close to the pit an ally or an enemy champion counts as at the objective | 1500 cm |
| Recall To Buy | Recall when the gold buys the next item of the build and nobody is near | on |
Each team's bots play one difficulty, set in Practice or the custom lobby (Normal in Find match); the two teams may differ. A bot no lobby gave one, such as the bots that fill a match started in Play In Editor, plays the Default Difficulty.
Bot hints on your abilities
Every Ability Definition has a Bot section that tells bots when and how to use the ability, so bots play a champion of your own with no code:
| Field | What it does | Default |
|---|---|---|
| Usage | What the ability is for: Bot.Usage.Damage, CrowdControl, Escape, Engage, Execute, Shield (heals too). Without one, bots never cast it | none |
| Min Range, Max Range | How far the target may be, edge to edge. Max Range 0 uses the ability's Range | 0, 0 |
| Min Enemies In Radius | How many enemy units must stand within the ability's Radius where it lands | 1 |
| Target Health Below | Cast only at a target below this share of its health: 0.2 for an execute | 1 (any) |
| Own Health Below | Cast only while the bot's own health is below this share: 0.4 for a last-resort shield | 1 (any) |
| Evaluator | A UMobaBotAbilityEvaluator subclass, C++ or Blueprint, whose Can Use has the last word | none |
| Players Only | Bots never cast it, as Teleport | off |
Saving an ability on Q, W, E, R, D or F without a Usage warns that bots never cast it. A passive needs none, and bots recall and ward by rules of their own. The sample champions' kits and the summoner spells show filled-in sections.
Fill the empty seats
- A match started without a lobby, such as in Play In Editor, fills its empty seats with bots a second after its first player arrives (Fill With Bots in the Match settings, on by default). Play In Editor with one player gives 4 bot allies and 5 bot enemies.
- A lobby decides it itself: Practice seats nine bots, Find match fills the empty seats after 60 s, and a custom game's host switches bot fill on or off.
- A disconnected player keeps their seat for reconnect.
AMobaGameMode::FillWithBots(ControllerClass) adds bots until each team has the match rules' Players Per Team.
AMobaGameMode::AddBot(ControllerClass, Team, ChampionDefinition) adds one, also as the Blueprint node Add Bot: it
gets the smaller team if you pass none, the Default Champion if you pass none, the default summoner spells and a body
at one of its team's player starts. APlayerState::IsABot() is true for it on every machine. From the console,
Moba.FillBots and Moba.AddBot [Blue|Red] [champion path] [level].
The StateTree
ST_Moba_Bot is a plain StateTree on the AI schema: open it in the StateTree editor. Under its root is one state per
situation, in the order above, each with two nodes from the Bots module:
- MOBA Bot Is In Situation (
FMobaBotSituationCondition): an enter condition, true while the bot is in the situation it names. - MOBA Bot Act (
FMobaBotActTask): does one round of an activity, then ends after the bot's think interval; the tree then goes back to the root, which chooses again.
Reorder the states to change what wins, give a state your own condition, or put your own task in a state: a task's
owner is the bot's controller, and GetBrain() on it reaches the bot's senses and hands (UMobaBotBrainComponent:
IsInSituation, Act, GetKnownEnemyChampions, GetTarget). Copy the tree into your project under another name and
name your copy in the Bots settings; see Tune the bots.
Settings
Project Settings > Pioneer MOBA Framework > Bots:
| Setting | What it does | Default |
|---|---|---|
| Profiles | The difficulties, in the order the lobby offers them | DA_BotProfile_Easy, _Normal, _Hard |
| Default Difficulty | The difficulty of a bot no lobby gave one | 1 (Normal) |
| Bot State Tree | The StateTree every bot runs | ST_Moba_Bot |
| Lane Fill Order | The lanes a team's bots take, in order | Top, Mid, Bottom, Bottom, Top |
| Think Rate | How often a bot looks again and decides | 10 Hz |
| Awareness Radius | How far around itself a bot pays attention to what its team sees | 1600 cm |
Project Settings > Pioneer MOBA Framework > Match: Bot Controller Class, the controller every bot gets
(AMobaBotController; set your own AI controller class to give bots another brain, one that wants a player state), and
Fill With Bots. Match Flow holds the summoner spells bots take (Bot Spell D and F: Leap and Mend).
The sparring brain
The simplest brain, UMobaSparringComponent, walks its lane and fights the nearest enemy it meets with everything its
champion has: it attacks, casts every ability that is ready and reaches, heals itself below half health and ranks up
its abilities. It does not dodge, retreat or think ahead. AMobaSparringBotController is an AI controller that has
one. On a player controller it plays the player's own champion as an autopilot, whose orders and casts are predicted and
checked like the player's own, which is useful for trying a champion out.