[MUD-Dev] Parlez vous NPC?
Nathan F Yospe
yospe at hawaii.edu
Mon Mar 23 17:39:09 CET 1998
On Fri, 20 Mar 1998, Matt Chatterley wrote:
: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.
Hmm. Interesting. I suppose this would be a good time to point out that, as
the guy that loves his language handling AIs, this makes me blanche. Either
you're going to end up spending many cycles on it, or you're going to have
a pretty lame AI. But... I like a good challenge, so let me at it.
: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).
Just a note: I'd have to handle this clientside... meaning (and I already do
try to do this with spoken text before exporting it) I would be having the
client tokenize all text and send the tokenized form to the server... but I
do send the complete text to all affected clients as well. I'm working on a
method to avoid involving the server in the transfer now. In any case... the
stuff I do is for input only, I haven't tried to stretch my local descriptor
program to the point that it could pose as an entity...
: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)
Mind if I try these myself?
What do you think about the weather? All this snow makes me miserable, how
about you?
I don't have the "what do you think about X?" in my phrase database, sadly.
Maybe I'll add it. Without it... I have [nature query] [action query]
[subject] [verb] [relation] [object] - which parses to "What is the nature
of the query about the action thinking with respect to the weather?" This
obviously needs some work. Perhaps if I shift the weight on "what"... Put
in conjunction... unfortunately, though my parser is great with verb-led
commands, it has a hard time outside of that, even with the newish
extensions. Let's see... It would be able to parse the first half of the
second line... except, perhaps, for the "all this" part. Let me see... no,
the design does allow for a correct parse of "all this"... but unless there
was snow on the ground, it would become confused indeed. In fact, from
memory, I think an AI hooked up similarly to the imput interpreter's query
would respond "All what snow?" Which kind of fits... "How about you?" is
taken correctly, mainly because I wanted to be able to handle "Are you
hurt?" "No. How about you?"... The context is even taken correctly, I think.
Of course, there is nothing in place to determine whether an AI is miserable
due to the snow... *sigh*
: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):
There is value to some of those words. Make sure you at least keep them in
a referenceable form...
: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.
Hmm. I have a lot of words cross referenced to sets...
:The NPC takes each statement, determines the topic of discussion, the
:tone, and any subtopics:
:1. Weather, neutral tone (question), give opinion
Um. Is this universal? Ask an NPC about how their wife is in bed, and they
don't crack you over the head (or alternatively describe in detail (I see
a slew of censored marks coming out of said NPC's mouth) how much better
his wife is than yours...) Mind you, I don't do this either... I've put a
lot of thought into making certain NPCs handled by "headless clients", and
the rest essentially either nonsapient or justified in their stupidity/
inability to communicate (aliens with no language that a PC can ever learn,
Mechanicals, hive minds that use a communication method beyond your ability
to tap into...) ... this is especially attractive because the set of tables
that allow a client to handle input from a player and generate output almost
handle generation of believable conversation. In other words, most _human_
and _humanish_ (meaning close enough to be played by a human player, like
the various available PC species... and I do intend to allow PCs on both
sides of the war eventually) NPCs will be handled by a set of local
stripped-down clients with sleeper codes to keep them from overstimulating
the landscape when not needed, and tasked with fooling players into
thinking that they are just particularly RP-fanatic PCs filling certain
roles... I think I can do it, too, especially if admins animate these people
on a regular basis to throw off predictability, doubly so if I keep behavior
learning feedback on when the admin has usurped control.
: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.
The problem is trying to analyze a statement that is far too vague... now,
when you have the statement preprocessed for meaning (not sentance by
sentance, but the whole lot) and given to the NPC for a response, you lose
the keyword capacity, but gain a much wider base to create an illusion of
original thought. That part is good. But doing it sentance by sentance is
a good way to lose context... my method incurs a potential for
misinterpretation of the whole statement, but it does so in an internally
consistant manner. You won't get the impression that word X threw off the
AI, you would have that sort of (realistic) situation where you were saying
X, and they were hearing Y, and everything you said was taken wrong.
: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?
Again, why make the stimulus-response absolute? If the NPC doesn't grok the
PC's conversation (or if it finds it uninteresting) blowing the PC off is a
good enough response.
The watchmaker glares at you. "What are you blathering about? Are you
going to buy a watch, or aren't you? I haven't time for a discussion
about the weather."
This is, as I see it, a perfectly reasonable response to a topic that had
no meaning to this particular PC. The topic parsed, but didn't actually have
an effect, so it was tossed back as a "go away" message.
: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. :)
The problem with parrots is, they sound like their owners. I'd much rather
NPCs learn from a team of admins that control them than from the unwashed
player-base... Just my 2 copper shillings
--
Nathan F. Yospe - Aimed High, Crashed Hard, In the Hanger, Back Flying Soon
Jr Software Engineer, Textron Systems Division (On loan to Rocketdyne Tech)
(Temporarily on Hold) Student, University of Hawaii at Manoa, Physics Dept.
yospe#hawaii.edu nyospe#premier.mhpcc.af.mil http://www2.hawaii.edu/~yospe/
More information about the mud-dev-archive
mailing list