How does one make a simple/basic dialog system?


(Froom7) #1

Hi there!
Can someone help me or explain how one can make a simple basic dialog system. If someone can help that’d be awesome! I now want to actually finish games and now I want to add dialogs, so finally there will be more interaction. :smiley:


(Jacob Albano) #2

You’re going to need to be a bit more specific than that. Visual Novel text with click-to-advance? Classic RPG dialogue panes? Mass Effect-style conversation trees?


(Froom7) #3

Yeah sorry for being a bit non-specific, I’m into ‘click to advance’ and RPG dialog styles.
If people can help me get started, then I’m happy. :smiley:
Giving the basics is enough for me, so then I can explore it further myself.


(Abel Toy) #4

You need to implement some kind of pause system that selectively pauses entities’ updates (1).

Then, you make an Entity that wouldn’t be paused for the Message Box. This entity would be able to display a single message box with all the effects and stuff you want to implement (like type-writing text effect, text styles, icons, anims… whatever).

Then, when you want to have a dialog, you could have a DialogueController or something similar. This would have all the text it has to display for the dialogue. When a MessageBox is read (the player presses the enter key, for example. Or perhaps it’s advanced automatically), it tells the DialogueController to continue, and it unpauses the game if there aren’t more MessageBoxes to display or it shows the next if there are.

(1): you can simply override the update function in your world and have a dialogue boolean or something. If it’s off, you call super.update. If it’s on, you’d update the DialogueController and the current MessageBox.


(Jonathan Stoler) #5

Note (in case this wasn’t obvious): doing something like this will effectively “freeze” the screen. Thinking of RPGs, oftentimes animations will still play in the overworld (grass blowing in the wind, characters’ eyes blinking, etc.) and this solution will stop that. It might be better to allow each entity to decide what to pause during dialogue (ie, disable controls but keep blinking animation).

In this case, just have the DialogueController inform all the relevant Entities that there is dialog active, and then send a similar message again when it’s no long active. From there, each Entity can decide what to do in its respective update() function.


(Jacob Albano) #6

I think that’s what AbleToy meant when he said to “selectively” pause entities. Not all entities should be paused, just those that would interfere with the dialogue system.


(Abel Toy) #7

Yeah. Just disabling controls and enemies or the conflicting stuff would be better.