Sign in to follow this  
vidhvat

Unity How Do RPGs Handle Conversation

Recommended Posts

vidhvat    169
I've been thinking about RPG's and I wonder how game developers handle a conversation system in their games.
Excuse me if I sound a bit silly here, but If I was to use a game engine like Unity, would I be scripting the whole thing, or do developers have dedicated system that they implement which help them code-in the conversations easily?

I've never tried my hand at an RPG before, this might be too much to ask for, but I was wondering what kind of a data structure does one set up for handling conversations between characters. Maybe it would require a complex state machine of sorts, I don't know.

I'd love to have some light thrown on the subject! Thanks!

Share this post


Link to post
Share on other sites
matt3d    137
I've dabbled in it in the past. I was always looking to make a dialog in the style of Black Isle/Bioware/Bethesda RPGs. So the dialogs have to be represented as a data tree. One way to do this is to implement SQLite for data storage, another is to just store the data in XML. I'd recommend the latter. You also will need a way to allow script/engine callbacks from dialog choices. For instance, choosing a particular dialog might cause someone to attack the player, receive an item or change reputation.

Have a look at Neverwinter Nights or Dragon Age's conversation editor and look at how they do it.

[img]http://www.korbavarn.de/news/wp-content/gallery/toolset/conversationeditor.png[/img]

Share this post


Link to post
Share on other sites
ApochPiQ    23064
This depends on the game design, really; but typically you use some form of tree or directed graph (depending on whether or not you want to allow repeating dialog segments). Usually it is very data driven, so explicitly implementing dialog via code (eg. state machines) is overkill. Even in the most complex scenarios all you need is the ability to invoke some animations and mayyyybe a script or two (for adding items, etc.). Unless you're doing something really niche (think Facade) that's all it takes.

Share this post


Link to post
Share on other sites
Daaark    3553
A data driven tree works much better than hard coding everything.

Basically, the structure would be a node with any number of child nodes. Each node would be a data structure which contained all the data needed to playback that line of text.

[b]Conditional Test [/b]- [i]A script or test (returns true or false) that is run to determine if this line should appear in the tree.[/i]
[b]Scrip[/b]t - [i]Any script to execute on display of this text.[/i]
[b]Text[/b]
[b]Sound File To Play
Speaker Animation[/b]
[b]Listener Animation[/b]
[b]Response Pointer(s)[/b] - [i]any number of child nodes that can be new responses, or links to any existing node to create loops, or jump back up a level in the tree.[/i]
[i]
[/i]
You can also add anything else relevant to your game.

Share this post


Link to post
Share on other sites
MeshGearFox    158
[quote name='Daaark' timestamp='1302751268' post='4798250']
A data driven tree works much better than hard coding everything.
[/quote]

What if your scripting/programming language didn't really differentiate between code and data?

Share this post


Link to post
Share on other sites
Bearhugger    1276
In a RPG you should avoid hardcoding anything that isn't part of the engine. (ie: data)

RPGs aren't champions of reusing, (typically a dungeon with all the conversations, monsters, etc. it contains are used only once in the adventure), so if you hardcode them then you're going to have a LOT of code to maintain, and it's a lot easier to introduce errors and faults when you have all the power of a programming language. It also means that the smallest change to your game will require you to recompile it, and RPGs, like most games, require a lot of polishing and balancing.

It doesn't mean that you have to use a scripting language, but you should at least have some trigger/macro system that your game reads as data to direct the conversations. Depending on the type of RPG, a conversation tree like the one in the screenshot above might be desirable too.

It doesn't mean that you're automatically fail if you don't separate data and code, and if your project is very small, it might even be a better alternative to hardcode stuff to save time, but generally speaking, it pays in the long term to introduce some scripting system to a RPG.

Share this post


Link to post
Share on other sites
vidhvat    169
It seems that the graph/nodes method would be easy to set up and use.
I'm guessing that, inside, the Dragon Age Origins editor works with the kind of a structure that Daaark has described.

Sorry for the late reply.
Thanks!

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