Advertisement

OOD in an RPG - Dialogs & UI

Started by March 04, 2005 04:30 PM
1 comment, last by Radagar 19 years, 11 months ago
I'm working on the design for an ongoing RPG, and I'm just not very good at Object-Oriented design. Right now I'm working on how my GUI will work - specifically with NPC conversations. I'm planning on keeping a std::vector list of Dialog objects. As more dialogs are needed on the screen they'll be added to to list, etc. When the drawing loop runs for the game engine, it will go through the list of dialogs and draw whichever ones are active at the time. If the Engine is in it's DIALOG gamestate it will accept input related to the last DIALOG drawn. I also have an NPC class that will contain a pointer to whatever function should run when conversation happens with this NPC object. I know of a couple ways that I could make this work, but none of them seem real clean or extentible. At this point I'm kinda lost in my own designs and not sure where to go from here. Can I get some suggestions on this? If you were building an RPG, How woud you design your NPC Conversation system and GUI system? Any links to any tutorials on this subject? Thanks,
WyrmSlayer RPG - In Early Development
Quote:

I'm planning on keeping a std::vector list of Dialog objects. As more dialogs are needed on the screen they'll be added to to list, etc. When the drawing loop runs for the game engine, it will go through the list of dialogs and draw whichever ones are active at the time. If the Engine is in it's DIALOG gamestate it will accept input related to the last DIALOG drawn.


I assume the reason you're using vector is that you want multiple text boxes on the screen simultaniously, if not then you don't need it. Either way you can use the same approach. First thing you need to do is seperate your classes having to much interclass dependicany is a bad things.

For classes I would recomand have the following:
Conversation
TextBox
Actor
Script


Conversation will handle the actual mechanics of running a conversation it will have a list of all actors involved and the current points in their scripts they are at.

TextBox handles all the text rendering, Convestation will call it using a method like:
show(string text)
Which renders the given text to the screen in the text box.

Actor is your npc class it is in no way connected to Conversation or TextBox, it has an istance of script which represents all the dialog that actor can say in the game.

Script hold all the dialog an npc can say, it should be organized in way that makes it easy to for an external class - in this case Conversation - to access the desired dialog in the script and follow along with the script in the correct mannor. You'll probably want some method of storing and accesses dialog based one acts, scenes, and lines for plot specific conversation and a generic catagory organized in a similar way for generic banter. You can and should also consider using a many to one relationship between actors and scripts. Meaning many actors can ues the same script. This will allow you to have generic conversation for groups of npcs without the need for replication.

I hope that helps.
Advertisement
Thanks TechnoGoth, that did help. Suggestions like that are what I'm looking for. I have a bad problem of thinking of one way to do something and not being able to get around that afterwards. Reading how someone else would structure something really helps me out.

If anyone else has more suggestions on how they would structure this, let me know.

Thanks!


WyrmSlayer RPG - In Early Development

This topic is closed to new replies.

Advertisement