Friday, 7 March 2008

Wanna try out Jim?

Jim is the current incarnation of the emotion-based character. He doesn't have a pretty 3D interface, but he does use emotions and also demonstrates learning, at least to some degree.

If you want to give him a try, you can download a windows version or a pre-compiled linux version.

I'm keeping the code under wraps, for the time being. At least until I've finished most of the demonstrations etc. related to the project.

Version 0.1 (the version released so far) comes with a relatively untrained character, so you will need to train it yourself. Brief instructions are included in the downloads.

Conference Paper

Today my conference paper has been submitted. This will be published, and also I'll be presenting it later in May!

For your reading pleasure, you may view the PDF version of my conference paper here.

Tuesday, 4 March 2008

Character Brain Working

Well the brains of the character seems to be working OK, I'm currently going through a process of trying to train it what actions are appropriate responses for the different user actions. It's getting there.

At present only a Linux version exists, and the last time I tried it wouldn't compile on Windows (something to do with the enormous arrays used to hold the "appropriateness" data...)

Something I have also thought of doing is introducing long-term memory. Using an external file the emotional state could be saved at the end of a session and loaded at the beginning of the next one... this could be an interesting addition.

At the moment the character doesn't really display any goals, but I'm not sure how to factor this into the current algorithms. It may be impossible at this stage.

I'm still upset that the visual aspects have had to be ignored. Unless a miracle happens, it seems unlikely that this will be able to be integrated before the end of the project. Still, the investigation into use of emotion as a decision making tool has been quite interesting!!

Thursday, 28 February 2008

Character Actions

Progress has been slow of late with OpenSG, to the point where I'm going to need to contact my project supervisor.

However, in order to make the most of the situation, I have been spending time developing the remaining framework of the character - taking an input, making an emotional decision and then giving an output. I will at some point publish the algorithms used in these processes, but in the meantime I wanted to publish the actual list of inputs and outputs.

Natural Language Processing simply wasn't an option with everything else I have to do, so it's more a matter of having a defined list of inputs / outputs.

There's going to be some learning involved, so that the character learns the most appropriate output, rather than it being hardcoded in. This should make it a little more interesting, and a little less predictable!

Inputs:
1. Say "Hello!"
2. Say "I love you!"
3. Say "Where's the toilet?"
4. Say "You smell!"
5. Say "I'm sad."
6. Say "You're sad!"
7. Say "AI sucks"
8. Say "You're quite clever, aren't you?"
9. Say "What do you know about AI?"
10. Say "Goodbye" (procedure for exiting?)
11. Do: Kiss
12. Do: Hug
13. Do: Smile at
14. Do: Stroke
15. Do: Rub belly
16: Do: Poke tongue out playfully
17. Do: Hold hand
18. Do: Give present
19. Do: Dance with
20. Do: Tickle
21. Do: Kick
22. Do: Poke
23. Do: Laugh at
24. Do: Poke tongue out at, in rude way
25. Do: Smack
26. Do: Push
27. Do: Blow a raspberry
28. Do: Trip up
29. Do: Scream loudly
30. Do: Shake fist at

Outputs:
1. Say "The toilet is not here."
2. Say "Artificial Intelligence? That's far too big a subject for me to know! Look on WikiPedia!"
3. Say "Hello!"
4. Say "Thank you!"
5. Wave
6. Say "It's a beautiful day!"
7. Smile
8. Laugh
9. Say "I just want to die!"
10. Cry
11. Sulk
12. Dance
13. Sit
14. Gaze into space
15. Say "That won't help!"
16. Say "I don't care about AI!"
17. Stamp feet
18. Kiss
19. Say "I love you!"
20. Blush
21. Scowl at
22. Punch
23. Say "I hate you!"
24. Say "Would you like to be my friend?"
25. Cuddle
26. Tickle
27. Push you away
28. Say "Get away from me, you minger!"
29. Poke you
30. Drool
31. Say "Hmmmmm... me want!"
32. Lick lips
33. Say "Ugh!"
34. Turn up nose
35. Shake head

Thursday, 14 February 2008

Character Animation in OpenSG

Today I've been investigating programming in OpenSG, by playing around with a really simple program that was used for my Virtual Reality project.

I also did a search around for a character to use - now I'm using Blender, Generi (which is a Maya character rig) is no longer suitable. After a little search around I came across a little chap called Ludwig, created by Jason Pierce.

I've plugged it into OpenSG and all seemed reasonably OK, but after playing around a bit and doing some research it looks like exporting from Blender into OpenSG exports a fixed model. Oh dear. So if I want to do any animation (which clearly I do) I'm going to have to program the individual parts as individual nodes, and then get them to move around that way.

Tomorrows job is to investigate creating a simple face using individual nodes.

Thursday, 17 January 2008

Emotion Engine Complete

The emotion engine has gone through some changes, both to make it more efficient and also to make it slightly less predictable.

The emotion engine now includes a randomisation effect to increase or decrease all of the emotions whenever the system is running without input. The idea is, if nothing is happening to the character the emotions should continue to fluctuate and change. If no one talks to you, you still manage to get happier or sadder, don't you?

If you are particularly mean to the test character (called "Larry") he gets extremely sad and struggles to get out of this rut. It seems the emotion engine I've designed may suffer from depression... However, this is probably quite acceptable - if someone kept repeatedly kicking me, I would get quite upset and it would take a lot to make me happier.

Test out "Larry" here. Please comment on this blog if there are any problems!

A quick note for future versions:
It may be interesting for some actions to have longer lasting effects. Such that if something really good/bad happens, it continues to affect the emotions after the initial action. This would be something to work into the overlying program, rather than the emotion engine itself.

Monday, 7 January 2008

Emotion Engine Functional!

The emotion engine is partially functional - the emotion object code has been tested in a very small (and extremely basic) program and the functions to run the emotions all seem to work.

However, during testing it seems that if you are particularly horrible to Larry (the test emotional character) he can get very hateful very quickly and not come out of it particularly fast. Therefore a new set of rules will be added which state:

17 - hate wears off naturally (only a little bit)
18 - love wears off (again, limited as above)

This marks an important milestone. Now that the emotions work, the character can use this engine to begine to appear intelligent!

Friday, 4 January 2008

Rules of Emotion

In order to apply the rules given in previous posts, it seems that they probably need to be placed in some order of priority. All of these rules will potentially be applied (where applicable) when an individual emotion is changed and some of the rules will be applied when the emotional
state as a whole is updated (this will be particularly useful for times when the interface is idle - after all, a humans emotional state changes whether someone is talking to them or not).

The rules, now given in order (and with some changes) are given below:

1. disgust should reduce all other emotions, so that it takes priority
2. increased anger increases sadness (or decreases happiness)
3. increased sadness doesn't affect anger
4. increased happiness decreases anger
5. the character can be calm (i.e. not angry) without being happy
6. consistently happy character (i.e. high level of happiness) should lead to increased love
7. consistently sad character should lead to hate
8. consistently angry character should lead to hate (anger should affect more than sadness)
9. certain words should evoke love/hate response
10. love increases desire
11. hate reduces desire (should it also activate disgust?)
12. strong love/hate emotions should lead to increased emotional response elsewhere
12a Strong love increases happiness, reduces anger, reduces hostility, reduces disgust
12b Strong hate decreases happiness and increases hostility
13. happiness increases desire (not as strongly as love)
14. sadness reduces desire (minimally, not enough to increase disgust as such)
15. anger should wear off
16. disgust should wear off

Thursday, 3 January 2008

Emotion Engine Programming

Programming of the Emotion Engine started today, but first required that the object structure be defined. Should each individual emotion be an object, and the combining done by the overall program; or should the emotions as a whole be the object, containing all aspects of the emotions.

It seems to me that the best way to create relationships between aspects of the emotions is to have the whole emotions as an object. This allows much more of the control to be done below the surface, thus making the emotion engine more portable.

The emotions object needs to include:
  • integers to hold the levels of each of the 5 aspects
  • functions to set individual levels
  • a function to set a starting level
  • functions to change the emotions (i.e. by adding/subtracting)
  • function to update them all (emotions will change even if no one is interacting with the character)
  • functions to read out the levels of the emotions

Tuesday, 27 November 2007

Recent Activity

Due to several pieces of coursework due in at the moment, activity on the Virtual Character has been put on hold.

My intention is to try and get the emotion engine complete or close over Christmas, as well as building on the VR project (mentioned below) to start the framework for the visual interface.

Quick update: Despite Prologs flexibility, it will be easier to program the emotion framework in C++, given that I can load emotion states from external files, and also change emotional reaction to stimuli. This shows evolution of emotions and learning etc.

Thursday, 8 November 2007

Emotion Design 2

This is the continuance of my Emotion Engine design, what I have achieved today. Not an awful lot, but I think I might actually be ready to start structuring the Prolog!

Further Emotion Engine Design

Now comes the time of actually attempting to put the design into Prolog. It's been a while since I last used prolog, so this process is something of trial and error. I'm going attempt to keep a record of this process, though I'm likely to forget to record something.

In addition, following a recent lecture, it seemed that a further emotion was missing from the emotion engine - Desire. Desire drives us in many aspects of our lives, particularly in the early part of our development.

In fact, it seems to me that disgust is the opposite of desire, so the relate that way. I just need to make sure that when a negative disgust is activated (i.e. desire) this should have an effect on the emotional state.

An additional aspect that came to my mind following the above thought was "learning". In order to be an "intelligent" character, does my character need to include learning?

Emotions stand as this, given as Positive/Negative: [Happiness/Sadness], [Peace/Anger], [Love/Hate], [Friendliness/Hostility], [Desire/Disgust].

All emotions will be 0-100 scale, whereby 0 is the negative, 49-50 is neutral and 100 is positive

Right, new rules, including desire:

1. increased anger increases sadness (or decreases happiness)
2. increased sadness doesn't affect anger
3. increased happiness decreases anger
4. the character can be calm (i.e. not angry) without being happy
5. anger should wear off
6. consistently happy character should lead to increased love
7. consistently sad/angry character should lead to hate (anger should affect more than sadness)
8. certain words should evoke love/hate response
9. strong love/hate emotions should lead to increased emotional response elsewhere
* NB. Strong love increases happiness, reduces anger, reduces hostility, reduces disgust
Strong hate decreases happiness and increases hostility
10. love above a certain level should activate flirtatiousness (?)
11. hate above a certain level should activate hostility
12. disgust should reduce all other emotions, so that it takes priority

New rules:
13. love increases desire
14. hate reduces desire
15. happiness increases desire
16. sadness reduces desire (minimally, not enough to increase disgust as such)

Interesting thought:
Emotions usually have two dimensions, their degree (i.e. what emotion and how strong) and their focus. For instance, I love this, I hate that. So far this idea of focus isn't employed. This could probably be employed in the overlying C "brain" program - focus could be set by the input, the emotional response calculated (the highest emotional level wins).

Emotion Design 1

This is a record I've had on my computer whilst thinking through the problem of designing the Emotion Engine. As yet I still haven't actually designed it. Ooops. Getting there though. Just trying to remember Prolog and work out how to structure the predicates. Anyway, the below text is from the 25th October:

Emotion Engine Design

Emotion needs to take a current state and a set of actions (may only be one action) and process the actions to give a new emotional state

Emotion is given as a function with several elements. These elements could come from my own approximation given on my blog: happiness, anger, love and hostility
Or alternatively use an adaptation of Ekman's model [1] as noted in AlphaWolves etc: fear, anger, sadness, happiness, disgust and surprise. Ekman's model seems to assume that you feel one emotion at a time.

My model lacks something of Ekmans, however it is simpler in one sense. A new model, improving on my own in light of Ekmans might be this: Happiness, Anger, Love, Hostility, Disgust. It seems unlikely that anything will be able to "surprise" the character, so including this emotional aspect only complicates the processing; also, I have chosen not to give my character fear (both in the interests of simplification and kindness).

The rules that I created for my emotional rules are below. These will need to be manipulated or added to in light of the additional aspect of Disgust.

1. increased anger increases sadness (or decreases happiness)
2. increased sadness doesn't affect anger
3. increased happiness decreases anger
4. the character can be calm (i.e. not angry) without being happy
5. anger should wear off
6. consistently happy character should lead to increased love
7. consistently sad/angry character should lead to hate (anger should affect more than sadness)
8. certain words should evoke love/hate response
9. strong love/hate emotions should lead to increased emotional response elsewhere
* NB. Strong love increases happiness, reduces anger, reduces hostility, reduces disgust
Strong hate decreases happiness and increases hostility
10. love above a certain level should activate flirtatiousness (?)
11. hate above a certain level should activate hostility

New rules:
12. disgust should reduce all other emotions, so that it takes priority

The Prolog action/emotion processor should be created using these rules.

Look ahead: Next step would be the Next Action function, taking received action and new emotional state to decide on a response. Responses would be limited, so it would need to choose most appropriate.

References:
[1] EKMAN, P. 1992. An Argument for Basic Emotions.
Basic Emotions. N. Stein, and Oatley, K.
Hove, UK, Lawrence Erlbaum: 169-200.

Thursday, 25 October 2007

VR and Project

Since recommencing Uni I have started a module called "Virtual Reality". The assessment for this particular module includes a group projected designing and animating a 3D character... sound familiar?

So it seems my issues regarding actually creating the character may have been solved by allowing someone more talented than me to create it. Interestingly, Simant suggested that my character might not necessarily by humanoid, as I had always referred to it until that point. I guess I had always assumed that it would be easier to generate an emotive response with a humanoid character.

Speech (or rather text) is looking more and more like it won't be possible in the alloted time, so the interface is looking more like a character and a selection of buttons representing actions - this actions might include things like smiling or poking and words/phrases like "Hello!" and "You smell!" etc. As you do something to the character it will respond with gestures, and perhaps some stock phrases (e.g. "I'm sad").

The prolog Emotion Engine will hopefully be started today, or tomorrow morning.

Project Specification

Well, since I last blogged I've been working hard on the Project Specification to get that handed in. Obviously I've returned to Uni, and so that's why there has been a lack of posts recently.

I've decided to make all of my documents available online, so a link is included below. The most interesting part is Section B, the "Overall Programme" which is supposed to give an overview of my project. At the advice of my supervisor I have made this fairly vague.

www.twinklebob.f2s.com/files/project_spec.pdf

Thursday, 4 October 2007

More changes

Well, yet another change to the Character aspect of the project. It's funny, because even though on the surface the charcter is what the project is about, in reality the project is about the character's brains.

My project supervisor brought this article on the bbc website to my attention: http://news.bbc.co.uk/2/hi/technology/6992613.stm

It talks about an AI character which lives in Second Life.

As I read the article, it just seems that this would solve a lot of my character issues, allowing me to spend even more of my time looking at the brains of this character. I've also been advised by my project supervisor that included natural language in the character may make it much more difficult, and that perhaps I should just concentrate on making the character autonomous in it's action. I'm not too sure about that yet, because that would require me to completely change my aim. Much thought to come!

Monday, 17 September 2007

Make Human

In my searc for a new female character, I came across this -> MakeHuman.org

This is a 3D human which exists in C++. Will that then save me a task? Hmmm...

If it is flexible enough, it may just work. More research required. After lunch probably...

Emotions

During reading of a paper on semi-autonomous wolves (called AlphaWolf) I was inspired to think a little about the emotional aspect of the character. At present, my initial thoughts are to essentially have a chatbot with emotions sitting on top - the emotions being reactive to the situation.

Given that I have done some work with Prolog in my AI module last year, it seems to me that it would make sense to manage the emotional state of my character in this way. It might be easier to plug a Prolog "emotion engine" into a C++ program than program something nearly as effective in C++ itself.

The current emotional state at any moment will be given by the previous emotional state, response to certain words and perhaps response the person themselves. It seems that the best way to encode the emotions are in pairs, these are the pairs I've thought of so far (don't want too many as this will over complicate things):
  • happy/sad
  • angry/calm
  • love/hate
  • flirtatious/hostile

These emotions will also be related in certain ways. Again, the ones I have thought of so far are listed here:

  1. increased anger increases sadness (or decreases happiness)
  2. increased sadness doesn't affect anger
  3. increased happiness decreases anger
  4. the character can be calm (i.e. not angry) without being happy
  5. anger should wear off
  6. consistently happy character should lead to increased love
  7. consistently sad/angry character should lead to hate (anger should affect more than sadness)
  8. certain words should evoke love/hate response
  9. strong love/hate emotions should lead to increased emotional response elsewhere
  10. love above a certain level should activate flirtatiousness (?)
  11. hate above a certain level should activate hostility

With regards to response to words, the character should respond not only to words spoken to it, but to the words that the chatbot generate. I think at present that the words coming into the character should have twice the strength of words being spoken. I think it is also important that the character includes some learning ability, whereby it can add words to the love/hate lists.

I mentioned about response to the user. It would seem a good idea that the character remembers a user, even if all it does is remember the emotional state it was in when the user last finished. That way, it will appear to have emotional memory and it's response to a user will be affected by the way the user treats it.

Two last thoughts:
The "speech" of the character should also be affected by the emotional response. An angry person would not answer a question the same way as a flirtatious one.
Last but not least, I've just thought that I've been thinking about speech and emotions, but the character will exist in 3D, it will also need to have gestures! Yet another thing to think about!

We have a name!

I've been thinking, since I first started looking for characters to use in Maya, that this character is going to need a name. I couldn't really think of anything interesting, so I spoke with my fiancée who instantly insisted that the character should be a woman and that she should be called Imogen. Who am I to argue with that?

However, this does give me one slight problem. Generi, though not entirely sexually defined (because he is a blue alien) does have a slightly more masculine look to him (thus I've been calling it a "him"). So I'm now going to have to search out another character which will work within version 6 of Maya 3D.

Thursday, 13 September 2007

Animating Generi

Well, I've spent a bit of the afternoon playing around on Maya 3D 6 and Generi looks like he may be just right. It's quite amazing what he is capable of doing, all possible movement (including some that humans can't do) and quite a range of facial expression - more importantly he comes complete with the ability to lip sync thanks to a range of lip movements. Just perfect!

All that remains now is trying to make him work. You see, the problem that I have discovered is that he's going to be difficult to control. From within Maya itself it's fairly easy to modify his pose an element at a time, with the intention of creating a frame by frame animation. However, I want my character to be live and autonomous. I am somehow going to have to embed the character I have into a program, and control him from that. Keeping him within the Maya "editing" space would just look too cluttered.

I may have to wait until I can speak to someone better at 3D animation before I do that. It just so happens that I have a module this coming term on Virtual Reality - hopefully this will lead to me to an expert in this field. It looks like my research will have to move onto the AI of the character.

Animation worries relieved!

The original blurb mentioned using a tool called Maya 3D to create the character itself. The only problem is that I have never done any 3D animation, and to create an entire person and then animate and control it was beginning to look like a daunting task.

I have now come across some pre-made characters on the internet, which will remove the need to create it out of my list of tasks - this therefore gives me more time to explore the "brains" behind the autonomous character and also the interface to control the animation!

It's worth mentioning that the project supervisor (one Simant Prakoonwit) made it clear to me that the animation wasn't the real purpose of the project and that any quality of animation would be acceptable. Therefore it seems unlikely that the use of a premade character will cause any problems.

Here are just a few of the sites I have found. It seems quite likely at first look that I may use a character called Generi (from the first site listed) as this is also released for non-profit use.