- Excerpt
VIRTUAL HUMANS:
A Build-It-Yourself Kit
by Peter Plantec
INTRODUCTION
The excerpt, below, is taken from the path breaking new book by Peter
Plantec, Virtual Humans. Just as digital video put filmmaking
into the hands of ordinary people, so Virtual Humans puts computer
animation into the hands of the home hobbyist and small business.
Virtual Humans is a build-it-yourself
kit for creating web-based virtual assistants. This is not pie-in-the-sky
A.I. It's not about *making* smart machines -- it's about *faking*
smart machines. Plantec shows you how to create the *illusion* of conscious
intelligence through careful Q&A scripting and sophisticated facial
expressions. The result is a bot that can guide visitors through your
web site, answering simple questions and collecting information.
The excerpt discusses the two most important tools for creating the illusion
of intelligence: scripting and facial expression. It includes a humorous
scripting failure and a two-scale method for morphing facial expressions.
More information about the book, Virtual Humans, and author Peter
Plantec follows the excerpt. Have fun!
Scripting and Expressions for Virtual Humans
by Peter Plantec
EMULATING EMOTIONS
Many individuals and companies are working on ways to generate face
and body expressions and track them with emotional context. My approach
yields subtle and nonrepeated facial expressions linked to emotionally
correct verbal responses. You won't find my engine on the CD-ROM that
comes with the book, but with this information you can ponder and play
with your own rules when building your own virtual human using the tools
on the CD. Mine is but one approach, which I offer to get you thinking
about how you'd like to handle emotion. If you're a true hacker you might
like to build an engine like this and post it at my web site, http://www.v-people.com,
for others to experiment with.
I use two linked affect engines
to create a flow of mood, attitude, and emotion. (The word "affect" here means emotional context. The root word
is affection -- as in "The child shows flat affect" -- meaning he's not
displaying any emotion.) One engine registers and expresses general mood,
while the other, more fine-tuned engine, measures and expresses instant
situational emotional peaks. Mood is a quality that varies slowly over
time. It's based on a stream of values from a numeric Happy-Sad scale,
averaged over time.
For example, if someone is verbally abusive to our V- person, Dawn, she
can express concern, yet let it roll off her back if she's in a positive
mood. If maltreatment continues for a while, it's going to get her down,
as negative scores accumulate over time. Conversely, a really nice person
might bring her out of a bad mood and have her be all smiles. Plus (+)
values indicate varying levels of happiness, while minus (-) values indicate
sadness. I use an arbitrary range of minus to plus 10. Some user inputs
will have a zero or neutral effect on mood. No single input will have a
large or immediate impact on mood because the input values are averaged
over time.
Situational affect is emotional expression tied to a specific input stream,
and is immediately expressed. It doesn't happen all the time, but if the
V-person is insulted, they need to know it and express shock, disappointment
and/or anger, while giving the user a cutting verbal slice. Such responses
strongly suggest humanness, and they encourage the suspension of disbelief.
Done properly, the instant affect engine detects direct insults, then instructs
both the display (face) engine and the natural language engine how to deal
with it.
Earlier in the book, I indicated
that your menu of responses for any given rule can have several random
choices that can be displayed. But now instead of being randomly selected,
you can use the output from mood and instant affect engines to select
special responses when necessary. The choice depends on mood or instant
affect, whichever is greater. You can set a threshold for instant affect
to kick in. I'd say any input or question that rates over +/- 6 on
any one scale should trigger a response geared to that emotion. For
example, if you get: "I really hate the way you look," it will trigger
the gestalt pattern: "I*you*look*," which has response alternates including:
"Thank you very much."
"I really appreciate that."
"Oh gosh, I'm embarrassed."
"Are you trying to upset me?"
"You really need to get some glasses."
"Oh, thanks."
Because the word "hate" has a high anger value of -9 for Dawn, the instant
engine automatically triggers the response designed for high negative
affect: "Are you trying to upset me?" while sending a surprised/distressed
expression to the 3D real-time face display.
Meanwhile, Dawn's mood determines
her baseline responses to less emotionally-charged inputs. For example,
if she's in a good mood any of the first three responses might be selected
at random. If her mood level drops below an arbitrary threshold that
you set, she'll say: "Oh, thanks," with a slightly depressed
look on her face (the unfelt smile), indicating that she's not buying this.
In fact, as Dawn's mood declines, her overall facial expression takes on
subtle signs of distress or depression, as shown in Figure 1. This
is accomplished by blending-in increasing percentages of different facial
expressions, known as "morph targets." More on morph targets later in the
book.
In Figure 2, you can see another example of facial expressions associated
with mood. Conrad's expressions, as shown here, are entirely the result of
morph blending. You'll be able to do your own experiments with morph blending
using BioVirtual's 3dMeNow Demo included on the CD-ROM.
In
yet another example, Dawn's feeling fine and responds to "How are
you feeling today?" with "I'm well, and you?" -- said with a happy face.
But when she's below mood threshold, she'll respond with, "I've been
better, why do you want to know?" -- said with a slightly depressed face.
In this example I use the A-C (Angry-Calm) scale to determine immediate
affect. But with a little programming skill you can build an engine that
will track several different scales. The use of multiple emotional scales
is discussed later in the book.
BASIC SCRIPTING
Scripting is the creation of gestalt
rules. Be aware that I'm probably the only person on earth who calls
them "gestalt rules." Being a psychologist,
I like to think in psychological terms. When your V-person gets the gist
of a conversation, and responds well, people will start to attribute
all sorts of wisdom to her or him. You'll find that most people have
no idea what's possible in virtual humans, and they'll tend to see much
more than is actually there. It's the art of illusion.
Sylvie: "Hi, I'm Sylvie. What's your name."
Female Guest: "I'm Diane."
Sylvie: "Hello, Diane. It's nice to meet you."
Diane: "What do you think of these parties?"
Sylvie: "I like parties. (pause) Lots of people to play
with."
Diane: "That was a good answer."
Sylvie: "Thank you."
Diane: "How smart are you, Sylvie?"
Sylvie: "I'm not smart enough, but I try to give the
illusion that I'm brilliant. (smile)"
Diane: "Well, you have me fooled."
Sylvie: "Is that a good thing?"
Diane: "I don't know."
Sylvie: "Me either."
Sylvie was equipped with a set of
rules I'd built up over about a year with help from others. She comes
off as quite intelligent and even charming. Fortunately, Diane's questions
matched well with the rules at hand. She took questions from several
people and left most of them feeling that she is much smarter than
she actually is. More than smart, she left people with the impression
that she has "being." One woman in public relations
said that she had chills after her visit with Sylvie.
I have to tell my favorite Sylvie story. Once while demonstrating her
to the press at a meeting near Boston, a woman reporter asked her if she
knew any children's stories. Normally she does, but in my great wisdom,
I'd removed them and added stuff I thought reporters would be more interested
in. To cover the empty space and I put in a few rules that struck me very
late at night. By morning I'd forgotten them.
Reporter: "Do you know any children's stories?"
Sylvie: "Yes, I know a really cool children's story."
The reporter than asked her to tell the story, but Sylvie
couldn't find it.
Sylvie: "I can't find the damn kid's story. Peetie, are you
here?"
Me: "Yes, Sylvie, I'm here."
Sylvie (with an angry look): "Where the hell did you put
the damn kid's story, I can't find it in here."
Me: "It's my fault, Sylvie, I took it out."
Sylvie: "This is embarrassing, Peter. You are such a
naughty boy."
I never suspected this scripting would ever see the light of
day. If I did, the words would have been more politically correct. But
I'm glad she came out with it because the reporters were rolling on the
floor. It was a thousand times better than if she'd actually recited
her little story. An embarrassing moment won the day.
The artistry of personality design is something you can learn. Sometimes
your best stuff will come late at night or after a few beers. It's always
best when you loosen up. You know it's going well when you're having fun.
I taught a young sports writer from The Washington Post the basics
of how to script one evening. He immediately got into the personality of
one female character. Late that night, I noticed he was still scripting
her. The results were wonderful.
For some it will be easier than for others, but with an understanding
of human personality -- that word again -- and a sense of humor, you'll
be able to create a believable personality.
Now that you have an idea of what
a good brain engine must do to fake consciousness, and you've given
up all hope for sapience, you're ready for some actual scripting experience.
Let's move on to the next chapter where we'll meet Mr. Lincoln.
Copyright (c)2004 by Peter Plantec. All rights reserved. Printed
here with permission of the publisher, AMACOM, http://www.amanet.org/books.