I'm building a game in XNA and I wanted to know how I would organize the character speech portions of the game. These would include both cutscenes and anything else where characters interact.

I wanted to know if it would be more efficient to use sound file (.wav) per character line, such as:


PLAYER1: Wow, this is going great! } One file called "04_PLAYER1_01.wav"
PLAYER2: I know! } A file called "04_PLAYER2_01.wav"
PLAYER1: Let's get going! } A file called "04_PLAYER1_02.wav"

I wanted to know if that would be better opposed to:


PLAYER1: Wow, this is going great! }
PLAYER2: I know!                   } One file called "scene_04.wav"
PLAYER1: Let's get going!          } 

I am aware that by going with option 2, you'd probably save a bit more space because you have less files (but they might be larger) but it poses the problem of coordinating it all.

I was thinking maybe XML for coordinating the speech and cutscenes, but am open to other suggestions. :)

P.S. This not intended to be a "DIALOG-TREE". These are actual models moving their lips in accordance with sound!

  • \$\begingroup\$ If it is not necessary to separate them then why go trough the difficulty of doing so? \$\endgroup\$
    – Eejin
    Commented Jun 17, 2014 at 21:11
  • \$\begingroup\$ But I want to know if it would be easier, because then you have to make the models lip-sync the text in a certain way when the time comes around, and how would one know when the character's line comes too? \$\endgroup\$
    – Gumptastic
    Commented Jun 17, 2014 at 21:13

2 Answers 2


Using a separate file for each line is going to be much easier to deal with. Here's why:

Typically, several segments will require multiple takes, since actors stutter or misspeak. If the actors are being recorded together, you'll need to merge these takes into a final cut. If you need to change something, you'll have to edit the entire sequence (changing the offsets for each line after that one). It's going to much quicker and less programming effort to use multiple files.

This is especially true when you're working in a team. If we're both working on the same scene, I can't make changes until you're done with that sound file.

Either way, you would still want to build a descriptor file to trigger each sound, ie

Delay - Subtitle - Sound
0:04 - [Explosions] - explode04.wav
0:01 - Wow, this is going great! - p1dlg01.wav
0:03 - I know! - p2dlg01.wav
0:02 - [Rocks falling] - tumble08.wav
0:03 - Let's get going! - p1dlg02.wav

I've added subtitles to this example for continuity, but actually these should be separate considerations. You'll want to integrate camera movement, animated events, etc., into your script, just like a movie's shooting script.

XML is fine for this, and XNA supports XML content out of the box. Lua is also a good choice, though it comes with more overhead.

It also follows that each scene should have its own script. If someone is helping, you don't need to merge differences to the files.

  • \$\begingroup\$ Excellent! Thank you! By the way, are there any tutorials that I could use to help me with this development? I'm good with XML and C# seperately but together would be something interesting! Thanks again! \$\endgroup\$
    – Gumptastic
    Commented Jun 17, 2014 at 21:55
  • 1
    \$\begingroup\$ Having what you call a "descriptor file" - something that says what happens when - is the key insight; the scene is a cohesive whole and everything that happens needs to flow together. I'd also make the point that there should be no direct relation between sounds and subtitles; what if there's a very long line of dialog? What if two characters are speaking over one another? These will have different effects on how you split your sounds and subtitles. \$\endgroup\$ Commented Jun 18, 2014 at 2:44
  • \$\begingroup\$ @Gumptastic Added some links for scripting options, how-to question. XNA has its own schema that it uses for XML content which is based on classes you provide in C#, so that can be tricky if you're unfamiliar with it. \$\endgroup\$
    – jzx
    Commented Jun 18, 2014 at 17:39

One wav for the whole scene can turn into a big headache if you want to alter the scene later, even a minor one.

And if any of the players have a problem during the playback (memory, CPU, bug...etc), the rest of the audio will be asynchronous. Players will skip the scene or close the game without you knowing about that. Which will throw away all your efforts.

Do that only if you are making a video scene and encoding the audio together with the video using a video codec. In this case the audio editing should be done last.

Otherwise always use one line per wav. You will be safe and peaceful.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .