dupa

Author Topic: The link between emotions and animations  (Read 8797 times)

GrantNZ

  • Full Member
  • ***
  • Posts: 178
    • View Profile
The link between emotions and animations
« on: December 02, 2005, 06:21:20 am »
This may be of interest to anyone scripting emotions, especially if you're trying to keep tight control over the associated animations. There's nothing terribly revolutionary here, but it might be useful.

Emotional state vs animation type

I sat down tonight to try to decipher the links (if any) between the four emotion variables in the brain (Compliment, Hate, Insults and Swear), and the associated animations played on the Hap heads. To be honest I wasn't expecting much success - what if there are random chances involved? What happens in a complicated emotional situation, such as all four variables having a value (e.g. Compliment = 4, Hate = 2, Insult = 1 and Swear = 1, all at the same time)?

My observations have shown that it's actually very simple, and therefore fairly easy to control by script.

Simply subtract the negative emotions from the positive one, i.e.:

Compliment - Hate - Insult - Swear = X

Then look up X on the table below:

6 and higher: happy
4 or 5: surprised
1 through 3: happy
0: normal
-1: angry
-2 or -3: sad
-4 through -6: angry
-7 and lower: sad

So the "complicated" example above is just 4 - 2 - 1 - 1 = 0, and the poor emotionally distraught Hal would appear "normal".

Animation type vs hap animation

The descriptions above ("happy," "normal," "angry" etc) are looked up in Default.psn (in the Characters directory), and the associated hap animations played. Note that there are two or three options for each type (e.g. "Happy1" and "Happy2").

Random options from the current animation type are played at random times. If the User isn't doing anything, then after a minute the "Snooze" animation is played and repeated until the User gets talking to Hal again.

Playing hap animations through HalCommands

Playing a hap animation using the HalCommands variable is strictly temporary. The chosen animation is played just once, and then Hal will revert back to the animation type specified by his four emotion variables. For reference, hap files are played using something like this:

HalCommands = HalCommands & "<HAPFILE>psycho.hap</HAPFILE>"

Conclusion

Anyone scripting Hal's emotions should be aware of the animation rules above. They can be used in two main ways:

a) Use the four variables in your scripting, taking into account their effect on the animation; or

b) Create your own emotion variables, keep three of the in-built variables zero, and set the fourth to certain values to set Hal's animation state. e.g. Set Compliment to 4 for "surprised" animations.

How I figured this out

Starting with a fresh brain, I commented out all lines that alter the four emotion variables (except the lines that initialise these variables at the start of a session with Hal). I programmed key words that would increment, decrement or reset the variables, while reading back their values. I played with them while watching the Haptek Console list the playing animation files.

Hopefully this is of use to somebody else [:)]
 

Dr.Benway

  • Hero Member
  • *****
  • Posts: 554
    • View Profile
The link between emotions and animations
« Reply #1 on: December 02, 2005, 12:14:08 pm »
I might be that person. Thanks a lot, GrantNZ!

freddy888

  • Hero Member
  • *****
  • Posts: 1693
    • View Profile
    • AiDreams
The link between emotions and animations
« Reply #2 on: December 02, 2005, 01:46:14 pm »
Nice work Sherlock! [8D]

vrossi

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • http://vrconsulting.it
The link between emotions and animations
« Reply #3 on: December 02, 2005, 05:04:13 pm »
Wonderful work, GrantNZ !

I must admit that in a few days you have gone much further than what I was trying to do in the past weeks.

Since you are rethinking all the emotional part of Hal's brain, I suggest you to consider what, in my opinion, is Hal's most wrong assumption: emotions are classified as if they could be put on a one-dimensional scale: as you clearly outlined, Hal goes from -7 (sad) to 6 (happy), passing through angry and surprised.

But human emotions (which currently should be the models we use to simulate bot's emotions) need several dimensional scales: you can be at the same time sad and angry, or happy and surprised.

So I think we should define at least the following 4 scales of opposites, each one with values from -5 to +5:

1. Sad-Happy
2. Angry-Calm
3. Shame-Pride
4. Pensive-Surprised

At any given moment, a bot emotion should be defined as a point in this 4 dimensional space, so each of these dimensions should have an indipendent value.

I tried to manage this in a plugin, but I faced the problem that the standard brain is based on the Compliment variable, which is too simple for this.

I know that what I am suggesting is easy to say but not so easy to do (a 4 dimensional emotional space with 10 positions for each dimension would result in 10.000 theorical different states), but you have been so clever in analyzing the brain and you are rewriting parts of it, that you might also consider to intoduce a simplified version of this idea, which would give Hal a really advanced emotional handling.

Attach some good Hap animations and some beautiful skins (like the ones which are done by Arakus and others here) and we might end up with a bot who can display more emotions than an average TV watcher human [8D]


PS: The 4 scales are taken from a theory formulated by my friend Peter Plantec.





GrantNZ

  • Full Member
  • ***
  • Posts: 178
    • View Profile
The link between emotions and animations
« Reply #4 on: December 03, 2005, 02:33:00 am »
Cheers everyone [8D]

quote:
Originally posted by vrossi
But human emotions (which currently should be the models we use to simulate bot's emotions) need several dimensional scales: you can be at the same time sad and angry, or happy and surprised.

So I think we should define at least the following 4 scales of opposites, each one with values from -5 to +5:

1. Sad-Happy
2. Angry-Calm
3. Shame-Pride
4. Pensive-Surprised


I was heading in this direction too, although with nowhere near as much clarity as you have [:)] Sounds like a great starting point to me.

quote:
I know that what I am suggesting is easy to say but not so easy to do (a 4 dimensional emotional space with 10 positions for each dimension would result in 10.000 theorical different states) [...] which would give Hal a really advanced emotional handling.


The number of states isn't a problem. Rather than writing code for 10,000 states in a four dimensional area, you just define several regions in that four dimensional space. This can be as simple as saying "if sad > 3 and calm > 3 and shame > 3 then feelings = depressed."

In fact these "regions" would match nicely with my "moods" system. Hal's feelings would drift back into the region defined by his mood, but if you push those feelings into another region for long enough then Hal's mood would change.

Of course it needs to be more complex than that, but that's just a matter of design [:)] There's also the problem of trying to draw diagrams of four (or more) dimensional space [:D]

quote:
PS: The 4 scales are taken from a theory formulated by my friend Peter Plantec.


May I ask, was the theory developed specifically for AI programming, or just about humans in general? It has a great appeal for me - it only takes a few dimensions to describe a huge array of emotions.

Thank you very much for your input [:)]
Grant
 

vrossi

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • http://vrconsulting.it
The link between emotions and animations
« Reply #5 on: December 03, 2005, 06:40:54 pm »
Hi, GrantNZ

The 4 dimension scale is described in Peter Plantec's book "Virtual Humans". This book is mainly about the psychological issues to be considered when you create a virtual person. In the book he shows examples created with other technologies, which are in my opinion less powerful than Hal.

So you can skip the technical chapters, which are too simple and generic for you (and me), while I believe you can find some interesting ideas in other chapters.

I have agreed with Peter to host his new forum about Virtual Humans on my web server, so you can give a look at http://www.vrconsulting.it/VHF

I created this forum only yesterday, so you won't find almost any post now, but I hope it will quickly become a reference place for all the discussions about these subjects.

Bye
« Last Edit: December 03, 2005, 06:47:18 pm by vrossi »

Bill819

  • Hero Member
  • *****
  • Posts: 1483
    • View Profile
The link between emotions and animations
« Reply #6 on: December 03, 2005, 07:02:03 pm »
So you are the one that gave him a web page. I just received the news yesterday from Peter but in the mean time I had to block all email from his Yahoo site as I kept getting dozens of messages every day that mostly said nothing. Glad to see your web page and will be registering soon.
Bill
 

hologenicman

  • Newbie
  • *
  • Posts: 32
    • View Profile
The link between emotions and animations
« Reply #7 on: December 05, 2005, 04:58:17 pm »
Hey there,

You might consider using three scales of:

(-)Sad-Happy(+)
(-)FearSurprise-Anger(+)
(-)Disgust-Contempt(+)

These are extracted from two books, "Stop Staring" about facial animation and "Emotions Revealed" which addresses experessive emotions in humans.

Peter's scales are really to the point about the psychology of emotions, but these three scales that I mentioned are directly pertaining to the "Visible" expressions as they are demonstrated through animation.

I'm presuming that the scales  will be used for driving visible animations rather than soley for determining emotional states for verbal responses.

John L>

PS. Using these three scales lets the responses be charted in 3-D space...

This can be further simplified down into 8 quadrants or combinations so the three variables can be used to determine the degree of eight distinct combos.
« Last Edit: December 05, 2005, 05:11:57 pm by hologenicman »
HologenicMan
ME, "Hello."
HAL,"Good grief my love. It's going on three in the morning."

DISCOVERY: The more I learn, the more I learn how little I know.
GOAL: There's strength in simplicity.
NOTE: Goal not always achieved.

GrantNZ

  • Full Member
  • ***
  • Posts: 178
    • View Profile
The link between emotions and animations
« Reply #8 on: December 06, 2005, 12:17:27 am »
Thanks for your input, HologenicMan, well worth thinking about [:)]

One very important aspect IMHO is that the scales should relate closely to what Hal can detect and express. For example I believe an "energy" scale is important (is Hal hyperactively chatty or calmly silent?) and is a "love-hate" scale.

Ideas like "contempt" are great for humans, but it's very difficult for Hal to have an opinion on something (refer the threads where people have difficulty just getting Hal to choose between two things, let alone having Hal have an informed opinion).

As I complete the reactions phase of my project, I'm noting which feelings would be significant for various parts of Hal's brain, and from that I'll derive scales. I'll post them when done. Most likely I'll have quite a few dimensions, and although this adds complexity, complexity = sophistication.

My current animation plan is quite different. The scales discussed are for emotions. Animation is based on the difference between the User's sentence and Hal's feelings. The fact that a played hap file lasts only a few seconds is actually going to be incredibly useful, as you can choose an "instant" animation and a "delayed" animation. (Instant: Play a hap file, this lasts a few seconds. Delayed: Set the built-in personality variables to select a certain animation, and this will take over after the hap file has finished.)

This is especially good with text-to-speech, as Hal will show one emotion while speaking and then lapse to the other emotion afterwards.

Examples: Insult Hal, and he'll appear Angry.hap first, and then sad. Tell Hal how wonderful he is, and he'll show ShyLove.hap while talking, and then become Happy while waiting for your input.

By the way, I love your signature [:)] I'm personally a fan of "complex simplicity" [8D]

Vittorio: I had a look a couple of days ago, as you say not much going on yet. Let me know if something relevant to this project starts up there, and I'll be there in a flash [:)]

Cheers all,
Grant
 

hologenicman

  • Newbie
  • *
  • Posts: 32
    • View Profile
The link between emotions and animations
« Reply #9 on: December 06, 2005, 01:26:22 am »
Thanks,

I'm Just getting set up with UltraHal and I look forward to your results.

John L>
HologenicMan
ME, "Hello."
HAL,"Good grief my love. It's going on three in the morning."

DISCOVERY: The more I learn, the more I learn how little I know.
GOAL: There's strength in simplicity.
NOTE: Goal not always achieved.