[MUD-Dev] Parlez vous NPC?
Matt Chatterley
matt at mpc.dyn.ml.org
Wed Mar 25 08:37:21 CET 1998
On Mon, 23 Mar 1998, Nathan F Yospe wrote:
> 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.
Ner. I don't mind spending a fair amount of power on handling this, but of
course, refining it to require less would be favourite. It's proof that I
need to do more reading on language processing, really, but I just haven't
got time until mid-May. :)
> :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...
Interesting. This helps solve some of the problems by the way; if the
client could perform basic parsing (break the text down into the
components that we want to use), it removes most of the initial work from
the server.
> :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 suspect, being you, you're about to point out one of the big problems.
Good! :)
[Snip one very confused parser]
> Of course, there is nothing in place to determine whether an AI is miserable
> due to the snow... *sigh*
Assume that it is familiar with basic question structure (this would have
to go in), and takes:
What do you think about the weather? All this snow makes me miserable, how
about you?
breaks this into two lines, removing the words it doesn't care about, and
then breaks the second at the comma:
what you think about weather?
snow me miserable
how about you?
Then checks for references to itself:
[question to me]: what think about weather
[statement about X]: snow makes me miserable
[question to me]: how about you
It's possible to get this far without confusing it at all (since regular
rules are applied; I'll try to show up a problem in these rules in a
moment by the way). Next, we could have an index of responses by question
type "what..", "how.." and so forth, and also for the second word
("think"). Assume for now this is built in, getting the system to
intelligently add this stuff is next to impossible I think.
[question to me]: what think about weather ->
"I think" +
[weather originally prefixed by the] "the weather is" +
[my opinion on weather] "okay."
It adds in 'okay' because it has no pre-formed opinion - this data would
be collected from conversations it has, or pre-set things (for instance,
we can have defintions of what are bad weather, and adjust NPCs to know
the weather is bad). In the snow example specifically, the NPC can use the
opinions that the player has passed on.
[statement about X]: snow makes me miserable
[for X]: snow -> miserable, snow is weather
[miserable is a negative word]: snow -> bad, weather -> bad
[question to me]: how about you
[question with no subject, retrieve last subject]
[last subject was weather]
"I think" +
[weather originally prefixed by the] "the weather is" +
[my opinion on weather] "bad."
> :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...
Yeah. As above, I realised they'd be needed for some things (at a basic
level, referring to something like 'weather' appropriately).
> :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...
I'm beginning to see that parts of this system will require as much data
as my current implementation, if not more. :)
> :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
Well, we could set subject attitudes by:
Locale -assume this to be the homeplace of the NPC unless otherwise set,
thus determining 'culture', and also from race, gender, age, and then
allow local-level configuration (setting npcs to check a particular file).
This adds up to lots of work to create exceptions to the universal rules,
though.
> 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.
Very nice. :)
> :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.
Yeah. I'm not sure how to address this; perhaps sentences can be handled
in context of the paragraph they come from (and sentence fragments from
the sentence that they belong to). Thus all the way thruogh the original
example the NPC would bear 'weather' in mind, and in a 'snow' sentence it
would bear 'snow' in mind, unless a change of context was detected. Mind
you, its hard to define a change of context here (at least in sentence
fragments; it should be used to create a paragraph break in paragraphs?)
> :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.
This is what I was alluding to, really. NPCs can shrug, they can smile at
you as if you were an idiot, tell you to get the heck out of it, try to
sell things, or redirect you rather forcefully ("Why do you waste my time
so? Leave now lest I be angered!" or "What on earth are you on about? Do
you want to know where the dragon is or not?")
[Snip]
--
Regards,
-Matt Chatterley
Spod: http://user.super.net.uk/~neddy/spod/spod.html
More information about the mud-dev-archive
mailing list