User:Orinuse/sandbox/tf bot: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(-)
Tag: Blanking
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{split-apart}}
{{cleanup|The information in Entity Description is completely unorganized and in dire need of restructuring.}}


'''This is an user page.'''<br>
{{tf2 point|tf_bot}}
{{code class|CTFBot|tf_bot.cpp}}
==Entity Description==
A {{ent|NextBot}} entity for TF2 that acts as a player. They are used for bots in [[Team Fortress 2]], which are mainly used in the Training and [https://wiki.teamfortress.com/wiki/Mann_vs._Machine Mann Vs. Machine] gamemodes, and are created automatically by the game when creating a listenserver through the training option. This entity can be created through {{ent|tf_bot_add}}, which when used will randomly select a bot name out of a hardcoded list of bot names.
{{note|This entity cannot use Teleporters and Dispensers in MvM.}}
{{bug|Creating the entity through {{ent|ent_create}} ''will'' crash the game.}}
{{bug|This entity will not move in Capture The Flag (and by proxy MvM) if there is no flag for that entity's team.}}
===Skill / Difficulty===
Bots behave based on the skill value (or difficulty) they have, which can be set through {{ent|tf_bot_difficulty}} or with {{ent|tf_bot_add}}. Skills are defined in game as follows:
* Easy (0)
* Normal (1)
* Hard (2)
* Expert (3)
{{todo|Summarize behaviors based on skill value.}}
===General===
Bots may change classes in spawn if {{ent|tf_bot_reevaluate_class_in_spawnroom}} is set, and will change classes upon death if {{ent|tf_bot_keep_class_after_death}} is set.
====Scout====
{|class="wikitable grid"
|+style="color:#aaa; border: 1px solid #525252; border-bottom-width: 0px;" | Info
|-
| Preferred Weapon
| Primary
|-
| Threat Value
| 0.6
|-
| Medic Bot Priority
| None
|}
====Soldier====
{|class="wikitable"
|+style="color:#aaa; border: 1px solid #525252; border-bottom-width: 0px;" | Info
|-
| Preferred Weapon
| Primary
|-
| Threat Value
| 0.8
|-
| Medic Bot Priority
| 2nd
|}
Soldier bots prefer their primary weapon in combat, but will switch to their secondary if they are out of primary weapon ammo and the threat is closer than 500hu.
====Pyro====
{|class="wikitable"
|+style="color:#aaa; border: 1px solid #525252; border-bottom-width: 0px;" | Info
|-
| Preferred Weapon
| Primary
|-
| Threat Value
| 1
|-
| Medic Bot Priority
| 3rd
|}
Pyro bots are normally offensive and will attack enemies with their primary weapon. However if the enemy is further than 750hu, the bot Pyro will equip its secondary weapon.
They airblast enemies that are closer than {{ent|tf_bot_pyro_shove_away_range}} hammer units to the bot pyro, and projectiles if they are visible to the pyro bot and are within {{ent|tf_bot_pyro_deflect_tolerance}} angles (in radians) relative to the Pyro bot's FOV. The chance that they will airblast a projectile depends on their skill level.
{| class="wikitable"
! Skill Level
! Chance to Airblast
|-
|Easy
|0% chance
|-
|Normal
|50% chance
|-
|Hard
|90% chance
|-
|Expert
|100% chance
|}
====Demoman====
{|class="wikitable"
|+style="color:#aaa; border: 1px solid #525252; border-bottom-width: 0px;" | Info
|-
| Preferred Weapon
| Primary and Secondary
|-
| Threat Value
| 0.6
|-
| Medic Bot Priority
| 4th
|}
Demoman bots fire their primary weapon in an arc. The angle they fire grenades is {{ent|tf_bot_ballistic_elevation_rate}} * the distance to the target (as a normalized vector); they will not fire with their primary above 45° or 0.79π.
When they encounter Sentries, Demoman bots prefer their secondary over their primary and stack stickybombs on the Sentry to then detonate them.
They will sometimes set up sticky-bomb traps on nav areas where they predict the enemy will pass through. The amount of stickybombs they place is
  {{ent|tf_bot_stickybomb_density}} * the area of the target nav area
which will always be ≥1. Demoman bots will stop setting up their trap if an enemy is less than 500hu away.
====Heavy====
{|class="wikitable"
|+style="color:#aaa; border: 1px solid #525252; border-bottom-width: 0px;" | Info
|-
| Preferred Weapon
| Primary
|-
| Threat Value
| 0.8
|-
| Medic Bot Priority
| 1st
|}
Heavy bots prefer to use their primary weapon when in combat. They will "rev" (hold right click) for at least three seconds if they see an enemy.
They are the most preferred patient to be healed by Medic bots, out of the other classes.
====Engineer====
{|class="wikitable"
|+style="color:#aaa; border: 1px solid #525252; border-bottom-width: 0px;" | Info
|-
| Preferred Weapon
| Melee and Primary (for combat)
|-
| Threat Value
| 0.4
|-
| Medic Bot Priority
| None
|}
Engineer bots focus on building near sentry spots ({{ent|func_tfbot_hint}}s with hint KV set to 1). Engineer bots normally just stay around their sentry and constantly hit it with their wrench. If the engineer bot get attacked however, they will attack with their weapon and flee.
{{note|Engineer bots will not switch to another class if their Sentry or Teleporter Exit is up, regardless if {{ent|tf_bot_reevaluate_class_in_spawnroom}} or {{ent|tf_bot_keep_class_after_death}} is set.}}
In Mann Vs. Machine Engineer bots will not attack, unless if they're marked as a squad. They can only build Sentry Guns and Teleporters, and they build around groups of {{ent|bot_hint_engineer_nest}}s, {{ent|bot_hint_sentrygun}}s, and {{ent|bot_hint_teleporter_exit}}s, rather than {{ent|func_tfbot_hint}}'s.
=====Teleporters=====
Non-Medic bots will normally prefer to take active teleporters over walking to the destination, but they will only take them when their incursion distance is less than <code>350hu + the teleporter area's nav mesh</code>. However Medic bots will only take the teleporter if it's patient also goes through the teleporter; otherwise they ignore them.
====Medic====
{|class="wikitable"
|+style="color:#aaa; border: 1px solid #525252; border-bottom-width: 0px;" | Info
|-
| Preferred Weapon
| Secondary
|-
| Threat Value
| 0.2
|-
| Medic Bot Priority
| None
|}
Medic bots passively heal patients that are in their current viscinity, and will follow their patient when they are between {{ent|tf_bot_medic_stop_follow_range}} and {{ent|tf_bot_medic_start_follow_range}} from them. They will respond to call for medic from ''human players'' that are within {{ent|tf_bot_medic_max_call_response_range}} units from the medic bots.
They prefer to heal ally heavies, soldiers, pyros, and demomen over the other classes. If the medic bot is in a squad, they will only heal the squad leader. In the training gamemode, medic bots will always stay on the human player.
If Medic bots have the vaccinator equipped, they will use their über when they or their patient have taken damage. Otherwise medic bots will use their über when:
* The patient's health ratio is less than 0.5.
* The patient is not already übered.
* The medic bot's health is less than 25, 50, or <code>bot_medic_uber_health_threshold</code> attribute.
{{bug|Due to an oversight where <code>CTFBotMedicHeal::IsGoodUberTarget( CTFPlayer who* )</code> always returns false, non-übered medic bots will not stick to their current patient regardless if they have über ready.{{confirm|Does this still happen in game?}}}}
In MvM medic bots will not attack, unless if marked to be part of a squad in the popfile.
====Sniper====
{|class="wikitable"
|+style="color:#aaa; border: 1px solid #525252; border-bottom-width: 0px;" | Info
|-
| Preferred Weapon
| Primary
|-
| Threat Value
| 0.4
|-
| Medic Bot Priority
| None
|}
Sniper bots typically look around for up to {{ent|tf_bot_sniper_spot_max_count}} Sniper Spots ({{ent|func_tfbot_hint}}s with hint KV set to 0){{confirm}} (or the Vantage point) that are atleast {{ent|tf_bot_sniper_spot_epsilon}} units away from adjacent sniper spots and attack from those areas. They search for {{ent|tf_bot_sniper_spot_search_count}} sniper spots per update frame. However if an enemy gets close to them, the Sniper bot will fight them and then try to retreat to their goal. If the threat is closer than 750hu, then Sniper bots will use their secondary weapon.
When aiming through their primary, Sniper bots choose a target part to hit based on their skill level and take 0.5 to 1.5 seconds to adjust their aim. Expert and Hard bots will aim for the head, normal bots will aim between the head and body, and easy bots will just aim for the body. If Sniper bots have the Huntsman equipped, then they will fire in an arc effected by {{ent|tf_bot_arrow_elevation_rate}}, and aim for the same body parts.
{{todo|Explain error angle and radius.}}
Sniper bots will stay {{ent|tf_bot_sniper_spot_point_tolerance}} units away from an enemy capture point, while they'll stay within this range in an ally capture point.
====Spy====
{|class="wikitable"
|+style="color:#aaa; border: 1px solid #525252; border-bottom-width: 0px;" | Info
|-
| Preferred Weapon
| Primary and Melee
|-
| Threat Value
| 0.6
|-
| Medic Bot Priority
| None
|}
Spy bots typically lurk around hiding spots{{confirm}}. They prefer to use their melee weapon if the target is closer than {{ent|tf_bot_spy_knife_range}} units to the spy. If their target is further than {{ent|tf_bot_spy_change_target_range_threshold}} units away, Spy bots will choose another target that is closer than that distance.
They are suspected by enemies if they collide with an enemy for more than {{ent|tf_bot_suspect_spy_touch_interval}} seconds.
===Combat===
If they kill a victim, a bot has {{ent|tf_bot_taunt_victim_chance}} chance to perform a taunt.
Bots will stay in combat until:
* They have less than 20% max ammo left.
* They need to do a full reload and they are Hard or Expert bots.
* Their friend score is lower than the foe score.
* Their health percentage is lower than {{ent|tf_bot_health_critical_ratio}}.
Bots will search for health kits and [[obj_dispenser|dispensers]] when their health is lower than {{ent|tf_bot_health_ok_ratio}} or they are on fire, they are not in combat, and a healer is not healing them already. The range that bots will hunt for health in is
    searchRange = {{ent|tf_bot_health_search_far_range}} + (current health / max health) * ({{ent|tf_bot_health_search_near_range}} - {{ent|tf_bot_health_search_far_range}} );
Bots won't try to get health in the Mann Vs. Machine gamemode.
====Threat Level====
{{confirm|Does this mechanic still exist?}}
Threat levels are scores used to determine how dangerous something is. This value is between 0 (no danger) and 1 (immediate danger). The following actions give a certain threat level:
{|class="wikitable"
! Threat
! Value
|-
| Enemy (Class)
| Varied
|-
| Übered enemies
| 1
|-
| Level 3 Sentry
| 1
|-
| Level 2 Sentry
| 0.8
|-
| Level 1 Sentry
| 0.6
|-
| Enemies further than {{ent|tf_bot_sniper_personal_space_range}} units from a Sniper
| 0
|}
Typically the threat level is stored in two variables: the friend score and the foe score. These scores are determined through accumulating the threat level of every visible known ally and enemy respectively. Bots will try to retreat if the friend score is lower than the foe score.
===Bot Names===
The following bot names are what the game uses to randomly set a bot name when creating a bot.
{{ExpandBox|
* Chucklenuts
* CryBaby
* WITCH
* ThatGuy
* Still Alive
* Hat-Wearing MAN
* Me
* Numnutz
* H@XX0RZ
* The G-Man
* Chell
* The Combine
* Totally Not A Bot
* Pow!
* Zepheniah Mann
* THEM
* LOS LOS LOS
* 10001011101
* DeadHead
* ZAWMBEEZ
* MindlessElectrons
* TAAAAANK!
* The Freeman
* Black Mesa
* Soulless
* CEDA
* BeepBeepBoop
* NotMe
* CreditToTeam
* BoomerBile
* Someone Else
* Mann Co.
* Dog
* Kaboom!
* AmNot
* 0xDEADBEEF
* HI THERE
* SomeDude
* GLaDOS
* Hostage
* Headful of Eyeballs
* CrySomeMore
* Aperture Science Prototype XR7
* Humans Are Weak
* AimBot
* C++
* GutsAndGlory!
* Nobody
* Saxton Halenav_gen_cliffs_approx
* RageQuit
* Screamin' Eagles
* Ze Ubermensch
* Maggot
* CRITRAWKETS
* Herr Doktor
* Gentlemanne of Leisure
* Companion Cube
* Target Practice
* One-Man Cheeseburger Apocalypse
* Crowbar
* Delicious Cake
* IvanTheSpaceBiker
* I LIVE!
* Cannon Fodder
* trigger_hurt
* Nom Nom Nom
* Divide by Zero
* GENTLE MANNE of LEISURE
* MoreGun
* Tiny Baby Man
* Big Mean Muther Hubbard
* Force of Nature
* Crazed Gunman
* Grim Bloody Fable
* Poopy Joe
* A Professional With Standards
* Freakin' Unbelievable
* SMELLY UNFORTUNATE
* The Administrator
* Mentlegen
* Archimedes!
* Ribs Grow Back
* It's Filthy in There!
* Mega Baboon
* Kill Me
* Glorified Toaster with Legs}}
====Unused Bot Names====
The following bot names were found in a leaked source code version of TF2, containing bot names that were never put into production for unknown reasons.
{{ExpandBox|
* John Spartan
* Leeloo Dallas Multipass
* Sho'nuff
* Bruce Leroy
* CAN YOUUUUUUUUU DIG IT?!?!?!?!
* Big Gulp, Huh?
* Stupid Hot Dog
* I'm your huckleberry
* The Crocketeer}}
==Keyvalues==
{{KV TeamNum|tf2=1}}
{{KV BaseAnimating|base=1}}
{{KV BaseEntity|base=1}}
==Inputs==
{{IO|IgnitePlayer|param=integer|{{tf2}} Ignites the entity with a specified lifetime and causes a reaction (sound and speech).}}
{{IO|ExtinguishPlayer|{{tf2}} Extinguishes the entity.}}
{{IO|BleedPlayer|param=integer|{{tf2}} Bleeds the entity with a specified length.}}
{{IO|RollRareSpell|{{tf2}} Forces the entity to roll a rare spell. Only available if spells are enabled on the map.}}
{{IO|SetCustomModel|param=string|{{tf2}} Set a custom entity model ''without'' animations.}}
{{IO|SetCustomModelOffset|param=vector|{{tf2}} Set a custom model position on the entity.}}
{{IO|SetCustomModelRotation|param=vector|{{tf2}} Set a custom model rotation on the entity.}}
{{IO|ClearCustomModelRotation|{{tf2}} Clears the custom model rotation.}}
{{IO|SetCustomModelRotates|param=boolean|{{tf2}} Set if the custom model rotates or not to the entity's angles.}}
{{IO|SetCustomModelVisibleToSelf|param=boolean|{{tf2}} Set if the custom model is visible to the entity, in thirdperson.}}
{{IO|SetForcedTauntCam|param=boolean|{{tf2}} Forces the player into thirdperson mode.}}
{{IO|SpeakResponseConcept|param=string|{{tf2}} Forces the player to speak the specified response concept, an example being <code>halloweenlongfall</code>.}}
{{IO|TriggerLootIslandAchievement|{{tf2}} {{todo}}.}}
{{IO|TriggerLootIslandAchievement2|{{tf2}} {{todo}}.}}
{{IO|RoundSpawn|{{tf2}} {{todo}}.}}
{{I TFTeam}}
{{I BaseCombatCharacter}}
{{I BaseAnimating}}
{{I BaseEntity}}
==Outputs==
{{O BaseAnimating}}
{{O BaseEntity}}
==See Also==
* [https://steamcommunity.com/sharedfiles/filedetails/?id=572409016 'TFBot skill levels explained in excruciating detail' - By Sigsegv]<br>
* [https://steamcommunity.com/sharedfiles/filedetails/?id=1911160067 'MvM - Advanced Popfile Techniques' - By Mince and 8 other collaborators]

Latest revision as of 15:16, 2 July 2024