Jump to content
  • Advertisement
Sign in to follow this  
Josheir

C++ Interactive Conversation On Character Visit, Help Please.

Recommended Posts

I am writing a text message box tool.  The program takes a string and wraps it onto a colored rectangle.  I am trying to understand how to program a game later.  I need some sort of idea that keeps track of the conversation when there can also be more than two members in the conversation.  A member of the conversation is a 2D image of a character at a particular x and y location that displays text depending on if the other interacting characters have been visited.  I  am running into problems because any member of the conversation can also display a yes or no question.  The yes or no question can be answered so it can create two new paths for each character.  If there was only one character to use a "yes or no" question than I was thinking a tree would work nicely that would also hold the text for the other character text conversations.  However, there are more than one of these and  I am trying to keep track of all the interactive conversations.

 

Best Regards; Thank You,

Josheir

 

 

 

Edited by Josheir

Share this post


Link to post
Share on other sites
Advertisement

You can still do this with a tree. Each "level" or "ply" of the tree represents one person in the conversation taking a turn speaking. A simple conversation would have each ply alternate between Person A and then Person B speaking, for example.

Share this post


Link to post
Share on other sites

That's what I needed, it looked like a tree to me so now I am understanding well.  A quick question, is there a method to writing a conversation that is interactive by visiting one of the characters locations as described above but using multi-dimensional arrays?  If there is, perhaps another quick explanation / demonstration.

Thank You,

Josheir

 

Share this post


Link to post
Share on other sites

It is technically possible to store certain forms of trees inside a flat one-dimensional array, but I'm not sure if that's what you're looking for. The closest thing I can think of that would use a multi-dimensional array would be to store a 2D array of Boolean values. Each "cell" in the 2D array is a location in the world. If a cell has a True value, then the character at that location has been visited. Otherwise, there is either nobody there, or the person there has not been talked to.

Does that sound like the direction you're wanting to go?

Share this post


Link to post
Share on other sites

ApochPiQ, I'm having a lot of trouble with this idea on how to make the whole form elegant.  I wrote the code for this problem years ago and it wasn't really graceful.  I used a variable to determine the level of the conversation (which conversation was   active ) and than a bunch of if-thens with flags to determine what to be printing out.  It was longwinded and sometimes waited for a response from keypress for yes/no to determine more flags.  There were flags for determining if the space of the character had been left and revisited.  A lot of if-thens and flags.  For example, do you have the item yet for a different text displayed.  Or, if you have visited a certain character before you have visited the current character.  The idea was that all the levels were in one huge loop.  There was a check for location, and than a lot of if than else to determine the correct text display.    

 

There has got to be an easy way is what I was thinking and wanted to rewrite it.  So I thought of the tree, but really I don't understand it to well.  I'm thinking maybe there is a variable with an if-then for determining if the tree should be traversed compared to a current variable.  Thinking about it this would probably be more complicated than what I had.  And if I needed to reverse the traverse backwards it could get complicated.

 

I did read a book that had a program of similar complexity (much shorter though) and the book noted the program  as being simple.  I am looking for a solution that is efficient, really.  What do you recommend?  Instead of being so long and spread out I want it more functional or something like that.

 

The main problem with the program was the function was very long that contained this.  Also, there were so many flags that it got confusing.   And It is difficult to debug.  And like I said, so many if-thens. 

 

Thank you for your time; I am curious about your recommendation,

 

Josheir

 

 

Share this post


Link to post
Share on other sites
On ‎12‎/‎4‎/‎2017 at 12:00 PM, ApochPiQ said:

You can still do this with a tree. Each "level" or "ply" of the tree represents one person in the conversation taking a turn speaking. A simple conversation would have each ply alternate between Person A and then Person B speaking, for example.

I just finished studying the tree.  I concluded the theory and wrote up all the pseudo-code / charts.  I wanted to thank you for your help!  As time allows (which it should,) I look forward to a quick study in the sorting/inserting/and deleting of the binary tree and than on to hashes.  Once again, thank you : ApochPiQ, and may you all have happy holidays!

Happily,

Josheir 

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  

  • 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!