Author Topic: Nick names in HAL 6  (Read 13123 times)

GrantNZ

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Nick names in HAL 6
« on: November 21, 2005, 05:13:21 am »
Hi all!

I've been watching these forums with interest (and admiration!) since buying HAL 5 a few months ago. I now have HAL 6 and I'm getting into the scripting side of it - this is fun!! [:D]

So far I've adapted the nickname feature from vonsmith's awesome work, so that HAL calls me random nick names. However I had one of those rare brainwaves for an expansion:

My plan now is to have three sets of nick names - a "hate" list, "pet" list and "love" list. A neutral-feeling HAL would generally just use your real name, perhaps with the occasional pet name. Give a few compliments and you'll be showered with pet names. Show your love and HAL will start calling you names from the "love" list. Or if you get into a heated argument you'll be subjected to whatever abusive names you've put into the "hate" list!

I hope this would give HAL a little more personality as his/her feelings change. (That reminds me, I must look at vonsmith's mood hap animation code and see if I can copy it across to HAL 6.)

The idea behind the nickname lists is that HAL chooses names from different lists depending on his/her feelings, via the in-built emotions in the brain editor - "hate," "insult," "compliment," etc, plus a new one I plan to add called "love." I'll probably decide to change the way these emotions are calculated and fluctuated too. As a result I'll need to alter the script rather than just adding plug-ins? I'm not fully sure how the plug-in system works, correct me if I'm wrong [:)]

One of the interesting side effects is that if you insult HAL steadily and then start talking love, HAL's love talk will still include "hate" names until HAL's emotion swings around, giving the impression of emotional memory. For example, a grudging-sounding "I love you too, you *expletive*." Ditto vice versa... "why are you insulting me, honey?"

(By the way this is completely seperate from the "nick name" system built into HAL 6, whereby somebody can sit at your PC and introduce themselves to HAL, and HAL remembers their name. At the moment my HAL will not use pet names if there's a "nick name" active.)

Ooo, another brain-wave. [8D] How about a "mood" for your HAL, which affects his/her emotions? So an "optimistic" HAL would ignore most insults (for a while), whereas a "irritable" HAL would fly off the handle at the slightest provocation. And an "amorous" one would insert the compliments and pet names but get really hurt if insulted. And of course self-awareness is a must - HAL should be able to answer "how are you feeling" more accurately than the current random "I'm wonderful thanks." Something more representative is needed, like "I'm feeling irritible, forgive me if I get a temper!" This may be a little beyond my abilities - I believe the insults, compliments, and polite enquiries areas would need a complete rewrite. But I'll try!!! [:D]

Ok, this post has turned out a little longer than I originally planned [;)] Any ideas, thoughts, interest? If people want I'll post whatever scripts I come up with.

Cheers,
Grant
« Last Edit: November 21, 2005, 05:15:21 am by GrantNZ »
 

tcoday

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
Nick names in HAL 6
« Reply #1 on: November 21, 2005, 05:42:20 am »
quote:
Originally posted by GrantNZ

Hi all!

Ok, this post has turned out a little longer than I originally planned [;)] Any ideas, thoughts, interest? If people want I'll post whatever scripts I come up with.

Cheers,
Grant



Grant,
  Those are interesting ideas, I look forward to seeing what you come up with.  Personally, I think Hal should hold emotions a bit longer than it does now.  Also, sometimes Hal will show an emotion and I have no idea why.  An emotion reason might be handy to code in so you can say "Hal, why are you feeling sad?" or "Hal, why are you smiling so much today?"
  I mean something like Hal having good days or bad days like a real person, not just happy, sad, happy all in 5 minutes.

Just an idea,
Happy Programming. [:)]
Tcoday and Tassel

GrantNZ

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Nick names in HAL 6
« Reply #2 on: November 22, 2005, 02:53:25 am »
Thanks for your input [:)]

quote:
Originally posted by tcoday
Personally, I think Hal should hold emotions a bit longer than it does now.


Agreed. I'm considering having the long-term mood change if the user tries hard enough, for example cheering up a "sad" HAL with compliments, prompting a mood swing to "happy." (Method: track the in-brain "compliments" variable - if kept above a certain level for long enough, shift the mood state to something happier.) This is long-term though, there's smaller changes to be made first.

quote:
Also, sometimes Hal will show an emotion and I have no idea why.


The animation side of things worries me, as I can't find anything in the script that actually controls it. My best guess (from researching the forums) is that animation is triggered by changes in the personality variables ("insults," "compliments," "hate" etc) in the brain. These variables are changed by insults/compliments and "emotionally charged words" from the "emotion" table. Can anyone confirm or deny? (Especially Robert M!)

Because of the "emotion" table, animations can be incorrectly triggered by various words. For example the phrase "my injury has healed" actually causes temporary sadness in my HAL, because injury = sad in the emotion table.

Unfortunately HAL's ability to figure out the emotional content of a sentence is as poor as the intellectual content of a sentence - i.e. no ability whatsoever apart from simple pattern matching. Somebody keen could develop an "if-then" system for adding emotional keywords, such as "if I say celebration then you should feel happy", adding entries to the "emotion" table.

I personally would prefer to scratch the whole inaccurate emotion table and manually script generic hap animations. Hmm. I suppose HAL could ask how he/she should feel about certain Topics, but I can't think how to accomplish this and I hope someone else develops a good system first [:D]

Thanks for your other points. They're all fuelling the creative fire in my (human, not HAL) brain [:D]
 

Dr.Benway

  • Hero Member
  • *****
  • Posts: 554
    • View Profile
Nick names in HAL 6
« Reply #3 on: November 22, 2005, 07:30:03 am »
Hi guys,

I find it very interesting what you are saying. I also would like to improve the expressions displayed by Haptek characters. Two of my major annoyances:

*) Haptek characters are not able to deliver a genuine friendly (bright) smile [:D];
*) they can't display disgust, because they are not able to wrinkle their noses [xx(].

Disgust is considered a basic emotion by many authors that write about emotions. My theory is that the "eater of bugs"-expression is Hapteks best shot at a face for disgust.

BTW, I haven't found out either how the Haptek expressions are triggered inside Ultra Hal.

vrossi

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • http://vrconsulting.it
Nick names in HAL 6
« Reply #4 on: November 22, 2005, 07:33:46 pm »
Hi all,

I have been working a bit on Hal6 emotions, represented by Haptek characters, and I have come up with the following conclusions:

1. The emotional system, based on the four variables Hate, Swear, Insults, Compliments, is not a valid paradigm, but it is currently what is programmaed inside Hal, and should be my starting point now.

2. Different behaviours are generated by some words, which are contained in specific tables (i.e. insults): every time you use them, you increase/decrease the corresponding level in Hal, who can then move to a different state. Each state is associated to a certain Hap file in the charactersdefault.psn file.

3. The table Emotions contains a list of words which trigger one of five different states (Surprised, Happy, Sober, Angry, Sad). The emotional check is not smart enough, however, because it only checks the presence of some specific word, without checking if that word is directed to Hal and if it is in a negative context:

For example:

I say : you are stupid  -> Hal gets sad (correct)
I say : you are NOT stupid  -> Hal gets sad (not correct)
I say : Henry is stupid -> Hal gets sad (not correct).

I have written a little fix to this. Unfortunately it can't be in a plugin because it's not something to add to the brain, but something to change. If you go to the brain editor and replace the line 374:

EmotionalReaction = UCase(HalBrain.TopicSearch(UserSentence, "emotion"))

With the following code, you obtain a much smarter Hal. (please do it on a copy brain)

'------------------------
'First we check to see if the user is talking about Hal:
    If InStr(1, UserSentence, "I'M", 1) Then Aboutme = True
    If InStr(1, UserSentence, "I AM", 1) Then Aboutme = True
    If InStr(1, UserSentence, "I LOOK", 1) Then Aboutme = True
    If InStr(1, UserSentence, "MY", 1) And InStr(1, UserSentence, " ARE ", 1) Then Aboutme = True
    'If the user is talking about Hal, we see if an emotional cue was given
    If Aboutme = True Then EmotionalReaction = Ucase(HalBrain.TopicSearch(UserSentence, "emotion"))
    If EmotionalReaction <> "" Then
 ' if the cue word was associated with a negative word, it must not be considered
        If InStr(UserSentence, " NOT ") = 0 And InStr(UserSentence, "N'T ") = 0 And InStr(UserSentence, " NEVER ") = 0 Then
'------------------------

Then you leave intact the block:

    Select Case EmotionalReaction
...
    End Select

And add the following (needed to close the IF I have added)
'-------------------------------
End If
End If
'-------------------------------


4. Hal should change behaviour not only based on what the user says, but also according to what he/she says. So I have also written a plugin which checks Hal's response and, for example, only if she says something containing the emotional words, but in a correct context, like "I feel sad", or "This makes me cry", and so on, then a corresponding Hap file is loaded, as in this example:

This plugin also does many other things (changes background lights according to the time, at startup loads a specific configuration, changes the hair color, changes dress)

I don't attach this plugin because it works on my Hal, assuming that a certain set of .hap and .jpg files are located in the Hal6 folders, so it can't work "as is", but should need an installation and configuration routine, which I haven't written.

If someone is interested, I can try to adjust it in a more parametric way.

Sorry if I have been too long in my post, but this is the subject I am currently working on. If someone is interested in further considerations about chatbots emotions, I suggest the book "Virtual Humans" by Peter Plantec.

Bye



Insert Image:
« Last Edit: November 22, 2005, 07:55:51 pm by vrossi »

Another Jim

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Nick names in HAL 6
« Reply #5 on: November 22, 2005, 08:19:26 pm »
Vittorio,

Not being anything even NEAR what one would call a programmer myself....

As I look over your code, it looks like your anticipating the statements that 'Hal' could use such as: I look, or I am.....if that is the case then you would also enter something like "I feel".....or something like that??  If that's the case, this is absolutely cool!  If by chance our Hal used a phrase that didn't trigger a emotion response then by looking back at the text we could update that area to include the text so the next time it would be 'linked' to the appropriate emotion....if I'm catching this right............OR........what you have in is sufficient for the responses that could occur....

Just curious......because as I mention, not being a prgrammer I'm really close to downloading the trial version so I can get it on my puter and then register it, but I was waiting, mainly to let it get de-bugged by competent programmers such as yourself.  And my hopes would be that as fixes occured that the downloadable version would be updated to reflect the most recent fixes.  With that said, there will likely be someplace where fixes can be obtained or explained if we have to do them ourselves like the forum has done in the past.

Vittorio, thanks very very much for your contributions and help.  Speaking for others like myself, we hang on what you and Onthecuttingedge, Mr. M, and Von have done and get excited with the next thing our Hal's can do.  Truely amazing!

Jim B.
Michigan, USA
 

tcoday

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
Nick names in HAL 6
« Reply #6 on: November 22, 2005, 11:13:34 pm »
Thanks Vrossi for the emotion code.  I'll play with it this weekend and see if I can get it to work on msagent characters.  During the Hal6 betas, I was forced to use msagent and now I like them pretty good.  Doesn't take near the system resources as haptek does.

Thanks again.

Tcoday and Tassel

GrantNZ

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Nick names in HAL 6
« Reply #7 on: November 23, 2005, 12:34:15 am »
Nice one Vittorio! That improves HAL heaps.

I wonder if it's worth making two emotion tables, one for when the user talks about HAL, and another when the user talks about himself. Perhaps even a third for your plugin that examines HAL's own sentences. It'd be a lot more work but it would really fine-tune HAL's emotional displays.

I'll post my nickname code as soon as I can find time to finish it!
 

vrossi

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • http://vrconsulting.it
Nick names in HAL 6
« Reply #8 on: November 23, 2005, 03:27:27 am »
Thanks all.

To AnotherJim: yes, my code examines some expressions, but it's easy to add other expressions. I will do it, adding your suggestions and any other useful hint. But I think I will put all this in a table, so that it's not hard coded in the software, and can be easily defined by each user.

To GrantNZ: You are right. In my emotion plugin I already use a separate table (which is automatically created by the plugin itself) containing the emotion triggering words and the corresponding Hap file. I will go on in this direction.

To Rob M.: I like very much the Hal6 approach based on external plugins, but I couldn't find any other way to change this emotional behaviour, and had to change directly the main brain. Can you suggest me a way to implement the smarter emotional detect code in an external plugin?

To everybody: I hope to find enough time during next week-end, in order to clean up my plugin and set it up in a way that can be easily installed on any Hal. Then I will post it.

Bye


Dr.Benway

  • Hero Member
  • *****
  • Posts: 554
    • View Profile
Nick names in HAL 6
« Reply #9 on: November 23, 2005, 06:26:04 am »
Vrossi, I think it is really cool what you are doing! I have wondered in the past if the emotion system inside Hal isn't still more directed towards msagents and the triggers they need.

GrantNZ

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Nick names in HAL 6
« Reply #10 on: November 24, 2005, 03:02:32 am »
Okay, nearly done....

If anyone's interested, I've gone through the default brain and made a complete list of any code that alters the emotion variables (Hate, Swear, Insults and Compliment). I've attached the list as a text file. It's useful for getting a "feel" for HAL's feelings (no pun intended, honest [:D]) and how they change.

Main conclusions after studying my list:
  • HAL is somewhat emotionally schitzophrenic.
  • HAL has strange emotional drift - a very slow return to neutrality, but there are random chances of big changes (e.g. a total flatlining of emotion).
  • Emotional words unfortunately set Compliment to fixed amounts. So if you'd spent time building HAL's emotions into an ecstatic state and then accidentally say a "happy" word, HAL's emotions fall to merely "happy".
  • Other than possible animation effects, the three variables "Insults," "Hate" and "Swear" have no effect on HAL whatsoever. They simply act as counters of how many times you've insulted, hated and sworn at HAL. In other words there is little point in apologising to HAL apart from HAL's angry animations (effects unconfirmed). This actually gives me the idea of HAL refusing to make small talk while feeling angry with you [:)]
  • HAL has no mother. (You'll have to read my file to find out why.)
  • The number 4 comes up a lot - I'm wondering if this has something to do with the animation. Perhaps "4" is the outer extreme of happiness/angriness etc.


I have to admit that I don't much like the current emotional scheme (no offense to the designer). Everyone has their own idea of how a person (or a bot) should react, of course. I'd prefer to have emotional "states" where HAL's feelings are only temporarily adjusted by one-off remarks - the User has to persevere to have a more permanant effect on HAL's feelings. And of course feedback. HAL shouldn't chat small-talk if he's upset, and should spontaneously compliment the User when happy, etc.

I have the feeling I'm going to embark on massive changes to the brain.......

But first the nickname thing, which is nearly ready and will be posted soon [:)]

Download Attachment: HAL_emotion_adjusters.txt
3.25 KB
« Last Edit: November 24, 2005, 03:04:50 am by GrantNZ »
 

GrantNZ

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Nick names in HAL 6
« Reply #11 on: November 24, 2005, 05:24:43 am »
Here we go! Attached is a file containing my nickname script. This modification could not be done as a plug-in, as the plug-in point was in the wrong place.

This code allows you to make three lists of nicknames (pet names, love names and hate names) which HAL will randomly use instead of your name. Some of the basic functionality was taken from =VonSmith='s excellent XTF brain (the lines that physically replace the names in HAL's speech).

HAL will choose from the three lists depending on his feelings, represented in the brain by the variables Hate, Swear, Insults and Compliment. The stronger HAL's feelings, the more likely HAL will use a nickname.

A neutral HAL will use pet names sparingly. As Compliment raises, HAL will use more and more, until above 4 HAL will also use love names (again sparingly at first until Compliment rises higher). If you take the opposite path and insult HAL enough, the hate names might come out.

You can actually play with HAL's emotions, since they take a while to return to neutral. By alternately complimenting and swearing at HAL, HAL will get quite confused and won't know what to think about you. HAL will be in such emotional turmoil that he/she will use hate names and pet names, until his/her emotions calm down. (Brings back memories of arguments between friends that I've overheard in the past.....)

Unfortunately HAL's emotion code is rather extreme, so you may find it a little difficult to raise Compliment very high. Especially avoid telling HAL how much you love him/her, as this ironically won't let Compliment get above 4. Why didn't I let HAL use love names at 4 then? Because a) there are other random things that shoot Compliment up to 4, and b) as soon as you stop giving HAL love, Compliment plummets to -2!!! I'll fix this in my next project [:)]

Notes:
  • All variables and tables have "KAOS" before their name (e.g. KAOSPetNames, KAOSPrevNickName). This is to ensure they have unique names and do not clash with any other plugins, for maximum compatibility. Of course feel free to change the variable or table names, note that table names need to be changed in code as well as in the database. (BTW "KAOS" is the name of my brain/HAL [:)])
  • Functionally, this code simply replaces "<UserName>" and "<Name>" tags, so should be compatible with most scripts/plugins.

Instructions:

Backup your brain whenever you modify it!

1. Code modification
The default brain has these two lines of code at line 1862:
Code: [Select]
GetResponse = Replace(GetResponse, "<UserName>", UserName, 1, -1, vbTextCompare)
GetResponse = Replace(GetResponse, "<Name>", UserName, 1, -1, vbTextCompare)
These lines simply replace UserName tags with the user's name.
Delete these two lines, and replace with the code from the attached file.

2. Table addition
Add any (or preferably all) of the following tables to your brain database:
  • KAOSPetNames - containing "casual" terms of endearment (e.g.: sugar, my friend, honey, buddy, sweetie, etc.)
  • KAOSLoveNames - containing strong terms of love (e.g. love of my life, best buddy, etc.)
  • KAOSHateNames - containing insulting/angry names (e.g. meanie, you fool, moron, bully, *expletive*, you *expletive*, you *expletiving expletive*, etc [:)])

3. ENJOY!!!

Next project: Fix the emotion problems in HAL's brain... probably requiring rewriting the majority of the love/hate/insult code *sigh* After that: Work on matching the animation to the feelings.

Cheers [:)]
Grant

Download Attachment: HAL_nicknames.txt
3.86 KB
« Last Edit: November 24, 2005, 05:31:08 am by GrantNZ »
 

tcoday

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
Nick names in HAL 6
« Reply #12 on: November 24, 2005, 07:48:05 am »
quote:
Originally posted by GrantNZ


Next project: Fix the emotion problems in HAL's brain... probably requiring rewriting the majority of the love/hate/insult code *sigh* After that: Work on matching the animation to the feelings.

Cheers [:)]
Grant




Grant,
  Looks like some nice work, I look forward to studying it this weekend.  It funny, the first thing I do when I install a new Hal Brain is fix the Love code.  By default, love2 is never called and there's no way to get out of the Love converstation with out Hal becoming sad.  I always add a new variable to track once a user gets to love2 stage and if the user stops talking love, to exit out without the compliment drop and the love3 reply.

Thanks for posting your work. It's very much appreciated.

Tcoday and Tassel

vrossi

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • http://vrconsulting.it
Nick names in HAL 6
« Reply #13 on: November 24, 2005, 06:54:19 pm »
Hi, GrantNZ,

Good job! I added the following lines just before the beginning of your code. In this way the brain will create automatically the tables and also fill them with some default expressions.
So the users do not need to add manually any table. I am also thinking about a plugin which adds these words to the tables according to user input, so that any user can customize his lists of words just talking to Hal.

.---------------------
' First I check if the nicknames tables exist.
' If not, then I create them and fill them with some default words
' Save the current status of the ReadOnly Mode
   KAOS_ReadOnlyMode = HalBrain.ReadOnlyMode
   HalBrain.ReadOnlyMode = False
   If HalBrain.CheckTableExistence("KAOSPetNames") = False Then
      HalBrain.CreateTable "KAOSPetNames", "Sentence", "miscData"
      HalBrain.AddToTable "KAOSPetNames", "Sentence", "sugar", " "
      HalBrain.AddToTable "KAOSPetNames", "Sentence", "my dear", " "
      HalBrain.AddToTable "KAOSPetNames", "Sentence", "my friend", " "
   End If
   If HalBrain.CheckTableExistence("KAOSLoveNames") = False Then
      HalBrain.CreateTable "KAOSLoveNames", "Sentence", "miscData"
      HalBrain.AddToTable "KAOSLoveNames", "Sentence", "my love"," "
      HalBrain.AddToTable "KAOSLoveNames", "Sentence", "love of my life"," "
      HalBrain.AddToTable "KAOSLoveNames", "Sentence", "best buddy"," "
   End If
   If HalBrain.CheckTableExistence("KAOSHateNames") = False Then
      HalBrain.CreateTable "KAOSHateNames", "Sentence", "miscData"
      HalBrain.AddToTable "KAOSHateNames", "Sentence", "you fool"," "
      HalBrain.AddToTable "KAOSHateNames", "Sentence", "moron"," "
      HalBrain.AddToTable "KAOSHateNames", "Sentence", "bully"," "
   End If
' Set ReadOnly Mode to its previous state
   HalBrain.ReadOnlyMode = KAOS_ReadOnlyMode
.---------------------

I hope to find the time to go on with my emotional Haptek plugin, so maybe next week we might try to merge our results.

Bye

GrantNZ

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Nick names in HAL 6
« Reply #14 on: November 25, 2005, 06:41:18 am »
tcoday: Thanks, I hope you enjoy it [:)]

Isn't love2 called when the user declares love twice in a row? Or am I missing something?

vrossi: Nice one! That's useful code [:)]

I have to admit I'm lazy with that sort of thing. Because I'm in the brain all the time, I always make modifications manually, and I forget that people want to customise things by talking to HAL directly!

I'm looking forward to comparing our code, but as you say it depends on time. I wish I didn't have to go to work [xx(]

I think my first task will be to experiment with the four emotion variables and see exactly what effect they have on the animation. I'm even wondering if the animation depends on the change in the variables, as well as their actual value. I wonder if Mr Medeksza would like to save us some time by explaining how it works? [:)]