dialogic-godot / dialogic

💬 Create Dialogs, Visual Novels, RPGs, and manage Characters with Godot to create your Game!
https://dialogic.pro
MIT License
3.91k stars 234 forks source link

Separation of the built-in UI and dialogue system, allowing the user to implement their own dialogue box UI. #692

Closed uzkbwza closed 2 years ago

uzkbwza commented 2 years ago

Is your feature request related to a problem? Please describe. Dialogic is an awesome, well-rounded plugin with many features. Unfortunately, due to the structure of the project, to use some of these features you are required to use all of them. In my case, I find that the timeline editor is incredibly simple to use and allows you to lay out complex branching paths of dialogue quickly. I'd like to be able to use this feature with my own custom-implemented dialogue frontend, instead of the built-in. Of course, the ingame UI that comes with dialogic is already fairly customizable and flexible to the user's needs with custom themes, but in my case there are just some things I'd like to be able to do that I can't without drastically altering code scene structure within the plugin.

Describe the solution you'd like This is a hard problem and something I'd like to discuss more with the people developing this plugin. Right now, the DialogNode is coupled with many behaviors from its child Control nodes (such as TextBubble, FX, Portraits, etc...), which makes isolating the logic from the UI impossible without modifying source code. I propose separating DialogNode into:

  1. A base, "headless" DialogNode class with logic implemented for loading, processing, and transitioning between events.
  2. An interface for things like showing text, portraits, displaying (and responding to) choices, etc.
  3. A default implementation of said interface in the form of the current default Dialogic UI.

On the user's end, this might look as simple as using the base class as an "iterator" over a timeline, which returns the current event info per iteration, then yields for user input (or not, if that behavior is not desired).

Describe alternatives you've considered The easiest alternative would be to simply alter the source code and design the UI to my liking. But this has the obvious downside of being very difficult to keep updated with the main branch.

Additional context I would be happy to help implement something like this, but I first would like to get a better handle on the source code and discuss a course of action, if this is something @coppolaemilio is interested in for the project.

AnidemDex commented 2 years ago

Related to #45

Jowan-Spooner commented 2 years ago

I totally agree with this as well as #45. I've worked on this plugin for about 3/4 of a year now and I think it is clear that it's best part is the UI. Unfortunately the DialogNode itself is much less perfect. Many many things are totally hard coded, and intertwined in a way that should not be necessary.

Undoing this is a crazy amount of work tho. I think we can try our best to make it better and split it into individual parts, that can be removed without the whole thing breaking. I cannot say tho, when this will happen. Sometimes I feel like some things should be redone from the ground up, but such big changes are very hard to bring into a project like this. If I'm correct this is why AnidemDex ended up with a seperate plugin after trying to improve this one.

BUT, all small improvements towards this are very welcome imo and a discussion about a general solution is good especially considering the 2.0 rework in the future. 2.0 is intended for Godot 4 tho, so who knows when that will happen...

AnidemDex commented 2 years ago

Yep, that's exactly why I ended making my own (see #203 and https://github.com/coppolaemilio/dialogic/issues/276#issuecomment-997906041)

Sure thing that everything can be adjusted to just work but two things can't be lost while doing that: the scope of the plugin and its ideal.

This plugin works pretty well for visual novels, but everything else needs a little bit more of work and magic tricks to be done (and is something understandable, dialogic was made with visual novels in mind).

Instead of trying to adjust the plugin for everything else, I think is a good idea to enforce the purpose what this plugin was made on: visual novels

coppolaemilio commented 2 years ago

As I said on the discord chat, I think that it makes sense that we finish the 1.4 version and then start almost from scratch working in the 2.0v. I can imagine releasing other 1.4.x versions if there are major bugs to fix but I'm happy with the idea of making Dialogic more modular and flexible to use each part of it individually. I was initially going to wait for Godot 4 to start with Dialogic 2 but it might make more sense to just start now since no one really knows when that will happen.

Jowan-Spooner commented 2 years ago

The real problem is how to uncouple the parts of the DialogNode in a way that doesn't mean we loose control on them and can still provide similar functionality to 1.X.

One way of doing these modular things in godot that comes to mind is SIGNALS. There could be a DialogHead with functions like:

and could send out all kinds if signals:

While this would mean you could implement your own UI completely, it would also disable many intricate behaviours. The question would be: Should the dialog node already parse names, values, glossary, commands, or should this be left to the user? or would there be a way to choose? Some things like automatically continuing after certain events (like portrait animations, etc.) would be hard to manage, because there is no way to know if a portrait animation was actually started. This would mean that together with an own UI, users would have to recreate a lot of the behaviour the dialog node currently gives.

There is also the question how different parts of the DialogNode should interact in the future:

For example the text-bubble would have to interact with FX and GlossaryPanel, etc.

Just some thoughts as always. Would be happy to hear your ideas on this.