Sign in to follow this  

Unity How Do RPGs Handle Conversation

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


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.

[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]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]
You can also add anything else relevant to your game.

Share this post

Link to post
Share on other sites
[quote name='Daaark' timestamp='1302751268' post='4798250']
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.

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  

  • Announcements

  • Forum Statistics

    • Total Topics
    • Total Posts
  • Similar Content

    • By abarnes
      I am a game development student in my second year of a three year program and I would like to start building my portfolio. I was thinking of creating some games to show what I can do to potential employers since I wont have any work related experience when I graduate. But as I'm sure you all know there are tons of ways to approach developing/designing a game and I'm curious if anyone had any insight as to any "standards" that come with this? Is it okay to use game engines like Unity, Unreal, Game Maker etc? Or would it be better to make a game from scratch to better show case your skills? Any and all advice will be greatly appreciated!
    • By Hilster
      Hello 2D Artists,
      I've started making a 2D Puzzle Adventure game for mobile and I'm looking for someone who would want in on creating assets for the game. The core of the programming is pretty much complete, you can walk within the grid laid out and push boxes, when there is an object on top of a pressure pad it will activate the linked objects or if there is one object with multiple linked pressure pads it requires you to activate all points for the object to become active. 

      The level iteration for the game is quick and simple, a Photoshop file that is made of individual pixels that represents objects is put into the game and it creates the level out of those pixels with the assigned objects.
      The objects that need sprites created so far is the character, box, pressure pad, door, trap door, the walls, the stairs and the tiled background.
      I intend to add more objects so the amount I'd like to add will be extended.
      My motivations for posting here is to have something that looks nice to be able to display on my portfolio, so if you're looking for a working game that you can place your art into and improve the look of your portfolio then we're in business.
      Please reply with a few past examples of your art below and I'll be in touch!
    • By thefollower
      I have set up my TcpClient to connect to my server and that works fine. But i am a bit confused how i read messages from the network stream with it continuously running via async, without ever closing the connection ?
      My TcpClient Manager class has:
      public async Task<bool> Connect(string address, int port) { try { await _tcpClient.ConnectAsync(address, port); IsConnected = true; return true; } catch(Exception e) { Debug.Log(e); return false; } } public async Task<int> Read(byte[] readBuffer) { if (!IsConnected) return -1; using (var networkStream = _tcpClient.GetStream()) { try { var bytesRead = await networkStream.ReadAsync(readBuffer, 0, readBuffer.Length); return bytesRead; } catch (Exception e) { Debug.Log(e); IsConnected = false; return -1; } } }  
      So i thought to just run a co-routine and call Read constantly to get the most recent message, but that doesn't make much sense to me since a co-routine would be blocked with the await. How is this actually done? The MS Docs don't have very good Async examples with the TcpClient class so i don't know fully get how to keep calling Read correctly.
    • By NUITGaming
      Landscaping back ground maid in Unreal 4.18
  • Popular Now