Hello! I've been coming up with a way to store the dialogue in my game. I have branching dialogues which are accompanied by character sprites. There is only one character the player can talk to at a time, so all I need is a way to store text + sprite for any dialogue line.

I've come up with a solution involving resources:

  • SpriteResource stores a sprite name + sprite texture
  • DialogueLine contains a SpriteResource and a String of the dialogue
  • DialogueFull stores an array of DialogueLines, and a ChoiceResource (for branching dialogue)

I've made a couple of DialogueFull resources, and filled the arrays inside with DialogueLines resources I created in the editor. However, on running the project I got an error because I was seemingly referencing a non-existent resource. I figured it was because I was using DialogueLines I'd created in the editor and had not saved as files, and so I saved the first DialogueLine in the array of the active DialogueFull. I thought I'd get an error for the rest of the DialogueLines that I have not saved, but the code run perfectly. I tried the same things with other DialogueFull resources, and got the same result.

My questions are:

  • Why do I need to save the DialogueLine resource as a separate file in the first place? Can it not just save itself inside the array of the DialogueFull it's a part of?
  • Why is it only the first one I need to save? If the issue was that information cannot be pulled out of unsaved resources, why is it that the rest of them run just fine?
  • Is there a better way to implement the dialogue system? I know about plugins like Dialogue Manager, but I would prefer to build one on my own.

Okay, well, I have no idea what happened, but I messed around with some other stuff and it seems to be working now? As in, I don't have to save the first element of the DialogueLines array now. So that's not an issue anymore.

I'm still open for suggestions on different ways of managing Dialogue, if anyone has any input! Is using .json files really worth it, or should I stick to Godot resources?