I’ve put quite a bit of thought into making the tools for the story-part of NEW ORBIT as reusable and practical as possible.
So here’s how Story, Subtitles, Voiceovers and Character Portraits play together:
I have a generic class called OnScreenTextController that takes a string, fades it in, displays it for a certain amount of time and fades it out again. In NEW ORBIT I use two classes that are based on it: SubtitleController and CenterScreenGUI – one displays the subtitles and character portraits, the other one shows the current objective in the center of the screen.
Both are being fed with LocalizationDBItems from the LocalizationDB. (basically just an object that holds an array of LocalizationDBItems) A LocalizationDBItem contains the actual text, the location of the voiceover-soundfile, the ID of the character who’s speaking and the duration.
The story itself is driven by a Mission-script that knows when to display something and when to wait for certain events to happen. The Mission-script only knows the IDs of the messages and works with the durations it retrieves from the LocalizationDBItems, so I can simply load a different LocalizationDB to switch to a different language and all the timing will adjust automatically.
I’ve created an Editor-window where I can manage all the text and audio in the LocalizationDB. If I drag in a new voiceover-file it automatically writes in the path and the duration. But if there’s more text in the file than fits into the subtitles-bar I have to manually split it into multiple entries and divide the time.