Skip to main content

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:

StateWhenWhat the bot does
Deadits champion is deadranks up its abilities and waits
Retreatbelow 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
Tradean enemy champion it has noticed is within its attack range + 300 cm, and neither stands under an enemy towerfinishes it (Execute), opens (Engage), holds it (Crowd Control), hurts it (Damage), then attacks it
Defendan allied tower of its own lane, a neighbouring lane or the base is attackedwalks to the nearest such tower and farms the wave under it
Objectivean 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 goattacks the main monster with its ally, or stands guard 600 cm from the pit
Pushits 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 cmattacks enemy minions, then an enemy structure with its minions at its foot
Farmenemy minions are nearlast-hits the minions its next attack kills, and holds behind its wave otherwise
Lanealwayswalks 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:

FieldWhat it doesEasyNormalHard
Reaction TimeHow long after an enemy champion comes into sight the bot answers it; never less than 0.1 s0.6 s0.35 s0.2 s
Last Hit AccuracyThe share of the last hits it could take that it times right0.50.750.95
Skillshot LeadHow far ahead along a moving target's path it aims a skillshot: 0 where it stands, 1 where it will be00.51
Retreat Health FractionBelow this share of its health it falls back0.250.350.4

The profile's Map section, the same in all three:

FieldWhat it doesDefault
Laning Phase EndUntil this match time each bot holds its lane840 s
Laning Ends With First Outer TowerThe laning phase ends sooner when the first outer tower fallson
Tower Attacked WindowHow recent a hit on a tower, or an ally's hit on an objective's monster, counts3 s
Objective Join RadiusHow far from an epic objective's pit a bot comes to fight for it5000 cm
Max Objective BotsHow many of a team's bots go to an objective at most, the nearest3
Objective Pit RadiusHow close to the pit an ally or an enemy champion counts as at the objective1500 cm
Recall To BuyRecall when the gold buys the next item of the build and nobody is nearon

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:

FieldWhat it doesDefault
UsageWhat the ability is for: Bot.Usage.Damage, CrowdControl, Escape, Engage, Execute, Shield (heals too). Without one, bots never cast itnone
Min Range, Max RangeHow far the target may be, edge to edge. Max Range 0 uses the ability's Range0, 0
Min Enemies In RadiusHow many enemy units must stand within the ability's Radius where it lands1
Target Health BelowCast only at a target below this share of its health: 0.2 for an execute1 (any)
Own Health BelowCast only while the bot's own health is below this share: 0.4 for a last-resort shield1 (any)
EvaluatorA UMobaBotAbilityEvaluator subclass, C++ or Blueprint, whose Can Use has the last wordnone
Players OnlyBots never cast it, as Teleportoff

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:

SettingWhat it doesDefault
ProfilesThe difficulties, in the order the lobby offers themDA_BotProfile_Easy, _Normal, _Hard
Default DifficultyThe difficulty of a bot no lobby gave one1 (Normal)
Bot State TreeThe StateTree every bot runsST_Moba_Bot
Lane Fill OrderThe lanes a team's bots take, in orderTop, Mid, Bottom, Bottom, Top
Think RateHow often a bot looks again and decides10 Hz
Awareness RadiusHow far around itself a bot pays attention to what its team sees1600 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.