Announcement

Collapse
No announcement yet.

Nonlinear quest and dialogue system

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SUBMITTED] 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...32eb3ac56f37f0

    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:
    Click image for larger version

Name:	questnames.png
Views:	1
Size:	35.2 KB
ID:	1147989

    Table with quest nodes info (not all rows are showed):
    Click image for larger version

Name:	questnodes.png
Views:	1
Size:	138.5 KB
ID:	1147990

    Dialogue names table (imported from CSV):
    Click image for larger version

Name:	dialogue_names.png
Views:	1
Size:	34.3 KB
ID:	1149763

    Dialogue fragments table (imported from CSV):
    Click image for larger version

Name:	dialogue_fragments.png
Views:	1
Size:	102.3 KB
ID:	1149764

    Dialogue cue asset:
    Click image for larger version

Name:	voiceover_hd.png
Views:	1
Size:	258.3 KB
ID:	1150493

    Place to add custom instructions:


    Place to add custom requirements:


    Example UI (UMG):
    Click image for larger version

Name:	exampleui_hd.png
Views:	1
Size:	547.4 KB
ID:	1150494


    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:
    Click image for larger version

Name:	quest1.png
Views:	1
Size:	13.2 KB
ID:	1150090

    Second quest:
    Click image for larger version

Name:	quest2.png
Views:	1
Size:	8.2 KB
ID:	1150091



    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:
    Click image for larger version

Name:	TutorialDialogue.png
Views:	1
Size:	61.7 KB
ID:	1150089


    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):
    https://goo.gl/NfSTQ0
    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).
    https://goo.gl/I07wUO


    As always, if you have any questions - you are free to ask. And I'm always interested in questions or "feature requests". So comment
    30
    Yes
    60.00%
    18
    Yes, but only with dialogues
    36.67%
    11
    Maybe
    3.33%
    1
    No
    0%
    0
    Last edited by funbiscuit; 09-14-2015, 06:09 AM.
    Blueprint Quest and Dialogue System
    Available on marketplace

    #2
    Guess this post is useless once again
    Last edited by funbiscuit; 05-25-2015, 01:00 PM.
    Blueprint Quest and Dialogue System
    Available on marketplace

    Comment


      #3
      For non-linear quests, just create each "goal" as its own mini-quest. Once each mini-quest is done, it completes the main quest.
      WIP: Science Project - A collection of middle school through advanced college level science theory and formula-based functions for use in your own projects
      World Machine to UE4 Export Macro
      WM Folder Generator - Creates a folder that you name with HeightMap, NormalMap, SplatMap, and Tile sub-folders

      Comment


        #4
        What you said is linear to me (as I think). What I meant is that you could have different variants to complete the quest.
        For example you start with node 1. Then you receive another node in your quest. And this new node can be different, it's type will depend on how you finished first node.
        Blueprint Quest and Dialogue System
        Available on marketplace

        Comment


          #5
          Ah, ok. I was presuming that "non-linear" referred to steps that didn't need to be completed in order. I would probably refer to the type of quest that you are referring to as "Choice-based quest system", but, the terminology for this stuff doesn't exactly have a "standard".

          Thanks for the clarification!
          WIP: Science Project - A collection of middle school through advanced college level science theory and formula-based functions for use in your own projects
          World Machine to UE4 Export Macro
          WM Folder Generator - Creates a folder that you name with HeightMap, NormalMap, SplatMap, and Tile sub-folders

          Comment


            #6
            You're right. I should've written "choice based" or "branching" in the first place. Anyway, I think I have some ideas how to implement branching quests.
            Blueprint Quest and Dialogue System
            Available on marketplace

            Comment


              #7
              this is really needed, but u should work together with someone who can do a combat and inventory system too. A Quest system is useless without something to use in the Quests XD

              Comment


                #8
                Originally posted by Kanizitas View Post
                this is really needed, but u should work together with someone who can do a combat and inventory system too. A Quest system is useless without something to use in the Quests XD
                I'm doing my best to make it as easily integrated as possiBle. To complete (or start) any quest you just call a special function in quest manager and it's doing all the work. Quest manager also has event dispatchers so you'll always now when quest node is completed and new quest is started (that's not all of them). Also you have option to add your own instructions. For example write in the special column "AddWeapon GoldenAxe" and create function AddWeapon inside of quest manager. This function will be called when this node is completed and there you can say to inventory system to add this weapon to your inventory.
                It's just that I want to keep it abstract so this system can be used anywhere when quests are needed.
                I'll try to record a video with all this basic functionality today (or tomorrow).
                Blueprint Quest and Dialogue System
                Available on marketplace

                Comment


                  #9
                  I managed to make a nonlinear system for any quest. Now you can make almost any nonlinear quest structure. I made it with two extra node types. Branching and Composite - both can have multiple children. Branching node will be completed when you complete any of its sub nodes. Composite node will be completed only when you completed every sub node. So it's basically like "OR" and "AND" boolean operators. And their subnodes can also be branching or composite. So there are no limit how many levels you have in the quest. Although I don't think you really need huge amount of levels. One or two is enough for most purposes.Also I almost completed description of this system with few pictures. So I'll update my second post soon.
                  Last edited by funbiscuit; 04-08-2015, 03:44 PM.
                  Blueprint Quest and Dialogue System
                  Available on marketplace

                  Comment


                    #10
                    Ok then u just need to widget this up in simple graphics and put some more deteiöed quests on for tests :3

                    Comment


                      #11
                      Well, I already have very simple graphics I think I'll improve them a little bit or maybe even make another one. I'll think about demonstration quests more. I think that future video with building up the scene will be using new quest (I think it will be very long because of this). Just need to find some time to record it.
                      I know how much every one wants to just download something and the problem will be solved. But I think it's not possible even for small projects. There will always be some work left because every project has some features that make it unique. Some unique UI, unique gameplay. So there are no solution which will fit any project and I want this system to fit any project that has quests.
                      Blueprint Quest and Dialogue System
                      Available on marketplace

                      Comment


                        #12
                        Hi funbiscuit, a Quest/Mission/Objective System would be a nice addition and I commend your bravery for taking the challenge to develop one. The description of the Branching System is reminiscent of Behavior Tree, which was the approach I was going to pursue. Data Tables are great for setting up and organizing data, but, I find myself rolling all of my data into SaveGame Slots to support in-game editing/save/load functions (it would be nice to edit and save Data Table Assets directly from Blueprints). My recommendation would be to move towards editing data in the UE4 Editor using a Array of User Data Struct (the same struct used for the Data Table). Although not a pretty table display, it allows for easy add/copy/delete of data elements.

                        I'm a firm believer in keeping it simple, but how sophisticated do you require instruction language to be?
                        HeadlessStudios.com - S P A G H E T T I: Ninja Swords, Guns & Monsters & Other S**t! - Join Our Discord

                        Comment


                          #13
                          Yes, currently I'm using different struct to handle all the data than struct of datatable. And the main reason it is a lot easier. With this separate struct I cun use ENums and arrays which is helpful sometimes. If you really want to save data from datatables it would be easier to convert this new struct to datatable struct at runtime. Maybe this will be a good solution. Anyway, I'll look more into easy implementation of savegame for this system,thanks!
                          Instruction language can be anythin you want It just uses this basis. You write down your instruction something like InstructionName AllParametersSeparatedBySpace. And then you can add your own blueprint function which will be called everytime you have your instruction executed (for example when quest completes). And all your parameters you can get inside of your function with GetParsFromStack (they will be given to you and automatically deleted from stack). I said why I use this stack, but it's easy to pass parameters directly to function just where you call it (I have screenshot with switch by string).
                          So basically if you can put something into one instruction word and one or many instruction parameters, tgen you can achieve this. Well, to be precise you can achieve anything inside of capabilities of blueprint system. But they are super awesome (what I realised when I was building this system) so I can think you can do anything you want. It's simple and powerful at the same time.
                          So to point out the idea: you're limited to one name and any amount of parameters. But all this stuff feeds up to your own blueprint function which can do anything.

                          UPD
                          Savegames support arrays, right? Don't have time to launch editor currently. Then the easiest approach will be to parsing all table at first launch and then use two new functions in quest manager GetSaveArray and InitFromSaveArray. Because changing cuerently used struct (well, it's almost like creating new one) will wreck everything inside quest manager. don't have courage to do such thing. So will it be good enough for you to receive extra array for your savegame? I didn't actually get why you want to save from datatables instead of array of new struct.

                          UPD2
                          Yes, they support arrays, they support any variable which you can have in blueprint. So I don't think it will be a problem using an array which will be given to you by quest manager. If it will be a problem, just say why, I don't get it

                          UPD3
                          I tested it, I can create example save system to load and save quest status. Just need to add a special array to save game blueprint and call to functions of quest manager: InitFromArray and GetSaveArray. So as I thought before it's possible and very easy
                          Last edited by funbiscuit; 04-09-2015, 01:44 AM.
                          Blueprint Quest and Dialogue System
                          Available on marketplace

                          Comment


                            #14
                            I've made some improvements to the system, now it's working a lot better. And now a lot of information is obsolete. Also now I have a lot of bugs after a lot of changes in blueprint. So when everything is ready, I'll update the post. Also I'll make a video with some demonstration. So now question to you, guys. Do you want only short demo video (~5 mins) or video with using this system (building a small level,~30 mins)?
                            Blueprint Quest and Dialogue System
                            Available on marketplace

                            Comment


                              #15
                              Okay, so I've made all improvements I wanted. Now I can say it's almost finished. Anyway, I'll keep looking for more features but this is the base version which can be used.
                              Here is the video with demonstration:


                              I've updated first post also.
                              Blueprint Quest and Dialogue System
                              Available on marketplace

                              Comment

                              Working...
                              X