Git Product home page Git Product logo

dialoguegraph's Introduction

Dialogue Graph

GitHub stars GitHub contributors

Dialogue Graph is an open-source editor tool for the Unity game engine used to create branching conversation trees in an easy and straightforward way by connecting nodes, and setting up conditions and triggers for the different conversation branches. An obvious use case for this tool is to create conversations with NPCs, although the versatility of this tool allows for any kind of project that requires branching behaviour based on checks and triggers.

Dialogue Graph is compatible with the following Unity versions:

  • 2020.3 LTS
  • 2021.2

Other versions of Unity may work as well, but are not tested.

Nodes

Installing Dialogue Graph

1. using OpenUPM

Requires OpenUPM-CLI
Run the following on the command line in your unity project's folder:

openupm add com.github.teodorvecerdi.dialoguegraph

2. using Git

To install Dialogue Graph in your project use the Unity Package Manager.
To open the Unity Package Manager, inside unity, go to Window > Package Manager and to install Dialogue Graph click the + icon in the upper left corner of the window, then click on Add package from git URL... and paste in https://github.com/TeodorVecerdi/DialogueGraph.git

Using Dialogue Graph (WIP)

Editor

To start using Dialogue Graph, create a Dialogue Graph in your assets folder by going to Assets > Create > Dialogue Graph > Empty Dialogue Graph.
Dialogue Graph currently contains four different types of nodes: NPC, Self, Property, and Boolean.

NPC and Self Nodes

General

TODO

Dialogue Lines

The NPC and Self nodes represent the dialogue lines said by either an NPC or the player. After creating one of these two nodes you can add dialogue lines by clicking the Create Dialogue Line button on each respective node.
Each dialogue line entry comes with additional ports. Branch and Trigger ports are available to both node types and the Check port is available only to NPC nodes.
The Branch port connects to the next node in the conversation tree. This connection is used by the runtime engine to progress the conversation once an option (dialogue line) was chosen. Unless you want the conversation to end with that line you should connect the Branch port to another node.
The Trigger port connects to one or more Trigger property nodes and is optional (more on that in the Property Nodes section).
The Check port connects to one or more Check property or Boolean nodes and is optional (more on that in the Property Nodes section).

Actor Port

NPC nodes also contain an Actor port to which you should connect your Actor Property node (more on that in the Property Nodes section). Actor property nodes not only let you differentiate between which character performs the dialogue lines but also allows you to attach any custom data to the actor through scriptable objects.

Property Nodes

TODO

Boolean Nodes

DialogueGraph contains several nodes that can be used to combine multiple Check nodes into one:

  • NOT Node: Negates the result of the Check port.
  • AND Node: Returns true if both Check ports are true.
  • OR Node: Returns true if either Check port is true.
  • XOR Node: Returns true if exactly one Check port is true.
  • NAND Node: Returns true if both Check ports are false.
  • NOR Node: Returns true if either Check port is false.
  • XNOR Node: Returns true if exactly one Check port is false.

You can combine multiple boolean nodes together to create more complex conditions.
If a boolean node has a missing connection, then that connection is assumed to be false.

Boolean Nodes All Boolean Nodes

Images

The following images use the Sample Project included with the package. You can install the Sample Project by going to the package manager, selecting Dialogue Graph, and clicking the Import button under Samples.
Nodes:
Nodes

Properties: (you can open the properties window by clicking the "Blackboard" button in the toolbar at the top of the Dialogue Graph window)
Properties

Runtime

Images

Note: The following images use the Sample Project included with the package. You can install the Sample Project by going to the package manager, selecting Dialogue Graph, and clicking the Import button under Samples.

Attaching functions to properties

Attaching functions to properties is almost identical to the way you would do it with the Unity UI system (Buttons, TextFields, etc). Attach a script to the object field and then choose the method you want to use.

Attaching functions to properties

Dialogue Graph in action

Check the included samples for the API usage.

Dialogue Graph in action

Contributing

If you would like to contribute to this project feel free to submit a pull request, and take a look at the Contributing document provided to get a better insight into what contributing means, and the Code of Conduct.

Versioning

We use SemVer for versioning. For the versions available check the tags on this repository.

License

This project is licensed under the MIT License. See LICENSE for more details.

dialoguegraph's People

Contributors

123tris avatar imgbotapp avatar shoman4eg avatar teodorvecerdi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

dialoguegraph's Issues

README is missing information

The README currently has empty or placeholder sections.

Ideally the README would be converted to a Wiki, but we should at least fill in the empty sections.

Error on build

Hello,

this tool seems to error when we try to build our game. Because the huge use-case of this tool, I would like to try to get this fixed.

The errors originate from Drawer.cs script and look like this:
obrazek

Sadly, I cannot build the game without this. I'd really like to try to fix this together, so I can use this great tool in our game.

Thank you

RuntimeDialogueGraph doesnt save actor data

Any changes made in RuntimeDialogueGraph.PersistentData.ActorData is not saved, making it impossible to utilize custom actor data.

I've solved this in my fork for development since I wanted to redo the inspector editor anyways. But I think in general having this data attached to the monobehaviour is a bit problematic. I think ideally all this data should be part of the actual graph object instead. If universal checknames/triggers/actor names are desired then separating that makes sense but will need some unified way of accessing that. (could be another separate scriptable object, could be a editorwindow/setting thing. etc.)

Prevent state from being actorless

OS
Windows 10

Unity
Unity 2021.2.0f1

DialogueGraph
2.0.0

Description
If the state has no actor, the following error occurs:

System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at <7b5f9a2f7db343a4ab54846ed680277b>:0)
DialogueGraph.Runtime.RuntimeDialogueGraph.GetCurrentActor () (at Library/PackageCache/[email protected]/Runtime/RuntimeDialogueGraph.cs:68)

originating from "RuntimeDialogueGraph.cs"

public ActorData GetCurrentActor() {
            var currentNode = DlogObject.NodeDictionary[currentNodeGuid];
            if (currentNode.Type != NodeType.NPC) return null;
            var currentNodeActorGuid = currentNode.ActorGuid;
            var actor = CurrentData.ActorData[CurrentData.ActorDataIndices[currentNodeActorGuid]]; // <- Throws error
            return actor;
        }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.