Implementation

From Valve Developer Community
Jump to: navigation, search
English (en)日本語 (ja)Translate (Translate)


Implementing choreography in your target game can be either very simple or very complex, depending on your approach. By number most scenes are performed during AI Routines, but lengthy set-piece choreography is typically triggered through map I/O and entities. This page intends to help you choose an appropriate method, and introduce you to the other options you might wish to consider for your future scenes.

Set-piece scenes

Main article:  logic_choreographed_scene
Hammer's logic_choreographed_scene icon

Set-piece scenes are those that occur at a predetermined time and/or location, and that usually see the greatest bulk of choreographical development effort. They are best deployed with the logic_choreographed_scene map entity. An LCS is created and configured by the mapper and exists entirely within the I/O system, allowing precise control over when and where its associated scene is performed. The LCS entity is also the only way to perform scenes that rely on the generic !target<n> Actor names and the Fire Completion and/or Fire Trigger events.

Furthermore, an LCS automatically captures all of the Actors your scene requires and can be configured to only play if the involved actors are not busy performing other actions.

Lastly, using an LCS gives you the unique option of manually pausing, resuming or cancelling a scene through the pause, resume and cancel entity inputs. You can perform each input operation, including the initialising start, as many times as is necessary.

logic_scene_list_manager

Main article:  logic_scene_list_manager
Hammer's logic_scene_list_manager icon

logic_scene_list_manager contains a list of logic_choreographed_scene entities. When one is played, all preceding scenes in the LCLM stack are removed; and when the shutdown input is given, the LCLM and all of the scenes referenced within are removed at once.

This allows scene progressions that would ordinarily have to be hard-coded into the Response system to be created on a per-map basis, without extensive logic branches and their inherent potential for bugs. For instance, an Actor might be needed to respond to dynamic player actions in a certain way, but only until a certain event occurs. By triggering the LSLM's shutdown input the old and unwanted scenes can be removed in a single, internal operation.

A chronological chain of dynamic scenes can also be easily set up with the system, simply by listing the LCS entities in the LSLM.

Dynamic scenes

Main article:  Response System

Dynamic scenes are typically quite short, and are generally used as part of Source's Response System to simulate the reaction of NPCs to their surroundings. While the decision to make the response is driven by the AI, the visible effects are composed entirely of choreography, from a medic running to another fighter and delivering a medkit to Alyx smiling at a player who has pressed the interact key over her, right down to the extremely simple, speech-only scenes played by rebels when joining the player's squad.

Dynamic scenes are limited to a single actor. If you try to play a multi-actor scene dynamically, the same NPC will attempt to play all of the parts at once! They also cannot be used for scenes dependent on !target<n>, Fire Completion or Fire Trigger, as these features require links to the I/O system.

See the Response System article for more information.

setexpressionoverride

Map designers have limited control over dynamic scenes with the setexpressionoverride NPC input. Despite the apparent usefulness of this bridge between static and dynamic however, extreme caution should be exercised when using it. As well as the standard limitations of dynamic scenes:

  • The NPC's AI system will not recognise that it is playing a scene and stands a high chance of carrying out other, conflicting actions on top of it.
  • The scene will loop endlessly until a new one is specified (specify an invalid VCD to stop the actor performing). TODO: can Actors override this setting on their own?

setexpressionoverride should only ever be used for what its name suggests–overriding an NPC's underlying facial expression–and even then, the response system remains a more suitable channel.

The VCD you want the actor to perform (Expressions cannot be directly referenced) is passed on as an input parameter consisting of the file's full path relative to the root game directory including file extension (e.g. ent_fire alyx setexpressionoverride scenes/npc/alyx/al_combat_angry01.vcd).