NPC speech algorithms
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    mudlab.org Forum Index -> Design
View previous topic :: View next topic  
Author Message
Kjartan



Joined: 13 May 2005
Posts: 110

PostPosted: Fri May 13, 2005 3:56 am    Post subject: NPC speech algorithms Reply with quote

I'm trying to implement something to let players talk to NPCs in english. I am banking on the fact that there are only so many things a player might say: my approach is to have a limited number of "things a player might say" and then spend my effort making a very general parser that can catch every variation of, for example, "where can I buy some food around here?"

Has anybody tried anything like this? Or, maybe someone has a better approach for getting the mobs to look like they're understanding english?

Also, my mud is H&S and I am going to need a pretty good reason for at least some of the players to stop rampaging through town and try to stay on the townsfolks' good sides. This can be done with one-off quest-type things, e.g. "to get this good piece of equipment you have to make the townsfolk of city 1 love you", but that will lead to someone laying off the rampaging for a while, winning the quest, and then rampaging again. I'd like something that was more permanently useful to the player. Any ideas?
Back to top
View user's profile Send private message Visit poster's website
Author Message
eiz



Joined: 11 May 2005
Posts: 152
Location: Florida

PostPosted: Fri May 13, 2005 4:09 am    Post subject: Reply with quote

Quote:

Also, my mud is H&S and I am going to need a pretty good reason for at least some of the players to stop rampaging through town and try to stay on the townsfolks' good sides. This can be done with one-off quest-type things, e.g. "to get this good piece of equipment you have to make the townsfolk of city 1 love you", but that will lead to someone laying off the rampaging for a while, winning the quest, and then rampaging again. I'd like something that was more permanently useful to the player. Any ideas?


Well the basic idea here is that the NPC needs to have something that the player wants. Player wants nice equipment, player does quest to make townfolk love him. It doesn't just have to be a quest objective, though, it can really be anything that has some kind of value. For example, a powerful mage might reserve the good stuff for people they like, shopkeepers might prefer them, would-be soldiers might want to join their Army of Darkness, whatever. Of course this is assuming some kind of reputation system to which NPC conversations are only one of many possible inputs. I think it would be cool if you made Townsfolk of City 1 super mad and they came and lynched you.

Information retrieval seems a bit more problematic in terms of keeping mob conversation useful. You're only really going to need to ask where to buy food once. However, it could be integrated into more dynamic systems - a lot of muds, for example, have simple autoquest systems which could benefit from this, perhaps taking on a bit more of an investigative slant than the straightforward 'kill some guys' quests that are ubiquitous. Of course, I have no idea if it's feasible to pull something so complex off believably. Richard Bartle has some articles on Notes from the Dawn of Time which cover similar subject matter. In his case, he uses a planning agent in order to construct interesting quests on the fly.
Back to top
View user's profile Send private message Visit poster's website
Author Message
HaiWolfe



Joined: 13 May 2005
Posts: 15
Location: Boston

PostPosted: Fri May 13, 2005 4:09 am    Post subject: Reply with quote

This reminded me of the chat bots currently out there, some of which can do a passable imitation of human conversation. I don't know how well such a thing could be integrated into a MUD, though.

One way to discourage town rampages, besides having tough law enforcement NPCs, would be a sort of "reputation" system in which players who regularly kill townsfolk quickly become pariahs -- shopkeepers refuse to trade with them and the like. Not an original idea, as I'm certain I've read about it before, but it could be a good deterrant.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Author Message
Molly O'Hara



Joined: 11 May 2005
Posts: 99
Location: Sweden

PostPosted: Fri May 13, 2005 8:14 am    Post subject: Reply with quote

What we have done in some larger quests is to set a speech script on several townspeople, to respond differently to a pretty large number of keywords. For example, if the backstory is that King Whatsit is dead, and that his son Prince Whosit is innocently accused of the murder by the evil Wizard Badguy, the scripts are set to give 5-10 different random replies to each of these keywords.

For instance if the player says something that contains the keywords 'Wizard' or 'Badguy', they would usually just respond with something adding a bit of atmosphere, but not very useful, like for instance
%self.name% shudders and whispers, 'Are you mad? Don't mention that person loud, there are spies everywhere!'
But in 10 percent of the cases they would actually drop some information that could be useful for the questor, like where the prince is held captive, or the name of the old wetnurse, who might have some more information.

Setting up scripts like this requires some effort from the builder's side, but they work pretty well, and make the mobs appear at least semi intelligent. The system can easily be adapted for the use you wanted, and you can also make sure that the mob answers in different ways the first and second time it meets the player, by setting a flag on whoever triggers the script.

One word of warning however, these types of scripts can easily get a bit spammy especially in a city with many roaming mobs, so be careful which mobs you set them on.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Author Message
KaVir



Joined: 11 May 2005
Posts: 565
Location: Munich

PostPosted: Fri May 13, 2005 8:47 am    Post subject: Reply with quote

Quote:
I'm trying to implement something to let players talk to NPCs in english. I am banking on the fact that there are only so many things a player might say: my approach is to have a limited number of "things a player might say" and then spend my effort making a very general parser that can catch every variation of, for example, "where can I buy some food around here?"


Several years ago I took a bot which had been designed for a MOO (I think), made some minor changes to it, and set it loose on my Diku derivative. It actually connected to the mud and logged in, so I had to create a character for it first, but it worked fairly well. As Molly points out, it did get a bit spammy sometimes, but I think it really depends on how many such mobs there are any how talkative they are.

Personally I think I'd be tempted to avoid "nonsense talk", and have the majority of their speech geared towards functional responses. Chatting to a mob about what he did last night is amusing for a while, but it's really just a novelty factor which even RPers are going to get bored of pretty quickly - it'd be far more useful IMO to have the mobs focus on useful information such as "Where does the dragon live?". I'd also be tempted to highlight keywords, so that the player can follow-up appropriately rather than having to keep trying to guess what things to ask - in other words, treat the mobs as an "IC" equivilent of help files.

Quote:
Also, my mud is H&S and I am going to need a pretty good reason for at least some of the players to stop rampaging through town and try to stay on the townsfolks' good sides. This can be done with one-off quest-type things, e.g. "to get this good piece of equipment you have to make the townsfolk of city 1 love you", but that will lead to someone laying off the rampaging for a while, winning the quest, and then rampaging again. I'd like something that was more permanently useful to the player. Any ideas?


Off the top of my head...how about removing exp rewards for killing townfolk, and assign each PC a 'popularity' rating which goes up for completing missions for the townfolk and goes down for killing townfolk. You could then use that rating to determine the prices of everything in the shops (assuming those shops are necessary for certain purchases). If a PC's popularity goes low enough, you could make the shops refuse to sell anything at all until they "pay off their arrears".

The shopkeeper mutters "This is a local shop, for local people. We won't have any trouble here..."
Back to top
View user's profile Send private message Visit poster's website
Author Message
Alayla



Joined: 11 May 2005
Posts: 88
Location: Prague

PostPosted: Fri May 13, 2005 1:06 pm    Post subject: Reply with quote

Quote:
I'd also be tempted to highlight keywords, so that the player can follow-up appropriately rather than having to keep trying to guess what things to ask


I'd hate that. While it seems like it would make conversation less annoying, the opposite is true. I remember when the Exile (a rather nice indie RPG) game introduced something similar for their sequel - you were able to click on the keywords instead of trying to figure them out. It no longer felt like a conversation, just midnless clicking through a text. A well-written NPC conversation is a puzzle in language structure. By highlighting the keywords, you eliminate that puzzle and gain only a tedious task for the player, typing in all the highlighted words. You might just as well tell them everything right away.

I stumbled across an interesting link related to NPC conversation when I was wading through my bookmarks yesterday.

Quote:
The shopkeeper mutters "This is a local shop, for local people. We won't have any trouble here..."


You should make that your signature for this forum. *grin*
Back to top
View user's profile Send private message Visit poster's website
Author Message
KaVir



Joined: 11 May 2005
Posts: 565
Location: Munich

PostPosted: Fri May 13, 2005 1:30 pm    Post subject: Reply with quote

Quote:
A well-written NPC conversation is a puzzle in language structure.


The problem is it's not one with clearly defined rules, and the guessing game can get really infuriating. If you want to involve a puzzle then IMO you'd be better off combining it with some sort of social combat like I mentioned in the other thread. Make the player convince the mob to spill the beans.

Actually that's probably a more appropriate than having the mob just tell their story to anyone who asks, anyway. Try walking up to someone on the street and asking them to tell you about X, and they'd probably give you a strange look then ignore you, or tell you to get lost. It'd be far easier to get mobs to act like that Wink

Bubba the newbie has connected.

A citizen walks in from the east.

Bubba says to the citizen, 'Where should I go?'.

The citizen glares at the Bubba and says, 'To hell'.

The citizen walks off to the west.
Back to top
View user's profile Send private message Visit poster's website
Author Message
Falconer



Joined: 11 May 2005
Posts: 16
Location: Paris

PostPosted: Fri May 13, 2005 1:44 pm    Post subject: Reply with quote

Quote:
Also, my mud is H&S and I am going to need a pretty good reason for at least some of the players to stop rampaging through town and try to stay on the townsfolks' good sides.


Law enforcement NPCs are the best method to stop PCs from slaughtering the innocents of a town. Properly implemented, it certainly wouldn't stop all combat/murder scenarios within the city limits, but would make any attack on NPC shopkeepers or citizens much more difficult to pull off. H/S and RP players alike enjoy strategy, tactics and intrigue - the more that's added, the better.

That said, the prestige and talker systems sound interesting. I'm particularly fond of Molly's design choice of having NPCs reveal information at random intervals to random people. This, of course, can be made much richer by tempering this randomness with a prestige or social rank system.
Back to top
View user's profile Send private message Send e-mail AIM Address
Author Message
Kjartan



Joined: 13 May 2005
Posts: 110

PostPosted: Fri May 13, 2005 1:45 pm    Post subject: Reply with quote

KaVir wrote:
Personally I think I'd be tempted to avoid "nonsense talk", and have the majority of their speech geared towards functional responses. Chatting to a mob about what he did last night is amusing for a while, but it's really just a novelty factor which even RPers are going to get bored of pretty quickly - it'd be far more useful IMO to have the mobs focus on useful information such as "Where does the dragon live?". I'd also be tempted to highlight keywords, so that the player can follow-up appropriately rather than having to keep trying to guess what things to ask - in other words, treat the mobs as an "IC" equivilent of help files.


Yeah, the nonsense talk in AIML is the problem with the A.L.I.C.E. based chatbots, which are sort of a glorified ELIZA afaict. Someone suggested one of these in TMC in response to my post there after we started this forum; it's an interesting read but I'm not sure A.L.I.C.E. would be a good platform for actual parsing of meaningful questions.

I am starting out aiming for the mobs to know stuff that's potentially useful to newbies (like where to buy food, where is a good thing for me to kill, and some tie-in to the help system) and have minimal random babbling. They will mostly just give one response, i.e., player asks, mob answers. After that's working to my satisfaction I would like to add a "start babbling" mode where the mob goes into an appropriate monologue, but such monologues almost need to be written per mob, yuck. Also I have an extensive insult-swapping mode: player insults, mob insults back, repeat.

Although, breaking off into tangential babbling is a great way to cover up a failed parse; that's what A.L.I.C.E. is a master of. If I don't understand what you said but I recognize a few keywords I could start talking about those. Another option I'm thinking of for a failed parse is utter cheating: have the mob page an admin and say "switch into me and take over this conversation please", providing the last few things said. (Admins would have to volunteer for this talking duty).

To minimize the annoyingness of NPC chatter to people who don't want to talk to the mobs, I am putting significant effort into having mobs correctly decide whether you're talking to them. Every talking mob in the room tries to parse everything said by a player, and then unless a mob is the only talking entity there, or you specifically address him, or you were already having a conversation with him, he will assume you mean someone else.

Unfortunately as much as I'd like to put the town mobs off limits or make them otherwise worthless kills, that would necessitate my making at least one new area per town where the newbies could go. Eventually this is probably a good idea - I don't like the fact that all newbies must be mass murderers to advance - but not now. Still that was a good point: maybe I can just ignore the rampaging problem for now and add replacement newbie areas later, then make rampaging useless for everybody.
Back to top
View user's profile Send private message Visit poster's website
Author Message
Alayla



Joined: 11 May 2005
Posts: 88
Location: Prague

PostPosted: Fri May 13, 2005 1:48 pm    Post subject: Reply with quote

KaVir wrote:
Quote:
A well-written NPC conversation is a puzzle in language structure.


The problem is it's not one with clearly defined rules, and the guessing game can get really infuriating.


Granted, it's a freeform puzzle, which is probably more appealing to people who like to rely on intuition (is it a bad thing to have puzzles for different mindsets?). But I wouldn't say there are no rules. It just requires some knowledge of sentence structure and semantics (theme vs. rheme) from the designer. That's also what I meant by "well-written".
Back to top
View user's profile Send private message Visit poster's website
Author Message
Kjartan



Joined: 13 May 2005
Posts: 110

PostPosted: Fri May 13, 2005 1:49 pm    Post subject: Reply with quote

Alayla wrote:
I stumbled across an interesting link related to NPC conversation when I was wading through my bookmarks yesterday.


That's a nice link, thanks. At least at first I am absolutely going to have the problem, mentioned therein, that all conversations are totally player-driven.
Back to top
View user's profile Send private message Visit poster's website
Author Message
Kjartan



Joined: 13 May 2005
Posts: 110

PostPosted: Fri May 13, 2005 1:52 pm    Post subject: Reply with quote

Alayla wrote:
Granted, it's a freeform puzzle, which is probably more appealing to people who like to rely on intuition (is it a bad thing to have puzzles for different mindsets?). But I wouldn't say there are no rules. It just requires some knowledge of sentence structure and semantics (theme vs. rheme) from the designer. That's also what I meant by "well-written".


Such variation is something I found surprisingly easy to add. Below I include an excerpt from my driver file detailing a response:

response 5 It's an item for sale near here.
allows_wildcards floor-item mob-item speaker-item
form You can buy those (at|from) $1
form $1 sells (those|that), I believe
form $1 sells (those|that)
form $1 will sell you (those|one of those|that), if I (remember|recall) [correctly]
form $1 will sell you (those|one of those|that)

This is one of the possible answers to "what is X?". I am randomly pulling one of the "form" lines from the list and then randomly evaluating the (a|b|c) to be either a, b, or c, and randomly evaluating the [a] to be either a or nothing. I think any generated descriptions might also benefit from this sort of thing. With just four or five lines of responses like this you get close to the feel of an actual human being answering you / writing your description.


Last edited by Kjartan on Fri May 13, 2005 3:50 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
Author Message
Alayla



Joined: 11 May 2005
Posts: 88
Location: Prague

PostPosted: Fri May 13, 2005 1:55 pm    Post subject: Reply with quote

Just a quick clarification: What I mainly meant was not syntax variation, but constructing NPC sentences so that the keywords and possible conversation topics become obvious from the sentence structure (that is, making them the theme).
Back to top
View user's profile Send private message Visit poster's website
Author Message
Ashon



Joined: 11 May 2005
Posts: 86
Location: Seattle

PostPosted: Fri May 13, 2005 3:31 pm    Post subject: Reply with quote

KaVir wrote:
Several years ago I took a bot which had been designed for a MOO (I think), made some minor changes to it, and set it loose on my Diku derivative. It actually connected to the mud and logged in, so I had to create a character for it first, but it worked fairly well. As Molly points out, it did get a bit spammy sometimes, but I think it really depends on how many such mobs there are any how talkative they are.


My buddy who works for a company that is working on a fourth generation MMO, is the SDET in charge of Automation. And he was tasked this week with botting the game. This is a perfect fit for him since he loves to write bots. His enjoyment from a game, is not so much the story, or the interaction, but trying to automate the game, and beat the code. PvCode.

So he was talking about how excitied he was about being able to unload his babies on this game as for the stress test (2000+ logged users). And so we got to talking about how he needs to build into the bot, interaction with other bots. And how to simulate actual players instead of how to simulate automated characters. Which led to a discussion on the ALICE bot. We thrashed around some ideas how to contextualize these ALICE bots, more so then the ALICE bot does.

The point comes down to this, I don't think that ALICE and it's context based conversations, are worthwhile to implement as NPC dialogue! You will get the nonsensical dialogue which will prove worthless. It's my gut feeling that the best way to handle most conversations in game for a story driven game is to give attitude based topics. Imagine the Dialogue that you get on most Console based RPG's. You have a menu of options to choose from. If you tie this into the attitude of the NPC vs the Player I think you could get some interesting results. The problem of course being that all meaningful conversations need to be scripted.

Somewhere there has to be a way to cross these systems. Have dialogue that is scriptable, but only comes up in the proper contextual conversation.

I don't know, I guess I'm just spewing forth thoughts.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Author Message
Vilmer



Joined: 13 May 2005
Posts: 5
Location: Kentucky

PostPosted: Fri May 13, 2005 8:20 pm    Post subject: Reply with quote

Ashon wrote:

Somewhere there has to be a way to cross these systems. Have dialogue that is scriptable, but only comes up in the proper contextual conversation.

I don't know, I guess I'm just spewing forth thoughts.


Iím reminded of Chomskyís earlier writings about grammar and language. Scriptable would mean thereís a finite goal, such as finding out a particular piece of information from the mob. Proper contextual conversation I suppose implies itís context sensitive, as apposed to context free. Can a finite goal be placed into a context sensitive field? Maybe, but according to Chomsky it would require having no restrictions at all if you want to cover all unique contexts, of which your automaton would have to implement a Turing machine.

Iím also just spewing forth thoughts, I havenít slept today. Iím going to dream of Chomsky now. Great. Razz
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    mudlab.org Forum Index -> Design All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2002 phpBB Group
BBTech Template by © 2003-04 MDesign