Standoffs: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (→‎Example: Updated URL)
(tweaks)
Line 1: Line 1:
When two groups of NPCs meet, they will automatically turn their energies to killing each other. But what if you don't want them to? For instance they may be required to have a shootout in the background until you can arrive on the scene to lead them on, or not cross an open area until a scripted sequence is ready to play. Or you may simply want to give an engagement more structure. Standoffs are the flexible solution to these problems.
==Purpose==
When two groups of NPCs meet, they will automatically turn their energies to killing each other. This is usually the expected behaviour, but in some situations it can act against your designs. For instance, the NPCs may be required to have a shootout in the background until the player gets close enough, or not cross an open area until a scripted sequence is ready to play. Or you may simply want to give an engagement more structure. Standoffs are the flexible solution to all of these problems.


A standoff consists of two component types:
A standoff consists of two component types:


* '''ai_goal_standoff''' (one per force)
*<code>ai_goal_standoff</code> (one per force)
* '''ai_battle_line''' (any number)
*<code>ai_battle_line</code> (any number)
 


==Structure==
==Structure==
<center>[[Image:Standoff_diagram.png]]</center>
[[Image:Standoff_diagram.png|center]]


[[NPC|NPCs]] follow the rules of engagement given them by an ai_goal_standoff. In addition, they will always stay behind any [[ai_battle_line|ai_battle_lines]] that apply to them. There is one standoff and any number of battle lines per force.
[[NPC|NPCs]] follow the rules of engagement given them by an ai_goal_standoff. In addition, they will always stay behind any [[ai_battle_line|ai_battle_lines]] that apply to them. There is one standoff and any number of battle lines per force.
----
 
===ai_goal_standoff===
==Components==
 
===<code>ai_goal_standoff</code>===
Specifies what NPCs are a part of the standoff and what special rules they should follow.
Specifies what NPCs are a part of the standoff and what special rules they should follow.


Line 31: Line 33:
* '''Activate/Deactivate:''' Force the beginning or end of the standoff. A standoff usually automatically activates when hostiles are encountered and deactivates when they are dead or out of sight for long enough.
* '''Activate/Deactivate:''' Force the beginning or end of the standoff. A standoff usually automatically activates when hostiles are encountered and deactivates when they are dead or out of sight for long enough.
* '''SetAggressiveness:''' Manipulate the '''Aggressiveness''' keyvalue.  
* '''SetAggressiveness:''' Manipulate the '''Aggressiveness''' keyvalue.  
** Accepts '''Very Low/Low/Medium/High/Very High''' or '''0-5''' where 5 is '''Very High'''.
** Accepts <code>Very Low/Low/Medium/High/Very High</code> or <code>0-5</code> where 5 equals Very High.
----
 
===ai_battle_line===
===<code>ai_battle_line</code>===
All NPCs covered by this entity will stay behind it. They may make small exceptions to round obstacles if required. The pigeon model on top of the entity signifies its direction when in-editor. Use ai_drawbattlelines to give an in-game visualisation of battle line positions.
All NPCs covered by this entity will stay behind it. They may make small exceptions to round obstacles if required. The pigeon model on top of the entity signifies its direction when in-editor. Use ai_drawbattlelines to give an in-game visualisation of battle line positions.


Line 40: Line 42:
====Keyvalues====
====Keyvalues====
* '''Actor(s) or squad to affect:''' Specify the NPCs to be involved in the standoff. Tip: have multiple squads graded by weapons for a more dynamic battle.
* '''Actor(s) or squad to affect:''' Specify the NPCs to be involved in the standoff. Tip: have multiple squads graded by weapons for a more dynamic battle.
* '''Strict:''' Can the player override this battle line with squad commands? This is a double negative: '''Yes''' means it IS strict and CAN’T be overwritten. Set to '''No''' to allow the player to order NPCs over the line.
* '''Strict:''' Can the player override this battle line with squad commands? This is a double negative: <code>Yes</code> means it '''IS''' strict and '''CANNOT''' be overwritten. Set to <code>No</code> to allow the player to order NPCs over the line.
** Note that this keyvalue will not overwrite the standoff's aggressiveness. NPCs in a standoff obey their aggressiveness as well as your commands, and sometimes they will conflict.
** Note that this keyvalue will not overwrite the standoff's aggressiveness. NPCs in a standoff obey their aggressiveness as well as your commands, and sometimes they will conflict.


Line 50: Line 52:


==Limitations and Bugs==
==Limitations and Bugs==
* Sometimes during testing, NPCs set to '''Very Low''' aggressiveness would charge out in front of the enemy entirely on their own. This may have been a map error.
* NPCs set to <code>Very Low</code> aggressiveness can sometimes charge out in front of the enemy entirely on their own. [[Nodegraph]] manipulation may present a solution.
* Commanding squads in a standoff is difficult as they do not always follow you or your orders.
* Commanding squads in a standoff is difficult as they do not always follow you or your orders.
* NPCs will go over battle lines in some circumstances, such as having hostiles in sight but not range or wanting to heal another NPC.
* NPCs will go over battle lines in some circumstances, such as having hostiles in sight but not range or wanting to heal another NPC.
Line 56: Line 58:


==Example==
==Example==
'''[http://www.steamreview.org/external/vdc/standoffs/standoff_example.zip Download Example (VMF)]'''


This example map contains two ai_goal_standoff entities and four ai_battle_line entitles: three for the rebels, one for the Combine.
This example map contains two <code>ai_goal_standoff</code> entities and four <code>ai_battle_line</code> entities: three for the rebels, one for the Combine.
   
   
* Rebels
*Rebels
** ai_goal_standoff
**ai_goal_standoff
*** '''Aggressiveness:''' Medium. The rebels will fight with a balanced strategy.
***'''Aggressiveness:''' Medium. The rebels will fight with a balanced strategy.
** 3x ai_battle_line
** 3x ai_battle_line
*** 2x battleline_platform
*** 2x battleline_platform
Line 80: Line 83:


There are two buttons near the player spawn, both labelled with their use. The left button sets how Aggressive the Combine are (toggles between VeryHigh and VeryLow), and the right button disables all ai_battle_lines.
There are two buttons near the player spawn, both labelled with their use. The left button sets how Aggressive the Combine are (toggles between VeryHigh and VeryLow), and the right button disables all ai_battle_lines.
:'''[http://www.steamreview.org/external/vdc/standoffs/standoff_example.zip Download Example (VMF)]'''


[[Category:AI]]
[[Category:AI]]
[[Category:Entities]]
[[Category:Entities]]

Revision as of 04:24, 1 August 2006

Purpose

When two groups of NPCs meet, they will automatically turn their energies to killing each other. This is usually the expected behaviour, but in some situations it can act against your designs. For instance, the NPCs may be required to have a shootout in the background until the player gets close enough, or not cross an open area until a scripted sequence is ready to play. Or you may simply want to give an engagement more structure. Standoffs are the flexible solution to all of these problems.

A standoff consists of two component types:

  • ai_goal_standoff (one per force)
  • ai_battle_line (any number)

Structure

Standoff diagram.png

NPCs follow the rules of engagement given them by an ai_goal_standoff. In addition, they will always stay behind any ai_battle_lines that apply to them. There is one standoff and any number of battle lines per force.

Components

ai_goal_standoff

Specifies what NPCs are a part of the standoff and what special rules they should follow.

Keyvalues

  • Reaction to tactical change: Defines how the AI should react if the standoff ends or changes. Changes listed include the leader moving (see Player battleline), enemies being killed, or hint group changing.
    • Move when ready (default AI): Act as normal.
    • Move when seek cover: Move when you next need to find cover.
    • Move immediately: Move to a different position straight away.
  • Aggressiveness: How aggressively should NPCs in this standoff behave?
    • A high level will make the NPCs push forward and spend more time shooting and less hiding, and other settings permitting, move forwards as far as they can.
    • A low level will make NPCs spend more time behind cover and less likely to move forwards.
    • Once an active battle line is reached, settings above Medium become redundant.
  • Player battleline: Use the player as a mobile battle line, if you are friendly towards him. This will not override any other active battle lines! Player facing has an unknown effect. If this is enabled, the player becomes the 'leader' of the standoff.
  • Stay at cover location: Once a NPC has found cover, it will stick to it until the standoff is over. This disables NPCs advancing to the battle line.
  • Abandon if enemies hide: End the standoff if there has been no recent known enemy activity in the area.

Inputs

  • Activate/Deactivate: Force the beginning or end of the standoff. A standoff usually automatically activates when hostiles are encountered and deactivates when they are dead or out of sight for long enough.
  • SetAggressiveness: Manipulate the Aggressiveness keyvalue.
    • Accepts Very Low/Low/Medium/High/Very High or 0-5 where 5 equals Very High.

ai_battle_line

All NPCs covered by this entity will stay behind it. They may make small exceptions to round obstacles if required. The pigeon model on top of the entity signifies its direction when in-editor. Use ai_drawbattlelines to give an in-game visualisation of battle line positions.

Battle lines can have some very interesting uses: you might perhaps parent them to a member of the standoff or use them in reverse, to keep the standoff moving forwards.

Keyvalues

  • Actor(s) or squad to affect: Specify the NPCs to be involved in the standoff. Tip: have multiple squads graded by weapons for a more dynamic battle.
  • Strict: Can the player override this battle line with squad commands? This is a double negative: Yes means it IS strict and CANNOT be overwritten. Set to No to allow the player to order NPCs over the line.
    • Note that this keyvalue will not overwrite the standoff's aggressiveness. NPCs in a standoff obey their aggressiveness as well as your commands, and sometimes they will conflict.

Flags

  • Use parent's orientation: If this flag is not checked and the battle line is parented to an NPC, when that NPC turns the battle line will turn with it. This is in almost all situations very undesirable.

Inputs

  • SetParentAttachment: Once a parent has been set through keyvalues, use this input to set the battle line to attach to a particular attachment point on it. This would require a truly gigantic animated prop to become useful: god knows what Valve had that needed it...

Limitations and Bugs

  • NPCs set to Very Low aggressiveness can sometimes charge out in front of the enemy entirely on their own. Nodegraph manipulation may present a solution.
  • Commanding squads in a standoff is difficult as they do not always follow you or your orders.
  • NPCs will go over battle lines in some circumstances, such as having hostiles in sight but not range or wanting to heal another NPC.
  • When choosing whether to go over a battle line, the decision is made irregardless of obstacles. This can lead to large backtracks.

Example

Download Example (VMF)

This example map contains two ai_goal_standoff entities and four ai_battle_line entities: three for the rebels, one for the Combine.

  • Rebels
    • ai_goal_standoff
      • Aggressiveness: Medium. The rebels will fight with a balanced strategy.
    • 3x ai_battle_line
      • 2x battleline_platform
        • Actor(s) or squad to affect: rebel_platform_squad. This is the one rebel standing on the platform when the map loads.
        • Strict: The rebel will not cross the battle line even if ordered to (the rebel is not commandable given this, but change that flag to see the effect yourself).
        • The two battle lines are at 90 degree angles, so that the NPC is 'boxed in' on the platform.
      • battleline_rebel
        • Actor(s) or squad to affect: rebel_*. This wildcard-matches all rebels on the map (which are named rebel_1 through to rebel_4).
        • Strict: No. The NPCs will not go over this battle line of their own accord, but will if ordered to by the player.
  • Combine
    • ai_goal_standoff
      • Aggressiveness: Very High. The Combine will move as far forwards as they can before reaching an impassable area or battle_line.
    • 1x ai_battle_line
      • battleline_combine
        • Actor(s) or squad to affect: combine_longrange.
        • The other Combine squad, combine_shortrange, does not have a battle line and you will see them (armed with shotguns) moving the whole length of the map if they need to.


There are two buttons near the player spawn, both labelled with their use. The left button sets how Aggressive the Combine are (toggles between VeryHigh and VeryLow), and the right button disables all ai_battle_lines.