Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411507 Posts in 69374 Topics- by 58429 Members - Latest Member: Alternalo

April 26, 2024, 06:21:47 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperDesignHow Does This Work?: Dialogue Design
Pages: [1]
Print
Author Topic: How Does This Work?: Dialogue Design  (Read 2893 times)
Suttebun
Guest
« on: May 12, 2020, 02:43:04 PM »

I'm looking to design a dialogue system for my game.
What first comes to mind is:

 Parsing
  >Word/Letter parsing
   -Allows Word colors
   -Allows Letter-by-Letter effects such as wave or shake

  Dialogue Patterns
  >Dialogue List/Node linking
   -Text node, player's response node, action node (like moving characters or triggering other events)

I'm using game maker and will not be taking advantage of the Timeline, as I feel building my own event based system is better.

Am I missing anything? Coffee
« Last Edit: May 18, 2020, 02:02:19 PM by Suttebun » Logged
RealScaniX
Level 6
*


Scanix (ignore the "Real", Scanix was taken)


View Profile WWW
« Reply #1 on: May 13, 2020, 07:50:06 AM »

I did a simple one for a gamejam game. Depending on what you want to do with it, the properties might differ. I had something like this:
 
DialogLevel
- id
- DialogNode[] options
 
DialogNode
- condition (if you need to know something first to be able to talk about it)
- DialogLines[] (noninteractive dialog lines between you and the other "person" that is triggered by this)
- link (id to switch to a deeper dialog level with that id | "<" to go up one level | "<id" to switch to that level as new top level | "x" to quit dialog)
 
All the styling would be done by markup in the DialogLine that is transformed to whatever you are using to display the stuff. Smiley

Logged

Suttebun
Guest
« Reply #2 on: May 17, 2020, 02:46:02 PM »

You're saying that there's 3 nodes right?
A condition, dialog line, and link node..

And then the DialogLevel is the travelable dimension which these as a system travel upon.
« Last Edit: May 17, 2020, 06:38:35 PM by Suttebun » Logged
RealScaniX
Level 6
*


Scanix (ignore the "Real", Scanix was taken)


View Profile WWW
« Reply #3 on: May 18, 2020, 12:22:59 AM »

You can do it however you like, you can even have a DialogNode that has DialogNode children to represent a "level" with options.
You just need some container for the options, then if the player clicks on one of them, the code checks the "link" of it and pushes the linked new level onto the stack or pops the current level from the stack or all levels or whatever behaviour you need. Before that it "plays" all dialog lines, which could also be simple strings with markup if you don't need them to have any more properties.
I do those things by pushing a new interaction mode onto an interaction mode stack that does its work (showing the dialog lines) and pops itself from the stack afterwards, so the dialog system is in control again.
Logged

Suttebun
Guest
« Reply #4 on: May 18, 2020, 12:26:07 PM »

How do you contain your nodes?

I imagine tables:
  [type_dialogue, name, "words"]
  [type_decision, "yes","no","maybe"]

But then am not sure how to connect the individual decisions to their output nodes.

---

Anyways using a stack sounds like a good way of handling a scene. Thanks RealScaniX :handthumbsupR
Logged
RealScaniX
Level 6
*


Scanix (ignore the "Real", Scanix was taken)


View Profile WWW
« Reply #5 on: May 19, 2020, 07:40:37 AM »

Well, if we go any further I will need to post code examples.  ^^
 
DialogLevel {
  string id
  DialogLine[] texts
  DialogNode[] options
}

DialogNode {
  string display
  DialogLine[] responses
  string link // the id of the next DialogLevel to push onto the stack or "<" to go up one level, "x" to quit or whatever you need
}

DialogLine {
  string text
  Speaker speaker // who says this? for text color, etc.
}

Whatever language you are using, I'd add the DialogLevels into a dictionary (or list, it does not matter performance wise here). Then load the initial level which might have the id "start" or "top" or whatever. When the player selects one option (DialogNode), I'd read the texts (DialogLines) that should be displayed then and when that is finished, read the link and get that DialogLevel and push it to the stack and the user can select the next option from there (or if the link is "<", I go one level up or close the dialog etc.).
Logged

Suttebun
Guest
« Reply #6 on: June 15, 2020, 10:12:03 PM »

Aha, thank you!
Logged
s0
o
Level 10
*****


eurovision winner 2014


View Profile
« Reply #7 on: June 22, 2020, 02:11:19 PM »

in gamemaker you could do this using nested ds_maps

a single dialog node map could contain an id for the dialog node (as a number or string), the dialog text as a string, plus a bunch of nested maps for the options, each containing the text for the option, plus the id of the the dialog node map it leads to.

you can store those dialogs in a json file and use gm's built in json functions to automatically generate the data structures you need. the one thing you'd have to write additional code for is converting the dialog node ids from your json file to actual data structure ids within game maker.

i second the suggestion of using some kind of simple markup language with tags that get converted by to draw functions for word coloring, effects etc.
« Last Edit: June 22, 2020, 02:25:17 PM by Silbereisen » Logged
Suttebun
Guest
« Reply #8 on: July 21, 2020, 01:41:45 AM »

@Silbereisen
Thanks for the write-up  Hand Thumbs Up Right

I recently discovered how much stuff you can do if you parse strings.
It becomes a linear strand of instructions which you can build your own programming language into, which translate into GML, and does what it does until it compiles into machine code.

A single string outputting one line of text being..

#type# Hello, how are you today? #delete# 19,6 #playsound# "snd_uhm" #wait# 5 #type# right now? #color# cyan,19,10 #blink# 19,10 #wobble# 0,5
(two numbers being position and length)

This gets interpreted by your own system, and then..

Commands output:
"Hello, how are you today?" is written out.
"today?" get's deleted.
You hear "uhmmmm".
5 seconds pass.
"right now?" gets written where "today?" was deleted.
"right now?" turns cyan.
"right now?" starts blinking.
"Hello" starts wobbling.

Persistent:
Right now stays cyan.
Hello continues to wobble.

You could have an entire cutscene event in one string.
This couped with a nice in-game way to edit and add events will lead to a pretty sweet way to build your game.
« Last Edit: July 21, 2020, 01:46:53 AM by Suttebun » Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic