Parallel Tasks
Tasks cannot only be executed sequentially but also in parallel if they, e.g., affect different regions of the agent's body. This means that an agent can, e.g., walk while waving its hand at the same time. To realize this, the Virtual Agents Framework provides a parallel tasks structure where tasks can be scheduled independently but also be synchronized using dependencies between tasks.
Parallel Structure
The agent consists of a series of task managers which determine which task to execute next.
By calling Schedule
- Left Arm
- Right Arm
- Left Leg
- Right Leg
- Head
When applying parallel tasks, the main use case is to layer animations. It is recommended to always assign an animation task to the base layer and then overwrite a specific body region with a custom animation. In the example of the walking agent which is waving its hand, the walking animation would be set up as a task on the base layer. The waving animation is scheduled as a task on one of the two arm regions. As a result, the agent displays the full walking movements and only its arm is concerned with the waving motion.
Synchronizing Task Layers
In some cases, tasks need to wait for each other to start synchronously.
In more complex tasks, this can be achieved by implementing a start condition on the tasks using the Can
Apart from this general purpose start-condition, the Agenta
depends on the completion of task b
and both inherit from Agenta.WaitFor(b)
.
Internally, Waita
.
The Cana
will only become true
, once b
has finished its execution, indicated by its Is
If task a
depends on multiple tasks b
and c
, they can quickly be defined in Waita.WaitFor(b, c)
.
Example Scenes
The framework contains two example scenes for parallel tasks: One of them demonstrates the independent execution of parallel tasks. Here, the agent is assigned a series of walking tasks on its base layer and a combination of waiting and waving tasks on its left arm layer, as well as a head-shaking animation for the head. The tasks are just executed but do not contain any synchronization. In contract to this, the synchronization sample contains the same task sequence but here, the second waving animation will wait for the head shaking animation to complete. Both samples contain a TasksSampleController which demonstrates how to schedule the tasks and how to set the dependencies.