Jump to content
  • Advertisement
Sign in to follow this  
Michael Lojkovic

Design for generating Conditional branches in Dialogue tree

This topic is 682 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'm working on an xml parser, for Articy Draft, that takes the dialogue trees in there, and spits it out in a format for Unreal to use.  I have it working fine with lines of dialogues. The only thing is there are conditional statements, and instructions the game runs listed in there. I'm just not sure how to handle conditional statements and instructions.


Conditional statements are things like:

Player.heath < 90

Time.time > 13:00:00

While instructions are:

Player.health += 5
Player.dexterity += 1

Conditions decide which branches to go down based on variables outside of the players control, and instructions add stats, or raise counters for unlocking new classes.

Were using a bunch of plugins for RPGs in Unreal 4. I get that I could just directly generate code using those plugins representation of health and such, but I'd prefer to keep the code abstracted away from the particular plugin in use and generic enough so if we change the plugins or go to custom C++ in the future we don't have to change how the condition checks are written.  Is the best option generating a wrapper class with a constructor taking the plugin Character class or time class, and assigning that to the data structure in use by our Dialogue code?

Share this post

Link to post
Share on other sites

The last time I worked with Articy Draft was rougly 3 years ago and I implemented the whole game logic of dialogs, quest, trading, construction, upgrades and so on with it.


At this time it was only possible to get conditions with the dialog system and only with the binary export(xml didn't export everything).

In the export was also a bug which filtered out some strings if you didn't used the full export.

There were also some pitfalls with the classes, you got most of the dialog system with one of the classes but not everything and the other class was able to get this part. The API was confusing and not well documented at this time but I got it working.

If I remeber right there was a standard API and a shortcut named expresso or similar but it wasn't working correctly with the data access.

You requested some data and it say there is nothing but if you used the standard API you could access them.


There was a sdl based point and click adventure in the sdk which used the dialog system and there was also a little demo to use the conditional branches in the dialog system(wasn't working at this time but I guess it's working now).

This way I implemented the quest system, dailies, dialogs and the campaign wih enums where each entry was a function in the c++ code.



You can also implement a limited logic by using the templates and some c++ code. Articy Draft used reflection and gave you access to the templates in an object. This way you could look for a specific template.

With Articy Draft you have to run a data driven approach which means write the logic once and the the input values comes from Articy Draft.

E.g. a template Upgradeable, Give and Take.

The Upgradeable template contains the Give and Take template and a Requirements object list.

To the Requirements list you add objects like a specific technology, location or what ever but it can not have a specific amount because Articy Draft don't allow object instances with customized values in the object list.

The Give and Take templates are a set of all your resources you want to use in the game.

They are both a transaction but one is positive and one negative.

You implement a transaction logic and wire it with the Give, Take and/or other templates which do transactions.

If you encounter a Give Template in the game you apply the values to your player and Take add the negative value(you can use a boolean in the template to signal this).

The advantage is you can use a hand full of code to realize buying/build/upgrade/discover Items, Buildings, Characters and Tech tree.

But you have to adjust the Give and Take template and the logic code each time the game designer change their mind about currencies.

During the development I encountered it only 3-4 times because the game designer had to rebalance the whole game and this encouraged them to think twice before demanding new resource types.

Articy Draft had a couple of bad design choices like allowing a template only once per template/object which was the reason to have exactly the same input data as Give and Take template because you can't create a template Transaction and add it twice.


The developers where pretty quick with responses at this time.

Share this post

Link to post
Share on other sites

I'm not using their stuff. Everything is in the export file.  I figure open source this if it's well made, and spin off modules for other documentation software.  I have the whole design done for the map.  


So, how I'm doing it is each key in the map has the id of the dialogue, and each value is a struct with two fields, a vector of the next dialogues, and a tagged union of either the current dialogue or a functor. If it's something other than dialogue the functor gets run.  I'm just trying to figure out how to keep the dialogue system generated separate from the actual game implementation.

Share this post

Link to post
Share on other sites

Decided I'm just going to implement an interface, and make whatever classes used inherit from the interface to link up. I.E. if they have a Player global variable set in Articy I'll generate and IPlayer interface, with inline methods for each variable in the set, and they just have their player class inherit it and implement what those variables correspond to.

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!