[Info] Bots

Apr 19, 2009
4,460
1,722
Erectin a dispenser
December 21, 2009 - Mike Booth

With the success of the AI systems of Left 4 Dead, we've been continuing to develop these technologies to create new kinds of game experiences. Team Fortress 2 is an excellent "sandbox" for explorations of this sort, and we've been quietly doing so for much of this last year. Some of the results of these explorations are TF "bots" — AI-driven player proxies with simulated humanlike senses, reaction times, and tactics. Although the TFBots are not yet complete, they play a pretty decent game of King of the Hill.

We thought you might enjoy testing your skill against these work-in-progress digital killing machines.

We'd also like to hear your thoughts on how the bots are behaving. Although we have our list of behavior bugs to tackle (this is a beta after all), we're sure you'll discover issues we haven't yet seen. If you'd like to give us bot feedback, you can post your thoughts in our new Bot Feedback sub-forum, or send us an e-mail at tfbots@valvesoftware.com. In either case, please tell us the three things you hate most about the bots, and the three things you like best about them (as well as anything else you think we should know).

Since this is a beta test, the TFBots are only functional on these King of the Hill maps: koth_viaduct, koth_sawmill, and koth_nucleus. They don't understand the rules of multiple point capturing, cart pushing, or flag getting... yet. There's also no interface in the game to accessing them yet (we'll add one in an update shortly), so you'll need to access them manually.

To add bots to your game, use the console command tf_bot_add. This will drop a random bot onto a random team (assuming there is a free player slot). The tf_bot_add command can also take up to three optional arguments: <count>, <class>, and <team>, in any order. For example, tf_bot_add 10 will add 10 random bots to the game with auto-assigned teams. Typing tf_bot_add pyro blue will add a Pyro to the blue team. Entering tf_bot_add red 5 will add 5 random bots to the red team. The command tf_bot_add red 3 heavyweapons will add three heavies to the red team.
In order to put specific bots on specific teams (for a bots-vs-humans game, for example), you may want to disable automatic team balancing. To do this, enter mp_autoteambalance 0 followed by mp_teams_unbalance_limit 0.
To remove a bot, use the console command kick <bot name>. To remove all of the bots in the game, use the command tf_bot_kick all.

TFBots are "players", and take up player slots. They run the exact same code that human players do, moving and firing weapons by pressing "virtual buttons". The bots have simulated humanlike senses, and only know what they see, hear, and touch. They also have realistic reaction times and aiming limitations. They don't "cheat" or use omniscient knowledge of the server state to make their decisions.

If you're interested in the technical details, give this a read-through.
http://www.teamfortress.com/post.php?id=3279

MikeBooth said:
If you are going to generate your own nav files, make sure you set this cvar first:
Code:
nav_max_view_distance 6000

Otherwise some valuable data will be missing from the nav file. We'll try to make sure that gets changed to the default behavior in future updates so you don't have to do that. But for now, you do.

Also, nav files usually need a bit of hand tuning after generation. Use:

Code:
nav_edit 1

to enable nav mesh editing.

Finally, recall that the bots only "understand" the King of the Hill scenario at the moment, and likely will not act very intelligently in the other scenarios.

All that said, experiment and have fun!
http://forums.steampowered.com/forums/showpost.php?p=12673281&postcount=9

Code:
"tf_bot_force_class" = ""
 game
 - If set to a class name, all TFBots will respawn as that class
"tf_bot_notice_gunfire_range" = "3000"
 game
"tf_bot_sniper_personal_space_range" = "1000"
 game cheat
 - Enemies beyond this range don't worry the Sniper
"tf_bot_add"
 game
 - Add a bot.
"tf_bot_kick"
 game
 - Remove a TFBot by name, or all bots ("all").
"tf_bot_warp_team_to_me"
 game cheat
"tf_bot_debug_seek_and_destroy" = "0"
 game cheat
"tf_bot_path_lookahead_range" = "300"
 game
"tf_bot_pyro_deflect_tolerance" = "0.5"
 game cheat
"tf_bot_sniper_aim_error" = "0.01"
 game cheat
"tf_bot_sniper_aim_steady_time" = "0.5"
 game cheat
"tf_bot_sniper_aim_steady_rate" = "10"
 game cheat
"tf_bot_debug_sniper" = "0"
 game cheat
"tf_bot_keep_class_after_death" = "0"
 game
"tf_bot_ammo_search_range" = "2000"
 game cheat
 - How far bots will search to find ammo around them
"tf_bot_health_critical_ratio" = "0.3"
 game cheat
"tf_bot_health_ok_ratio" = "0.8"
 game cheat
"tf_bot_health_search_near_range" = "1000"
 game cheat
"tf_bot_health_search_far_range" = "2000"
 game cheat
"tf_bot_melee_attack_abandon_range" = "500"
 game cheat
 - If threat is farther away than this, bot will switch back to its primary weapon and attack
"tf_bot_retreat_to_cover_range" = "1000"
 game cheat
"tf_bot_debug_retreat_to_cover" = "0"
 game cheat
"tf_bot_wait_in_cover_min_time" = "1"
 game cheat
"tf_bot_wait_in_cover_max_time" = "2"
 game cheat
"tf_bot_offense_must_push_time" = "60"
 game cheat
 - If timer is less than this, bots will push hard to cap
"tf_bot_sniper_offense_push_time" = "60"
 game cheat
 - If timer is less than this, the Sniper will try to cap
"tf_bot_min_travel_to_build_teleporter" = "4000"
 game cheat
 - How far away our goal needs to be before we try to build a teleporter
"tf_bot_debug_sentry_placement" = "0"
 game cheat
"tf_bot_medic_stop_follow_range" = "100"
 game cheat
"tf_bot_medic_start_follow_range" = "300"
 game cheat
"tf_bot_medic_max_heal_range" = "600"
 game cheat
"tf_bot_medic_debug" = "0"
 game cheat
"tf_bot_medic_cover_test_resolution" = "8"
 game cheat
"tf_bot_sniper_flee_range" = "400"
 game cheat
 - If threat is closer than this, retreat
"tf_bot_sniper_linger_time" = "5"
 game cheat
 - How long Sniper will wait around after losing his target before giving up
"tf_bot_sniper_patience_duration" = "20"
 game cheat
 - How long a Sniper bot will wait without seeing an enemy before picking a new spot
"tf_bot_min_setup_gate_defend_range" = "750"
 game cheat
 - How close from the setup gate(s) defending bots can take up positions. Areas closer than this will be in cover to ambush.
"tf_bot_max_setup_gate_defend_range" = "2000"
 game cheat
 - How far from the setup gate(s) defending bots can take up positions
"tf_bot_min_setup_gate_sniper_defend_range" = "1500"
 game cheat
 - How far from the setup gate(s) a defending sniper will take up position
"tf_bot_max_point_defend_range" = "1250"
 game cheat
 - How far (in travel distance) from the point defending bots will take up positions
"tf_bot_koth_sniper_spot_min_range" = "1000"
 game cheat
"tf_bot_koth_sniper_spot_density" = "2"
 game cheat
 - How many sniper spots, on average, per 25x25 unit area
"tf_bot_sniper_spot_max_count" = "100"
 game cheat
 - Stop searching for sniper spots when each side has found this many
"tf_bot_show_sniper_spots"
 game cheat
 - Display the current set of sniper spots.
"tf_bot_sniper_spot_epsilon" = "10"
 game cheat

How to use bots:

On official KOTH maps:
tf_bot_add

On non official KOTH maps:
sv_cheats 1
nav_max_view_distance 6000
nav_gererate
tf_bot_add

CP/KOTH/ARENA:
Bots work as intended on all but cp_steel

PL/PLR:
Busted, BLU will push the cart but RED will stay on the cap point.

A/D CTF/CTF:
Busted, teams stay in spawn and will not cap intel.

General notes:

tf_bot_add does allow optional class and team parameters. The command takes up to three arguments of <count> <class> <team>, which can appear in any order.

For example, tf_bot_add 5 red pyro would add 5 pyros to the red team.

tf_bot_force_class random for scouts and spies mixed in with the rest of the bots.

Bots will constantly get caught on clipping issues, as they follow very close to walls when walking.

The bots are actually very good in spawncamping

The bots do not allway avoid props, sometimes they just keep walking staight into a prop. They do avoid it after a few seconds.

They think a func_door brush is unpassible.

Class Notes:

Medic:

Medics will prioritize heavies over every class when healing, and occasionally they will appear to be spamming the fire button rather then constantly healing.

Medics will also fall off high ledges due to constant strafing, yet continue to attempt healing their previous target, even through a wall.

Engineer:

Engineers will build a Sentry and a Dispenser near an ammo kit and constantly return to the kit to build up their sentry.

Engineers prioritize their sentry when building, and level it up first.

Engineers build in a diagonal line, with the sentry in front and the dispenser behind.

When attacking, Engineers will primarily use their pistol, unless very close to the enemy.

Engineers, once their buildings are maxed, will stay crouched behind sentries and constantly hit them with their wench.

Engineers are more likely to build close to one another, however they do not appear (at the moment) to share metal with each other's dispensers

Engineer bots will build teleports if you set a tf_bot_min_travel_to_build_teleporter from 4000 to 0

Sniper:

Snipers will always headshot a class when zoomed in, however they occasionally will noscope.

Snipers (along with a few other classes) seem to huddle around dispensers.

Snipers will also fire on sight, rather then build up their shots. (When *searching* they will stay zoomed in however).

Heavy:

Heavies tend to play direct offense, they will consistently spin up their gun and walk into the heat of battle, even in the way of an enemy sentry.

I will add more info when I get the time to test these things more!

Special thanks to Jack Riguel, martijntje, Randdalf, Ravidge, and TheBladeRoden for the expanded notes.
 
Last edited:

Freyja

aa
Jul 31, 2009
2,994
5,813
I have contacted valve about this.

Bots only fully understand KoTH, and partially understand CP and Arena.

Other gametypes are in the works, this is just beta testing :)
 

Jack Riguel

L10: Glamorous Member
Jul 19, 2009
721
254
I couldn't get bots to work on anything besides KOTH. Did you nav_gernate the other ones as well? I tried badlands, dustbowl, and arena_nucleus and they didn't respond.

Also I found a few interesting traits:

*Medics will prioritize heavies over every class when healing, and occasionally they will appear to be spamming the fire button rather then constantly healing.

*Medics will also fall off high ledges due to constant strafing, yet continue to attempt healing their previous target, even through a wall.

*Engineers will build a Sentry and a Dispenser near an ammo kit and constantly return to the kit to build up their sentry.

*Engineers prioritize their sentry when building, and level it up first.

*Engineers build in a diagonal line, with the sentry in front and the dispenser behind.

*When attacking, Engineers will primarily use their pistol, unless very close to the enemy.

*Snipers will always headshot a class when zoomed in, however they occasionally will noscope.

*Snipers (along with a few other classes) seem to huddle around dispensers.

*Snipers will also fire on sight, rather then build up their shots. (When *searching* they will stay zoomed in however).

*Heavies tend to play direct offense, they will consistently spin up their gun and walk into the heat of battle, even in the way of an enemy sentry.

I'm actually very impressed with the current AI the bots have, and if you load them up you'll notice they have some pretty funny names that I wont' spoil here. :p

EDIT: Never-mind, I figured it out. Once I get a few more tests running I'll do a full class by class behavior sheet. They actually respond very well to a lot of dangers... I'm running them in my map arena_cargo, and they actually respond to and use the moving train (a dynamic prop) for cover.

Here's a few new items:

*Engineers, once their buildings are maxed, will stay crouched behind sentries and constantly hit them with their wench.

*Engineers are more likely to build close to one another, however they do not appear (at the moment) to share metal with each other's dispensers

*Bots in general will constantly get caught on clipping issues, as they follow very close to walls when walking.

EDIT #2:

Bots do not like pl_waste. They will only fight over the initial point. Oddly enough, blue team will hang back and build up ubers and play more "attacker" classes (mostly soilders and heavies), while red team will stand on the center point.
(Engies will run around building up in a few areas, while demos, snipers, soldiers, pyros, and medics stand on the point.

Oddly enough, BLU will occasionally push the cart forward, however they abandon it very quickly. Red team will push it slightly back, however I think it reads a a dispenser for them so they use it for heath and then abandon it.

Also, I have not yet seen a bot play either Spy or Scout.
 
Last edited:

martijntje

L8: Fancy Shmancy Member
Aug 2, 2009
539
334
*Engineers will build a Sentry and a Dispenser near an ammo kit and constantly return to the kit to build up their sentry.

*Engineers prioritize their sentry when building, and level it up first.
I do that all the time, it is not that weird of a tactic.

I do like this. The only way I've got it working is by using a dedicated LAN server, wich is kind of annoying.

some things I am wondering
* can the bots use unlockables?
* can we make the bots spawn as specific classes (say I want to simulate a scout rush)
 

Pseudo

L6: Sharp Member
Jan 26, 2008
319
150
can we make the bots spawn as specific classes (say I want to simulate a scout rush)
"tf_bot_force_class" = ""
- If set to a class name, all TFBots will respawn as that class



There's also a bunch of tf_bot_ commands for tweaking the AI behavior. Right now it seems that Sniper is the most customizable.
 
Last edited:

Jack Riguel

L10: Glamorous Member
Jul 19, 2009
721
254
I do that all the time, it is not that weird of a tactic.

I do like this. The only way I've got it working is by using a dedicated LAN server, wich is kind of annoying.

some things I am wondering
* can the bots use unlockables?
* can we make the bots spawn as specific classes (say I want to simulate a scout rush)

I reread my post and found that it's mostly me just rambling about how cool this all is. Once I get back home I'm gonna spend a few solid hours messing with the bots and seeing how they behave to different situations and in different maps. (I find running them in pl_waste to be very interesting, and slightly humorous as well).

The old bot setup allowed for specific classes to be selected, however I do not think that scouts and spies, will work correctly (both classes are never picked by any of the bots I've spawned). I'll test this when I get back though

Also, as far as I know, bots cannot use unlockables since they would require a "drop" and more importantly... a connection to the steam cloud.

I still have to say though , I am amazed at the bot's AI on assault maps. I watched two medics build ubers on two different heavies and attack at the same time using two different routes. The engineer's AI is especially interesting, while they mostly stay defensive and stationary by their sentries, they will occasionally attack when threatened and I've seen some take more unused paths to surprise the enemy and run away once they make a kill.

AI has always amazed me, and while I can tell Valve made this for use in small lan game and single player, there is so much potential for map makers here to use this feature. While the best tests are made with real people, these bots could prove useful in quick-updates and for pre-testing a map version before it's released. I'm definitely going to spend a lot of time with this feature, I'm especially interested to see how they work when I play as spy...
 

Nutomic

L11: Posh Member
Feb 7, 2009
888
177
AI has always amazed me, and while I can tell Valve made this for use in small lan game and single player, there is so much potential for map makers here to use this feature. While the best tests are made with real people, these bots could prove useful in quick-updates and for pre-testing a map version before it's released. I'm definitely going to spend a lot of time with this feature, I'm especially interested to see how they work when I play as spy...

Although i never mapped for any other game than tf2, i was always angry at people mapping for other games, that could easily test their maps with bots. These will hopefully solve this, at least partially.

/puts bots on his map and lets run
 

TheBladeRoden

L420: High Member
Oct 26, 2007
491
168
Although i never mapped for any other game than tf2, i was always angry at people mapping for other games, that could easily test their maps with bots. These will hopefully solve this, at least partially.

/puts bots on his map and lets run

Then again, on UT2004 half of my efforts were spent on pathing and trying to get the bots to run the map properly.
 

Tapp

L10: Glamorous Member
Jan 26, 2009
776
215
I've noticed soldiers don't seek the high ground or rocket jump. Also, bots don't appear to be fond of jumping at all.
 

martijntje

L8: Fancy Shmancy Member
Aug 2, 2009
539
334
so I used the bots on one of my custom maps. The map design was kind of rubbish, and the bots thaught so to. They usually took the one path, wich I did not intend as the main path.

* the bots are actually very good in spawncamping
* the bots do not allway avoid props, sometimes they just keep walking staight into a prop. They do avoid it after a few seconds.
* they think a func_door brush is unpassible.
 

Mr.Late

L7: Fancy Member
Nov 27, 2009
408
157
I tested bots with my custom PL map.

-Bots sometimes forgotted the cart, but usually there was 1 bot pushing it.
-Bots defended precisely on the CP.

However, they did quite good job for alpha/beta bots.
 
Feb 14, 2008
1,051
931
Engineer bots will build teleports if you set a cvar from 4000 to 0 (can't remember what it's called though, tf_bot_.... teleporter_range, something like that).
 

Ravidge

Grand Vizier
aa
May 14, 2008
1,544
2,818
Engineer bots will build teleports if you set a cvar from 4000 to 0 (can't remember what it's called though, tf_bot_.... teleporter_range, something like that).

tf_bot_min_travel_to_build_teleporter
"- How far away our goal needs to be before we try to build a teleporter"

There are actually tons of commands to use. I'm waiting for someone to write a massive list of what each option does.... I'm too lazy to do it myself. Here's a quick list and their in-game description however.

Code:
"tf_bot_force_class" = ""
 game
 - If set to a class name, all TFBots will respawn as that class
"tf_bot_notice_gunfire_range" = "3000"
 game
"tf_bot_sniper_personal_space_range" = "1000"
 game cheat
 - Enemies beyond this range don't worry the Sniper
"tf_bot_add"
 game
 - Add a bot.
"tf_bot_kick"
 game
 - Remove a TFBot by name, or all bots ("all").
"tf_bot_warp_team_to_me"
 game cheat
"tf_bot_debug_seek_and_destroy" = "0"
 game cheat
"tf_bot_path_lookahead_range" = "300"
 game
"tf_bot_pyro_deflect_tolerance" = "0.5"
 game cheat
"tf_bot_sniper_aim_error" = "0.01"
 game cheat
"tf_bot_sniper_aim_steady_time" = "0.5"
 game cheat
"tf_bot_sniper_aim_steady_rate" = "10"
 game cheat
"tf_bot_debug_sniper" = "0"
 game cheat
"tf_bot_keep_class_after_death" = "0"
 game
"tf_bot_ammo_search_range" = "2000"
 game cheat
 - How far bots will search to find ammo around them
"tf_bot_health_critical_ratio" = "0.3"
 game cheat
"tf_bot_health_ok_ratio" = "0.8"
 game cheat
"tf_bot_health_search_near_range" = "1000"
 game cheat
"tf_bot_health_search_far_range" = "2000"
 game cheat
"tf_bot_melee_attack_abandon_range" = "500"
 game cheat
 - If threat is farther away than this, bot will switch back to its primary weapon and attack
"tf_bot_retreat_to_cover_range" = "1000"
 game cheat
"tf_bot_debug_retreat_to_cover" = "0"
 game cheat
"tf_bot_wait_in_cover_min_time" = "1"
 game cheat
"tf_bot_wait_in_cover_max_time" = "2"
 game cheat
"tf_bot_offense_must_push_time" = "60"
 game cheat
 - If timer is less than this, bots will push hard to cap
"tf_bot_sniper_offense_push_time" = "60"
 game cheat
 - If timer is less than this, the Sniper will try to cap
"tf_bot_min_travel_to_build_teleporter" = "4000"
 game cheat
 - How far away our goal needs to be before we try to build a teleporter
"tf_bot_debug_sentry_placement" = "0"
 game cheat
"tf_bot_medic_stop_follow_range" = "100"
 game cheat
"tf_bot_medic_start_follow_range" = "300"
 game cheat
"tf_bot_medic_max_heal_range" = "600"
 game cheat
"tf_bot_medic_debug" = "0"
 game cheat
"tf_bot_medic_cover_test_resolution" = "8"
 game cheat
"tf_bot_sniper_flee_range" = "400"
 game cheat
 - If threat is closer than this, retreat
"tf_bot_sniper_linger_time" = "5"
 game cheat
 - How long Sniper will wait around after losing his target before giving up
"tf_bot_sniper_patience_duration" = "20"
 game cheat
 - How long a Sniper bot will wait without seeing an enemy before picking a new spot
"tf_bot_min_setup_gate_defend_range" = "750"
 game cheat
 - How close from the setup gate(s) defending bots can take up positions. Areas closer than this will be in cover to ambush.
"tf_bot_max_setup_gate_defend_range" = "2000"
 game cheat
 - How far from the setup gate(s) defending bots can take up positions
"tf_bot_min_setup_gate_sniper_defend_range" = "1500"
 game cheat
 - How far from the setup gate(s) a defending sniper will take up position
"tf_bot_max_point_defend_range" = "1250"
 game cheat
 - How far (in travel distance) from the point defending bots will take up positions
"tf_bot_koth_sniper_spot_min_range" = "1000"
 game cheat
"tf_bot_koth_sniper_spot_density" = "2"
 game cheat
 - How many sniper spots, on average, per 25x25 unit area
"tf_bot_sniper_spot_max_count" = "100"
 game cheat
 - Stop searching for sniper spots when each side has found this many
"tf_bot_show_sniper_spots"
 game cheat
 - Display the current set of sniper spots.
"tf_bot_sniper_spot_epsilon" = "10"
 game cheat
 
Last edited:

rawket

L1: Registered
Dec 11, 2009
4
1
Oh awesome, right when I started wondering how I could get a group of people to help test a map Valve comes out with bots! Thanks for the info :D