21 Dec, 2012, arendjr wrote in the 1st comment:
Votes: 0
Hey all,

For my MUD I want to have NPCs to have semi-intelligent dialogs and conversations. I want them to remember what I said to them and what they said to me before, so that they don't repeat the same dull replies over and over. I want to have them have conversations amongst themselves, and to have them spontaneously talk to me about whatever is going on lately, etc..

Of course I can code a lot of this using triggers and scripts, but it would be better to have some decent "dialog editor" so that builders can easily add "conversation content".

How do other MUDs handle such situations? Any good solutions out there? Examples of other implementations? Other good ideas? I would like to know :)

Cheers!
Arend jr.
21 Dec, 2012, Rarva.Riendf wrote in the 2nd comment:
Votes: 0
What is the gameplay goal ?
21 Dec, 2012, arendjr wrote in the 3rd comment:
Votes: 0
The goal is create an immersive, personal, lively and believable setting. In a sense, the NPCs will give the builders a key mechanism of storytelling towards the players.

For example, if a new player enters the world, he will start exploring and get a lot of background information about the game, as well as get updates about what is going on by enquiring the NPCs. Note that in our setting, the players will actually take the role of soldiers who will be protecting and defending the world which is initially occupied by a lot of NPCs. Having those NPCs behave in a more realistic way and showing some active behavior should help to get players accustomed to their role.

Does that make sense? :)
21 Dec, 2012, Rarva.Riendf wrote in the 4th comment:
Votes: 0
I see a flaw right away:mass murders of your npcs…it WILL happen. (and then you understand why all you want them to be is pretty much useless)
21 Dec, 2012, arendjr wrote in the 5th comment:
Votes: 0
Hehe, very good point, thanks :)

Fortunately I think it will be possible to find some solution to that. The soldiers are actually clones which are the result from a cloning program of the humans. (If you think about it, it's actually a role-swap, the NPCs are the "real" humans, and the players are the clones, cloned for the purpose of defending the humans). Given that the players are cloned and thus also lower in rank than the humans, there can be some safety mechanism built in there. Storywise, there can be a very interesting twist when a clone starts murdering humans. As long as the situation can be contained to prevent someone from murdering all (or just too many) NPCs we'll be alright :)
21 Dec, 2012, quixadhal wrote in the 6th comment:
Votes: 0
In an LpMUD, the NPC object will typically have a dialog tree with various things for it to say, and responses that are "valid" for that point in the tree. When a player interacts with the NPC, the data about what choices they've made and what step they're at usually gets saved in the player object itself. You could put it in the NPC object, but then the NPC's data space will grow huge over time with players who aren't playing any more.

Of course, all LpMUD's are different, so while one may have a dialog system coded in that you can inherit, others may require the builder to come up with their own way of doing that.

One simple implementation would just be a mapping that holds data for each step, including things to watch for in the tell/say/etc messages it sees. It's basically the same thing as a quest system, except the dialog isn't necessarily aimed at sending the player off to do something.
21 Dec, 2012, KaVir wrote in the 7th comment:
Votes: 0
arendjr said:
How do other MUDs handle such situations?

Generally speaking they don't, or else they provide something minimal. A little conversation is okay, but too much can become spammy and detract from the gameplay.

You might find this thread of interest.
21 Dec, 2012, Ssolvarain wrote in the 8th comment:
Votes: 0
We use a 'talk' command to converse with mobs. It's basically just a trigger, but using variables and a little randomization, we can come up with a few different lines of conversation. Nothing very deep or realistic, though.
21 Dec, 2012, Dean wrote in the 9th comment:
Votes: 0
Ssolvarain said:
We use a 'talk' command to converse with mobs. It's basically just a trigger, but using variables and a little randomization, we can come up with a few different lines of conversation. Nothing very deep or realistic, though.


I did something similar, though it never really saw widespread use - turns out when you're the only writing dialog and you've gone a tonne of stuff to build, it falls by the way side a bit. Hehe.

@OP - My personal preference would to be have an editor of sorts. Making it easy for your builders to add new content (in any shape or form) is definitely a plus in my books.
22 Dec, 2012, arendjr wrote in the 10th comment:
Votes: 0
Thanks! These responses are really useful.

I was indeed thinking about an editor for a state tree/graph. Not sure exactly what kind of UI would fit yet (I have an HTML5 map editor, so I want to fit it in there).

Saving the state in the player objects sounds like a good idea indeed.

I also agree too much conversation may be spammy, but I think the solution is easy: go somewhere where the NPCs are not. In our game those areas will have rather clear separation. Also my engine supports overhearing conversations from different rooms, something I want to actively use for "leaking" information to players. When the NPCs cannot see you (there's line-of-sight as well) they may talk about stuff you're not intended to hear, whereas if you walk up to them they may quickly abort the subject or switch topic.

I like the AI thread as well. If I'm to build a dialog editor, why not go all the way and build an "AI editor". Probably I'm looking another multi-month project then, but it's an interesting thought :)
22 Dec, 2012, ForgottenMUD wrote in the 11th comment:
Votes: 0
Here is my implementation. I put the script of a dialogue tree in a flat file with a format that is easy for a human to read and edit:

Quote
{Tongues spoken by the NPC}
{Dialogue option number} {NPC text}
{Condition to say dialogue option} {New dialogue number if condition met} {if condition not met} {Possible NPC reaction} {Player text option}


A condition such as having an item or a certain amount of gold, and the new dialogue number is saved.

Here is an NPC (orc guard) from the book "Death in Freeport" which has been released under the Open Game License:



For which I wrote the following script:

Quote
Common;Orc
00 What? What is you doing here? This orc territory.
any;1;n;I am here to meet Captain Scarbelly.;any;0;endtalk,n;Sorry, I didn't know.
01 Captain Scarbelly busy. Go!!!
skill,intimidate,9;3,2;n;[Intimidate] Don't make me hurt you…;any;1;endtalk,n;Sorry, I'm leaving.
02 Haha! You little girl. Not scary. [He pushes you away with a kick.]
any;2;spawn,orc.spawn,orc.endtalk,n;[Fight];any;2;endtalk,n;[Leave]
03 [He calls for the first mate, Aggro, who ducks out of the forecastle, revealing a huge frame.]
any;4;n;Hey, I'm here to talk to the captain about the human Lucius.
04 [Aggro loudly snorts, hawks, and spits while you inquire about Lucius. When you are done, Aggro says,] He was here last week, sniveling for an audience with the captain. I told him the same thing I'm telling you: Sod off! [You notice that the archer in the crow's nest has an arrow nocked. Aggro and the guards are fingering the pommels of their wicked scimitars. They're clearly itching for a fight.]
any;2;teleport,1715;[Fight];any;4;endtalk,n;[Leave]


with skill,intimidate,9 meaning an Intimidate skill check with a difficulty of 9 and teleport,1715 sending the player to room 1715 on the ship.

The player just has to type or click a number. This is what it looks like (screenshot):

http://sites.google.com/site/forgottenmu...
23 Dec, 2012, Idealiad wrote in the 12th comment:
Votes: 0
Wasn't it the Neverwinter Nights editor that had a gui conversation tree editor too? Might get some ideas from that.
26 Dec, 2012, Scandum wrote in the 13th comment:
Votes: 0
My codebase uses something like this:

>greet_prog 100~
if quest (0,4,$n) == 1
say Are you here to AID me $n?
else
if quest (0,4,$n) == 2
if hasobjnum ($n) == 3720
say Yes! I see you have found the stone!
say Now give it to me $n!
emote beams from excitement at you.
else
say You should look high up in the tower for the stone of concealment $n.
endif
endif
if quest (0,4,$n) == 4
cackle
say Good job $n.
say Now do not forget to ask for your REWARD
endif
endif
>rand_prog 10~
mpasound From somewhere nearby you hear a voice scream in agony!
mpecho The Grey Lord cries out in pain and agony!
>speech_prog aid~
mpecho The Grey Lord narrows his eyes and looks at you carefully.
if quest (0,4,$n) == 1
mpecho The Grey Lord sighs in relief.
say I am glad my servant was able to find you. It is not
say possible for you to help me escape, but you can help
say me gain revenge against my captors. The first step
say is to CONCEAL my presence from the recruiters.
else
say The mark of my servant is not upon you. If you have
say helped me in the past, I am sorry that I do not
say remember you. If you are a thief I warn you: if you
say attempt to harm me you will regret it!
endif
>speech_prog conceal~
mpecho The Grey Lord narrows his eyes and examines you again.
if quest (0,4,$n) <= 2
mpmset $n quest 0 4 2
say There was a time when I was the master of this tower and
say of all its contents. Then the thrice damned servants of
say Gaia, Manwe, Ulmo and Demise joined together to strip
say me of my powers.
say As I was captured I managed to hide a powerful Stone of
say Concealment in one of the force cages. Find it and give
say it to me so I can implement the next step of my plan.
else
say Have you been spying on one of my
say helpers? I see no mark upon you. Begone before it is
say too late!
endif
>give_prog I3720~
if quest (0,4,$n) == 2
or quest (0,4,$n) == 1
say At last!
mpecho The Grey Lord utters the words 'dsepmlg'.
mpecho The Stone of Concealment begins to glow brightly!
mpmset $n quest 0 4 3
say Now hurry. Since they cannot detect my presence it
say will be simple to instigate a fight. Tell either of
say the recruiters that:
say The other recruiter set the grey lord free
say Come back to me afterward and I will REWARD you
say handsomely.
else
say At last, the stone!
mpecho The Grey Lord narrows his eyes and examines you.
say You do not have the mark of one of my helpers. Are you
say a spy for Manwe and Hypnos? You will get no information
say from me!
endif
mpjunk i3720
>speech_prog reward~
if quest (0,4,$n) == 4
nod $n
say I am happy enough now to last another 1000 years of this
say torture. Take this rune dagger $n.
say It is weak, but bears the powers of Hypnos, thus will
say help to keep you safe from harm.
mpoload 3721
mpmset $n quest 0 4 5
give I3721 $n
say Now leave me to my torment.
mpjunkperson $n I3719
else
say You have not fulfilled your part of the bargain yet.
endif

Variables are assigned by area with mobs being able to allocate ranges within a 64 bit integer. It's more flexible than a dialogue system, though this has drawbacks as well as it's harder to integrate game mechanics.

Some suggestions: Could add a 'lie' commands so you can lie to NPCs with a bluf check. This would be useful for group quests. Other RPG elements could be included as well, but it'll quickly complicate the system to the extend where builders will use it too inconsequential for it to be useful.
0.0/13