Nonlinear quest and dialogue system

UPDATED 09/14/2015
first tutorial added

Good news, everyone! System is now on Marketplace!
https://www.unrealengine.com/content/d1558ee4089d4babac32eb3ac56f37f0

If you’re looking for documentation - skip to the end of the post.

I think you can quickly get an idea about system by watching this short trailer. And then you can dive into text if you want to know

You can just skip to features and videos, or you can read this section too.
In almost any game we can find a quest. RPG, Adventure, Shooters, even Racing games (you should follow certain track - that’s a quest). It can be a mission, objective or just achievement. In the end it doesn’t matter and basic logic is always the same. Moreover, usually a lot of things are handled through dialogues. So I decided to create a very general yet functional non linear quest system and branching dialogue system. My goals were as follows:

  • create a system in which you can make almost any quest for any game.
  • create a system in which you can make almost any dialogue for any game
  • it should be easy to use
  • it should be easily extended to be more project unique

And I think that the main goals are achieved (or almost achieved).
With quest system you can create almost any quest flow logic, even highly non-linear. And all this logic is written in two datatables (are imported from CSV files). You can see example ones below.
With dialogue system you can create very complex and non-linear dialogues. All logic is also stored in two datatables.
Systems utilize special UtilityManager that has ability to create custom requirements and instructions. Requirements can even use keywords OR and NOT. You’re also free to use them anywhere else. For example, instructions can be used for cheat engine.
Finally, you can specify CUE file and then your dialogue will have voice over.
Example UI is present. It also has all needed for UI functionality.

To keep this post more light weight and not overwhelm you with text I decided to highlight only important features without much explanation or how you can use it. If you want more detailed explanation you can check a newly created manual for this system. It is work in progress so I will be constantly add new info:
https://goo.gl/RnG9z6

Important information:
This system is not simple in terms of blueprint code. So don’t just rush in the moment you buy it. Even though there are only three main blueprints (managers) to control system, there are >50 functions in them. And almost all of them are quite big and complex. It’s almost impossible to understand everything in the beginning.
So start simple, play example levels, build your own simple quests and dialogues. Add simple custom instructions and requirements. When you feel like you understand how system works (from the outside) you can start dig deeper and investigate system on the inside. You don’t open Shooter Game code and just expect to understand everything, right? Same situation is here.
I’ve started to prepare series of a step-by-step tutorials and first one will be available soon. In them I’ll start very simple and in each lesson will add some complexity so it should be easy to follow. I’ll post another message when first tutorial is ready.

Coming soon:

  • more tutorials so you can easily understand how systems work and start using it
  • even more cool features

Quest system features:

  • To use system just drag and drop quest manager somewhere on scene and you can use your quest.
  • Data driven with CSV tables
  • Quest nodes can have children. And children can have their children. And so on.
  • Two quest nodes flags: optional and repeating (can use both). If node is optional then you don’t have to complete it to complete its parent (quest or quest node). If node is repeating you need to complete it multiple times (very suited for repeating tasks like kill 5 robots)
  • Ability to set node to be optional or/and repeating.
  • Requirements (both node and custom). You can add any custom requirement that you want. Keywords OR and NOT are supported
  • External (used in dialogues also) instruction system where you can add your own instructions.
  • Example UMG Journal so you can see how to implement different features in your own UI
  • Example levels (you can see them in the videos below) to show different uses of the system
  • Example save and load system (easily extended or replaced with your one)
  • Event dispatchers to always know when something updates in your quests
  • Different blueprint helpers to get you started quickly and without extra blueprint scripting:
    -OnTouch will change quest or quest node state when player overlaps it (something like a waypoint)
    -SpawnActor will spawn any actor which you specify, certain amount of times when specified Quest or QuestNode receives specified state (suited to spawn quest items)
    -CollectableItem can be collected by player by pressing [E] while standing closely. Also you can specify what quest or quest node should be completed when item was collected (suited for quest nodes like “find 10 flowers”). I also added VERY simple Inventory System for demo purposes (it’s just a string array of item names), you can replace it with your own InventorySystem.

Dialogue System Features:

  • Everything works from one actor: dialogue manager. Just drag and drop it somewhere on scene and you can use your dialogues.
  • Dialogues can start from different fragments depending on requirements
  • For each fragment you specify what fragments will be next. If there are more then one fragment available - player will have to chose one. So any amount of replies is possible
  • Different flags to specify special behavior. For example fragment can be used only once or it will disable close button so player can’t close dialogue without saying something
  • Requirements. You can specify which nodes should be used to this fragment become available. Moreover, you can create your own custom requirements (just as with quest system). Keywords OR and NOT are supported
  • Custom Instructions. Will be executed when fragment is shown. You can add any instruction of your own (with any amount of arguments). Some are already built in.
  • Voice-over. Defined by column in CSV table and a Sound CUE
  • Animation for dialogues! You can specify what animation (if any) to play for each dialogue fragment. Examples are done with blendshapes and with them you can play simultaneously basic animation (e.g. Idle) and facial animation
  • NPCComponent. By adding this component on your NPC (can be anything, even simple cube or just empty actor) you can use dialogues. In component defaults you can specify which dialogue should start as well as other parameters (e.g. talk radius). By walking inside of talk radius UMG widget will appear with your message (that can be easily changed). What button to press you specify in Dialogue Manager.

Utility system Features:

  • Custom requirements. There are few built in and you can create your own (just as with quest system) to use in dialogues and quests (and in your blueprints too). Keywords OR and NOT are supported
  • Custom Instructions. You can add any instruction of your own (with any amount of arguments). Some are already built in. These instructions can be used in dialogues and quests.
  • External variables. For dialogues (use them to create dynamic text, simply add $VarName]] to the fragment text and it will be replaced with its value), requirements (you can check if variable value is equal to some string or can compare it with number, e.g. $VarName == value, $VarName >= 6) and instructions (e.g. $VarName == 5, $VarName1 < $VarName2+$VarName3). Available operators: +, -, *, /, =, ==, >=, <=, <, >, +=, -=, *=, /=. Variables can be added in default values and at runtime.
  • Example save and load system (only functions, no UI, it’s to get you an idea how you should save state of everything)

CSV tables.

Table with quest info:

Table with quest nodes info (not all rows are showed):

Dialogue names table (imported from CSV):

Dialogue fragments table (imported from CSV):

Dialogue cue asset:

Place to add custom instructions:

Place to add custom requirements:

Example UI (UMG):

This is the video with demonstration of abilities of quest system. It doesn’t have dialogue system in it. Video with dialogues can be found lower.

Below you can see flow diagrams of shown quests,
First quest:

Second quest:

I’ve extended old example level with some characters and dialogues. A quick demo you can watch here:

Here you can see just one dialogue from showed demo (dialogue with trainer). So you get an idea how complex dialogues can be:

Since I can’t show every feature in these videos or describe in text (because it will make video too long) I decided to package this project and you can play around. Be careful, it uses default graphics setting so it may be very laggy on low spec GPUs. On my laptop I get around 5-10 fps.
This link is updated, now there are background animations and external variables.
Download (~100 MB):

In that zip archive you can also find CSV files to get an idea of how things are built.

To sum up:
These two systems provide you with all necessary features to build complex quests and dialogues. Some game specific features are present and some are not. But this systems are easily extendable so it will not be hard to add any game specific features to this system when you will need them.

Documentation links:

Manual (same link as in the middle of the post)
https://goo.gl/RnG9z6

Series of step by step tutorials (work in progress).

As always, if you have any questions - you are free to ask. And I’m always interested in questions or “feature requests”. So comment:)