Parlez vous NPC?
Matt Chatterley
matt at mpc.dyn.ml.org
Sat Mar 21 02:49:08 CET 1998
Richard Woolcock asked me to make a post about something I mentioned as an
offhand comment while dissecting one of the more annoying advertisements
posted to rec.games.mud.admin in some time.
I made an allusion to NPCs capable of conducting semi-coherent
conversations with players, without following predefined patterns, and not
using strictly pre-set responses, but rather, creating their own replies.
Sadly the system I have in practise is neither as advanced as this, nor
functional (I improved it, thus, it doesn't work now), but, this is the
design model to which I am working, and with the exception of the last
point, the system worked. An overview:
The NPC receives a sentence from the player. The method of delivery is
arbitary (I used directed speech, aka: 'say NPC, this is a sentence for
you.' but this could equally be done with a separate command).
The NPC takes this sentence, and performs some basic tests on it,
determining the subject matter, sub-topics, and the overall tone of the
statement. This is the hard part. One simple way to go about it is by the
use of topic and context dictionaries, a sample entry in which might be:
Weather:
Good:
sunshine, dry, warm, pleasant, breezy
Bad:
blustery, cold, showers, snow, blizzard, rain, sleet, hail
Thus, when our NPC is fed the sentence 'What do you think about the
weather? All this snow makes me miserable, how about you?', it dismantles
it into components:
what, do, you, think, about, the, weather (question)
all, this, snow, makes, me, miserable
how, about, you (question)
giving it three statements to deal with. Next we need to remove words
which are of no value to us (for instance 'and', 'the', 'a' and so forth),
leaving us with (writing from the NPCs point of view):
1. (directed at me) think about weather (question)
2. (directed at <player>) snow miserable (statement)
3. (directed at me) about (question)
This incidentally shows up one flaw in the system - simple statement
portions (such as #3 above), are mangled very badly and may no longer be
useful. Anyway, to continue.
The NPC takes each statement, determines the topic of discussion, the
tone, and any subtopics:
1. Weather, neutral tone (question), give opinion
For #2, snow is listed under 'weather: bad:' above thus, and 'miserable'
might appear in a general dictionary of 'overall negative words' thusly:
2. Weather, bad tone (statement), none
3. Indeterminate, neutral (question), give opinion
The precense of 'about' in #1 and #3 as well as 'think' in #1 allow the
NPC to know that it is being asked a question (along with the rather
obvious hint the ? symbol provides), and it is able to determine that it
should give 'its opinion' (definition or determination of this is not
important yet). #2 is more straight forward and provides it with more
information about the situation it is in.
If it groups this information, it has two clear groups:
1. Respond about weather (neutral tone). <Player> sees the weather as bad.
2. Respond (neutral tone).
Since #2 has no subject, but the NPC knows it is attacked to <player>'s
statement about the weather, it can determine that the player really
wants:
Respond about weather (neutral tone). <Player> sees the weather as bad,
respond (neutral tone).
This gives it two responses to make about the weather, which it can
simplify to:
<player> sees the weather as bad, respond (neutral tone).
Since the player applies a negative tone, the NPC can add in the
assumption that the weather really is bad:
The weather is bad. What do I think?
Which leaves us with the big question. How does the NPC respond?
One way is by having an indexed set of responses (so multiple responses
for each tone, within the weather, some generic, some specific, and so
forth). Another is of course to be far more sophisticated and go for the
fully dynamic build. Given that the information the NPC has is 'weather,
bad', can it really build a sentence from a bank of words?
This wordbank would have to be very sophisticated, giving linkages between
words and topics, and so forth - this begins to cause us problems in terms
of the base data required. However, if our miracle NPC knows we are
discussing bad weather (or assumes - either is sufficient for now), it can
tie together a very simple 'test' sentence, and simply reply:
"I think the weather is bad."
That isn't terribly impressive given all this effort, is it?
Mind you, if you begin to construct a suitable databank, and include
methods for the NPC to teach itself, who knows what one could achieve? By
implying that it might teach itself, I really mean creating a very
sophisticated parrot like entity.
"NPC, this snow is horrible, it sucks!"
and later, we receive
NPC: "I think the weather sucks.", because it is able to make the
following connections:
snow -> sucks
horrible -> sucks
There are still a thousand and one problems which I have deliberately not
described (I wanted to put across the system outline in a basic fashion,
plus I'm very tired). The obvious problems are actually amongst the hard
ones to solve, and I await your blowtorches. :)
--
Regards,
-Matt Chatterley
Spod: http://user.super.net.uk/~neddy/spod/spod.html
More information about the mud-dev-archive
mailing list