Population File

From Valve Developer Community
Jump to navigation Jump to search
English (en)Translate (Translate)
Icon-callout-under-construction-blue.png
This is a draft page. It is a work in progress open to editing by anyone.
Remember to check for any notes left by the tagger at this article's talk page.

Population files are Mann Vs Machine script files for Team Fortress 2 Team Fortress 2 that handles robot spawning, robot missions, robot templates, Inputs and Outputs, etc. and is usually owned and controlled by the tf_populator entity.

These files operate under a unique Object Orientated language (those familiar with the concept will understand this better) and operates inside a sudo-JSON file format.

While you can easily make and edit these files with any text editor, if you're using Visual Studio Code you can install a community extension that focuses on population files and other TF2 related formatting, ease of development like Peaking, IntelliSense, etc.


Note.pngNote: If you cannot see the wavebar that means the map is missing it's Navigation Mesh, generate it using "nav_generate" console command
Note.pngNote: File format is ".pop"
Note.pngNote: To make developer notes via comments, type before the sentence: //

Root

Usually the first few lines of code, usually where developer comments appear on.

Imagine this as the roots of a tree that holds the foundational elements that the stump and branches use for data/information.


Popfile Formatting
//Hello World #base robot_standard.pop #base robot_giant.pop #base robot_gatebot.pop //etc... WaveSchedule { Advanced 1 AddSentryBusterWhenDamageDealtExceeds 3000 //etc... Wave { WaveSpawn { } } }


Variable Type Default Description
#Base string Inheriting from another population file's templates, etc.
  • You can have multiple in a population file


WaveSchedule

Base information and asset tree relating to Robot Templates, Populators, etc.

Imagine this as the stump of a tree that holds the branches of data for all waves.


Popfile Formatting
WaveSchedule { Advanced 1 AddSentryBusterWhenDamageDealtExceeds 3000 AddSentryBusterWhenKillCountExceeds 15 CanBotsAttackWhileInSpawnRoom No EventPopfile Halloween FixedRespawnWaveTime Yes IsEndless 1 RespawnWaveTime 10 StartingCurrency 0 Mission { Where Anywhere //etc... TFBot { Template T_TFBot_ExampleName //etc... } } Templates { T_TFBot_ExampleName { Class Demoman //etc... } } Wave { WaveSpawn { TFBot { Template T_TFBot_ExampleName //etc... } } } }


Variable Type Default Description
Advanced boolean 0 Used to mark a level as Advanced difficulty.
Confirm:May have additional functionality.
  • 1 = Yes / 0 = No
AddSentryBusterWhenDamageDealtExceeds integer 3000 Encouragement to spawn Sentry Buster(s) when any RED Sentry deals equal or more much damage.
Icon-Bug.pngBug:A RED Sentry damaging its Engineer can contribute to spawning a Sentry Buster.  [todo tested in ?]
  • tf_mvm_default_sentry_buster_damage_dealt_threshold ConVar = 3000
AddSentryBusterWhenKillCountExceeds integer 15 Encouragement to spawn Sentry Buster(s) when any RED Sentry kills equal or more then this many robots.
Icon-Bug.pngBug:A RED Sentry killing its Engineer can contribute to spawning a Sentry Buster.  [todo tested in ?]
  • tf_mvm_default_sentry_buster_kill_threshold ConVar = 15
CanBotsAttackWhileInSpawnRoom boolean No When inside a func_respawnroom will robots be able to shoot at any visible enemy?
  • Yes / No
EventPopfile string Halloween (BLU Zombies)
Confirm:May have additional functionality.
FixedRespawnWaveTime boolean No Makes respawn time a set value, doesn't change as the wave goes on, etc.
  • Yes / No
IsEndless boolean 0
Confirm:Does this do anything?
  • 1 = Yes / 0 = No
RespawnWaveTime integer 10 Base duration for RED players to respawn.
StartingCurrency integer 0 How much Currency does RED start with?


Mission

This Populator defines a set of TFBots that the tf_populator can send in to accomplish certain context-specific goals.

Popfile Formatting
WaveSchedule { Advanced 1 AddSentryBusterWhenDamageDealtExceeds 3000 AddSentryBusterWhenKillCountExceeds 15 CanBotsAttackWhileInSpawnRoom No RespawnWaveTime 10 StartingCurrency 0 Mission { Where Anywhere Objective DestroySentries CooldownTime 30 BeginAtWave 1 RunForThisManyWaves 1 DesiredCount 1 TFBot { Template T_TFBot_SentryBuster } } Mission { Where Anywhere Objective Spy CooldownTime 30 BeginAtWave 1 RunForThisManyWaves 1 DesiredCount 1 TFBot { Class Spy } } Mission { Where Anywhere Objective Spy CooldownTime 30 BeginAtWave 1 RunForThisManyWaves 1 DesiredCount 4 TFBot { Class Spy } } Mission { Where Anywhere Objective Sniper CooldownTime 30 BeginAtWave 1 RunForThisManyWaves 1 DesiredCount 2 TFBot { Class Sniper } } Mission { Where Anywhere Objective Engineer CooldownTime 30 BeginAtWave 1 RunForThisManyWaves 1 DesiredCount 4 TFBot { Class Engineer } } //etc... }
Variable Type Default Description
Where String Can use info_player_teamspawn to spawn on, or can use these descriptors like Missions: "Ahead", "Behind", "Anywhere".
Objective String What specific mission will this bot do?
  • Sniper = Bots will use their sniper rifle and snipe players.
  • Spy = Bots will cloak/disguise and attempt to backstab players.
  • Engineer = Bots will build Sentries and Teleporters to support their teammates.
  • SentryBuster = Bots will walk up to player's Sentry guns and destroy them.
CooldownTime Integer How long should this Mission wait for after the bots are dead to respawn?
BeginAtWave Integer Which Wave should this mission begin on?
RunForThisManyWaves Integer How many waves should this mission appear in before disappearing?
DesiredCount Integer How many bots should this mission spawn in?

PeriodicSpawn

An older and more limited Populator that was used for the predecessor RAID mode, this invokes its Spawner periodically. (For example a PeriodicSpawn might spawn a TFBot every 30 seconds)

Not recommended to use since it operates throughout all waves (like an uncontrollable Mission Populator) and it isn't as dynamic as TFBot Spawners, but it's functional and included here for documentation purposes.

This article or section is a stub. You can help by expanding it.

RandomPlacement

An older and more limited Populator that was used for the predecessor RAID mode, this is invoked once at the start of each round, and spawns entities at random locations throughout the map. (For example a RandomPlacement might place random Sentry guns throughout a map)

Not recommended to use since it operates throughout all waves (like an uncontrollable Mission Populator) and it isn't as dynamic as TFBot Spawners, but it's functional and included here for documentation purposes.

This article or section is a stub. You can help by expanding it.


Templates

Specified in a separate area or file, and then referenced inside WaveSpawn or TFBot entries.


Popfile Formatting
WaveSchedule { Templates { T_TFBot_ExampleName { Class Scout //etc... } T_TFBot_AnotherExampleName { Class Soldier //etc... } } }


Wave

A mission can contain multiple waves, and in theory you can have +10 waves, but try not to go overblown or pad out your missions longer then 40 minutes for typical Valve-styled missions.


Popfile Formatting
WaveSchedule { Wave { Checkpoint Yes Description "Hello World!" Sound Announcer.MVM_Get_To_Upgrade WaitWhenDone 10 DoneOutput { Target LogicEntityName Action InValue Param CaseValueName } InitWaveOutput { Target LogicEntityName Action InValue Param CaseValueName } StartWaveOutput { Target LogicEntityName Action InValue Param CaseValueName } WaveSpawn { //etc... } } }


Variable Type Default Description
Checkpoint Boolean Yes Doesn't seem to do anything, but its presence won't cause a parse error. [confirm]
Description String Doesn't seem to do anything. [confirm]

Valve entails the text would've been displayed in the HUD prior to counting down its 'WaitWhenDone' timer, and thereafter.

Sound Soundscript Listed sound that will be played when the wave starts.
WaitWhenDone Float 0.0 Specifies a delay (in seconds) to wait after the wave is completed (when all robotic foes are destroyed and the hatch hasn't been destroyed)
DoneOutput Output Triggers when the players beat a wave.
InitWaveOutput Output Triggers when resetting/transitioning to the wave.
StartWaveOutput Output Triggers when the beginning countdown reaches 0.
Spawner Branch Instantiation of a Spawner.

WaveSpawn

A WaveSpawn Populator spawns a single robot of # quantity or squads of multiple robots at a time. These work sequentially from top to bottom, and can be instructed to wait for other Populators to be finished, or for # of seconds.


Warning.pngWarning: If you make these wait for a Support Spawner to be "All Dead" or "All Spawned" this will cause the Spawner to never begin, since Support Spawners technically never end unless it's set to "Limited" mode
Warning.pngWarning: If you make the "SpawnCount" more then "MaxActive" value this will cause the Spawner to not work properly


Popfile Formatting
WaveSchedule { Advanced 1 AddSentryBusterWhenDamageDealtExceeds 3000 //etc... Wave { WaveSpawn { Name 1a_bot_wave Where spawnbot TotalCount 20 MaxActive 5 SpawnCount 1 TotalCurrency 800 TFBot { Template T_TFBot_ExampleName } } WaveSpawn { Name 1b_bot_wave WaitForAllDead 1a_bot_wave Where spawnbot TotalCount 20 MaxActive 5 SpawnCount 1 TotalCurrency 800 TFBot { Template T_TFBot_AnotherExampleName } } } }


Variable Type Default Description
DoneOutput Output Triggers when all entities associated with this WaveSpawn are dead. [confirm]
DoneWarningSound Soundscript Listed sound that will be played when all entities associated with this WaveSpawn are dead. [confirm]
FirstSpawnOutput Output Triggers when it spawns the first entity.
FirstSpawnWarningSound Soundscript Listed sound that will be played when this spawns it's first entity.
LastSpawnOutput Output Triggers when it spawns the last entity.
LastSpawnWarningSound Soundscript Listed sound that will be played when this spawns it's final entity.
MaxActive Integer 999 The maximum amount of bots that can be active in the map from this WaveSpawn.
Name string The name of this specific WaveSpawn for other WaveSpawns can refer to.
RandomSpawn boolean 0 Will this randomly spawn each entity to different locations listed?
  • You must provide multiple "Where" values for this to be functional.
StartWaveOutput Output Triggers when this Spawner activates for the first time. [confirm]
StartWaveWarningSound Soundscript Listed sound that will be played when this Spawner activates for the first time. [confirm]
SpawnCount Integer 1 How many entities to spawn in a single group.
Support boolean 1 Will this be displayed as a support group, and will it never stop spawning entities till the wave ends or if it reaches the maximum value?
  • 1 = Yes / 0 = No
  • "Limited" = TotalCount
TotalCount Integer 0 The total amount of bots that can spawn from this WaveSpawn.
TotalCurrency Integer -1 How much money do the bots in this WaveSpawn drop.
Where string Can use info_player_teamspawn to spawn on, or can use these descriptors like Missions: "Ahead", "Behind", "Anywhere".
WaitBeforeStarting float 0.0 How long will it take for another entity or group of entities to spawn.
WaitBetweenSpawns float 0.0 Once all of the bots in this referred WaveSpawn are dead, spawn in the entities in this WaveSpawn.
WaitBetweenSpawnsAfterDeath float 0.0 Once all active are dead, then the countdown occurs before spawning another group.
Note.pngNote: You can use either WaitBetweenSpawns or WaitBetweenSpawnsAfterDeath, but not both
WaitForAllDead string Once all of the bots in this referred WaveSpawn are dead, spawn in the entities in this WaveSpawn.
WaitForAllSpawned string Once all of the bots in this referred WaveSpawn have spawned, spawn in the entities in this WaveSpawn.
Spawner Branch Instantiation of a Spawner.

Spawners

Branches that contain information to use when spawning an entity, it's attributes, etc.

Mob

An older and more limited Spawner that was used for the predecessor RAID mode.

Not recommended to use as it doesn't display properly on the Wave Panel and isn't as dynamic as TFBot Spawners, but it's functional and included here for documentation purposes.


Popfile Formatting
WaveSchedule { Advanced 1 AddSentryBusterWhenDamageDealtExceeds 3000 //etc... Wave { WaveSpawn { Mob { Count 3 TFBot { Class Demoman Skill Expert //etc... } } } } }


Variable Type Default Description
Count integer 0 How many robots does this spawn?
Spawner Branch Instantiation of a Spawner.

RandomChoice

Contains a set of Spawners and invokes one at random.

This article or section is a stub. You can help by expanding it.

SentryGun

An older Spawner that was used for the predecessor RAID mode.

Spawns an unowned RED Sentry Gun at a specified upgrade level.


Popfile Formatting
WaveSchedule { Wave { WaveSpawn { Where SpawnpointName TotalCount 5 SpawnCount 2 MaxActive 4 //etc... SentryGun { Level 3 } } } }


Variable Type Default Description
Level integer 0
  • 1 = level 1
  • 2 = level 2
  • 3 = level 3

Tank

An unstoppable bomb carrier that uses similar movement and spawning like func_tracktrains, as they use path_track entities to move throughout the map and can use branching paths and invoke path related I/Os.

When the Tank reaches the end of the track, it will start deploying the bomb for roughly 8 seconds, giving players another chance to destroy it at the last minute!

Warning.pngWarning: It cannot teleport to track points.
Icon-Bug.pngBug:If there are no path_tracks present in the map, the game will crash.


Popfile Formatting
WaveSchedule { Wave { WaveSpawn { //Do not use "Where" KeyValue TotalCount 5 SpawnCount 2 MaxActive 4 //etc... Tank { Health 50000 Name "Tank Name" OnBombDroppedOutput { Target LogicEntity_Name Action InValue Param CaseValueName } OnKilledOutput { Target LogicEntity_Name Action InValue Param CaseValueName } Skin 1 Speed 75.0 StartingPathTrackNode PathTrack_Name } } } }


Variable Type Default Description
Health integer 50000 Maximum health it spawns with.
Name string Unused, was most likely used for Deathcams at some point. [confirm]
OnBombDroppedOutput Output When the deploy animation is complete.
OnKilledOutput Output When health drops to 0%.
Skin integer 0 What the tank looks like using defined indexes from the model file?
Speed float 75.0 How fast does the Tank move?
Note.pngNote: Rotation isn't as fast, so higher values may look less immersive.
StartingPathTrackNode string Where it will spawn and start its journey?

TFBot

A robotic mercenary, reusing one of the 9 playable class' functionalities.

This article or section is a stub. You can help by expanding it.


External Links