Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


'intelligent' conversations with npc's

This topic is 6964 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Guest Anonymous Poster
Well, I havent done much work like this before, but you could check the input string for defining combinations of letters, e.g.
check string for 'have' and 'candle' would be good, but it would not solve all cases, because the user could put
'do I have a candle in my ear?'

but hopefully you could find a way around the problem...

Share this post

Link to post
Share on other sites
I can't offer any advice, just a word of warning -

NLP routines, even at their best, are FAR from perfect.

I wouldn't be concerned so much with the execution speed of NLPs (presumeably there's nothing else going on in the game when the player's talking to an NPC?)... I'd be more concerned with the *development* speed of the routines.

Off the top of my head this doesn't sound like it'd be worth the cost. I'd seriously reconsider using NLP... there's far better things to spend time developing.

Just MHO.

Mason McCuskey
Spin Studios

Share this post

Link to post
Share on other sites
i am hoping to use the intelligent conversation routines to create depth to the game. i really feel that this is of the utmost importance.

good thing that not much else will be hitting the processor when these routines are taking place

did i forget to mention that i want each npc to also have a pluggable personality module? this personality module could (and will) effect the NLP routines (someone who hates people will certainly be less wordy).

im investigating doing this the "right way" in the hope that in that process i will find middle point that will offer enough functionality to make it into a version one with the plan being to improve upon this part in a version 2 release. with so many parts to a game, it is hard to get all of it up to par (in reference to the original design) in one release. some parts will have to suffer a featurectomy...this maybe (hopefully) will be one of those parts that gets flagged as an "improve in version 2".

i would love to see the following:

PC: "Good morning. I was hoping to ask you a question."

NPC: "Morning?! It is 11:28pm, but anyhow, what did you want to ask me?"

PC: "Do you have any candles for sale?"

NPC: "Yes, but we are closed, it is 11:30 at night afterall. Try coming back again tommorrow morning between 8:00 and 5:00."

long way to that...idea of context within conversation and humour. version 2 maybe

this brings up another question:
when working on a game with so many components, how does one prioritise and organise so as to keep from getting drowned in all of the details? project plan, aye...but that will not make approaching the game any easier. so far ive been able to decide that the graphics engine will come near the end. that leaves quite a bit of things between.


Share this post

Link to post
Share on other sites
Okay, ignore people who say it can't be done or isn't worth doing.
Always aim to take games to the next step, progression is more important than the possibility of failure.

Okay, pep-talk over.

Personally I see the problem being more in the NL generation than the parsing. With parsing you can get the gist of the conversation from selected words and without full grammar. Bascially I think you have to because otherwise you'd have to deal with all the different grammatical systems everyone in the English speaking world(and beyond)uses.
If someone asks about the status of a banana in their ear then, unless they're playing sim-fetish, they're not taking it seriously.

So, language generation, well you can have a series of templates, fairly generic, to express different facts. Describing objects or their costs or their current actions (if an object was, say, an attacking orc) limited by your willingness to type in endless(ish) sentence templates.
Then you could have sets of templates for different NPC groups. Representing the grammar of different social groups.

So what was the method you were considering?

Share this post

Link to post
Share on other sites
I love the idea, and would love to make one myself, but I do not have the drive to go quite that far.

Here is a way that will work very well I believe, unluckly it is very extensive on the programming end.

Basicly we learn how to structure sentences by following a bunch of rules, I believe that most grammar checkers will destructure sentences based on these rules. If I am not incorrect you could program an algorithm to detructure a sentence into the primary noun/s, the primary verb/s and the adj, adv, and prepositions. Then take these, and connect them with the item they describe as you go. This may allow you to deal with more complex sentence structures.

I want to buy a hat.

is changed to

Action: wants
What: hat
Which: unknown
How: buy

change to "I want to buy your hat.", and the which: would be NPC's

( I'd advise talking to someone that programs grammar checkers or such about this type of algorithm, because presently I believe this is the furthest area of computer science in the idea of identifing what someone is trying to say.)

I hope this helps with the first part.

As to putting in different styles of talking, and reactions to what is said. It may be possible to do this to some degree, but beyond having a few types of plugins I believe it would be far too much coding and that it would slow the game down tremendously to be sending every variable in all the talking through an improperly designed plugin.

Sorry but I believe that part is completely beyond me.

Tell the truth and you will never fear someone will figure out you lied.
<<I'm sure I'm quoting someone out there, wish I knew who!>>
David Abresch

Share this post

Link to post
Share on other sites
My preferred way of doing this would be an inversed parser, there is a good article on it from Chris Crawford here:


(Actually, this article is really just a good overview for the topic, but implementation would be heavily dependent on your goals and interface anyway)

Good luck.


[This message has been edited by ghowland (edited September 23, 1999).]

Share this post

Link to post
Share on other sites
I was thinking about this.

Couldn't you do some kind of matching system, where the NPCs are loaded up with strings and responses:

"Someone would like to buy a candle"
'Here is your candle'

The npc text parser would pack this down into some code you would include, but essentially it would only pack

q:"someone buy N candle"
a:"Here [is/are] your candle[s]"

Then when someone types in

"I would like to buy your candle"
"I would like to buy 2 candles"
"I would like to buy a candle from you"
"I would like to buy the candle"

You parse out the 'unimportant' words:

I buy a/your/the/N candle[s]

further parsing would equate a/your/the to 1, and strip off the [s] from candles.

Then you look for

I buy N candle

do a reverse lookup so you first match for candle, then N, then buy, and you filter out

"A would like to have a candle buy my ear"
"Buy a candle from me"
"buy a candle from the man" // its a conversation, not a text adventure game
"Put the candle buy from you in my ear"

and such.

anyways.. symbol tables etc.

Some of the scripting tutorials might give you a good idea on implementing symbol tables.

[This message has been edited by Sphet (edited September 23, 1999).]

Share this post

Link to post
Share on other sites
An inversed parser would actually remove all these problems because you are feeding the user their choices. If you dont want them to use the candle with their ear, you just dont give them that as an option.

It eliminates players having to try to guess proper commands as well, as they can all be laid out in front of them through a list (or icons).


Share this post

Link to post
Share on other sites
i am working on a game which will require that players be able to have conversations with computer controller players via text.

i am looking to make this portion of the game rather powerful (in other words, i would like to allow the input to be simple: "Have Candle" and as complex: "Do you have any candles for sale?").

should i be looking at NLP or something else?
i am afraid that NLP routines in the game will be too resource heavy, however i would rather the immersiveness of conversations with NPCs to be deep, so i would be willing to sacrifice fancy graphics for this functionality.

has anyone else worked with this "conversational functionality" before?


Share this post

Link to post
Share on other sites
Now that we are talking boolean tables and relations, I feel an urge to do a bit of advertising (feel free to skip ):

I happen to be working at a company that produce software to handle extremely large logic systems VERY fast and higly compressed (we're talking billions of combinations represented by a database in the <100K range). There's a few very small (and old) examples on our web-site www.array.dk (Yes I know, it's not pretty - a new one with larger examples will be available soon )...

The system essentially consist of a "compiler" that analyzes the complete set of variables and relations and generate a run-time database that:

1) Is guaranteed to be complete
2) Immediately gives ALL consequences to any stimuli (table-lookup speed).
3) Allow rollback to alternative solutions in case of contradiction (I.e. If you want to apply a selection that is illegal according to the current system state, the run-time system will give a complete list of the changes needed to allow the selection).
4) + a ton of other features

And a run-time part (Java or DLL) that give access to the compiled data base.

The system is defined in a simple declarative text format. Declaring each variable (of types: int, bool, string or interval + structures of these). And the relations (by equations or tables).

If you want to know more, feel free to contact us !!

Sorry for the shameless plug (No I'm not )


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!