Creating Emotions as Finite StatesAnother component is included in the overall AI architecture to handle emotions. Internally, it is composed of two nested finite-state components, handling sensations and emotions. Finite-State Machine for EmotionsThe finite-state machine used to model the four emotions contains four states. However, each emotion is associated with two states, such that each state corresponds to two emotions. When pairs of complementary emotions are considered as dimensions, the finite-state machine can be understood as a 2D grid—as shown in Figure 39.1. This enforces the restriction that two complementary emotions may not be active at the same time. Figure 39.1. The four different mood states, each with two emotions.
The finite-state machine is fully connected, so there are transitions from each state to every other. The conditions for the transitions are left generic, and are defined by the sensations. The design of this finite-state machine is therefore frozen. All the flexibility comes from the sensations finite-state machine, which defines active emotions; transitions in this finite-state machine match the desired mood. Each state contains specific values for each of the parameters used to control the behaviors. These are defined in Table 39.2, but can be adjusted by the designers. The parameters are defined for the turn and move actions, and the visual senses are defined as follows:
Finite-State Automaton and SensationsA finite-state automaton is used to process the perceptions into concise sensations that can be interpreted by the finite-state machine used for emotions. An example finite-state automaton is shown in Figure 39.2. Because these sensations are crafted by the designer (and the emotions are frozen), they implicitly affect the personality of the animats. Some creatures may be likely to react better in combat, whereas others become complacent when nothing happens. These personalities can be controlled indirectly by adjusting the sensations. Figure 39.2. Finite-state automaton to recognize the sensations based on the stimuli.
The system could be modeled with only one finite-state automaton with five states (one start state and four states corresponding to the recognized sensations). Arbitrary intermediate nodes can be used to simplify the model as necessary. Although this approach is the simplest possible, it does not provide much diversity in the behaviors. Instead, using one finite-state automaton for each of the moods provides the flexibility to customize each of the transitions, while still keeping the complexity of the system low. IntegrationThe two finite-state components are built separately, but need to work closely together to produce the final system. The stimuli from the environment are passed as events to the finite-state automaton. The sensations are passed asynchronously as messages to the finite-state machine modeling the emotions, as shown in Figure 39.3. With this approach, the emotional state is always up-to-date, driven reactively in a very efficient fashion. Figure 39.3. Integration of the sensations and the emotions using message passing.
Similarly to biological creatures, the emotions are experienced subconsciously. In this system, the moods are essentially an underlying layer for the AI already developed. The previously developed AI architecture is therefore required as another layer to provide the intelligence. These two layers need to interact for the mood to affect the behavior, as shown in Figure 39.4. The mood is queried by sensor and effector components that manifest the emotions (that is, vision queries or movement actions). Depending on the component, the emotions are queried on-the-fly when necessary or they are passed by messages and cached. Figure 39.4. High-level view of the architecture with the emotions and the reactive behaviors working independently. The emotions affect the senses and actions with parameters.
|