How to code sentence components?

im trying to make a game where the npcs can actually have generated conversation via the adaptive prose feature. for instance

A person has some text called greeting. The denial of a person is usually “hello”.
I want to add a better version later, one where sentences are broken down by word as well as possibilities for what could be next. also possibly some banned grammar list to prevent incorrect responses like “That is that that what” or smth

1 Like

Conversation with NPCs is a difficult topic with a number of different approaches. I’d start with a well-known extension before trying to cook something up yourself (see below).

One thing that is definitely beyond the abilities of any interactive fiction system is what I think you are talking about – generating responses word-by-word. We’ll see what happens in the future with LLMs and other AI systems, but right now it’s just not possible.

Anyway, here are some extensions you might try:

Can anyone recommend other extensions?

2 Likes

If you somehow found the source code for The Mary Jane of Tomorrow, that would be the best possible; that has amazing procedural generation.

I did some very basic procedural generation in Grooverland:

A person has some text called the exclamation.

A person has some text called the congratulation.

Table of Procedural Responses
speaker	congratulation	exclamation	apology	honestly	think
gate guard	"congratulations"	"oh"	"sorry"	"to tell the truth"	"I think"
sausage seller	"I'm impressed"	"ah"	"sorry"	"well"	"I think"
ceviche chef	"very nice"	"oh my"	"my apologies"	"to be honest"	"I believe"
jelly man	"good for you"	"ah ha"	"I'm sorry"	"I'll be honest"	"It seems to me"
David	"good job"	"wow"	"sorry"	"you know"	"I think"
chief engineer	"impressive"	"oh"	"well, I'm sorry"	"well"	"I believe"
dad	"amazing work"	"oh wow"	"sorry"	"honestly"	"I think"
alice	"I'm proud of you"	"nice"	"sorry"	"I have to say"	"I'm pretty sure"
snack attendant	"not too bad"	"oh"	"unfortunately"	"to tell the truth"	"I believe"
mom	"good work"	"ah"	"sorry"	"to tell the truth"	"I think"
shop clerk	"cool"	"huh"	"I'm sorry"	"honestly"	"I think"
zookeeper	"very good"	"well"	"sorry"	"I'll tell you"	"I believe"
menagerieper	"very good"	"oh my"	"my apologies"	"i'll tell you the truth"	"I believe"
creaky singer	"goodness"	"oh my"	"my deepest apologies"	"i have to say"	"As far as I know,"
dance instructor	"congratulations"	"ah"	"my condolences"	"in all honesty"	"In my opinion,"
morgan the mechanical	"congratulations"	"wow"	"I am sorry"	"honestly"	"To the best of my knowledge"


Table of Additional Procedural Responses
speaker	great	well	because	many
gate guard	"great"	"Well,"	"because"	"quite a few"
sausage seller	"very good"	"You see,"	"because"	"a lot"
ceviche chef	"lovely"	"It seems that"	"due to the fact that"	"many"
jelly man	"wonderful"	"Well my friend,"	"because, you see,"	"quite a few"
David	"awesome"	"You know,"	"because"	"a bunch"
chief engineer	"impressive"	"See,"	"since"	"a lot"
dad	"great"	"Well, kid,"	"since"	"a lot"
alice	"pretty nice"	"Well,"	"because"	"a lot"
snack attendant	"very good"	"Hmmm,"	"since"	"a lot"
mom	"very good"	"Well,"	"because"	"a lot"
shop clerk	"nice"	"Huh, I guess"	"because"	"a lot"
zookeeper	"very good"	"Well,"	"because, well,"	"many"
menagerieper	"very good"	"Well,"	"due to the fact that"	"quite a few"
creaky singer	"excellent"	"Indeed,"	"because, child,"	"quite a few"
dance instructor	"excellent"	"Yes,"	"due to the fact that"	"very many"
morgan the mechanical	"very good"	"Well,"	"because"	"a lot"

Spike is a man. Spike is not changy. Understand "inspector" or "park inspector" as spike.

Instead of interrogating a changy person about spike:
	choose row with a speaker of noun in the table of procedural responses;
	say "'[Exclamation entry in sentence case]! [Apology entry in sentence case], we don't talk about Spike,' says [the noun]. 'Just pretend you didn't see him.'"

Instead of interrogating a talkfamilial about spike:
	choose row with a speaker of noun in the table of procedural responses;
	say "'[Honestly entry in sentence case], I saw him earlier and he looked dangerous. Don't let him try to teach you advanced math,' says [the noun]."

etc. etc.

It worked but three different reviewers mentioned weakness and vagueness in the prose and/or dialogue, so this kind of generation isn’t wowing anybody.

I just remembered that Emily Short does have some publicly available procedural code with her room in Cragen manor, available here. It includes stuff like:

 
After informing the ES-blocker about something:
if the second noun is an ES-item listed in the Table of ES Conversation Topics:
say "[ES-speech-tag]'I know things about [the second noun] that [one of]you would find [Table of ES Inscrutable word][or]you could only dream of[at random][es-dot]'[line break]" instead;
say "[The ES-blocker] [one of]suggests[or]requests[or]recommends[or]requires[or]demands[stopping] you cease your [Table of ES Gibbering word]." instead.

and later on stuff like:

Table of ES C Interpretations
key    explanation
"cadaver"    "The deceased has borne enough"
"cadaverous"    "Dead things are a warning to the living"
"cake"    "Cake indicates that you need to learn to share and allocate your workload instead of trying to do everything yourself"
"calamari"    "Calamari indicates that you are feeling battered or beaten"
"canvas"    "Canvas [es-indicates] possibilities, especially if the canvas is blank"
"cat"    "Who knows the thoughts of a cat"
"cellar"    "The cellar is the next thing to a crypt"
"cemetery"    "To think that you are in a cemetery [es-indicates] an end to a habit or behavior"
"ceramic"    "Ceramic things may be broken"
"chair"    "Those who sit may never stand again"
"chalice"    "A chalice may be poisoned"
"chamomile"    "Chamomile is the beverage of inaction and delay"
"chapel"    "The chapel is a place of ritual"
"charnel"    "Charnel [es-indicates] the grave's breath"
"cheap"    "To think something is cheap [es-indicates] your own feelings of inadequacy"
"cheese"    "Cheese [es-indicates] gains and profits"
"chess"    "Chess [es-indicates] that you need to carefully think through the situation before making a decision"
"china"    "China is fragile"
"christmas"    "There is no Christmas here"
"clock"    "A clock [es-indicates] the short time remaining"
"closed"    "What is closed can reopen, and at the most inconvenient time"
"coal"    "Coal paints the sky itself black with soot"
"cobweb"    "To see cobwebs [es-indicates] that you have not reached your full potential"
"comprehension"    "You understand less than the smallest fragment of the world"
"cyan"    "Cyan is the [Table of ES Shade Words word] of cadaverous lips"
"cyanotic"    "That which is cyanotic is near death"
"cyclopean"    "Here is a thing that has been here since before humans walked the earth"
"cypress"    "A cypress tree [es-indicates] death, the underworld, and the subconscious"
3 Likes