Jump to content
  • Advertisement
Sign in to follow this  
vidhvat

Unity How Do RPGs Handle Conversation

This topic is 2681 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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.

conversationeditor.png

Share this post


Link to post
Share on other sites
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
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.

Conditional Test - A script or test (returns true or false) that is run to determine if this line should appear in the tree.
Script - Any script to execute on display of this text.
Text
Sound File To Play
Speaker Animation

Listener Animation
Response Pointer(s) - 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.


You can also add anything else relevant to your game.

Share this post


Link to post
Share on other sites

A data driven tree works much better than hard coding everything.


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

Share this post


Link to post
Share on other sites
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
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
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!