Skip to content

A modified version of DoublSB's D'Dialogue System, redesigned for more broader/general uses in games.

License

Notifications You must be signed in to change notification settings

Josephy5/DDialogueSystem-Extended

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

D'Dialogue System-Extended

Unity Version Unity Pipeline Support (Built-In) Unity Pipeline Support (URP) Unity Pipeline Support (HDRP)

This project is a modified version of DoublSB's D'Dialogue System (Original GitHub Repository), a simple dialogue system that uses C# Code to play out dialogues. These modifications help to make the system more usable for broader use, including 3D games and re-triggerable dialogues.

The original system was specialized for single-shot visual novels and 2D-based dialogue, which felt restrictive for me in using it for other uses (even in a visual novel context). I used an older version of this modified system on an old game project, but it has since been scrapped. I am putting in my changes here in this repo for anyone to see or use for thier own purposes under MIT license. I have tested the code on Unity 6 (6000.0.30f) and in the URP pipeline, but it should be able to work on older unity versions or other pipelines just fine (other than maybe some modifications if required).

Do note that I haven't draft out the documentation yet, I will draft out one in the future. You can still refer to the old documentation (it is in the repo as well), as most of its commands and original functionalities are still there.

The changes to the original system

  • Dialogues are now re-triggerable, allowing developers to decide when and how dialogues can be replayed
  • Removed Character and Emotion functionality, focusing on text, actor names, and dialogue choices
  • Added character name text integration into the UI and Dialogue Manager
  • Upgraded to TextMeshPro for better text rendering (can be changed back to using Text instead of TextMeshPro)
  • Simplified SFX audio playing
  • Enhanced the DialogueAsset prefab to align with these changes

Installation

  1. Download and import the system (via UnityPackage, zip, clone, fork, etc.)
  2. Locate the DialogAsset in the Prefab folder under DDSystem and add it to your scene
  3. Create a custom dialogue script for your character game object, or refer to the provided Dialogue_DEBUG script
  4. Assign references to the appropriate fields in the inspector

Creating a basic dialogue script

Here’s a simple example of creating a dialogue script:

Public DialogManager dialogManager;

void Start(){
  //creates the list needed to play the dialogues out on the screen
  var dialogTexts = new List<DialogData>();

  //this will add a new dialogue to the list, saying "Hello World" by the character, Bill
  dialogTexts.Add(new DialogData("Hello World", "Bill"));

  //this will play out the dialogue, and it will pop on the screen. Once it is finished, it will automatically turn off
  dialogManager.Show(dialogTexts);
}

Commands

All commands start with /(Command Name)/. An example of using a command is

//the command we are using is /sound/, which will play a custom SFX clip at that point in the dialogue
dialogTexts.Add(new DialogData("And here we go, /sound/the haha sound!.", "test"

List of possible commands (You can also refer to the documentation as well, just no /emote/ command):
Screenshots from the original repo about the commands (as I don't have time to write through all this at the moment, will update this later on, so treat the screenshots as temporary for now)
image image
The original system's /sound/ command uses /sound(name)/, but here, we can simply call /sound/ and have it replace the SFXaudio audiosource in the DialogAsset prefab with the correct audio clip by utilizing callbacks. To better demonstrate what I mean, here is an example to explain it

//assume we give this public varaible the haha sfx
public Audioclip HahaAudio;

//We will be using a helper method as a callback. So after we finish the dialogue and want to play the next it, since we set our callback to DialogueExtra, we would first execute the DialogueExtra function
//before playing the next dialogue. Lets say in the DialogueExtra method, we take haha sfx that we have and insert it into the SFXaudio Audiosource's audio clip field in the DialogAsset prefab in our scene.
//So we insert the audio clip to the correct audio source in DialogAsset, so when we play the next dialogue, it will refer to that audiosource in that prefab and play it in that moment in the dialogue
dialogTexts.Add(new DialogData("Blah Blah", "Jill", () => DialogueExtra(HahaAudio)));

dialogTexts.Add(new DialogData("/sound/haha!", "Bill"));

for more information, you can refer to the old documentation or the info in the original repo (Original GitHub Repository).

To-Do

  1. Optimize the code
  2. Better Dialogue Actor/Character to Dialogue Manager system
  3. Multiple SFX capability for the /sound/ command
  4. More in-text dialogue commands
  5. Draft documentation
  6. Unity DOTS intergration

Credits/Assets used

The base code of the dialogue system is from DoublSB's D'Dialogue System (Original GitHub Repository)