GithubHelp home page GithubHelp logo

nathanhoad / godot_dialogue_manager Goto Github PK

View Code? Open in Web Editor NEW
1.7K 20.0 132.0 5.5 MB

A powerful nonlinear dialogue system for Godot

License: MIT License

GDScript 94.64% C# 5.36%
godot dialogue editor runtime addon gdscript godot4 godotengine csharp

godot_dialogue_manager's Introduction

Nathan Hoad

The code that powers https://nathanhoad.net

Writing posts

Create a folder in the /posts directory and name it what your slug/url is going to be (eg. posts/just-start-now).

Now create a .text file of the same name as the folder and put it in that folder (eg. posts/just-start-now/just-start-now.text).

The first lines of the post will be its title, followed by a list of its headers:

# Just start now

- published: 2018-03-06
- tags: games, painting
- share: some-image.jpg

There is a long road between a dream and reality. The path is not well worn and sometimes hard to see.

...

Developing

To run the server just do npm start. Posts will be compiled statically and then a simple asset server will spin up.

In development mode (NODE_ENV !== 'production') the server will watch for changes to posts and templates and recompile/restart when needed.

godot_dialogue_manager's People

Contributors

4kxz avatar azul372 avatar breadcrumbistaken avatar caimantilla avatar cajunwildcat avatar chevifier avatar citizenken avatar dangerousl avatar exodrifter avatar feendrache avatar festerdam avatar gepsu avatar gnuqb114514 avatar gueckmooh avatar hauntedbees avatar jcnoon avatar jmoon1506 avatar kinsman avatar loregret avatar loufe avatar marcuslimdw avatar marcusriemer avatar mournguard avatar nathanhoad avatar nickstersand avatar nospoone avatar rothiotome avatar selenyhr avatar sheepyhangcn avatar xchrix 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

godot_dialogue_manager's Issues

Skip to the end of current line

Not sure if this is possible with the way you have mutations set up, but could you add a function to the DialogueLabel for skipping to the end of the current line?

So, as the text is typing out, if someone presses let's say "ui_accept", the entire line shows immediately.

Request: Better Internationalization Features

I am bilingual and I translate my own script and also like to switch back and forth between versions a lot as I write. Oftentimes when translating into one language I end up revising the other language script a lot too. Right now this means switching between the csv file and the resource a lot and since that's a pain usually I just adjust my scripts in the spreadsheet, then copy-paste each modified line back into godot... which is also a bit of a pain.

One thing that might help is a way to import lines from the csv file if they have the same static keys. It would at least do away with the copy-pasting.

If there was a way to edit translations from within godot itself that would be a massive help but I'm not sure how that would work.

Play test relies on window size

I'm making a pixel art game so the window size is relatively small (256 x 150). When running play test, the scene is too small to actually preview anything.

ksnip_20220309-111517

I'm not sure how this should be resolved. Maybe put the test scene in a Viewport?

Better conditional information for responses

First: thanks for the hard work! Second: I just started using the addon so perhaps I'm missing something obvious or using it the wrong way.

Is your feature request related to a problem? Please describe.
The manager doesn't feel very transparent regarding responses at the moment. It seems like disallowed responses are hidden from the user.
If I understand this correctly, DialogueLine has an array of DialogueResponse, and each response has an is_allowed field. I'm unsure if that field works, because the manager simply discards the responses with failed conditions.

I feel like the most transparent way to handle this would be to pass all the responses to the user, allowed or not, so the user can decide what to do with them for their particular project (hide them, gray them out, etc).

Describe the solution you'd like
Ideally, the dialogue would output all the responses, both allowed and not.
It would also be great if DialogueResponse included its condition(s) as an aditional field, both failed and passed. This would allow you to parse the response and inform the player why a certain response is enabled or disabled. This is very common in interactive fiction and CRPGs, where the actions of each choice are made explicit, for example it's common to see choices like: "- Tell me about your past. (Requires relationship 5+)" or "- Pick the lock (Requires picklock)".

Hopefully this sounds reasonable. Thanks again!

example_balloon gets freed too fast, resulting in a 2+ frame blink

If a 'continue' input has been made, example_balloon deletes itself before the a new one gets added to the scene tree, resulting in a very noticeable and disrupting text experience. Even though the 'actioned' signal gets emitted first.

With V-Sync ON and 60Hz monitor the 'blink' is most of the time two frames long. But can be longer depending on the machine and if its a 'menu' or not.
https://user-images.githubusercontent.com/57991867/153765869-b8408f13-f3a0-4cf6-b1f1-404ce10bc3b6.mp4

EDIT: I'm an idiot, I found out how make this work. (Made a pull request)

BUG?

image

如果找到不应该报错应该加入判断

Allowing for single responses

I kept on running into a weird problem during debugging where the responses were not appearing. The response I wrote just straight up was not appearing.

image

Turns out that with only one response, it just straight up isn't rendered. You need minimum 2 responses for it to work. I'm not too sure if this is an issue with the example dialogue bubble or an issue with the dialogue manager itself, but it's something that needs looking into.

Why would you ever want a single response? To signal to the player that they have no choice, that something is inevitable, and that it is them is doing it. It's more active and engaging than passive dialogue text.

Passing arguments for characters

Is your feature request related to a problem? Please describe.
For dialogue heavy VNs the text could get quite full with repetitive functions, for example changing the character emotions

Example :

~ ask_about_dishes
do actor_emotion("mc", "thinking")
mc : Why are you doing dishes by hand? [TR:t0b190be9e7]
mc : Is the dishwasher broken? [TR:t72e4ba6e7b]
do actor_emotion("mom", "cheese")
mom : No honey, it's working just fine, I just like doing them manually sometimes [TR:t9744dbd84d]
mc : Is this the real reason? [TR:tdbf3168707]
do actor_emotion("mom", "thinking_back")
mom : Well...the dev drew me washing dishes and he forgot that there is a dishwasher! [TR:teac14c1038]
do actor_emotion("mom", "neutral")
mc : typical [TR:t0612d3d5fd]

the actor_emotion() function is repetitive and breaks the flow of the script and makes it less readable

Describe the solution you'd like
Passing arguments for characters in the dialogue as follow :

~ ask_about_dishes
mc "thinking": Why are you doing dishes by hand? [TR:t0b190be9e7]
mc "thinking": Is the dishwasher broken? [TR:t72e4ba6e7b]
mom "cheese": No honey, it's working just fine, I just like doing them manually sometimes [TR:t9744dbd84d]
mc "thinking": Is this the real reason? [TR:tdbf3168707]
mom "thinking_back": Well...the dev drew me washing dishes and he forgot that there is a dishwasher! [TR:teac14c1038]
mc "neutral": typical [TR:t0612d3d5fd]

and then we can use the balloon script to separate the arguments from the character name and handle the logic from there.
this could be very useful for heavy dialogues VNs and could be used for other stuff other than character expressions, maybe changing characters positions on the screen just like in renpy

Change the syntax for `goto`?

Currently, goto syntax is goto # Some title. This makes it look like a comment, considering that Godot uses # to designate them.

Maybe eliminate the symbol altogether?

Skip text whilst in the middle of being typed out

Is there a way to set an input so that you can skip any text that's in the middle of being typed out? I'm having a hard time understanding where the plugin controls the text speed, or indeed if an input function can be shoehorned somewhere so you can skip dialogue in the middle of its "being typed out" animation.

Feature? Show selected response line

Not sure if this is possible yet without adding code to the example balloon:
Right now, the response line that is selected, is not displayed before the reply is displayed.
Maybe this could be a toggle?

Dialogue Editor is slow to type in for large projects

Hello, I run a large project with thousands of files. This causes saving to be much slower than the average project.
I was wondering if the editor auto-saves upon entering any text. If so, this might be the cause of the performance issues. The option to turn off auto-save and have a manual save button would be a simple solution I think.

I tested it again with a fresh minimal project, and the slowdown does not happen there.

Attached is a video demonstrating the slowdown. Under Godot's code editor, input is smooth, but in the Dialogue tab, it is slow to enter anything.

2022-03-07.20-07-49_edit.mp4

More advanced expressions

I wish I could do something like

- Foo [if foo and (bar or baz)]
    ...

or

set foo = bar and (baz or quaz)

or

set foo = f1(bar, f2(baz))

Keywords (or, and) could be operators instead (||, &&), doesn't matter.
Doing 2nd or 3rd one would allow 1st one indirectly (by using a temp variable (and maybe custom functions)).

This would allow for more complex checks in responses etc.
Currently it's technically possible with custom functions and more temp variables, but it's kinda ugly and verbose.

Nice work so far, I think it has a lot of potential!

Some Ideas about improving the workflow/Scalability Enhancements

I'm a huge fan of this plugin and I feel confident saying it is by far the best one available for Godot and I have few suggestions that could potentially improve the user experience and make the plugin scalable and flexible to fit any type of scenario you may come across.

**Suggestion 1 : ** Make titles shared between dialogue files (.tscn files)
Basically the ability to call titles from other dialogue files. This is helpful for couple of reasons,

  • It will keep the project more organized.
  • Remove Repetitive dialogues .
  • You can make a series of events that can be called in other dialogues, In my experience, On of the strength of this plugin is not only to easily write dialogues but It's ability to call functions through dialogues makes it super helpful at making scriptable events for any scenario you may come across. Ex : An event that changes the room the player is in with some dialogue in the middle.

**Suggestion 2 : ** Title blocks should not stop upong meeting a new title
I can understand why blocks would end upon meeting a new title but nesting titles will make you able to save a lot of effort and time.
So each title should end with an '=> END' if you truly want it to end
This will be explained in the Suggestion 3 example as they go together

**Suggestion 3 : ** Title blocks can execute as functions.

  • You can add '()' after a title name to make it jump back to where it was called from after ending.
    Just like in renpy when you call a title block, uporn reaching an END it should jump back to where it was called from, then continue the dialogue as you would normally do. it's like executing a function.
    Example (This example is written with Suggestions 1 and 2 in mind):
~ talk_to_mia 
=> fade_screen_in() [This could be stored in another helper file because it's repetitive]
do actor_join("mc", "left")
do actor_join("mia", "right")
=> greeting_mia()
~ mia_options 
- Video games
	=> ask_about_video_games
- Leave
mc : Okay then...I'll see you later...
=> fade_screen_out() [This could be stored in another helper file because it's repetitive]
=> END

~ greeting_mia
mc : Hi, Mia, How is your day going?
if good_mood
	mia : My day has been great so far
	mc : That's awesome
else
	mia : I was doing just fine until you showed up
	mc : Oh....
=> END

~ ask_about_video_games
mc : Is the challenge still up?
if good_mood 
	mia : Ofcourse, 50 bucks if you win
	start_playing_video_games()
	=> END
else
	mia : I don't want to play right now!
	=> mia_options

Anyway these are all just Suggestions based on my own experience with the plugin while using it on somewhat of a long game and most of the enhancements are inspired from renpy workflow.
I know that they can bee too much work but maybe Nathan can consider them for the future of the plugin.

Responses nested inside of conditions continue outside of nesting

Nesting regular dialogue lines under conditionals works as expected:
("Condition is TRUE" is the last thing you see before the conversation ends)

~ start
if true
	Condition is TRUE
else
 	Condition is FALSE (You shouldn't see this)

However, if you add a response, the else is also run:
("Condition is FALSE (You shouldn't see this)" is the last thing you see before the conversation ends)

~ start
if true
	Condition is TRUE
	- Foo
else
 	Condition is FALSE (You shouldn't see this)

image

The workaround is to simply add an => END under the response:

~ start
if true
	Condition is TRUE
	- Foo => END
else
 	Condition is FALSE (You shouldn't see this)

Obviously since the workaround is so simple, this isn't a huge issue, but I figured I should document it anyway in case anyone else comes across this.

Join forces with Rakugo ?

My friend and I are making then Rakugo project is a dialogue system inspired by Ren'Py,
but also Kits that bundles together other addons and ui with options/save/load for given game genre:
Visual Novel, Point & Click Adventure or JRPG.
Do you want to join our efforts ?

Requesting the ability to fold/unfold title blocks

Describe the solution you'd like
Well it's failry simple, It's kinda the same thing that we have with the godot script editor where you can fold/unexpand blocks of code such as functions and classes only this time inside the dialogue text editor to fold titles. I dont know if it's an easy task to do but this would really help games with lots of dialogs

BBCode is Not Correctly Re-Added When Using GDM's Markup

Describe the bug
When using BBCode within GDM's scripting, the BBCode will become misaligned after sequential usage of GDM's mark up.

To Reproduce
Steps to reproduce the behavior:

  1. Create new piece of dialogue
  2. Write: AAAA [wait=0.5000000000][wait=0.5][wave]BBBB[/wave] CCCC DDDD
  3. The resulting text will be AAAA BBBB CCCC [wave]DDDD[/wave].
  4. This happens no matter what is between the two [wait]s. The [wave] around BBBB will always be misaligned. See screenshot No. 2.

Expected behavior
I expect the [wave] tag to surround the correct text: AAAA [wave]BBBB[/wave] CCCC DDDD

Screenshots
image
image

Escape ":" if it's part of a dialogue line

I chose your dialogue plugin for my first game built with Godot and it looks very promising!

Is it possible to handle ":" differently if it's just part of a dialogue line, maybe with an escape sequence?
If no character is speaking, the whole part before ":" becomes the character.
If a character is speaking, the part after ":" is not shown.

not or !

Hope to add negative judgment

Character names should support variables

It appears that character names are not supported as variables. For example, if I let my player pick their name, there does not appear a way to set the name of the player to that name. It might be a bit niche and gimmicky, but it benefits games that focus on the player rather than a pre-defined protagonist.

One workaround is just to have the player as "You", but it feels a bit strange. Another workaround is to to a regex replace on the raw text, and then run the whole thing into the parser.

Error connecting to signal: completed during yield()

Describe the bug
Unable to use any dialogue (custom balloon or example balloon) because of an error that Godot returns.
Error: Error connecting to signal: completed during yield

To Reproduce

  1. Download the latest Godot Dialogue Manager
  2. Create some dialogue
  3. Try to show dialogue

Expected behavior
The written dialogue shows up successfully.

Request: An option to toggle word-wrap

Hello, great work as always with this addon. I was wondering if it would be simple to implement a word-wrap toggle, since sometimes I write pretty long lines, and having word wrap would feel cozier.

Will it be updated in the near future?近期会更新吗?

I want to reconstruct my project and deploy this plugin.
Can you open an interface, let the code control TRES directly? This is more flexible

我想重构项目,直接部署此插件?
可以开放接口,让代码直接控制tres吗?这样更灵活

Quick font change

Because this plugin does not change the font quickly by default, I had to make a copy of example balloon, which I hope will change.

mutate function missing yield

When creating a dialogue that emits a signal with an argument do emit("dialogue_event", "arg"), mutate() doesn't yield and line 82 throws an error:
First argument of yield() not of type object.
In order to use "completed" on a function in yield, the function itself must yield.

This is easily solved by unindenting lines 280-281 by one, so that we always yield:

	# Wait one frame to give the dialogue handler a chance to yield
	yield(get_tree(), "idle_frame")

Change action for skip_action in the DialogueLabel node.

Currently, the skip_action used in the DialogueLabel node is set to "ui_cancel" and I was wondering if it would be possible to be able to change that. I'm currently changing it to what I need before the label starts doing its thing so it's not a big deal, but I'd thought I ask.

Some times editor gives output error when no dialogue is loaded

Sometimes when I start Godot up and the no dialogues is loaded.
I get an error in the output: line 80 in main_view.gd can't call raw_text on null (sorry I didn't capture it).

Changing line 79 to:
if is_instance_valid(editor) and current_resource:
Fixes it

Do not include generated contents on the dialogue resource file

Is your feature request related to a problem? Please describe.
Having the clear and concise dialog language is awesome. Thanks for that!

What I have seen in my short experience with this is that the text is being mixed with implementation details from the resource itself.
This makes it difficult with git conflicts where the text is repeated on the rawText and lines. This also adds a bit of redundancy.

Describe the solution you'd like
I would like to see a simple text file with the rawText contents (or the closer to only that). Was wondering if the lines (and maybe other fields) could be some kind of cached data that could be build at compile time from the text to keep it more simpler and have a nicer git conflict experience.

Describe alternatives you've considered
I haven't considered alternatives - not even sure if what I'm asking is possible.

Additional context
None

How to combine string

image

i want to get check1 or check2 or check3

Get it through the get_game_status function

Suggestions for the csv generated files workflow

One of the small problems with the generated csv files is that if you want to change the dialogue later on you would have to generate a new csv file or overwrite the old one meaning you will have to modify the csv file again for both the new generated keys and the old ones.

I was thinking If it would be possible to instead of overwriting the file, we can just append to it the new keys that were added and replace any dialogue that changed while keeping the original translations

One way I can think of is storing the csv data into a dictionary and modifying it accordignly
Also it would be really nice if the save pop up remembered the last saving directory instead of opening in the same folder the tscn file is in.

Access translation_key of Dialogue Line

Hi, I'm extending the example balloon to play a line of voice when a line is displayed (if you'd be interested in adding that functionality I could provide a PR when done).
For this I need to access the translation_key (to lookup the audio file), so I added this to dialogue_line.gd:

var translation_key : String
and in _init
translation_key = data.get("translation_key")

If this makes sense, would you consider adding this? Thanks

Conditions without operator are evaluated incorrectly

Describe the bug
Right now a condition like [if var] is accepted, but not evaluated correctly. It will treat it as true even when var is set to false.

To Reproduce
Steps to reproduce the behavior:

In the game state:

var _false = false

And in a dialogue:

~ dialogue
This is some dialogue.
- First one [if _false == true]
	This works.
- Second one [if _false]
	This doesn't.

Issue calling Inline Mutation

This could just be user error, but when using inline mutations, this error appears:

"Invalid type in function 'mutate' in base 'Node (dialogue_manager.gd)'. Cannot convert argument 1 from Array to Dictionary."

Just in case, this is how I called the mutation:
Capture

Here is where the error is appearing:
image

Any plans on porting the addon to Godot 4?

I love the idea of your 'Say What' plug-in. To parse a simple dialog script that treats the data and events almost automagically is mindblowing. This mixed with something like dialogic (a dialog-box theme editor) could make frameworks like Ren'Py outdated and deprecated. :P

Anw, praises aside. As soon as I got my hands on the plugin, decided to translate it to Godot 4 alpha. Availlable here. It's somewhat functional ─ I may test it later to catch unreached bugs.

If you wish to post it already into Godot 4 AssetsLib, go ahead! I would love to contribute. :3

Nicer text animation

Previously I built a dialog manager in a similar style to the Animal Crossing games with a small sound effect as each character is played.

How would be the best way to go about implementing this in the godot-dialogue-manager?

On each character played a small note is also played to give the illusion of some speech.

Screen.Recording.2022-02-01.at.13.48.59.mov

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.