Skip to content
Arthur Casals edited this page Aug 14, 2019 · 7 revisions

Here you can find some information about Groups, and how they are used in conjunction with Behaviors. In order to understand Groups, however, it is important to consider (i) how collective behaviors can be manifested and (ii) what are scenarios where groups can be used with behaviors. It is important that you have a basic comprehension of how the behavior system works (especially the concept of behavior trees and associated states); if you didn't do it yet, please see this link.

Coordinated behaviors

There are different ways to look at collective behaviors, but in a general manner, we can classify it from the coordination perspective. Collective (group_) behavior can be either actively coordinated, or it can emerge from the actions of its members. As an illustration, we can consider the difference between group movement patterns: flocking is something that can emerge from the individual behaviors of each of the group members, driven by the necessity of being close enough of their neighbors or moving towards the same direction they are moving. Emerging behavior can be active or passive, depending on the interaction between the group members. Flocking does not require any form of interaction between the creatures: each group member perceives its neighbors and takes the appropriate action (getting closer or further). This can be seen as passive emergent behavior. An example of active emergent behavior would be a stock market operated by multiple entities: while each entity has its own set of goals and can make their own decisions (coordinated or not), the market behavior emerges without any coordination, as a result of the decisions taken by the entities.

Active coordination can be centralized or decentralized. Following a leader is an example of centralized coordination since the decision process is held by a single entity. This entity can be a part of the group (the alpha wolf in a wolf pack) or it can be an external entity, not taking part in the actions resulting from the decision process (a general can order the dislocation of troops without having to leave the HQ). Decentralized decision processes, on the other hand, take into account multiple group members - there is not a central coordinator role. If all members of a group vote on their destination (considering an entirely democratic process), the destination selection can be seen as a decentralized coordination mechanism.

From the game perspective - and taking this dimension into consideration - ideally, we want to be able to implement:

  • Passive emergent group behavior (mainly for movement)
  • Decentralized coordination
  • Centralized coordination, considering a member of the group
  • Centralized coordination, considering a member external to the group

Scenarios

Let us consider three different scenarios where an entity joins a group:

  • Scenario 1: Entities that join a group receive the same behavior mechanism, regardless of state. This can be illustrated by a situation where an NPC joins a group and just sits idly. In this case, there's no need for it to be coordinated with the other group members - it's enough that they are behaving similarly. That means all entities possess the same behavior tree, but they act independently from each other. We will refer to this kind of group as an autonomous collective.

  • Scenario 2: Entities that join a group receive the same behavior mechanism, and they have to be somewhat coordinated. Let's say that a group of deers gets startled by some reason; the behavior description may require that all deers have their speed multiplier increased at the same time. Observe that doesn't mean changing the behavior (or the behavior tree), but rather assigning the same behavior change to all entities within a group. We will refer to this kind of group as a coordinated autonomous collective.

  • Scenario 3: Entities that join a group receive the same behavior tree, and they must act the same way. This can be illustrated by behavior changes that depend on a probability. Suppose that there's a behavior change that is bound to a probability roll of 50%. That means all entities in the group will go through the probability roll, but each with its own - so some of the entities within the group will change their behavior, and some won't. In scenario 3, however, there will be only one probability roll, and all entities in the group will behave as one. We will refer to this kind of group as a hive.

Different scenarios are usually related to different group behavior patterns. From the system perspective, emergent and decentralized coordination require only that the entities belong to the same group (autonomous collective). At the same time, centralized coordination can require either a coordinated autonomous collective (for reactions to events external to the group) or a hive (some cases involving follow-the-leader behaviors).

Implementation