Dialogue Tree Extension : global feedback, enhancement suggestions

Here is a global feedback about the Dialogue tree Extension after using (torturing it) for the last two weeks.

This is a great extension, with really cool features and i fully implemented it in my Swamp project to replace my homemade dialogue system (for the future full release of the game). Even if it’s “experimental” for now, it’s totally usable, most of the features are already working. Unlike few people who reported it, i didn’t have any problem with the changes introduced by the beta93.

Here are few points i’d like to submit to enhance and extend it:

1) Unable to “unload” Yarn Data (by an action) :

When you load a json file to the memory, it’s loaded as “global” datas (a bit like global variables ?). This allows great usability over internal variables in dialogues and through different scenes.
Same things for internal yarn variables: the variables datas are stored globally and are accessibles from all scenes, wich is great, but can be weird…

You might want sometimes to “unload” some persistent datas :

  • Using different JSon files on different scene, with potentially same branchs names in different JSon files, especially if you use Gdevelop events to parse “incremented” branchs.
    In swamp for example, i have branches named (and standardised) “MyObjectName.Description.1”, “MyObjectName.Description.2”, etc. Depending on internal Swamp Engine conditions, different branch could be triggered. Problem: on two differents scenes, i can have the same object (with same name, because it’s a global object), but more or less incremented branches (so it’s why each scene have its own json textfile)). Unloading yarn datas from the previous scene might prevent issue: a branch that should no longer exist in the memory.

  • Resetting/deleting all variables (and datas), when for example the user(player of a game using dialogue tree) want to create a new game. Since Yarn variables are declared/created “on the fly” in yarn files, you can’t have a clear view of all variables to reset In Gdevelop. It’s especially an issue when you collaborate on a game creation: the writer use Yarn Editor to write the story, the (g)developer of the game doesn’t want to check all variables he could have created/changed through Yarn. It’s even more important when the writer just edits the JSon files without exporting the game again as html5 (or for game modding purpose :blush: ).

    => proposed solution : An action to “Unload all dialogue datas”, wich delete all branchs and variables values from the memory. Or at least an action to delete all variables datas.

2) Support for “If statements and options” just like it’s described in the documentation

Right now, if you try to use “if” statement in options, it just doesnt work. If/else condition can only be used if you repeat the full branch text + Options.

3) Change “load data from Json” action to use a textfield wich support expression :

I know the field in this action is linked to ressources, but making it a classic string expression editor might allow a lot… For example, in case of different languages, and differents JSON to Load ; example: Load data from JSon “/data/text/” + GlobalvariableString(userLang) + “.json”

This is it for a first feedback, i hope @blurymind would read it :slight_smile:

5 Likes
  1. Can you submit an issue at the git tracker and provide an example project.
    I have not tested extensively with more than one yarn files. It is worth noting that the extension can only load one at a time.

  2. If statements do work and are presented in the example project. If your syntax is incorrect they probably will fail. Can you check how they are used in the example project, then check if you have the right syntax. If thats the case, again open an issue at the tracker and attach an example project where you see them fail and think they should work :slight_smile:
    If something is not broken in the example project but fails for your project, there is a high likelyhood something in your project is making it fail

  3. I believe there was a command to load the data from a gd string variable.
    See Load dialogue Tree from a Scene Variable: Use that if you want to get that functionality. We will not change the json commands its actually preferred to load the data from a json resource :wink:

I try to keep up with dialogue tree stuff and fix it when I can

1 Like

Yarnspinner’s documentation that you link to has a syntax that doesnt work for us.

I think I will remove the link to it from our wiki,so as to avoid confusion over unsupported features that bondagejs treats differently

Look at the wiki first
http://wiki.compilgames.net/doku.php/gdevelop5/all-features/dialogue-tree

we use
«if $myYarnVariable == aValue»

they use
«if $myYarnVariable is aValue»

I suspect yarnspinner’s syntax has differences from bondagejs causing it to fail for you. We use bondagejs, not yarnSpinner - so some stuff works differently, although most stuff is the same.

Btw if you notice more stuff like this, leave a comment at

1 Like

on the point of yarn data - with multiple yarn files. Right now all the files you load will share the same data. That allows you to access/overwrite variables from one yarn file when parsing another yarn file.

So when you parse yarn file 1 and the player sets a variable by visiting a node, later on when yarn file 2 is parsed, yarn 2 can check if the variable from yarn file 1 was set.

This is an advantage, but it also comes at a price - you have to name your variables carefully when parsing different files. You can follow a naming convention such as yarnName_variableName to name your yarn variables in your project.

All the yarnData is in one place, so it can be used for save games. I do not plan to change that for now.

I can let you do that with an action of course, but you will lose the dialogue state from your save game. That is valid to use when you want to start a new game, so I guess it does need implementing.

I added a new action to do that at

2 Likes

Thanks for precision and the last PR @blurymind :slight_smile:

I’ll make more tests on if statements and will report if i can illustrate the issue, but from here i failed to conditionnally displays Options (using DialogueTree::OptionsCount() + DialogueTree::Option(Number)), it seems like skipped.

Questions/reports about variables usage (but almost another ideas/requests):

  • There is a numerical expression to get yarn variable statement (DialogueTree::Variable("")), but no string expression. It could be useful (displaying it in a text field, using it another expression, compare directly in a “compare 2 strings” condition…).

  • The numerical expression DialogueTree::Variable("") return a string (“true” or “false”), whereas numerical expression editor fields require numbers.

  • The expression DialogueTree::Variable("") returns the value only for a short amount of time after a value change, it’s a bit strange, since the content of the variable is not changed. The expression should always returns the value of a variable, and not only for one/two seconds after there is a state change ?

  • if you dont assign a value to a yarn variable, it’s impossible to compare it ! Since variables are created on the fly in yarn editor, it could be great to make it return 0 (for number and string) or false(for state boolean (or even “null”) by default ? This is both an issue in Gdevelop and Yarn.

I have a strong suspicion you are not using those right :slight_smile: for starters they require a parameter (the variable name). In a last pr I had to change the setters and getters of yarn variables to fit better with how gdevelop does things, but I forgot to update the documentation. If you look at the updated example, you will see an example of how to use them I think. Always look at the example project before trying stuff.

To check if a variable exists or not I suppose you could check it for being undefined. I haven’t tested that myself. Might have a look tomorrow if I get any time

I will double-check the expressions to be sure and fix those too if there’s anything wrong

To be clear getVariable will return an empty string if the variable doesn’t exist- which is probably your case when you pass no variable name to getVariable. Compare variable will return false if the variable doesn’t exist.

We do not have a condition to check if a variable exists in memory or not yet. I suppose I might as well make one some time. For now use the get variable expression returning an empty string trick to do it :wink:

Please please please :pray: open the newest updated example project and study it. Then and only then and if there is no example of how to use an action or a command or an expression, then raise questions

Always doing it ! By studying again, i see that If statements and options are in fact working , but you use with only 1 option in a if/else, wich leads to another nodes. I’m trying
to use it like it was explained here: Controlling Dialogue | Yarn Spinner, but after your warning about YarnSpinner syntax (and difference with bondage.js), i’ve read carefully your doc and understood what was not working in the example (use of different syntax and tabulation).

But i’m still in trouble with some usage, that sounds to me like really common in many other dialog systems (modding games for the last 2 decades!).
I fail to conditionnaly display some options, when you know sometimes you just want to add one or two options if some variables are true. The only workaround i have is to duplicate the full contents (text lines + options lines) in each if/else cases, or even worse, duplicate nodes. It’s not optimal, and i’m trying to seek why the examples beyonds aren’t doing what i want.

Here is a sample project containing all the examples beyond.

If i use this (example1 in the attached project):

<< set $robot_head_0_done = 1>>
<< set $robot_head_1_done = 1>>
<< set $robot_head_2_done = 1>>
Ok kids we're gonna go with...
[[Actually, I'm not sure yet...|NotSure]]
<<if $robot_head_0_done == 1>>
[[Frog Head|PickRobotMascot0]]
<<endif>>
<<if $robot_head_1_done == 1>>
[[Pig Head|PickRobotMascot1]]
<<endif>>
<<if $robot_head_2_done == 1>>
[[Rabbit Head|PickRobotMascot2]]
<<endif>>

This ^^ just don’t work in the extension , no options are displayed at all, the dialog just jumps to the links.

If i use this (example2 in the attached project):

<< set $robot_head_0_done = 1>>
<< set $robot_head_1_done = 1>>
<< set $robot_head_2_done = 1>>
Ok kids we're gonna go with...
<<if $robot_head_0_done == 1>>
[[Actually, I'm not sure yet...|NotSure]]
[[Frog Head|PickRobotMascot0]]
<<endif>>
<<if $robot_head_1_done == 1>>
[[Actually, I'm not sure yet...|NotSure]]
[[Pig Head|PickRobotMascot1]]
<<endif>>
<<if $robot_head_2_done == 1>>
[[Actually, I'm not sure yet...|NotSure]]
[[Rabbit Head|PickRobotMascot2]]
<<endif>>

Only these options are displayed (the second and third if contents are skipped):
Actually, I’m not sure yet…
Frog Head

If i use this (example3 in the attached project):

<< set $robot_head_0_done = 1>>
Ok kids we're gonna go with...
[[Actually, I'm not sure yet...|NotSure]]
<<if $robot_head_0_done == 1>>
[[Frog Head|PickRobotMascot0]]
<<endif>>

It’s jump directly to next branch “NotSure”. I assume it’s because your extension directly jumps to a branch when only one option is found, but in this case, there should be 2 options displayed.
Since Jumps can be used directly (example: [[NotSure]]), in my opinion, if there is only a single option with a label, it should be displayed, and never handled like a jump. It’s an opinion and maybe not like bondage is designed to work, but i find it obvious.

Another non-working example (example4 in the attached project):

<< set $robot_head_0_done = 1>>
Ok kids we're gonna go with...
[[Actually, I'm not sure yet...|NotSure]]
<<if $robot_head_0_done == 1>>
[[Frog Head|PickRobotMascot0]]
<<else>>
[[Pig Head|PickRobotMascot1]]
<<endif>>

this^^ jumps to branch “NotSure” too.

Well don’t spend too much time on this if i just makes an horrible mistake on how to use it. But i’d really like to use conditionnal Options without repeating/duplicating whole sentences + options or nodes. My writer will hate me, and my translators too :rofl:


About undefined variables : I don’t have any trouble to compare it in GD. The problem is in internal dialogue variables, how to test if it’s undefined… Sounds “noobish” but:

  • <<if $Myvar == null>> doesnt work
  • <<if $Myvar == undefined>> doesnt work
  • <<if $Myvar == “”>> doesnt work
  • <<if $Myvar == 0>> doesnt work (or works if i set previously the value to 0)

Again, maybe i’m “corrupted” by Yarn Spinner documentation :slight_smile: : Expressions and Variables | Yarn Spinner

This is unfortunately how the parser bondagejs works, not my extension. A single option is treated as a jump to another node. It’s designed to do that. :slight_smile:
I personally like it, and yes it does have gotchas, but they are all demonstrated in the example project. If you don’t like that, by all means find a better one, make another extension. I am not going to change the design of the syntax for one guy. It’s already established and used that way by other games.

Yarn spinner does not yet work in a Js app and we can’t use it. If that ever changes, by all means everyone is free to do a pr to swap out bondagejs for it :slight_smile:
If you are a programmer, roll your sleeves and do a pr to bondagejs to fix these details. Put a bounty on it, maybe it will get fixed faster.

I suggest you actually try using yarn spinner in unity3d and tell us of your experience with it. Does it do what you need? Does your code work in it as you expect it to work here?
Your feedback might help us evaluate it.

I am 99% sure you can do conditional options, but to do it you need to come up with something better. And why are you so set on checking if a variable exists to put text/options. Why not check if it’s something or not something !=

Bondagejs is open source, have a look at it’s runner class and study how variables get created by it. Open an issue at it’s tracker and point to yarn spinners solution. That’s my advice to get this sorted anyways. On this forum only I can see your woes, but at bondages tracker, other devs will and might do something more.

Avoid bundling a billion issues into a wall of text, write them as separate issues at the tracker.

I am actually tempted now to update the example yet again to demonstrate how to do conditional choices. You seem to have found the one wrong way to do it by writing logic that triggers jumps to nodes when variables are met instead of presenting the user with choices. To do what you want you will have to write all choices that the user will be given when a variable is met, not just one which is seen as a jump. Your yarn code is written wrong. Move the not sure option inside both if and else.

I will try to update the wiki and add your code as an example of how not to do it and explain why the not sure is treated as a jump

1 Like

I updated the wiki to include your example of wrong use of yarn syntax and explanation how to use it to achieve the result you want
http://wiki.compilgames.net/doku.php/gdevelop5/all-features/dialogue-tree

I removed links to yarnSpinner’s documentation.

Anyone spoilt by it, go use Unity where you can get yarnSpinner :wink:
Maybe one day we will get it in gdevelop, its devs need to port it over to javascript though and that is not a simple task.

I dont know about you, but I rather live with the limitations of bondagejs than use closed source bloat unity

1 Like

I don’t want anything to do with Unity, like you i would prefer Godot over it :slight_smile:

If it’s in the doc, or if you tell me : “it works like this, not like this”, then that’s all what i need.

What i exprimed are feedbacks (and one opinion) about my experience using the extension, and it was mostly questions, i’m sorry if you took it as criticizes. It’s a good point that you removed the Yarn spinner doc, it’s clearly what i’ve seen in their examples that influenced me.

Since i can’t give a hand on the work you do on the extension (lack of skills, lack of time to learn), i would be happy to help you to enhance the documentation and examples, but for this, i have to be sure of how the things works.

Ah no worries, I don’t take it as criticism really
Just want to be sure that people understand the extensions design limits atm.

Bringing these points has absolutely helped the documentation. I updated the wiki to add.more clarity to when a jump to another node is triggered and when options are shown to the player

2 Likes