Team Fortress 2

Team Fortress 2

757 ratings
TFBot skill levels explained in excruciating detail
By sigsegv
TFBots can have one of four different difficulty/skill levels: Easy, Normal, Hard, and Expert. It's obvious that Expert bots are much better than Easy bots, but what are the exact differences between each of the skill levels? Valve has never fully documented this information, so I dug into the game code myself to find out the complete list of effects that bot skill has.
3
   
Award
Favorite
Favorited
Unfavorite
How bot skill is set
Console Commands
Outside of MvM mode, the game uses the value of the tf_bot_difficulty console variable to decide the skill of bots as they are added to the game.

Setting
Skill Level
Default?
tf_bot_difficulty 0
Easy
tf_bot_difficulty 1
Normal
Default
tf_bot_difficulty 2
Hard
tf_bot_difficulty 3
Expert

Also, when adding bots via the tf_bot_add console command, there is a parameter for the difficulty of the bot, which can be "easy", "normal", "hard", or "expert". The TF2 Wiki page on bots has more information on this command and others.

MvM Pop Files
Pop files are used to spawn bots in Mann vs Machine mode. Inside each TFBot spawner block, there is parameter called Skill that sets the bot's skill level (Example: Skill Expert). If no Skill parameter is specified, the bot will default to Easy skill.

Giant robots almost always have Expert skill. As a general rule (at least in Valve's missions), engineer and spy bots always have Expert skill, and sniper bots usually have Hard (but sometimes Expert) skill.

If you use the EventChangeAttributes system (introduced in the Two Cities Update) to dynamically change your bots' parameters in response to map events, note that one of the things that can be changed between different EventChangeAttributes sets is the bot's Skill parameter.

MvM Endless Mode
In Mann vs Machine's never-officially-released Endless Mode, bots spend money to purchase upgrades in a similar manner as players. One special upgrade available only to bots is an AI skill level increase.

Entity bot_generator
This is a relatively obscure way to spawn bots. I think it's used in training mode, and it may have also been used in the early development of Mann vs Machine mode. In any case, it has a SetDifficulty input that allows the skill to be set. You'll have to do your own research if you want more information.
Robot eye glow color
The Mann vs Machine robot models have an eye glow particle whose color changes depending on the bot's AI skill level. This can help players get a rough idea of the skill level of a bot just by looking at it.

The eye color difference isn't explained anywhere officially, as far as I know, so relatively few players are likely to actually notice it and realize what it means in practice.

Skill Level
Eye Color
Exact RGB Value
Easy/Normal
Blue
#24b4ff
Hard/Expert
Yellow
#fff000

Vision: recognition time
When a player (or other entity) enters a bot's field of view, the bot vision system will not immediately allow the rest of the AI to react to it; instead, it will pretend that the bot can't actually see the entity until a certain amount of time has passed. This effectively imposes a "reaction time" on the bot, so that it must see new threats for a moment before it can actually react and take action against them.

Higher-skilled bots are significantly faster at recognizing and reacting to new threats.

Skill Level
Min Recognition Time
Easy
1.00 seconds
Normal
0.50 seconds
Hard
0.30 seconds
Expert
0.20 seconds
Aim: tracking rate
Bots decide which direction to aim by periodically calculating the position and velocity of their target, and then predicting linear movement from that information. The faster their tracking rate, the better they are able to accurately track threats that change speed or direction frequently.

Skill Level
Aim Tracking Interval
Equivalent Rate
Easy
1.00 seconds
1x per second
Normal
0.25 seconds
4x per second
Hard
0.10 seconds
10x per second
Expert
0.05 seconds
20x per second

Exception: spy bots
TFBot spies are always forced to the Normal aim tracking rate, regardless of what their skill level is set to.

Video Demonstration of Aim Tracking Rate
Aim: weapon-specific proficiency
For certain weapon types, bots are able to aim in a more specialized manner than simply pointing their crosshair at the center of the target player.

Grenade Launchers and Stickybomb Launchers
Bots of all skill levels are able to compensate their aim for the vertical arc of grenades and stickybombs.

However, they use the fixed value of console variable tf_bot_ballistic_elevation_rate to predict the vertical falloff with distance, so they won't properly adjust their arc prediction for the faster projectiles of certain GL variants (e.g. the Loch-n-Load, or basically anything with a projectile speed modification attribute).

As this aim ability is based on weapon ID, demo bots won't use it if using a GL/SL variant that has a different weapon ID from stock. Currently, the only case of this is the Loose Cannon; bots won't raise their aim for the projectile arc when using that weapon.

Huntsman
Bots are capable of compensating for the slight vertical falloff of the arrow projectile with distance, based on the value of console variable tf_bot_arrow_elevation_rate. They also know to aim for the target's head instead of the center of their body.

Bots with Easy skill will not do vertical compensation, nor will they aim for the head. Bots with at least Normal skill will compensate for the vertical arc, but will only aim for headshots at very close range (150 HU). Bots with Hard or Expert skill will always aim for headshots.

Rocket Launchers
When their target is not right next to them (greater than 150 HU), bots will aim rockets at the target's feet instead of at the center of their body, to get a better chance at splash damage and to pop them up into the air. If their target is very close to them (less than 150 HU), they will aim for the target's head instead.

Bots with Easy skill will not do this; they will always aim for the middle of players, regardless of the distance.

As with the demoman aim ability described earlier, this soldier aim ability is based on weapon ID. Two Rocket Launcher variants have custom weapon IDs: the Direct Hit and the Cow Mangler. Because their weapon IDs don't match that of the stock rocket launcher, bots won't attempt to aim at their targets' feet. For the Direct Hit, this actually makes sense, given the weapon's lack of splash damage. For the Cow Mangler, there's no good reason for it; this part of the AI was written before the CM5K was added to the game, so it simply doesn't know to check for it.

Sniper Rifles
Bots with Easy skill will aim for the body of target players. With Normal skill, they will aim for a spot 33% of the way down from the target player's head to the center of their body. With Hard or Expert skill, they will aim directly for the target player's head.

This matters less in Mann vs Machine mode, since sniper bots don't actually get increased damage from headshots.
Hearing: quiet gunfire sensitivity
Whenever a weapon is fired, bots are able to "hear" the shot, meaning that they become aware of the player who fired the weapon, even if they aren't currently able to see them.

Bots are able to hear most weapons firing at a distance of up to 3000 HU (based on console variable tf_bot_notice_gunfire_range). They have a 100% chance of noticing the shots being fired (although they may or may not decide to turn and aim for the shooter depending on other considerations, such as the presence of other, higher-priority threats).

Certain classes of weapons are considered "quiet". Bots are only able to hear these weapons within a radius of 500 HU (based on console variable tf_bot_notice_quiet_gunfire_range). They also have a less-than-100% chance of hearing each gunshot; higher-skilled bots are more likely to notice the shots.

Skill Level
Will Notice Quiet Gunfire?
Easy
10% chance
Normal
30% chance
Hard
60% chance
Expert
90% chance

Note that these probabilities are further reduced by half if other, non-quiet gunfire has been heard within the last 3 seconds. (The loud sounds "mask" the quiet sounds.)

These are the weapons which are considered to be "quiet":
Weapon ID
Items
TF_WEAPON_KNIFE
All spy knives
TF_WEAPON_FISTS
All heavy-specific melees (but his all-class melees are actually TF_WEAPON_FIREAXE)
TF_WEAPON_PDA
I don't think anything uses this directly
TF_WEAPON_PDA_ENGINEER_BUILD
Engineer's Construction PDA
TF_WEAPON_PDA_ENGINEER_DESTROY
Engineer's Destruction PDA
TF_WEAPON_PDA_SPY
Spy's Disguise Kit
TF_WEAPON_BUILDER
Engineer's Toolbox and Spy's Sapper
TF_WEAPON_MEDIGUN
All mediguns
TF_WEAPON_DISPENSER
Pretty sure this is not actually used, since Dispensers are objects, not weapons
TF_WEAPON_INVIS
All spy invisibility watches
TF_WEAPON_FLAREGUN
All pyro flare guns except the Manmelter
TF_WEAPON_LUNCHBOX
Sandvich, Dalokohs Bar, Buffalo Steak Sandvich, Bonk, Crit-a-Cola
TF_WEAPON_JAR
Jarate (but not Mad Milk, which has a separate, non-quiet weapon ID)
TF_WEAPON_COMPOUND_BOW
Huntsman
TF_WEAPON_SWORD
Eyelander, Skullcutter, Claidheamh Mor, Persian Persuader, Half-Zatoichi (even on soldier)
TF_WEAPON_CROSSBOW
Crusader's Crossbow

The list of quiet weapon IDs hasn't been updated since December 2010, so any weapons added to the game since that time which use a new weapon ID (instead of reusing an existing weapon ID, as is often the case for weapons that are only slight modifications to stock) will not be considered quiet, even if that makes no sense for the item in question.

Example: the Manmelter has its own weapon ID, TF_WEAPON_RAYGUN_REVENGE, which was added to the game after the quiet weapon list was created, so it is not considered quiet; but all three of the other flareguns are considered quiet, since they all share TF_WEAPON_FLAREGUN, which is in the quiet weapon list. The Scorch Shot was released more recently than the Manmelter, but because it reused the existing flaregun weapon ID it's considered quiet. Yes, this is dumb.
Strategy: threat prioritization
When bots know about multiple enemies at the same time, they prioritize them based on certain criteria, such as which of the threats is closest to them, which of the threats is firing at them, and other factors.

Higher-skill bots will additionally check if their top-priority threat is being healed by a medic, and if so, they will target the threat's medic instead of the threat itself.

Skill Level
Will Target Threat's Healer?
Easy
No
Normal
50% chance
Hard
Yes
Expert
Yes

Enemies that are farther than 500 HU away from bots aren't considered immediate threats to them, so they are prioritized lower. There are a few exceptions, however. Enemy snipers who are aiming in the general direction of the bot will always be considered an immediate threat, regardless of distance. And higher-skill bots will always consider medics and engineers immediate threats, regardless of distance.

Skill Level
Considers Distant Medics/Engies/Snipers Immediate Threats?
Easy/Normal
No
Hard/Expert
Yes

(The distant sniper consideration is actually broken, as it requires the dot product of the sniper's aim vector with the displacement vector between the bot and the sniper to be exactly zero, which is incredibly unlikely to actually happen. The developers should have done a threshold/epsilon comparison rather than a direct floating-point comparison-with-zero.)

Correction (2016/10/20): I was actually wrong about the sniper dot product being broken; the code actually checks whether the dot product is greater than zero, not equal to zero. So enemy snipers are considered to be an immediate threat if they are facing anywhere in the range from directly toward the bot, to as much as perpendicular to that; but not if they are facing anywhere from perpendicular to directly away from the bot. (Thanks to Hex-Rays for improperly decompiling the SSE floating point comparison.)
Movement: dodging
Bots will intentionally strafe to the left and right in an attempt to dodge attacks. Easy skill bots will never dodge under any circumstances.

Bots with Normal or higher skill will dodge when they are holding a "combat weapon" (anything that can shoot, basically), have seen an enemy within the last 3 seconds, and that enemy has a clear line of sight to their position (meaning that there is a chance of being shot at).

However, they will not dodge:
  • if they have Attributes DisableDodge
  • if their current AI behavior is telling them to hurry
  • if they are invulnerable (any uber condition)
  • if they are taunting
  • if they are an engineer
  • if they are cloaked or disguised as spy
  • if they are zoomed-in as sniper or spun-up as heavy
  • if they are currently charging up a Huntsman arrow

When dodging, bots have a 33% chance to strafe left, a 33% chance to strafe right, and a 33% chance to do neither. (They will not strafe if they detect a potential gap in that direction, however.)
Movement: bumping enemies
Under certain circumstances, bots will specifically avoid bumping into certain enemies. In practice, this only seems to be used by the spy bot AI, presumably so that they don't clumsily bump into enemy players while cloaked and reveal themselves.

Skill Level
Avoids Bumping Enemies?
Easy
No
Normal
No
Hard
Yes
Expert
Yes
Pyro: airblast proficiency
Pyro bots know how to use airblast for two purposes.
  • PvP and MvM: reflecting incoming projectiles
  • PvP only: shoving away enemy players that are close to them
In both situations, the chance that they will actually fire their airblast depends on their skill level.

Skill Level
Will Fire Airblast?
Easy
0% chance
Normal
50% chance
Hard
90% chance
Expert
100% chance
Spy: disguise effectiveness
The skill level of a spy bot influences how intelligently they choose the class they disguise as.

Skill Level
Disguise Method
Easy/Normal
Chooses disguise class at random, ignoring the enemy team's class composition
Hard/Expert
Chooses a random member of the enemy team and disguises as that class

Their skill level also determines how good of an acting job the spy will do while disguised.

Skill Level
Behavior When Disguised/Cloaked
Easy/Normal
Will look toward enemy players when it sees them (suspicious)
Hard/Expert
Will intentionally avoid looking at enemy players (more believable)
Spy: backstab aggressiveness
At long range (300 HU, determined by console variable tf_bot_spy_knife_range), spy bots will only decide to go for a backstab if they can see their victim and the victim's back is turned. The bot's skill level determines how much the enemy's back can be angled away from the spy and still be "close enough" for the bot to go in for the stab.

Skill Level
Angle Constraints
Easy
Will always go for backstabs, even when enemies are facing toward him
Normal
Will only go for a backstab if he's +/- 45 degrees from the enemy's back
Hard
Will only go for a backstab if he's +/- 78 degrees from the enemy's back
Expert
Will go for a backstab if he's +/- 90 degrees from the enemy's back, which means he will always go for any possible backstab, since backstabs are allowed in a 180 degree angle behind players

Exception: Mann vs Machine
In Mann vs Machine mode, spies are always forced to the Normal backstab angle constraint, regardless of what their skill level is set to.
Tactics: weapon selection
Less relevant in Mann vs Machine mode, since bots usually have WeaponRestrictions set

Bots will choose which weapon to deploy based on the kind of threat they're facing and other circumstantial factors. The following considerations are only made for bots with skill higher than Easy:
  • scout: switching to secondary weapon when primary weapon clip is empty
  • soldier: switching to secondary weapon when primary weapon clip is empty and the threat is closer than 500 HU
  • sniper: switching to secondary weapon for threats closer than 750 HU
  • pyro: switching to secondary weapon for threats farther than 750 HU, unless they are a soldier or demoman
Tactics: reloading in cover
Not relevant to Mann vs Machine mode

If the bot's current AI behavior isn't giving it any specific input about whether to retreat, and the bot's primary ammo clip is empty, and the bot isn't being ubered, higher-skill bots will temporarily switch to RetreatToCover behavior so they can reload their weapon in cover.

Skill Level
Retreats To Reload?
Easy
No
Normal
No
Hard
Yes
Expert
Yes
CP gamemode: defender roam tendency
Not relevant to Mann vs Machine mode

When defending a control point, higher-skill bots have a greater likelihood of deciding to roam far away from the point to look for kills (using the SeekAndDestroy AI behavior). They will only do this when there's a decent amount of time on the clock, though (determined by console variable tf_bot_defense_must_defend_time.

Skill Level
Chance of Roaming
Easy
10%
Normal
50%
Hard
75%
Expert
90%
CP gamemode: capture blocking
Not relevant to Mann vs Machine mode

When defending a control point, higher-skill bots are more likely to try to block the capture when the enemy team contests the control point.

Skill Level
Will Try to Block Capture?
Easy
No
Normal
50% chance
Hard
Yes
Expert
Yes
Summary
Easy
Normal
Hard
Expert
Exceptions?
Vision: recognition time
1.00 sec
0.50 sec
0.30 sec
0.20 sec
Aim: tracking rate
1x/sec
4x/sec
10x/sec
20x/sec
Spies always use the Normal value
Aim: grenade/sticky vertical compensation
Yes
Yes
Yes
Yes
Aim: huntsman vertical compensation
No
Yes
Yes
Yes
Aim: huntsman aim for headshots
No
< 150 HU
Yes
Yes
Aim: rocket launcher aim-for-feet
No
Yes
Yes
Yes
Aim: sniper rifle target
Body
Near head
Head
Head
Hearing: chance to notice quiet gunfire
5-10% chance
15-30% chance
30-60% chance
45-90% chance
Strategy: aim at threat's healer
No
50% chance
Yes
Yes
Strategy: consider engies/medics immediate threats
< 500 HU
< 500 HU
Always
Always
Movement: dodge
No
Yes
Yes
Yes
Movement: avoid bumping enemies
No
No
Yes
Yes
Pyro: chance to airblast
0%
50%
90%
100%
Spy: disguise class selection
Dumb
Dumb
Smart
Smart
Spy: stare at enemies
Stares
Stares
Ignores
Ignores
Spy: backstab angle
Too dumb to care
+/- 45 deg
+/- 78 deg
+/- 90 deg
MvM forces the Normal value
Tactics: situational weapon selection
No
Yes
Yes
Yes
Less relevant in MvM
Tactics: reload in cover
No
No
Yes
Yes
Not applicable in MvM
CP: defender roaming
10% chance
50% chance
75% chance
90% chance
Not applicable in MvM
CP: capture blocking
No
50% chance
Yes
Yes
Not applicable in MvM
141 Comments
Amicdict Nov 10, 2021 @ 4:26pm 
I checked the CTFBotSpyAttack NextBot action in the source code leak.

I have stored my findings here: https://pastebin.com/7aw5VMQE (don't forget to archive the link!)
SayakatheSnoo Nov 4, 2021 @ 4:26pm 
Join the Insurgency against Tacobot! We, as the Burrito Insurgency, will make all Tacobot members bow and beg for mercy, we will become immune to their kicks through sheer numbers, and we will force them to seek forgiveness!

https://steamcommunity.com/groups/theburritoinsurgency
[APG]RoboCop[CL] Oct 22, 2021 @ 5:02pm 
Hello I work for Bots-United do you much on how to maybe allow nav meshes to work with 3rd Party Bots like RCBot2?
Orinuse Jan 19, 2019 @ 9:50pm 
no but that helped me gain new knowledge so thanks

what I mean is that are mission makers actually able to alter the Sentry Buster's spawn times, or they can but there's some weird things happening behind the scenes that alter their spawn times

wanted to ask this because during solo testing with busters on a map to check if the bot navigation meshes are working fine, I decided to set the buster's spawn times really really high (for fun or something, I dunno) but it respawned quickly after the active buster died
Fission Power Dec 21, 2018 @ 2:08pm 
Orinuse Dec 21, 2018 @ 2:18am 
I wanted to know this for a long time, how exactly do Sentry Busters's spawntimes work? They sometimes seem to spawn faster than their previous respawn duration

Do they obey the keyvalue "CooldownTime" or "InitialCooldown" too?
Orinuse Dec 17, 2018 @ 7:52am 
can you look into Medic skill levels with overhealing bots
sigsegv  [author] Nov 21, 2018 @ 10:37am 
@Airstirke Medic bots do share a lot of the same base AI functionality with other-class bots. Which can include things like attempting to do the typical "look toward enemies that I know about" and "switch to the best weapon to engage this enemy with" stuff (at least so far as their main AI doesn't override it.) And the medic bot heal AI does override some of that stuff, because it e.g. knows the bot will need to have its medigun out, knows the bot will need to look/aim at its desired heal target (at least for a moment) so it can start the heal beam on it, etc.
Artillery Nov 20, 2018 @ 4:56pm 
it seems as if the medic bot has some ripped ai from other bots as I've noticed that they look at enemies and attempt to pull out a weapon but forced to go to their secondary which is kinda weird