Assault: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Added example map and further details)
Line 40: Line 40:
'''It is important to remember that assaultpoints affect the journey ''to'' them, not ''from'' them.'''
'''It is important to remember that assaultpoints affect the journey ''to'' them, not ''from'' them.'''


* '''Assault Hint Group:''' Constrains NPCs in the assault to this [[hint]] group.
* '''Assault Hint Group:''' Constrain NPCs in the assault to this [[hint]] group.
* '''Assault time out:''' How long to wait after eliminating all hostiles in this area before moving on.
* '''Assault time out:''' How long to wait with no activity at this assaultpoint before moving on.
* '''Clear on contact with enemies:''' If the assault meets enemies on it’s way to this point, it will consider it cleared and target the next point in the chain. Only really useful in non-linear assaults.
* '''Clear on contact with enemies:''' If the assault meets enemies on it’s way to this point, it will consider it cleared and target the next point in the chain.
* '''Allow diversion:''' If the assault comes into contact with hostiles on the way to the point, divert to kill them and resume once the area appears clear.
* '''Allow diversion:''' If the assault comes into contact with hostiles on the way to the point, divert to kill them and resume once the area appears clear.
**If it set to '''Yes''' NPCs will chase any hostiles until they are dead or out of sight for the period set in '''Assault time out'''.
**If it set to '''Yes''' NPCs will chase any hostiles until they are dead or out of sight for the period set in '''Assault time out'''.
**If this is set to '''No''' assaulting NPCs will run non-stop to the next point, attacking enemies they can see but not chasing them.  
**If this is set to '''No''' assaulting NPCs will run non-stop to the next point, attacking enemies they can see but not chasing them.  
* '''Never Timeout:''' Force NPCs to try and reach this point forever, with no exceptions.
* '''Never Timeout:''' Force NPCs to try and reach this point forever, with no timeouts.





Revision as of 13:44, 29 June 2005

An assault consists of four component types:

  • ai_goal_assault
  • assault_rallypoint
  • assault_assaultpoint
  • info_nodes for pathfinding

Its purpose is to coordinate a group of NPCs to follow a designed route. In this regard it is quite similar to path_corner: the differences revolve around assaults being designed for combat situations.

An assault is also far more flexible. An assault can have multiple paths that are chosen by the AI based on their surroundings and hints from the mapper. An assault can be suspended (e.g. to clear a room not directly on the chain) and resumed, again dynamically but with design-time influences. You can order an assault to pause until another event has occurred with far more precision than previous systems. This article will detail how to use them, but please be aware that AI was previously undocumented so mistakes are inevitable.

Structure

Assault diagram.png

NPCs follow the structure of rally and assault points they are attached to by an AI goal.

ai_goal_assault

This entity specifies what NPCs are to carry out the assault and triggers it when any conditions given are met.

  • Actor(s) to affect: Enter the name of the actors that will perform the assault. This field supports wildcards, should they be needed.
  • Rally Point Set: The name of the assault_rallypoint at which this assault will begin. This field can also support wildcards, which will be matched with the wildcards in Actor(s) to affect. This means that rebel_1 will go to rally_1, rebel_2 to rally_2, and so on.
  • Search Type: It is also possible to specify classes. If your NPCs do not have names, or you want all NPCs of a certain type to join the assault, you can set this to 'Classname' and make the appropriate changes to Actor(s) to affect.
  • Assault Cue: The goal can be set immediately after being activated, after it has received an input through the I/O system, or when the entity 'hears' gunfire depending on the setting here.

assault_rallypoint

All assaults begin at a rallypoint. Specific differences are currently unknown.

  • Assault Point: The first assault_assaultpoint in the chain.
  • Assault Delay: The amount of time to wait here once the assault has begun before moving to the first assault_assaultpoint.
  • Rally Sequence: Set a specific animation sequence for NPCs waiting to begin the assault.
  • Priority: If an NPC is faced with multiple assault_rallypoints, it will choose the best from it’s knowledge or take the one with the highest priority.

assault_assaultpoint

The body of an assault chain. Specifies where the assault should go once it has begun. There can be any number of assault_assaultpoints in each chain and they do not need to be linked in a row. An assaultpoint can link to a rallypoint and move the assault on to a new chain.

It is important to remember that assaultpoints affect the journey to them, not from them.

  • Assault Hint Group: Constrain NPCs in the assault to this hint group.
  • Assault time out: How long to wait with no activity at this assaultpoint before moving on.
  • Clear on contact with enemies: If the assault meets enemies on it’s way to this point, it will consider it cleared and target the next point in the chain.
  • Allow diversion: If the assault comes into contact with hostiles on the way to the point, divert to kill them and resume once the area appears clear.
    • If it set to Yes NPCs will chase any hostiles until they are dead or out of sight for the period set in Assault time out.
    • If this is set to No assaulting NPCs will run non-stop to the next point, attacking enemies they can see but not chasing them.
  • Never Timeout: Force NPCs to try and reach this point forever, with no timeouts.


  • Flag: Clear this point on arrival, UNCONDITIONALLY: Move on to the next point once reaching this one regardless of any other influences.

Limitations and bugs

  • When moving to an assaultpoint, all assaulting NPCs will wait for any others before continuing. If there is only one NPC it will go to the standing posture for a moment before continuing, which looks unnatural.
  • NPCs will always arrive at a rally or assault point and turn to face in the direction the entity is set to. This is again unnatural in most cases.
  • NPCs must stand on or near an assaultpoint to clear it if Clear on contact with enemies is not set and triggered. This can result in illogical backtracking.
  • If enemies are in view of an assaultpoint, they will be seen just before the point is reached and probably calculated using the wrong (previous) settings. To avoid this, try to ensure assaultpoints are always in 'safe' areas.

Example

This example map contains a single NPC on a linear chain using all the major options available to designers when moving NPCs from assaultpoint to assaultpoint. There are four points, and each is configured differently:

  1. Clear on contact with enemies is enabled. When the NPC sees the hostiles, it clears out the assaultpoint and continues to 2.
  2. Clear this point on arrival, UNCONDITIONALLY is flagged. When the NPC reaches this point it clears it regardless of the fact that there are still hostiles in sight and begins to move towards 3.
  3. Allow diversion is set to No. The NPC will charge towards the assaultpoint ignoring anything else, in this case a hostile that it will instead shoot while moving.
  4. Allow diversion is set to Yes. The NPC will divert from moving to this point until there are no hostiles visible.

Note that the Metropolice cannot harm the NPC and will not attack you in this example.

Example (VMF)

Conclusion

Assaults are extremely powerful, flexible tools which in conjunction with other AI controllers can create believable strategic behaviour of infinite complexity.