Topic 5 Emotive States; Emotive Animat Emotions and Computers A Model of Emotions Emotional...

23
Topic 5 Emotive States; Emotive Animat Emotions and Computers A Model of Emotions Emotional Expression for Communication Affective Model for Animats Sensations, Emotions, Moods and Feelings Portraying Emotions in Games An Extensible Affective System Processing Sensations & Emotions The Affective System Put Together Reading: Champandard Chapters 36, 37, 39 Links to Affective Computing, Kismet Robot on Website

Transcript of Topic 5 Emotive States; Emotive Animat Emotions and Computers A Model of Emotions Emotional...

Page 1: Topic 5 Emotive States; Emotive Animat Emotions and Computers A Model of Emotions Emotional Expression for Communication Affective Model for Animats Sensations,

Topic 5Emotive States; Emotive Animat

• Emotions and Computers• A Model of Emotions• Emotional Expression for Communication• Affective Model for Animats• Sensations, Emotions, Moods and Feelings• Portraying Emotions in Games• An Extensible Affective System• Processing Sensations & Emotions• The Affective System Put Together

Reading: Champandard Chapters 36, 37, 39

Links to Affective Computing, Kismet Robot on Website

Page 2: Topic 5 Emotive States; Emotive Animat Emotions and Computers A Model of Emotions Emotional Expression for Communication Affective Model for Animats Sensations,

ICT219 2

Emotions and Computers• The idea of computers with emotions may seem strange because

i) our culture separates emotions and logic and ii) associates computers with logic

• Yet the truth is that models of emotions have been built from the earliest days of AI and “affective computing” is by now a well-established subfield

• There could be many advantages in making machines cable of having emotions, or at least recognising them in humans and reacting properly

• In nouvelle game AI, we are interested in making emotional animats for the same reason as story-tellers – because this will enhance the realism of non-player characters, make them more entertaining and help to more fully engage players with them

• A lot of interesting philosophical questions flow from the idea of emotional computers

Page 3: Topic 5 Emotive States; Emotive Animat Emotions and Computers A Model of Emotions Emotional Expression for Communication Affective Model for Animats Sensations,

ICT219 3

A Model of Emotions• Plutchick (1980) described eight primary emotions organised into

pairs of states. In this model, it is impossible to experience the two states of a pair at once. The overall emotional status is registered by degrees of arousal of one of each pair

• Each state has a degree of intensity and a target object or state of affairs to which it refers

• Each state has behavioural implications which betray its “purpose” in helping the organism survive

causes rejection of the target object or state of affairs/produces aversive signal for learning

FEAR | ANGER

ACCEPTANCE | DISGUST

JOY | SORROW

ANTICIPATION | SUPRISE

recruits energy and directs destructive force toward an obstacle

flags unexpected event/ directs attention to percepts/ raises heart rate

releases hormones, tensions muscles and prepares for fight or flight

recruits energy and produces reinforcing signal for learning

withholds energy, forces withdrawal to safety and produces aversive signal for learning

tolerates target object or state of affairs/produces reinforcing signal for learning

allows preparation for expected event/ tests model of the world

Page 4: Topic 5 Emotive States; Emotive Animat Emotions and Computers A Model of Emotions Emotional Expression for Communication Affective Model for Animats Sensations,

ICT219 4

A Model of Emotions• The Plutchik model allows states to combine to produce compound

“flavours” of emotion. Eg sorrow + suprise = disappointment; fear + acceptance = submission, etc.

• The model presupposes perceptual, learning and cognitive systems, but says little about them

• Since emotions are closely tied to sensors, effectors and bodily interaction in the world, it follows that embodied AI might be useful at providing these as a more complete system than traditional AI models, which had to work on disembodied computers

• Generally speaking, affective models of this kind try to mimic the different basic functions of emotions: regulation of behaviour, learning and communication

• Plutchik’s model is an example of how emotional states might signal survival-related classes of stimuli and how this could regulate action

Page 5: Topic 5 Emotive States; Emotive Animat Emotions and Computers A Model of Emotions Emotional Expression for Communication Affective Model for Animats Sensations,

ICT219 5

Emotional Expression for Communication• Emotion has an important role in dealing with others

• Being able to read the emotional state of another human would have powerful survival implications, and hence be selected for in human evolution

• Being able to influence the emotional state of another human would also be very useful

• Humans signal their emotional states by universal expressions, and we can read these in other humans

• It could be useful to have computersor robots do this:

- vision systems could read human facial expressions and classify them as emotions

- graphical or robot faces could have their features set into universal expressions to signal emotions

Page 6: Topic 5 Emotive States; Emotive Animat Emotions and Computers A Model of Emotions Emotional Expression for Communication Affective Model for Animats Sensations,

Emotional Expression for Communication

• Emotions can also be expressed in (and read from) gestures

• Over a longer time frame, emotions can be expressed in (and read from) behaviours

• Emotions may also be communicated via language:

- choice of words may be influenced by emotional state

- pitch, tone, speed and loudness of voice carries affective information

• This means that an emotional system needs to interact with other behavioural control mechanisms and influence them according to the current emotional state of the system

• So research on these areas often overlaps with the study of realistic body animation, including facial expression, mannerisms, natural language generation and speech synthesis

Page 7: Topic 5 Emotive States; Emotive Animat Emotions and Computers A Model of Emotions Emotional Expression for Communication Affective Model for Animats Sensations,

ICT219 7

Affective Model for Animats

• We would like to try out our notions of affective AI in a FEAR animat

• In Chapter 37, Champandard advances a model that distinguishes a number of separate affective states in terms of their origin, longevity, and the ‘data’ they hold

• These are sensations, emotions, moods and feelings. Be careful – these are special technical definitions of these words in terms of C++ data structures and should not be confused with their usual meanings

• Once these are modeled, we can consider an interface to the FEAR game engine modules which communicate the effects from the AI model

Page 8: Topic 5 Emotive States; Emotive Animat Emotions and Computers A Model of Emotions Emotional Expression for Communication Affective Model for Animats Sensations,

ICT219 8

Sensations• Emotions in embodied creatures begin with sensations. In this model,

a sensation will be defined as an immediate reaction to a creature’s current situation

• They might include surprise, anticipation, disgust, attraction, pain and pleasure

• Sensations are visceral “gut reactions” – they happen almost instantaneously, and do not last very long. They may arise from two different sources:

• Sensations from Perceptions – The body detects a certain class of stimuli from the environment, which causes an immediate short term reaction eg sensation of surprise if a player or NPC appears suddenly

• Sensations from Cognition – A mental state may also cause a sensation. For example, the thought of blood might cause a sensation of disgust

Page 9: Topic 5 Emotive States; Emotive Animat Emotions and Computers A Model of Emotions Emotional Expression for Communication Affective Model for Animats Sensations,

ICT219 9

Emotions• Higher-level and longer-lasting affective trends are called emotions in

this model. An emotion is a lasting characteristic of a persons affective state

• Emotions might include fear, anger, joy and sorrow

• Emotions change slowly compared to sensations. Emotions could be triggered by a single sensation, or by multiple sensations

• Champardard calls basic dimensions (such as fear, anger etc) primary emotions. Each may have various degrees of intensity, which Champandard calls secondary emotions (?)

• Eg the primary emotion of fear might have a low intensity (apprehension) or a high intensity (terror)

• As with Plutchik’s model, some might be mutually antagonistic eg

joy and sorrow. These are called complementary emotions.

Page 10: Topic 5 Emotive States; Emotive Animat Emotions and Computers A Model of Emotions Emotional Expression for Communication Affective Model for Animats Sensations,

ICT219 10

Moods

• Now a creature’s mood will be defined as its complete set of emotions at a particular time

• This will be represented as a set of primary emotions, each with its own intensity

• A positive mood might include acceptance, satisfaction (moderate amount of joy) and awe (high level of surprise)

• Moods thus include complex emotions, which are subsets of primary emotions

Page 11: Topic 5 Emotive States; Emotive Animat Emotions and Computers A Model of Emotions Emotional Expression for Communication Affective Model for Animats Sensations,

ICT219 11

Feelings

• Affective states can refer to an object or event (even one remembered in the past or anticipated in the future)

• In Champadard’s model, these are called feelings

• Feelings are persistent associations between an emotion and a (class of) object

• Examples are cruelty (to dogs), love (of a brother), hatred (of pirates)

• Feelings do not depend on the current state of the creature, but may refer to past or present (or even hypothetical) states of affairs

Page 12: Topic 5 Emotive States; Emotive Animat Emotions and Computers A Model of Emotions Emotional Expression for Communication Affective Model for Animats Sensations,

ICT219 12

Portraying Emotions in Games

• How could an observer see the effects of emotional states in an animat which had them?

• Many games (certainly FEAR/Quake2) have little, if any provision for controlling facial expressions well enough to signal emotions that way (The action is usually too fast to see the faces close up anyway)

• However, recall that emotions can also be communicated by actions and language

• Existing actions can be triggered or changed by affective state. Eg, terror might cause the animat to wail, or depression might cause it walk more slowly than usual

• A lack of action might also signify something: eg failing to respond to attack might be a sign of submission. Higher level decisions, even at the strategic level, might also reveal emotions in some circumstances

Page 13: Topic 5 Emotive States; Emotive Animat Emotions and Computers A Model of Emotions Emotional Expression for Communication Affective Model for Animats Sensations,

ICT219 13

Portraying Emotions in GamesPortraying Emotions in Games• Existing gestures such as Flipoff() may be used to signify (anger)

• Champandard describes a general-purpose interface to the enumerated action functions of the Quake 2 engine

void Gesture ( const GestureType g );

• Senses indirectly play a role in the portrayal of emotions, because they are closely linked to action – especially in reactive models

• A good example is anticipation, which has the effect in real creatures of heightening sensory awareness. The thresholds at which stimuli signifying possible danger are detected are lower than usual in this state

• Chat communications can also be used to make language signify emotions eg Say() or SayTeam() functions

void Say ( const string& text, const GroupType g = everybody );

Page 14: Topic 5 Emotive States; Emotive Animat Emotions and Computers A Model of Emotions Emotional Expression for Communication Affective Model for Animats Sensations,

ICT219 14

Portraying Emotions in Games

• Some affective behaviour scenarios:

- Joy: dance or jump

- Fear: faster but less accurate turns than usual; run faster

- Extreme fear: stop thinking and freeze for a while

- Disgust: turn away from reference stimulus; say “ugh”

- Anticipation: swing gun wildly at any sound; slower walking than usual

• Extra touches for very emotive characters

- Insult enemies during battle; perform taunting gestures

- Run away screaming when the enemy is powerful

- Keep a history of conflict, and target enemy based on grudges

Page 15: Topic 5 Emotive States; Emotive Animat Emotions and Computers A Model of Emotions Emotional Expression for Communication Affective Model for Animats Sensations,

ICT219 15

An Extensible Affective System

• Champandard designs an affective system for FEAR animats that

- is based on the model described so far (and the Plutchick psychoevolutionary model)

- uses a FEAR finite state automata/machines module

- works with other behavioural control architectures (since emotions are only part of a functioning cognitive system) and can be enhanced

• Simplified: only models four primary emotions: fear/anger, surprise/anticipation. These are complementary states, so one should observe no more than two at any time

• Simplified: each emotion is represented as a binary value: either fully activated or inactive (no secondary emotional levels here)

• Simplified: emotional states merely raise or lower the effectiveness of existing reactive behaviours

Page 16: Topic 5 Emotive States; Emotive Animat Emotions and Computers A Model of Emotions Emotional Expression for Communication Affective Model for Animats Sensations,

ICT219 16

FEAR’s FSA/FSM Module

• The FEAR platform allows both Finite State Automata (recognisers, acceptors, parsers) and Finite State Machines (transducers) to be easily and efficiently implemented

• FSA – inputs are a sequence of symbols (eg from an vector of characters) which can trigger the state transitions. The output can be any kind of data, but usually sets a categorical variable (for classification) or a Boolean variable (for acceptance):

bool Accept ( const vector<Symbol>& sequence ); Symbol Recognise( const vector<Symbol>& sequence );

• FSM – one output for each input, so you need to either step a single symbol in and out, or else run an entire set of symbols and get a matching output set: Symbol Tick ( const Symbol in );

void Simulate(const vector<Symbol>& in vector<Symbol>& out );

Page 17: Topic 5 Emotive States; Emotive Animat Emotions and Computers A Model of Emotions Emotional Expression for Communication Affective Model for Animats Sensations,

ICT219 17

XML for FSA/FSM Data Structures<knowledge>

<Emotions start="fear/surprise"> <state name="fear/surprise" output="fear/surprise">  <transition target="fear/anticipation" input="fa" />   <transition target="anger/anticipation" input="aa" />   <transition target="anger/surprise" input="as" />   </state> <state name="fear/anticipation" output="fear/anticipation">  <transition target="fear/surprise" input="fs" />   <transition target="anger/anticipation" input="aa" />   <transition target="anger/surprise" input="as" />   </state> <state name="anger/surprise" output="anger/surprise">  <transition target="anger/anticipation" input="aa" />   <transition target="fear/anticipation" input="fa" />   <transition target="fear/surprise" input="fs" />   </state> <state name="anger/anticipation" output="anger/anticipation">  <transition target="anger/surprise" input="as" />   <transition target="fear/anticipation" input="fa" />   <transition target="fear/surprise" input="fs" />   </state>  </Emotions> <Sensations> <state name="fa" output="">  <transition target="aa" input="expected_damage" />   <transition target=“xx" input=“unexpected_sound" />   </state><state name=“xx" output=“">  <transition target=“fs" input=“explosion" />   <transition target=“as" input=“item_pickup" />   </state> <state name="fs" output="fs">  </state> <state name="aa" output="aa">  </state> <state name="as" output="as">  </state> </Sensations>

</knowledge>

Specification for emotion FSM

Specification for sensation FSA

transition to target x (“anger/anticipation”) on input y (“aa”)

state labeled a outputs symbol b (here, they are the same)

Page 18: Topic 5 Emotive States; Emotive Animat Emotions and Computers A Model of Emotions Emotional Expression for Communication Affective Model for Animats Sensations,

ICT219 18

Processing Sensations

• Sensations will be simply perceived classes of objects or events in the environment, such as unexpected sounds, blood splats or explosions (cognitive sensations are not addressed in this prototype)

• A simple FSA, used as a recogniser, will accept perceptions or sequences of perceptions and move into a state representing the current sensation, at each Think cycle

Anger/anticipation

Anger/surprise

Fear/surprise

Fear/anticipation

expecteddamage

unexpectedsound

explosion

item picked upfa

fs

as

aa

Page 19: Topic 5 Emotive States; Emotive Animat Emotions and Computers A Model of Emotions Emotional Expression for Communication Affective Model for Animats Sensations,

ICT219 19

Processing Emotions• The mood of the system may be in any of four states, each consisting of a

pair of (non-complementary) emotions. This enforces the constraint that complementary emotions may not be expressed at the same time

• The moods are fully interconnected, so sensations from the sensation FSA may move the system from any mood to any other

fear/surprise fear/anticipation

anger/surprise anger/anticipation

faaa

fs

fa

fsas

as

aa

faas

aa

fs

• Each state will output an associated change in the parameters used

to control accuracy and power of actions; and the delay and precision of perceptual functions...

Page 20: Topic 5 Emotive States; Emotive Animat Emotions and Computers A Model of Emotions Emotional Expression for Communication Affective Model for Animats Sensations,

ICT219 20

Emotional Output

• Accuracy is the randomness or error of an action: 1.0 means the commanded action is performed perfectly; 0.0 means the action is randomised

• Power is used to scale the magnitude of the action: 1.0 means the actions have their maximal value 0.0 means the action is frozen

• Delay alters perceptions. A delay of n means n seconds pass before a stimuli is recognised by perceptual functions

• Precision alters the location of objects in space by perceptual functions. A value of 1 means the position is exact; while 0 means that a large random number is added to the distance and angle

Precision = 0.7 Power = 0.2

Delay = 0.0 Accuracy = 0.9

Precision = 0.9 Power = 0.4

Delay = 1.0 Accuracy = 0.2

Precision = 0.0 Power = 1.0

Delay = 0.3 Accuracy = 0.8

Precision = 0.1 Power = 0.9

Delay = 0.8 Accuracy = 0.3

surprise anticipation

fear

anger

Page 21: Topic 5 Emotive States; Emotive Animat Emotions and Computers A Model of Emotions Emotional Expression for Communication Affective Model for Animats Sensations,

ICT219 21

Affective System Put Together

affecting allactions andperceptions

sensation

pattern of parameters

emotion FSM sensation FSAcycle ofperceptions

• At each Think cycle a (possibly new) sensation may arise in the sensation FSA if it reaches an end state

• New sensations are passed asynchronously to the emotion FSM, which may change state to a new mood

• Each mood outputs its characteristic parameters which in turn affect both actions and perceptions

Page 22: Topic 5 Emotive States; Emotive Animat Emotions and Computers A Model of Emotions Emotional Expression for Communication Affective Model for Animats Sensations,

Evaluation of Affective System• This design is (partly) implemented in the Moody animat

• The alterations to action and perceptual parameters do make a difference to the animat’s behaviour, but it is subtle and you need observe carefully to see the effects

• It would be possible to make the emotional system output more dramatic behaviour - easier to see, but possibly inappropriate at times

• Errors in perception and changes in speed of response are realistic emotional effects and do lead to game events which wouldn’t happen otherwise

• System is simple to adjust (though not as simple as Ch suggests)

• Transitions are all boolean – states do not rise and fall in degree, so no “secondary emotions” are possible. Also the emotions do not change

• Emotional states have no “hysteresis”, meaning they can change as fast as sensations – not true to the model

Page 23: Topic 5 Emotive States; Emotive Animat Emotions and Computers A Model of Emotions Emotional Expression for Communication Affective Model for Animats Sensations,

ICT219 23

Summary• The recognition and production of emotions in computers is possible, and there

are many reasons to wish to do so

• In nature, emotions regular behaviour, assist learning and allow communication to other organisms

• Plutchick’s model of emotion specifies 8 primary states organised into mutually antagonistic pairs. Each state has behavioural, learning and communication implications

• Embodied animats in games are a good test bed for emotions, because they can play out these implications in the game world, and should be more entertaining as a result

• But the portrayal of emotions in games can be problematic, because the opportunities for facial expression, gestures etc. could be limited

• Champandard defines sensations, emotions, moods and feelings technically, as part of an application of Plutchick’s model to the design of a FEAR animat (Moody)

• This model uses a FSA to transform perceptions into sensations

• The sensations drive a FSM model of emotional states, each of which modifies the efficiency and speed of perceptions and actions in the Moody animat