Code Monkey home page Code Monkey logo

dialogic's Introduction

cover

Dialogic

Create Dialogs, Visual Novels, RPGs, and manage Characters with Godot to create your Game!

Discord Godot v4.2+ Dialogic 2 Documentation GitHub Actions Workflow Status Latest Dialogic Release

Table of Contents

Version

Dialogic 2 requires at least Godot 4.2.

It's a major rewrite compared to the previous Dialogic 1.

If you are looking for the Godot 3.5 version you can find it here.

Installation

Follow the installation instructions on our Getting Started documentation.

Dialogic comes with an auto-updater so you can install future versions right from within the plugin.

Documentation

You can find the official documentation of Dialogic here: Dialogic Documentation

There is a Class Reference as well: Class Reference

Connect with us!

If you need help or want to share your Dialogic projects, take a look at the following options:

Testing

Dialogic uses Unit Tests to ensure specific parts function as expected. These tests run on every git push and pull request. The framework to do these tests is called gdUnit4 and our tests reside in the /Tests/Unit path. We recommend installing the gdUnit4 add-on from the AssetLib, with this add-on, you can run tests locally.

To get started, take a look at the existing files in the path and read the documentation to create your first test.

Interacting with the Source Code

All methods and variables in the Dialogic 2 source code prefixed with an underscore (_) are considered private, for instance: _remove_character().

While you can use them, they may change in their behavior or change their signature, causing breakage in your code while moving between versions. Most private methods are used inside public ones; if you need help, check the documentation.

Public methods and variables can be found in our Class Reference.

During the Alpha and Beta version stages, code may change at any Dialogic Release to allow drafting a better design. Changelogs will accommodate for these changes and inform you on how to update your code.

Credits

Made by Emilio Coppola and Jowan-Spooner.

Contributors: zaknafean, thebardsrc, and more!.

Special thanks: Arnaud, AnidemDex, ellogwen, Tim Krief, Toen, Γ’scar, Francisco Presencia, M7mdKady14.

Thank you to all my Patreons and Github sponsors for making this possible!

License

This project is licensed under the terms of the MIT license.

dialogic's People

Contributors

anidemdex avatar arnaudvergnet avatar atlinx avatar aurora-eluvia avatar bitbrain avatar cakevr avatar champbob avatar coppolaemilio avatar cristianros avatar ellogwen avatar endaye avatar exelia-antonov avatar invertex avatar iscke avatar jamesmwestbrook avatar jowan-spooner avatar kvagram avatar lamsorsen avatar m7mdkady14 avatar mechpensketch avatar metanoder avatar miere43 avatar oddfacade avatar pheubel avatar redxgames avatar skyace65 avatar timkrief avatar tradfursten avatar willnationsdev avatar zaknafean 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  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

dialogic's Issues

Samples not valid JSON

Hello,
If you move your embedded JSON sample script (in dialog_node.gd) to a file then it fails to load because it is not valid JSON. In addition, your file() method performs no checks on the parsed JSON to see if it's valid, it simply returns null back to your code.

I know this is all WIP and not ready, just trying to help in case you didn't have these in your list of things to do.

Hope this helps ;-)

  1. In the following the comma after 'face' should not be there, it's invalid JSON
    {
    'character': 'Kubuk',
    'text': 'Maybe... Now that you mention it, I can actually see your face!',
    },

  2. None of your single quotes are valid, they should be double:
    {
    "character": "Kubuk",
    "text": "Maybe... Now that you mention it, I can actually see your face!"
    },

In your file() method, you may want to check the dict is valid, i.e. as below is simply check for null.

if typeof(p.result) == TYPE_ARRAY:

btw, I think it looks a lot neater moving all that json sample in the dialog script to a separate json file...

Better keyboard support.

Writing text requires to use the cursor way too many times, so I'll be adding a few hotkeys for better keyboard navigation.

Some ideas for the Text Event are:

  • Shift + Enter: Create a new text event with the same settings as this one? (or maybe alternating between this and the previous, so you can create a conversation between two characters easily)
  • Tab: Jump to the next Text Event text edit field
  • Shift + Tab: Jump to the previous Text Event text field
  • Alt + up / Alt + down: Move selected event up or down

Clean/Clarify use of icons in conversation editor

There are 3 distinct things that appear with the script icon:

  1. The button to display the conversation editor within the Dialogic main screen.
  2. The texture shown beside the names of individual conversations within the conversation editor.
  3. The button to add an actual GDScript to the conversation.

conversation_editor_edited

There should be distinct icons for each of these purposes, imo.

Simplify left-hand panel UI to put data where it is relevant.

conversation_editor

In this original layout, you have many different parts of the UI present on the left-hand panel. But we've mixed together navigation, dialogue operations, and modifying the content of the dialogue all together in one place.

Here is a revised prototype of the UI:

conversation_editor_new_ui

In this case, the "events" stuff is all added to a sticky bottom "event" block that contains the buttons to add more blocks.

A toolbar is added to the top of the panel which would contain the script and folding ToolButtons.

Script: should show "add a script" icon when no script exists for the dialogue and the generic "script" icon (which it currently shows) to open the script in the ScriptEditor.

Folding: should be a toggleable ToolButton. If any 1 collapsable block is not collapsed, then the button displays a "fold" icon and clicking it will fold all blocks, after which, it displays the "unfold" icon. Clicking the button while in the "unfold" state will unfold all blocks and subsequently change it to the "fold" icon.

This paves the way for more making more fully-featured navigation options on the left, and creates more space for executing more dialogue-level operations in the above toolbar. I would reserve the higher toolbar for tabs, as you've done so. However, it might look better to give it more prominence with a full-fledged TabContainer or something. That way you can directly see the subsections of the dialogue editor laid out for you rather than the "tabs" looking like some sort of operations you can click on to execute. You could, in the long run, use it as a place to switch between minor editors for all kinds of pieces of data related to the story.

Unhardcode everything and split behaviors into digestible scene structure

Currently, Dialogic interface is hard-coded and difficult to expand with extra systems any developer would like to have (for example, my attempts to implement an Ace Attorney cross-examination system are hell right now.)
image
example of current hard-coded nature

My proposal is to expand and unhardcode the system in such a way that it's split into several digestible scenes, all of which can be replaced and overriden by developers while Dialogic still provides out-of-the-box default versions of the behaviors. This way, beginners will have an immediately working interface - what Dialogic is very good at right now - and also provide an alternative for advanced users who want to use the backend of Dialogic while handling the frontend themselves.
image
example of a dynamic and nice version

In simple terms, the parser node is the big focus of this issue report. A very good principle to hold for this is as such:
image
example how a parser node only acts as an intermediary for anything connected to it to interpret the data

This approach will also solidify Dialogic's position in the Godot plugin scene and might even make it the #1 go-to plugin for dialogue interfaces πŸ€”

Translate Dialogic UI to multiple languages

Initial work for this one has been done. This will be a tracker now of the things left to translate:

  • Timeline Editor (Event buttons)
  • Character Editor
  • Definition Editor
  • Theme Editor
  • Settings

Creating a "Character Join" event without "position" gives an error

Maybe the title had to be renamed to get_character_position() returns null

Issue

If you create a Join event with a character but without position, it gives you an error and breaks your game.

Dialogic timeline:

image

Debugger:

image

Json file:

image

This is due a problem with the dialog_node function get_character_position(). This returns null if all positions are false, but it should be returning an string to pass that to the init function of Portrait node, because the second parameter of init expects an string, but the dialog_node pass a null reference (because that's the actual behaviour).

Proposed solution

Playing with the code I got 2 possible solutions

1

Let the function get_character_position() return something:

func get_character_position(positions) -> String:
	if positions['0']:
		return 'left'
	if positions['1']:
		return 'center_left'
	if positions['2']:
		return 'center'
	if positions['3']:
		return 'center_right'
	if positions['4']:
		return 'right'
	return 'none'

And then handle that string inside the init function of Portrait node

func init(expression: String = '', position_offset = 'left') -> void:
	if position_offset == 'none':
		return # This line will not work as expected

or modify the positions variable

var positions: Dictionary = {
	'left': Vector2(-400,0), 
	'right': Vector2(+400,0), 
	'center': Vector2(0,0), 
	'center_right': Vector2(200,0), 
	'center_left': Vector2(-200,0),
        'none': Vector2.ZERO # or whatever you like
}

2

Handle the null value directly inside the init function of Portrait node

func init(expression: String = '', position_offset = 'left') -> void:
	if position_offset is null:
		return # This line will not work as expected

If you ask to me, I prefer the first option modifying the positions variables

Constant errors on placing a dialog node

I got two errors of the following:

  1. 0:00:00.506 get_node: Node not found: TextBubble/NameLabel.
    <C++ Error> Condition "!node" is true. Returned: __null
    <C++ Source> scene/main/node.cpp:1381 @ get_node()
    dialog_node.gd:27 @ _ready()
    2.E 1:14:19.183 get_node: Node not found: TextBubble/NextIndicator.
    <C++ Error> Condition "!node" is true. Returned: __null
    <C++ Source> scene/main/node.cpp:1381 @ get_node()
    dialog_node.gd:103 @ _process()

Plugin doesn't seem to be listed?

Please excuse me if I am making a really basic beginner error, but I am unable to get Dialogic to show up as a plugin in Godot! I have followed the documentation -- i.e. opening a new project, then downloading the zip, unzipping it and copying the 'addons' folder over to my empty Godot project, then checking in Project Settings>Plugins -- but Dialogic isn't listed there as a plugin to enable?

I have tried both the very latest build (0.8) and also v0.7 and it's not showing up in either.

I'm using Godot 3.2.3 on a Mac (Catalina 10.15.6).

Create helpful editor hints/warnings for accessibility

Just taking a look at Mark Brown's Designing for Disability series where he discusses subtitles and the like. I figure you can do a couple of things, like...

  • have larger paragraphs of text clearly indicate where breakpoints should be added to split it into a separate section in order to ensure the font size fits a limited amount of text on screen for readability.
  • design tools that conduct color tests on the font/background/scene background to ensure that the font is clearly legible at all times.

This issue is just to throw some ideas out there. Could be used to catalog other more specific issues of implementing a particular solution for one of the problems mentioned in Mark's YouTube series.

Invalid get index 'nodes'

  1. Add Dialog.tscn to project
  2. Start game
print('-------------------------\n', dialog_resource.nodes)

This line errors. After removing it works fine.

Maybe I haven't caught up? I'm on v0.6, but still watching video 1...

Make dialog resizabe

The dialog should be able to be displayed at any size, so instead of the fixed hard-coded control node it should be dynamic.

Using DialogNode makes the dialog object incorrectly sized

With this setup:
image
Whenever the game is launched, the dialog node appears disappeared - however, it is simply incorrectly sized. This is caused by resize_main() being called in _ready():

WHXKM4z8MY

When looking into the scene structure using the Scene/Remote tab in the engine, it appears that the dialogue node was not destructed, however, it's size is incorrect and way bigger than it is supposed to:
Godot_v3 2 4-rc1_win64_cBva1PdGZG

Timeline paused after emitting a signal

Hi,

when using a "emit signal" the timeline paused processing the next event.
Maybe an go_to_next_event() in line 311 from dialog_node.gd is missing.

Line 311 in dialog_node.gd
{'emit_signal'}: print('[!] Emitting signal: ', event['emit_signal']) emit_signal("dialogic_signal", event['emit_signal']) go_to_next_event()

btw, dialogic is really great. :)

Dialog node doesn't load text in an exported project

When exporting a project that contains a dialog_node the node only displays the default text even when supplied with a timeline and only uses the default settings. The node works when loading in the editor however where it displays the correct text and uses the correct settings

Error as reported by godot debug output(image attached):
Dialogic_issue

SCRIPT ERROR: parse_branches: Invalid get index 'events' (on base: 'Dictionary').
At: res://addons/dialogic/Nodes/dialog_node.gdc:64
(1024, 600)
[!] settings loaded: {}

dialog_node.gd loading settings
{}

SCRIPT ERROR: load_theme: Invalid get index 'theme_font' (on base: 'Dictionary').
At: res://addons/dialogic/Nodes/dialog_node.gdc:441
SCRIPT ERROR: load_dialog: Invalid call. Nonexistent function 'has' in base 'Nil'.
At: res://addons/dialogic/Nodes/dialog_node.gdc:191

Screenshot from the exported project:
Dialogic_text

MacOs icon size

When using Dialogic on a Mac the icons don't resize properly to the display. This does not happen in Windows at any display % resolution.

dialogic-mac-bug

I'm not sure if this is a Godot bug or an extra setting that I need to check, but leaving the issue here so I don't forget to fix it

Add full width for dialog themes.

Right now the dialogues are only displayed on a "bubble", so there should be an option to make them full size like in the GDQuest tutorial:

image

Bug with selecting choices in nested questions

When questions are nested, pressing on one of the buttons can cause a bug
Invalid type in function 'set_mouse_mode' in base 'InputDefault'. Cannot convert argument 1 from Nil to int.
Seems like it's simply trying to set a mouse mode to "Null" which gives an error. A simple null check might fix it.

Version: master, commit 83a7a0e

GDScript styling update

Some variations from the official GDScript style guide. I would recommend making changes to the codebase to match its specifications, for better cross-maintainability and consistency with the overall Godot community.

With just a quick glance at editor_view.gd, I noticed two issues already:

  1. Some nodes with PascalCase onready variable names.
  2. The spacing of newlines between functions is only 1, not 2.

Supporting more and improved data serialization options

From what I can tell, you used to use your character resources for data, but you've since migrated to using JSON for everything.

However, there are distinct pros and cons to each data format.

  • Resources:

    • visual editing with drag/drop support
    • type-safe use of properties
    • support for methods, signals, constants
    • automatic data-sharing at global scale (separately loaded resources with the same path share the same instance; this is not true of Dictionaries which will produce duplicate when loading the same file multiple times).
  • JSON:

    • doesn't have any of the 3.2.x frustrations with exporting user-defined resources, namely because it's all done via code anyway.
    • can easily edit data in any text editor with a commonly understandable format that does not break as a result of Godot API changes.
    • easier to export to or import from alternative editor software.

It'd be better if multiple serialization options could be supported simultaneously, presenting users with options to suit their preference/scenario.

I can also see that you manually parse and put together the data in the editor_view.gd script which performs many other tasks as well. Might I suggest the following changes?

  • Use the Strategy pattern to define serialization strategies (or just use an enum inside some Saver class). Allow JSON and Resource as options. Make the selection configurable from the UI.
  • Switch to exclusively using Resources for in-editor work, rather than Dictionaries.
  • Switch to using inst2dict and dict2inst to automatically convert resources to and from JSON formats.
  • Write a separate class that exclusively handles the data for the app, e.g. a DialogicDB class. Have it handle your "iterating over directories" work, building the object instances, and storing them in Arrays/Dictionaries/whatever for use elsewhere. Then, have your editor_view.gd just create an instance of the DialogicDB class and initialize it. This will help clean up the editor_view.gd script.

Also, long-term, because editing arrays of resources in the Inspector kinda sucks, we could consider implementing a spreadsheet-like editor in the bottom panel for editing multiples of these resources at once (with each row being a different instance), at which point, the entire collection of resources could be saved into a single dialog_db.tres file. Give people the option of saving each resource out to a separate file in a directory, but also give the option to just have it all saved to a single resource file that stores an array of the other resources internally. There's actually already a proposal I wrote about it at godotengine/godot-proposals#13. Not a requirement of the above changes though.

Dialogic not stopping input from filtering down to parent game

Input in Dialogic (input_next) is handled by the _process() method and not _Input.

This means the scene tree method set_input_as_handled() cannot be called. The result is if the underlying game is not paused then the input event is propagated down to the rest of the game that may handle _input, so if the same key handling input in Dialogic is handled in the game it is still called.

I'm not too hot on gui input in Godot but I had to fix the above problem by moving the _process() code handling input into the following similar code:

func _input(event: InputEvent) -> void:
	if Input.is_action_just_pressed(input_next):
		get_tree().set_input_as_handled()

i.e. after dialogic has processed the next screen key, it cancels input, otherwise Godot will just send the key to the rest of the game regardless.

Apologies if this version has already addressed this, I was using a slightly older version, but a quick scan of the code shows the same input being used.

Saving behavior is wacky.

It seems to save on every letter typed in the Text Block, which is excessive file I/O.
Instead, why not make it only save on every switch between timelines, whenever a new element is added to the timeline, or the game is about to be launched using the "Play the Project"/"Play the Scene" buttons?

Additionally, there might be a related issue to current saving being problematic:
#39

EndBranch element used for conditionals, yet internally called 'endchoice'

It's saved in json as 'endchoice' and is called that internally (in code) despite being "EndBranch" in editor and working with conditionals.
Suggested refactor should still be able to read the 'endchoice' in json but transform it to correct 'endbranch' naming automatically for backwards compatibility/migration to new method.

Hard to find plugin when searching for "dialogue"

When I was first looking for dialogue solutions this never appeared in my searches, mainly because all docs use the word "dialog" and I was looking for "dialogue". (i.e search for "dialogue" in Godot's asset library)

Both spellings are correct, but maybe if you find a way to include the second word somewhere you may improve your discoverability.

Nice work, though.

Error appears whenever I enable the plugin

Hi, whenever I import and enable the plugin in a project the following error appears:
res://addons/dialogic/Editor/EditorTheme.gd:43 - Invalid get index 'theme_font' (on base: 'Dictionary').
I tried it both on the current stable version of Godot and on the latest beta version. I also tried it on multiple projects and the result is always the same.
Cheers

Theme editor

A theme editor should be able to change the basic properties of the text and the dialog box where the final dialog is going to be displayed.

Can't add a new character

Whenever I try to add a character to my Dialogic project, I get the following error message and nothing happens:

ERROR: File must be opened before use. At: core/bind/core_bind.cpp:2216

Do I need to add some specific file to my project in order to make it work? (Other than the plugins subdirectory)

I'm on Windows, Godot 3.2.3 stable, Dialogic 0.8.
Haven't tried it yet on Linux but if you think that might help I can give it a shot.

Let me know if you need an example project to reproduce this.

Missing features

As in any narrative based games, there are few functions or effects that are missing in this wonderful plugin.

  1. Screen shake effects
  2. Character sprite animation (useful for character expressions such as; angry, sad, etc...)
  3. Choices tagging (for conditional multiple endings) e.g: if I choose "YES" in ch1 and "NO" in ch3 I will get bad ending and so on and so forth.
  4. Better multimedia handling (audio, video, sound effects, start to end of the audio being played).
  5. Tweening kinda effect (Character leaving the scene from left to right or the other way around)
  6. Visual editor/chart (useful to know the branching paths)

Point 1-3, I coded these manually and it's not that hard but for the sake of completeness of this awesome plugin, it would be nice if they come out of the box.

Thanks for this awesome plugin. Cheers!

Dialogic plugin makes Godot consume more resources than neccesary

Plugin version

0.9

Device

Windows 10 x64 (RAM 4Gb, Intel HD graphics 4000)

Issue description:

While using the plugin, I noticed that my computer was working slower than usual. I assumed it was just windows background tasks (because windows y'know). After closing them, the slow work still there, so i opened up the task manager and notice something interesting:
image

My ram being drowned by Godot. Things goes worse when i excecute only a Node with Dialog.tscn as child:
image

Note: % is the CPU usage.

(Just to be clear, i used the same scenary for all my test. An open Scene as the main scene with a Node as root and a Dialog.tscn as child of Node. This is usually the consumed ram without the plugin and the consumed ram without the plugin but Dialog.tscn as child)

Playing a little with the code, I managed to solve this problem (kinda):

  • Apparently, the Dialogic's lines 20 and 21 could be the cause of the problem (but I can't figure out why anyway).
  • I don't know if this issue is related to #44 , since reading and wrinting many things on disk can cause some problems.

Steps to reproduce

  1. Create a new project
  2. Create a new scene with a Node as root
  3. Import and activate the plugin
  4. Make Dialog.tscn child of Node

example_project.zip

Create mechanism for branching dialogue paths

Derived from a YouTube comment I made on your first devlog.

  • Allow a dialogue sequence to divert to another dialogue sequence.
  • Allow a diverted-to dialogue to pull data from the diverted-from dialogue, such as...
    • scene settings
    • current speakers
    • conversational variables
    • etc.
  • Store data in a resource that tracks the dependencies of each dialogue (both to and from references). Use this to power UI elements in the dialogue editor that displays a list of incoming and outgoing dialogue sequences related to the currently opened one.
  • Allow users to generate a graph view of how dialogue sequences are related to one another. Generated. Clicking on a dialogue in the graph would open it.

This would necessarily require occupying screen space on the left-hand side that is currently being used for events, folding, and script attachment. See #7 for more details on modifying the UI to accommodate things (including more complex navigation).

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.