TRAUMA – Implementing Subtitles

Sometimes I get up in the morning and I turn on our coffee machine, still half-asleep. I sometimes find out that the machine starts flashing all sorts of red lamps indicating that I need to clean it and put it some water etc. And sometimes even that’s not enough. I push the button and the machine starts grinding the beans, the beans sometimes run out and the machine continues to grind air. All of a sudden, I need to drop everything and rush to the fridge, grab new beans and put them in the machine before the machines gives up on grinding. That’s how a simple cup of coffee sometimes turns into a hectic chore at the worst possible time of the day.

That’s how game development also sometimes is. You think you just implement a very simple function but while doing so you encounter one problem after another. And you spend the entire weekend just trying to catch up with all the problems that keep on appearing.

See, the subtitles were actually already implemented but sometimes they didn’t quite appear in-sync with the voice because the voice doesn’t always start at the beginning of a sound sample. So I decided to implement a function that would delay a subtitle so it appears in-sync with the voice.

But then I noticed that one of the bugs I thought I fixed the other day was still there. So I went bug hunting for a while.

Then I returned to implementing the subtitle delay. While doing so I noticed that some voice samples are really long and had some dramatic pauses in-between. So the subtitles still didn’t quite match the voice even with a delay. I started working on a system to split a subtitle into multiple parts and show each part at a different time.

While working on that I noticed that I was still using a very inefficient workaround to do subtitles for videos. You see, videos have their own sound built into them. So in oder to show subtitles during videos I play a “silent” mp3 when the video starts. I attach subtitles to that mp3. This was messing up my timing for multiple subtitles because the silent mp3’s had a length after all. I thought I remove this workaround while I’m at it. This caused all sorts of problems, one of them being that the subtitle splitting stopped working.

After fixing that, I continued implementing the subtitles. I noticed that some subtitles still didn’t show up in-sync with the voice. I realized it was because of a system I had in place that would ensure each subtitle was visible on the screen for a minimum amount of time. I had to create an exception there.

The subtitles started showing up properly so I finally finished the first two levels and my mood started to improve.

But then I realized that one video in the third level didn’t have any voice in it. I must have forgotten it. So I had to go back to After Effects and render it out with the voice.

In the After Effects project I realized that the timing of the video actually didn’t work at all with the voice so I had to re-edit that video.

Then I realized that after my Windows re-install all my After Effects rendering presets were gone. So I had to boot up my other system to re-create my old rendering presets.

With the video working again, I returned to the work on the subtitles. Already the next video didn’t show any subtitles at all.

Sadly, this bug showed up only intermittently so it was very difficult to replicate. After a very long investigation I concluded that this had something to do with the way this specific video was implemented. So I wrote an exception for this, which in turn caused all sorts of problems that needed to be taken care of.

Finally I could move on to the last level. Here again, the first video didn’t show any subtitles. This also had to do with the fact that it was triggered in a very different way than all the others. I used a combination of a hard-coded exception and a tricky workaround to make it work anyway.

At this point it was starting to get late and I realized that I was still missing an important feature – subtitles for the cut-scenes at the end of each level. They are rendered in a different way and you should be able to watch them also from the main menu. So this means I can’t use the same system I have been using so far. I decided to put this on my to-do list and call it a day.

It’s the first weekend of the final push, I started with the easiest task and I’m already behind my schedule. Naturally, I’m not happy about it. But that’s just how Game Development sometimes turns out. On the other hand, I managed to get a German translation done and I made at least some progress. I will attempt to get some work done during the week so I’m back on schedule next weekend.

Krystian Majewski

Krystian Majewski was born in Warsaw and studied design at Köln International School of Design. Before, he was working on a mid-size console project for NEON Studios in Frankfurt. He helped establish a Master course in Game Design and Research at the Cologne Game Lab. Today he teaches Game Design at various institutions and develops independent games.

6 responses to “TRAUMA – Implementing Subtitles”

  1. whatever

    Good description of the common hell of informatic working, we must put a candle to saint Murphy, whos laws master our destinys, hehe. Luck with it, man, we dream with what you are creating.

  2. Yu-Chung Chen

    Although it was a bit difficult to catch the actual sentences between all the bugs, fixes, workarounds and not-workings, it’s great as ever to follow the project. Go Krystian!

    Btw, I wonder what made you not use the built-in cue-points for synchronization?

    1. Krystian Majewski

      What do you mean with “built-in cue-points”?

      1. Yu-Chung Chen

        I mean the cue-points in FLV that will fire events in ActionScript. They are specifically made for captions and synchronizing SWF content to video content. I’ve only used it with the FLVPlayback component, can’t say if that will play well with Trauma’s code.

        The workflow is quite usable actually. Place layer markers in After Effects, export the whole composition as FLV, and it will contain those cue-points at the exact times. FLVPlayback will then fire events for each of those and, well, the rest is a simple matter of reacting to the events.

        I used this Adobe tutorial which was made for tracking points (cue-points will carry additional coordinates with each event object). Check out the section in the livedoc as well.

        1. Yu-Chung Chen

          Oh there’s this AIR tool for editing cuepoints in existing FLVs without re-encoding the actual videos:

        2. Krystian Majewski

          I had NO idea that there FLV had this System! Pretty cool!

          However, it is not really a solution to the trouble I had. It’s not that I have a hard time implementing such feature at all. It’s just that my code is so complex that changing just a single thing can produce all sorts of unwanted side-effects.

          I don’t think I will go with FLV cue points in any case. I don’t need precise synchronization and I do prefer to change subtitles / add new languages dynamically.

          But it is a very cool feature! Could come in handy for all sorts of effects. Thanks! :D


The Game Design Scrapbook is a second blog of group of three game designers from Germany. On our first blog, Game Design Reviews we describe some games we played and point out various interesting details. Unfortunately, we found out that we also need some place to collect quick and dirty ideas that pop into our minds. Hence, welcome to Game Design Scrapbook. You will encounter wild, random rantings. Many of then incoherent. Some of them maybe even in German. If you don't like it, you might enjoy Game Design Reviews more.


follow Krystian on Twitter
follow Yu-Chung on Twitter
follow Daniel on Twitter