Skip to main content

Tune the bots

The bots are tuned in four places, from the lightest touch to the deepest: the difficulty profiles, the bot hints on each ability, the Bots settings, and the StateTree that decides what a bot does. None of it needs code; a bot brain of your own can be C++ or Blueprint. Bots explains how a bot plays.

Watch a bot first​

Play Riftwood alone in Play In Editor: one second after you arrive, nine bots fill the seats. A few commands help to watch them:

  • Moba.MatchTime 0:55 brings the first wave, so the bots start laning at once.
  • Moba.AddBot Red /PioneerMOBA/Sample/Champions/Rook/DA_Champion_Rook.DA_Champion_Rook 6 adds a level 6 Rook to Red.
  • moba.Vision.ShowAll 1 shows you every unit, so you can follow a bot through the fog. The bots still see only what their team sees.
  • F7 gives you the free camera, to fly along with a bot.

Step 1: Change a difficulty​

A difficulty is a Bot Profile Data Asset. The plugin's three are DA_BotProfile_Easy, _Normal and _Hard in /PioneerMOBA/Bots.

  1. Copy the three into your project, for example into /Game/Bots.
  2. Change their numbers:
    • Reaction Time: how long after an enemy champion comes into sight the bot answers it.
    • Last Hit Accuracy: the share of last hits it times right.
    • Skillshot Lead: how far ahead of a moving target it aims, from 0 to 1.
    • Retreat Health Fraction: below this share of health it falls back.
    • The Map section: when the laning phase ends, how bots defend towers and join objectives, and whether they recall to buy.
  3. Name your copies in Project Settings > Pioneer MOBA Framework > Bots > Profiles, in the order the lobby should offer them. A fourth profile adds a fourth difficulty; give it a name in Match Flow > Bot Difficulties too.
  4. Set Default Difficulty, the index of the profile a bot gets when no lobby chose one, as in Play In Editor.

A difficulty never changes a bot's gold, XP, stats or vision, only how well it plays.

Step 2: Tell the bots how to use an ability​

Every Ability Definition has a Bot section. Without a Usage, bots never cast the ability, and saving warns about it. The sample champions show filled-in sections; open Rook's DA_Rook_R_FinalCut for an execute or Thorne's DA_Thorne_W_Aegis for a shield.

AbilityUsageOther fields
A damaging skillshot or areaBot.Usage.DamageMin Enemies In Radius 2 for an area that should hit a group
A stun or rootBot.Usage.CrowdControl
A dash or blink awayBot.Usage.Escape
A gap closer or a leap inBot.Usage.EngageMax Range, if it should open from closer than its full range
An executeBot.Usage.ExecuteTarget Health Below 0.2
A shield or healBot.Usage.ShieldOwn Health Below 0.4 for a last resort
A spell bots must not useanyPlayers Only on

When the fields cannot say it, write an Evaluator: a subclass of UMobaBotAbilityEvaluator, in C++ or Blueprint, whose Can Use has the last word on each cast.

A bot trading with an enemy champion casts in this order: Execute, Engage, Crowd Control, Damage, then attacks. Retreating, it casts Shield on itself and Escape or Crowd Control at a champion closing in.

Step 3: The Bots settings​

Project Settings > Pioneer MOBA Framework > Bots:

  • Lane Fill Order: the lanes a team's bots take, in order. Top, Mid, Bottom, Bottom, Top by default; on a one-lane map, every bot takes that lane.
  • Think Rate: how often a bot decides, 10 times a second by default. Lower it to save server time with many bots.
  • Awareness Radius: how far around itself a bot pays attention to what its team sees, 1600 cm.

Project Settings > Pioneer MOBA Framework > Match Flow: Bot Spell D and Bot Spell F, the summoner spells bots take (Leap and Mend). Match: Fill With Bots, whether a match without a lobby fills its empty seats.

Bots buy their champion's Recommended Build in order, the Starting row, then the Core row. Change a champion's build to change what its bots buy.

Step 4: Change what bots decide​

The StateTree ST_Moba_Bot (in /PioneerMOBA/Bots) holds one state per situation, in priority order: Dead, Retreat, Trade, Defend, Objective, Push, Farm, Lane. Ten times a second the first state whose situation holds acts.

  1. Copy ST_Moba_Bot into your project under another name, such as ST_MyGame_Bot.
  2. Open the copy in the StateTree editor and change it:
    • Reorder the states to change what wins: Push above Defend makes bots more aggressive.
    • Remove a state to stop a behaviour: without Objective, bots never come to the dragon.
    • Add a condition or a task of your own to a state. A task's owner is the bot's controller; GetBrain() on it reaches UMobaBotBrainComponent, with IsInSituation, Act, GetKnownEnemyChampions and GetTarget.
  3. Name your copy in Project Settings > Pioneer MOBA Framework > Bots > Bot State Tree.

Step 5: A brain of your own​

To replace the brain entirely, set your own AI controller class in Project Settings > Pioneer MOBA Framework > Match > Bot Controller Class. Every bot a lobby seats or a match fills gets it. It must want a player state, and it plays its champion through the champion's orders (AMobaChampion::GetOrders()) and the cast requests of the ability system, so the server checks it as it checks a player.