Parallel

A Parallel Operator (beOpParallel) is used to process several Behaviors in the same time. This operator handles children behaviors (added by drag'n drop on the Parallel Operator), but it can only contain Behavior Containers and built-in Behaviors (not Behavior Operators).

    
    
An empty Parallel Operator
A Parallel Operator containing two Behaviors

When the Parallel operator is evaluated, it first starts all the children Behaviors and then keeps running until all or one of the children have stopped (according to a given exit mode).

Creation

  • Behavior Editor / Behavior Library: 
  • Behavior Editor Workspace: drag and drop a Behavior Container or a built-in Behavior on another built-in behavior
    Parallel Operator automatic creation using Behaviors drag'n drop
     
  • Golaem Menu: Crowd Behaviors / Operators / CrowdBeOp Parallel Node
  • MEL command: glmCrowdBeOpParallelCmd;

Configuration

Parallel Attributes

Parallel Attributes of a Parallel Operator
Exit Mode

Define the mode to use to stop the Parallel Operator, based on the state of its children Behaviors:

  • When all behaviors have ended (default value): Wait for ALL children behaviors to stop before stopping itself.
  • As soon as one behavior has ended: Stop when any one of the children Behavior stops. The children Behaviors that are still running are forced to stop, then the Parallel Operator stops itself.
  • When a specific behavior has ended: Stop when a chosen child Behavior stops, select the Behavior in the next combo box. The children Behaviors that are still running are forced to stop, then the Parallel Operator stops itself.
Exit Behavior Select the Behavior used to stop the Parallel Operator. This attribute is only available with the "When a specific behavior has ended" exit mode.

Container Attributes

Container Attributes of a Parallel Operator
Children List the Behaviors contained in the Parallel Operator. This attribute is read-only and can not be edited (use the Behavior Editor workspace to add or remove Behaviors in a Parallel Operator).

Example

The following example describes a Parallel Operator used to animate an Entity by playing a Walk animation (using a Motion Behavior) and looking at its feet (using a LookAt Behavior) in the same time, then playing an "Idle" animation (also using a Motion Behavior). Considering that the "Walk" Behavior stops after a given a duration and the "LookAtFeet" Behavior has no Stop Trigger, it is necessary to set the "As soon as one behavior has ended"exit mode of the Parallel Operator in order to run the "Idle" Behavior; otherwise, if using the "When all behaviors have ended" exit mode, the LookAtFeet Behavior will keep running and the "Idle" Behavior will never start (so the entity will be looking at his feet without playing any animation).

A Parallel Operator used to animate an entity with a Walk motion while looking at its feet in the same time (then playing an Idle animation)

To keep the entity looking at his feet wile playing Walk then Idle animations, it is necessary to run the LookAtFeet Behavior in parallel with a Behavior Container which handles both Walk and Idle animations.

A Parallel Operator used to animate an entity with a Behavior Container handling animation while looking at its feet in the same time
 
The Behavior Container playing the Walk and Idle motions
 

Ordering Inside Parallel

The parallel children ordering is done via an attribute on each behavior, giving the priority of each of them. A higher priority means that the behavior will be higher in the parallel and evaluated sooner. By default, each behavior is affected a rank at creation time, based on an automatic growing counter held by the manager node. Thus the nodes created late will appear at the bottom of parallel and will be executed later. The reordering can ONLY be done by modifying the behaviors priority (graphically moving behaviors in parallel will only re-drop the behavior at the same location).

Each behavior & container has a "Priority Attributes" section, with an execution priority attribute, used to order parallel behaviors