Repost - Dialogue


The first part of my work on this project was building the dialogue system, which was a huge learning experience and went through quite a few iterations. Let me break it down step by step and reflect on how things progressed.

Initial Standalone Dialogue System

The first thing I had to do was create a basic dialogue system. At its core, this was about displaying text and allowing the player to move through dialogue panels. Honestly, it felt pretty straightforward at first:

  1. I made a DialogueManager script that handled displaying dialogue text and moving to the next line when the player clicked a button.
  2. For branching dialogue, I added a simple choice system with buttons that would appear when a node had options.
  3. I also created a DialogueNode ScriptableObject to define the actual dialogue content, which let me store each line of dialogue and connect it to the next node (or choices).

At this stage, it was basic but functional. The problem, though, was that it wasn’t very connected to the rest of the game. It didn’t interact with quests or any larger systems, and every NPC would need its own dialogue logic manually set up. It worked for testing, but it needed to evolve.

Integrating the Quest System

Next, I worked on tying the dialogue system into the quest system, which was a pretty big upgrade but also brought a lot of challenges. The goal was to make it so:

  1. Certain dialogue nodes could start or progress quests.
  2. Quests could influence what dialogue an NPC would say (depending on the player’s progress).

To do this, I added fields to the DialogueNode ScriptableObject, like:

  • triggersQuest: A boolean to check if the node triggers a quest.
  • questToTrigger: A reference to a QuestData object.
  • ActionType: An enum for specifying whether to start or progress a quest.

I also updated the DialogueManager to handle these fields. If a dialogue node had a quest to trigger, it would call the QuestManager to either start or progress the quest. This made the system feel a lot more connected to the overall gameplay, but getting it to work with the existing systems was tricky.

For example, one of the challenges was ensuring the quest system wouldn’t break if a node tried to progress a quest the player wasn’t on yet. I ended up adding checks in both the QuestManager and DialogueManager to handle this gracefully.

Creating an NPC Prefab

After getting the dialogue system to work with quests, I needed to make it easy to reuse for multiple NPCs. This led to creating an NPC prefab. Here’s how that went:

  1. I added an NPCInteraction script to handle clicking on an NPC to start their dialogue.
    • The script would call the DialogueManager and pass the NPC’s starting dialogue node.
    • If the NPC had a quest, it would also pass that to the QuestManager.
  2. I set up a simple 3D model (just a capsule for now) with a BoxCollider to detect clicks.
  3. I added fields in the Inspector for assigning the starting dialogue and optional quest, so each NPC could have unique interactions without extra coding.

This part felt like a big milestone because it finally made the dialogue system feel modular and reusable. Now I could easily drop new NPCs into the scene and hook them up with their dialogue and quests.

Attempting an In-Unity Dialogue Editor

At this point, I wanted to improve the workflow for writing and editing dialogue. Manually creating and connecting DialogueNode ScriptableObjects in the Inspector was getting tedious, so I tried building an in-Unity dialogue editor tool. The idea was to:

  • Create a graph-based editor where I could visually connect dialogue nodes.
  • Allow writers to edit dialogue text, choices, and quest triggers in one place.

Unfortunately, this didn’t work out as planned. I ran into a lot of issues with Unity’s UI system and figuring out how to save and load nodes dynamically. While I got a basic prototype working, it wasn’t stable or polished enough to use. I’ve decided to postpone this tool for now and come back to it later when I have more time to focus on it.

Final Reflection

Looking back, the dialogue system has come a long way. It started as a simple standalone system and now feels like a fully integrated part of the game, working with quests and reusable NPC prefabs. I’m happy with how it’s turned out, but there’s always room for improvement. For example:

  1. I’d still like to revisit the dialogue editor tool to make it easier for writers to work with.
  2. It might be worth adding more dynamic conditions to dialogue nodes, like checking inventory items or player stats.

If anyone has tips or ideas for improving dialogue systems, especially with Unity, I’d love to hear them. Thanks for reading!

Get NeoNoir

Leave a comment

Log in with itch.io to leave a comment.