Sign in to follow this  
Cosmic R

rpg dialogue system

Recommended Posts

Cosmic R    159
well it doesnt really matter if its text or graphics. I really need to know how to implement the system. for example:

Orc: "What brings you to Eldarwoods?"
(and you get to choose your answer.)
1. I'm just visiting.
2. I'm not here by choice.
3. I'm here for the beer and the bitches.

and then the Orc reacts depending on your choice - he might say something else, or attack, or whatever. I suppose you could call it a tree. I'm just curious to see how other people have implemented it. I've started out with linked lists, but its getting too complex. I have had no problem creating the linked list, but working with it is something else. Is this the best way to do it?

Share this post


Link to post
Share on other sites
Overseer    162
Graphs with numbered node transitions, maiby even event checks/triggers [like if you are evil aligned, or pay 100 gold toll] on each transition. A highly dynamic conversation machine becomes very complicated, but if you are just providing a list of possible answers, then you can just as easily represent it as a graph with numbered transitions. [that way you can get looping speech, instead of just going from beginning to end]

But event scripting becomes more complicated, especially considering you are going to want to make it easy to write, as opposed to all hard-coded, so some sort of scripting might be in order, [like for the 'attacks you' type of reaction] but you can pre-parse the scripts when you load up the dialog.

Share this post


Link to post
Share on other sites
Quote:
Original post by Cosmic R
well it doesnt really matter if its text or graphics. I really need to know how to implement the system. for example:

Orc: "What brings you to Eldarwoods?"
(and you get to choose your answer.)
1. I'm just visiting.
2. I'm not here by choice.
3. I'm here for the beer and the bitches.

and then the Orc reacts depending on your choice - he might say something else, or attack, or whatever. I suppose you could call it a tree. I'm just curious to see how other people have implemented it. I've started out with linked lists, but its getting too complex. I have had no problem creating the linked list, but working with it is something else. Is this the best way to do it?


Hmmm...well what comes to mind with me is these "Choose your own adventure" books I read when I was younger. Basically, you've got a bunch of different events, and different outcomes based upon what you choose from them. Depending upon how complex you want the outcomes to be, you're gonna have to account for more and more variables. I'm still a n00b myself. But I'd organize it into a tree of sorts...

Share this post


Link to post
Share on other sites
TheFlea    107
I'm a novice and i dont understand very well what u want to say(sorry for my english)
code
if (bla==1)
cout<<"Ok go on";
if (bla==2)
cout<<"adadda";
........

bye bye

Share this post


Link to post
Share on other sites
Endar    668
Do you know what a tree data structure is? If not, log out and go and read up on tree data structures. Search for "binary tree" and that should give you a bunch of links to look at.

A good idea for a tree is to use a tree that has a non-restricted number of children nodes for each node in the tree (eg. a binary tree can only have 2 children for each node, we can have 300,000 if we want).

Here's my idea: The first node (the root node of the tree) has say 3 children. That means that you visit each of those three children and print out the possibilities. Then, whichever one is chosen, you then go down to that node and then you have all the children there, which are the possibilities for responses. You can keep going down. You can also always assign a higher node as the child of a lower node, as I've seen many rpg's where you can click on 3-4 responses all day and keep getting the same response possibilities.

Or something like that.

Share this post


Link to post
Share on other sites
Quote:
Original post by Endar
Do you know what a tree data structure is? If not, log out and go and read up on tree data structures. Search for "binary tree" and that should give you a bunch of links to look at.

A good idea for a tree is to use a tree that has a non-restricted number of children nodes for each node in the tree (eg. a binary tree can only have 2 children for each node, we can have 300,000 if we want).

<snip>
Or something like that.


A tree won't let you do loops - what you describe is a graph, not a tree. Overseer's idea (using a graph with intelligent transitions) is a bit more general than yours.

You may be able to find a C graph library (maybe in glib?). If not then it is not really a problem to do one: you graph node structure contains a list of transition structures. Each transition structure has 2 graph node structure pointers ("from" and "to"), the possible answer - and you can associate a more complex condition to it (using a function pointer for example). Each graph node also store the answer of the questioned guy.

This way, you'll have a very basic dialog system :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this