Dynamic assaults

From Valve Developer Community
Jump to: navigation, search

Setting up an assault using assault entities (ai_goal_assault, etc.) can be tedious and complicated, and the result is a rigid system which cripples much of the NPC AI. If the purpose of the assault is simply to attack natural enemies (like the player), setting up assault entities is often totally unnecessary. Here is how to set up an assault that relies only on the built in AI for teamwork:

The key to this system is that NPCs with the same squadname keyvalue will share information about enemies, and support each other. (Especially combines can share this tactical information with groups in different locations, using their radio sets.) Once a member of a squad spots an enemy, all members of that squad will be called in for backup (as long as the path to the enemy is accessible via the nodegraph), moving towards the last known position of the enemy without any need for assault_assaultpoints or assault_rallypoints. Just make sure that the nodegraph is good and valid.

Additional waves

You can control these backup waves in two ways:

The natural way is through simply placing additional groups of squad members further away on the map. These additional groups will result in wave after wave of attacks. The drawback of this system is that it will involve moving and coordinating a large amount of NPCs at once, which will cost computer resources, and that the attackers can amass a force that over time will threaten the game balance.

The other way is through spawning new NPCs using npc_makers, giving its NPCSquadname keyvalue the same name as the squad. To prevent the assault from stopping if all the spawned members are killed before the new members are spawned , you will need to create an npc_enemyfinder in the squad, to keep it alive even if all its other members die. You can also use an ai_relationship entity to keep the relationship hateful towards the player, even once the members have died.

Improving this system

You can improve the dynamic of this system in many ways, here are some suggestions:

  • The combine can use cameras, scanners and/or manhacks in order to find the player. (Just include them into the squad.) If they are not at your disposal, you can also cheat by including npc_enemyfinders into the squad. By setting their FieldOfView keyvalue to -1, they will look in all directions.
  • Make a few ways around your map, to surprise the player at every replay.