Text that is displayed to the player (for example, in a text box) is stored in a Text Database. All of the text in your game is stored in the Text Database, and each individual message is given a unique name. The Text Database is created by Story Machine and automatically updated as a file called “Text Database.txt” in your project directory.
The Text Database File
The contents of a Text Database file look like this:
StartButton=START
QuitButton=QUIT
# Quit confirmation dialog
ReallyQuit=Are you sure you want to quit?
# Scene 1 Dialog
Intro01=Harris Bullard was found dead in his study five days ago.\nNobody believes me, but I think he was murdered.
Intro02=I'm not leaving until I find out what happened.
Each line defines a message and a name to name that message. For example, the first line names the message “START” (a label to be put on a button in the main menu) with a name called StartButton
. To display the word “START” in a text box in Story Machine, we assign the StartButton
name to it.
Lines beginning with a #
character are comments and will not be included in the database. Comments may also be added at the end of a line of text.
All text entries must fall on a single line. To add a line break within an individual message, use \n
to specify a new line.
Editing the Text Database
You can add new text entries to you game by editing the Text Database.txt file directly. If Story Machine is running, it will automatically import your changes immediately.
You can also add and edit text entries directly in Story Machine, via the Set Text action or directly in a Text Box. To add a new entry, type the name first, hit return, and then enter the text to be associated with that name. To edit an existing entry, select the name from the drop-down list. Note that the Text Database is shared across the entire game, so if you edit an entry in one scene, those edits will be reflected in all other scenes.
Localization
The purpose of the Text Database is to make localization easy. To localize a game in Story Machine, simply translate the Text Database.txt file, leaving the names intact and changing only the text messages. For example, a Japanese version of the example database above might look like this:
StartButton=スタート
QuitButton=終了
# Quit confirmation dialog
ReallyQuit=本当に終了しますか。
Pro Tip
A future version of Story Machine will support multiple text databases in the same project, allowing you to bundle multiple languages into a single release.