The blog of an indie game dev !
Demos, paintings, tutorials and problems

Get all the news !

Never miss out any update.

Dialogs and localization

Hello,

Today, I’m going to talk about… dialogs (haha). Yes! There will be some dialogs in my game because I want to propose some kind of story (surely a simple one). So, I want the characters to talk, explain, … live. In addition, dialogs/explanations are useful for the tutorial phase.

I – Localization

First problem: I want to release my game to the whole world (I shall reign over it 😀 Mouahaha)! And, even if I speak English, I can make some mistakes. I can’t sell a game where there are mistakes. Hence, at some point, I’ll need the help of some translators (by the way, if you’re interested, you can contact me). But translators are not really into programming ;). I can’t ask them to modify source code. The easiest way I found to handle this is to create a simple google spreadsheet/excel document with French sentences and their English (or Spanish, or Italian, or …) translations. Something like this:

The localization file

This translation management is called “Localization”. Here, I use one sheet for each game level. When everything is OK, I save each sheet in a simple TXT file that my game is able to load. According to the global language setting, it will show the good translation for each sentence.

In another localization file, I keep all the “global” names/information that I want to be able to access in all levels of the game: the character/place names, the menu labels, the help hints…

II – Dialogs

You can notice that in the localization file, there is no logical information about which sentence is the first, and what answer a character should give if the player asks him such or such thing. This “logical part” is stored in another spreadsheet file. It looks like this:

The dialog tree file

This file stores the information of the sentence sequencing. For each sentence (line in the file), we can find the corresponding ID in the localization file, the character who is speaking, the next dialog ID (NOT the localization one), a flag to know if the dialog should end after this sentence, and some action to execute (that the game can understand and perform). For example: when you speak with a character, you may earn an item, or money, unlock a quest, or go to the next level… You can see that there are a lot of other field/information that I do not use at the moment, but that I may use one day: camera position, animation to play for a character, music, audio…

This “mini-program” can’t run alone. It needs to be called by the game with a given start line. At the moment, the tutorials start these dialog programs according to some actions of the player. Actually, we usually speak about a “dialog tree” because the user choices may influence the behaviour of the other characters, leading to different possibilities. For example, you may see lines with “WellDone” and “Failed” IDs, which, as you may expect, are run when the player succeeds,… or fails. However, those very specific and sometimes complex tests must be coded. So, I can’t do everything with those simple text files, but it still offers a nice freedom, and it’s not that complicated.

And…

Yay! Master Josh speaks! He’s aliiiiiiiiiive! Well… Not exactly…

Soooo that’s it for the dialog system. You may wonder why I didn’t put the sentence translations directly in the dialog file. There are two reasons for that: first, not every single line of text is included in a dialog (menus, hints, descriptions of objects…). Second, I don’t want translators to accidentally destroy the behaviour of non player characters by modifying logic fields. I will only share the localization file. This will avoid mistakes.

I hope this little post :p was interesting to some of you! Take care, and see you next time.


Posted

in

by

Tags: