LibGDX Yarn Interactive Dialogues!

Just to clarify: This is a lib for creating interactive dialogues(conversations);

Yo!

Recently while working on a project I was searching for a way to create dialogues using a third party tool and then import them into my game. I came across a really cool language/tool called Yarn. This is the same tool used for games like Night in the Woods and Knights and Bikes.

It checked out everything I was looking for, and then some:

  • Easy Syntax
  • Branching Node based Dialogue
  • Conditional Statements(e.g <<if visited() >> do this line<>do this<>)
  • Variable Continuity
  • Very Extensible

I created a port of an existing Yarn library for use with libgdx projects.

Here is a link to the YarnGDX github

Here is a link to Short Demo.

Its still not perfect , but currently gets the job done. I am trying to add documentation whenever i get the change but there is basic stuff in the getting started and also a simple example Test Class.

Hope someone finds it useful :slight_smile:

This is interesting. I am currently trying to do dialogs as well, GLFW doesn’t support dialogs (or any model / child windows for that matter) yet. I am not using libGDX, do you think this would be a non trivial thing to integrate directly with LWJGL?

I think all it would entail is switching all the libgdx classes like Array - ObjectMap ect. to Your own implementation or java’s implementation like ArrayList and HashMap(althought i dont think these are as good for gamedev as the optimized libgdx versions). Ill put this in my todo list - to decouple libgdx and create my own set of similar collections classes.

EDIT:

I just re-read your post. Im afraid this is not a graphic “dialog” library but instead a library for creating interactive dialogues(the conversation type) . Sorry if there was any confusion.

I suppose I could have clicked your demo link, I feel dumb. lol

haha no man, dont feel dumb. I only added the demo link after I replied to you; to avoid further confusion :slight_smile:

Oh! haha! Well, less dumb now!

So are you working on something that needs this? RPG or something?

Yes i am working on a game that has a narrative and i wanted to make sure i had the tools for better workflow. I could have just written everything in code but then it would become very hard to change or scale it in the future.

YarnGdx can be used for much more than dialogues though since it does provide an extensible scripting platform. You can create “Functions” in java and add them to the Dialogue library and in your scripts you can call on those functions. The possibilities are endless.

Ill be adding more documentation to the wiki as soon as i am able. :slight_smile:

Project looks great!

I have a question though. If making a RPG game with this with a lot of tree’s, does the code and variable tracking become overwhelming long? Looking forward to seeing more of it and possible a clean solution to implementing a system with a big story.

What they said ^

This looks like it has a ton of potential!

So basically right now the dialogue loads all your nodes and parses them - you then call a start(“nameofnode”) method and you can specify what node to start from(“Start” by default). You then step through the dialogue by consuming results with the dialogue.getNext() method kind of like an iterator. These results are things like your Lines/custom commands/options(these link to other nodes which can be in the same file) ect.

I could go into more depth which i think ill save for the wiki(unless requested here) , but basically once you implement the dialogue into your game and are able to read the results - it becomes really easy and scale-able.

The Variable continuity that comes with the lib comes with built in functions so that you can serialize it into a json string: this makes it easy to save it. Also you may use the same variable continuity for different dialogues so you could make the continuity a global variable that you access from anywhere in your game that your dialogues interact with.

To clarify: all the variable continuity is(UserData.java) , is a <String,Value> object set(objectmap).

TLDR: Keeping track of your variables should not be an issue - i think the hardest part will be implementing it to fit your needs and then its just a matter of loading your dialogues and using the results. Saving the variables is really easy with the toJson(), and fromJson() methods; and you can use the same variable storage for multiple dialogues.

Hope that cleared some stuff up.
Feel free to ask any more questions i am happy to help :slight_smile:

Could you please update the YarnGDX’s wiki, because it’s confusing when trying to figure out what to do with the incompleted wiki (i.e dialogues,…) ? :frowning: