Dialog System - Code/Format/Tools

2 views
Skip to first unread message

Dante

unread,
Mar 17, 2008, 9:18:15 PM3/17/08
to FLASHOVER - Game Project
I've been working on the Dialog System lately.

The format for Dialog will be reading from text files in this format:
NPC:Text<audio.mp3>
PC: Text<audio.mp3>
NPC: Text<audio.mp3>
PC: Text<audio.mp3>
NPC:Text<audio.mp3>
etc....

The Dialog System makes a Dialog Node for each line of text, storing
the text, what level in the tree, and the audio file associated with
that line. Next, I will have the Dialog System put all the Dialog
Nodes in a Tree Data Structure that will be interactively iterated at
run time.

A tool is needed for creating the text files with the above format. I
think it would make sense to make the tool in C# or Python. With this
tool, the game designer can create branches and leaves of the dialog
tree as he desires, identifying whether the NPC or the Player is
talking, write the line of text to say, and file browse for the
correct audio asset associated.

Cyberdrill

unread,
Mar 18, 2008, 8:18:19 AM3/18/08
to FLASHOVER - Game Project
I want take it. What time are you planning for this task?

Dante

unread,
Mar 18, 2008, 12:44:11 PM3/18/08
to FLASHOVER - Game Project
If you'd like to help with this one, that would be great! So, you
could make the tool that exports the text file, while I work on the
loader for it. I would think this should take no longer than 1 or 2
weeks, unless you have no time? Let me know. I could always switch to
working on something else if you need more time.

Cyberdrill

unread,
Mar 18, 2008, 2:08:32 PM3/18/08
to FLASHOVER - Game Project
What do you think about making this dialog file in XML format? for
trees it's very nice. I haven't experience in working with XML format,
but this is one more stimul to make this work better and learn
something (i try my best to explain, sorry for english :))) What about
time - I have very hard period now, because of my project at work (CAD
app). But I think 2 weeks is more then enough. Please answer about XML

Dante

unread,
Mar 18, 2008, 3:00:12 PM3/18/08
to FLASHOVER - Game Project
XML would be fine. They are both just text after all in code, right?
It might be easier to keep track of things and read the actual output
files. Sound good.
Let's do it! :)

Cyberdrill

unread,
Mar 18, 2008, 3:03:52 PM3/18/08
to FLASHOVER - Game Project
Yes it's simple text, but it's a world standart format, and it is very
easy to handle and it's great for tree like this. I'll begin at the
end of the week.

Praetor

unread,
Mar 19, 2008, 4:13:41 PM3/19/08
to FLASHOVER - Game Project
Irrlicht has a built in xml parser, if that helps (you can download it
separately somewhere as well (it's called irrXML, you can download it
at the following address):

http://www.ambiera.com/irrxml/index.html

Cyberdrill

unread,
Mar 19, 2008, 4:37:57 PM3/19/08
to FLASHOVER - Game Project
Thanks! But this tool will not deal with Irrlicht, I plan write it
using C# and XML (.NET 2.0 has great library to work with XML docs).
And I already begin :)

Dante

unread,
Mar 19, 2008, 4:40:09 PM3/19/08
to FLASHOVER - Game Project
Right, Cyberdrill, you won't use Irrlicht. But, since we are using XML
now, I'll use irrXML from Ambiera to load it into the game. Thanks
Praetor.

Dante

unread,
Mar 19, 2008, 4:44:49 PM3/19/08
to FLASHOVER - Game Project
Oh, since we are using XML now, we need to define the format. What do
you have in mind?

Here's what I think we need:
-Define whether a NPC or the Player is saying each line
-The text for each line
-The audio asset associated with each line
-How many degrees deep into the tree each line is.

Cyberdrill

unread,
Mar 19, 2008, 5:01:19 PM3/19/08
to FLASHOVER - Game Project
It is what i'm working now on :)

Cyberdrill

unread,
Mar 19, 2008, 5:21:15 PM3/19/08
to FLASHOVER - Game Project
<dialog id="666">
<speech id="1">
<autor>PC</autor>
<audio>audio1.wav</audio>
<text>Hello</text>

<speech id="11">
<autor>NPC</autor>
<audio>audio2.wav</audio>
<text>Don't bother me! :)</text>

<speech id="111">,,,<speech>


</speech>

</speech>

<speech id="2">...</speech>


</dialog>

Cyberdrill

unread,
Mar 19, 2008, 5:27:52 PM3/19/08
to FLASHOVER - Game Project
What's your opinion? XML is good because it can be easly include new
elements without breaking source format. So for the beginning we need
to keep it simple, and include elements as required...

Dante

unread,
Mar 19, 2008, 7:31:46 PM3/19/08
to FLASHOVER - Game Project
Looks good, minor correction:

autor, should either be Actor or Author? Actor would be nice.

I'm not sure we need IDs. Does your tool generate IDs with some
certain rule?

Cyberdrill

unread,
Mar 20, 2008, 7:46:12 AM3/20/08
to FLASHOVER - Game Project
1) Yes :) So - Actor.

2) We need to discuss that.
Here is purpose of Ids:
- It unique identify every speech. So if we need to find some speech
in some BIG dialog, how you we do it without Ids? I think there are
not other variants exept Ids. And also we can't say that such
situation can't exist. What do you think?
Talking about rule of Id creation - I think it's does not metter, for
example I simple can increment Id for every speech, or even use random
numbers ( :-) of course random - is joke, just to explain, that Id is
just unique name of speaches in dialog and rules doesn't add some
advantages in this task)... Please tell me your opinion

Cyberdrill

unread,
Mar 20, 2008, 8:30:00 AM3/20/08
to FLASHOVER - Game Project
And last thing I want to discuss is how to organize dialogs.
I'm planning to make simple file store, like:

Level 1
TavernDialogs
Barmen.xml
Hostess.xml
Thief1.xml
.... :)
Street
Level2

Of course, all names sets dialog maker.

Dante

unread,
Mar 21, 2008, 2:09:55 PM3/21/08
to FLASHOVER - Game Project
I was thinking more keeping multiple dialogue instances in the
one .xml, and keeping track of the levels into the tree in the .xml as
well, so that all the dialog .xmls can be put in one Dialog folder.
Here is kind of what my data organization looks like:

Data
Dialog
Models
Music
SoundFX
SoundEntity
Textures

As far as keeping IDs, it doesn't hurt to have it there for
extendability etc..., but I don't see how we need them. Each piece of
dialog is handled through player interaction, which will iterate a
data structure. If I use IDs, they would be generated by the Game
System code and kept error free, instead of by a tool or user. I was
thinking, if the user chooses answer 2, then the data structure
iterates past answer 1, and executes answer 2, and so on.

But, for multiple different conversations with the same NPC, the .xml
needs to keep track of which conversation to execute, so some sort of
Identifier should be tied to that.

Cyberdrill

unread,
Mar 21, 2008, 2:34:17 PM3/21/08
to FLASHOVER - Game Project
It's for sure, that in most of game dialogs our xml speaches will be
used with data iteration. But when you for example will need in some
situation to jump through speeches, Ids is what can easy solve this
task. I think it's difficult for now to predict will such situations
exist or not, but If NOT - Ids weight is negligible, and if YES -
indispensable. You dont't need to orient Ids in dialog system!!! It's
just reserve, and it always can add more flexibility. So should we use
Ids or not? Boss final word :)

Dante

unread,
Mar 21, 2008, 2:37:01 PM3/21/08
to FLASHOVER - Game Project
Like I said, keeping IDs couldn't hurt, only help if needed. So, go
for it. Just keep in mind, that the user of the Dialog Tool should not
have control over IDs, it should be hidden.

Cyberdrill

unread,
Mar 21, 2008, 2:50:23 PM3/21/08
to FLASHOVER - Game Project
I'm not maniak :) All routines should do computer (even writing
code! :))).

Another questions: would dialogs audio connected to this tool?

If we keep multiple dialogue instances in one xml, we need reorganize
xml file structure, so that there must be one more top hierarchy like

<leveldialogs level="somelevel">
<dialog id="1">... </dialog>
<dialog id="666">...</dialog>
</leveldialogs>

Dante

unread,
Mar 21, 2008, 4:55:28 PM3/21/08
to FLASHOVER - Game Project
Yes, that is fine, however it needs to be laid out to get it working.

And yes, the tool should have the user select the audio needed for the
dialog, unless it is accomplished through a naming scheme. In this
instance, I think the naming scheme will be much too confusing, and so
a standard open file dialog box in the tool to select which audio
files to use would be good here.

Cyberdrill

unread,
Mar 22, 2008, 7:37:59 PM3/22/08
to FLASHOVER - Game Project
I change <leveldialogs> tag on <dialogsgroup>, because I think we can
group dialogs by locations or any other thing, and levels may have a
lot of dialogs. So:
<dialogsgroup name="">
...
</dialogsgroup>

Dante

unread,
Mar 22, 2008, 7:57:15 PM3/22/08
to FLASHOVER - Game Project
What level a line of dialog has doesn't have anything to do with
locations, I don't mean level like a game level. I mean level as how
deep into the tree data structure the line of text is.

Like this:
<Conversation>

<Actor> NPC </Actor>
<Id> 100 </Id>
<Level> 0 </Level>
<Option> 0 </Option>
<Text> This is the first thing said. </Text>
<Audio> GaryBriggs_NPC_Speech00.mp3 </Audio>
<Actor> PC </Actor>
<Id> 200 </Id>
<Level> 1 </Level>
<Option> 0 </Option>
<Text> This is reply 1. </Text>
<Audio> PC_Speech01A.mp3 </Audio>

<Actor> PC </Actor>
<Id> 201 </Id>
<Level> 1 </Level>
<Option> 1 </Option>
<Text> This is reply 2. </Text>
<Audio> PC_Speech01B.mp3 </Audio>

</Conversation>

Each Dialog should be NPC specific, and each NPC's Dialog XML should
contain all of their Conversations.

There is no need to organize by game levels.

Cyberdrill

unread,
Mar 23, 2008, 7:25:55 AM3/23/08
to FLASHOVER - Game Project
Last time I told about storing multiple dialogue instances in one XML
file. How should we group them? In simplified structure:
- dialogsgroup name="travelers dialogs"
dialog 1 name="meet traveler 1"
speaches...
dialog 2 name ="meet traveler 2"
speaches
....

And DIALOG directory then:
/DIALOG/
travelersdialogs.xml
tavern1dialogs.xml
.....

Is this right? Or one file- one dialog?

And we rename dialog to conversation?

Dante

unread,
Mar 23, 2008, 12:31:23 PM3/23/08
to FLASHOVER - Game Project
Yea, you have it right the first time. I think it will be easier to
manage that way. (Sorting by dialog names within one xml file).

And now... I finally attempt to move the game code to open source.
I'll let you know.

Dante

unread,
Apr 7, 2008, 1:01:12 AM4/7/08
to FLASHOVER - Game Project
Any update Artem? Do you need help with anything? Just let me know.

Thanks.
Reply all
Reply to author
Forward
0 new messages