In the previous prototype, only combinations of primary emotions were represented. The architecture in this chapter makes the concepts of moods explicit, using separate finite-state machine component in the system.
The moods correspond to certain emotional patterns, such as cautious, complacent, entertained, depressed, or aggressive. Each mood corresponds to an atomic state in the finite-state machine. The transitions between these moods are determined by changes in the emotions. When the animat gets frightened, for example, it becomes cautious; animats show aggressiveness with anger and sorrow, entertainment arises from amusement and joy, and so forth.
When modeling the moods based on emotions, remember that many of the transitions—especially outbound ones—are similar to each other. This causes a spaghetti layout, which can be simplified with the concept of superstates; transitions from the superstates also apply to the nested states. This is demonstrated in Figure 42.5.
Figure 42.5. The five moods are defined as atomic states. The superstates around them reduce the number of transitions.
The moods are in fact used to store parameters for the senses and actions—as the emotions in Chapter 39. However, moods are also used to provide high-level biases for the reactive behaviors. For example, mood will influence the desires of the animat: Prevent damage when scared, inflict damage when angry, or minimize violence when happy. The moods provide preferences, but other AI techniques are needed to create behaviors that take these preferences into account. The next part of this book uses moods as guidance for a reinforcement-learning algorithm, creating behaviors that adapt near optimally to the desires. This chapter just prepares the emotional aspect of the system, ready for integration with high-level behaviors in Part VII.