Edward Keyes: Plan B from Outer Space

The original plan was perfect. Crimsoness was an ideal piece for a novice translator/hacker like me to tackle as a solo project: short, funny, and unique, with relatively simple language and a non-standard game engine.

For my last endeavor, Visions from the Other Side, I had honed my Japanese skills with the singular dedication of the unemployed, collecting a shelf full of grammar texts, fasting on nothing but Crystal Light and Pizza Rolls, and taking long showers in the neighborhood waterfall while contemplating kanji. After all that effort, my language abilities approached even those of an autistic Japanese preschooler!

Unfortunately, in the ensuing years, my skills had atrophied back to the level of "Domo arigato, Mr. Roboto," as we soon discovered to our horror. So Plan B was enacted: Seung would translate the text, and I'd handle everything else. This he immediately did, a hundred times faster, a thousand times better, and with 30% more in-jokes than I could have mustered. The result was outstanding, and the game certainly benefitted from that choice.

So let me talk about everything else, since this game is a good example of the little things that can go into a localization project.

Script encryption

In the original packaged game, all of the graphics are regular BMP files, with particular colors for text locations and for transparency. Two text files define the script, one for the main action and one for Iteko's monologue, but they are unreadable as shipped.

So the first step was to defeat the encryption applied to the script files, and fortunately this was very easy. The algorithm just XORed the contents by a constant byte (except for line-breaks) so it could be brute-forced with a quick bit of experimentation, even without any known plaintext.

Once deciphered, the scripts used normal SJIS character encodings and a pretty simple command structure, so replacing the text with English was straightforward.

Font selection

The original game defaulted to MS UI Gothic for its text, which isn't typically present on English PCs. Proportional text would have been nice, and does work in most of the game. But since Iteko's monologue was printed character-by-character, the spacing issues would have been difficult to manage.

So instead we settled on switching everything to Courier, a monospaced font present on every Windows version. Using a rough bitmap font rather than a scalable one even matched the graphical character of the game pretty well!

Hard-coded text

There were several pieces of text that weren't present in the script file, such as the title bar, the intro screen, and the Rage Gauge labels. For those cases, a combination of a Windows resource editor and a good old-fashioned hex editor was necessary.

For the intro screen, the centering of the text also needed to be tweaked, but thankfully those coordinates were present in the executable near the text itself, and easily edited.

Graphics changes

Seung initially modified a few of the screens which contained hand-drawn text, since it was easiest to just edit the graphics directly while translating their contents. For the sound-effect graphics, more elaborate work was needed.

Eschewing the traditional tools such as Photoshop, I bravely grabbed a pencil and drew out all of the sound effects on paper, in my best and roughest comic-book style. As you can tell from the result, I am no artist, and this was my greatest advantage, because of the feel of the rest of the game. They're supposed to look exactly like that! Really!!

In any case, the graphics were scanned, converted to 1-bit grayscale, reduced, tweaked in Photoshop, and masked for transparency. The files were also renamed to avoid using Japanese characters.

Element placement

After the initial text insertion and graphics replacement, the piece was still very unpolished, since it was hard to tell ahead of time how much room each text block had. Much of the word-wrapping was off, and in some cases the space was just too small for the translation to fit with the original font sizes.

So I played through the game multiple times, taking over 100 screenshots of every issue, and adjusted the word-wrapping, font sizes, and in a few cases, the phrasing itself so that everything would fit and flow properly. Due to the structure of the game, it was a bit challenging to explore every possible screen, but I also had the hacker's powers of adding "goto" statements in the script file and starting the game already loaded up with world-destroying rage, heh heh.

Character spacing

Iteko's monologue was still a problem, both because in the typical Japanese fashion it was wrapped character-by-character instead of word-by-word, and because the text spacing looked like crap, with letters running together in an odd way.

Upon further analysis, it seemed like every adjacent pair of letters was being printed properly, but the spacing between the pairs was too small. This is understandable, because the game engine was assuming that each Japanese character was two SJIS bytes, and thus printing each pair of English letters as if they were one symbol, with normal Japanese font spacing between the pairs.

So I dug through the game executable until I found the section which calculated the character widths, and adjusted it up to the size of two English characters in the Courier font. Now everything printed properly, and from there it was just an easy matter of word-wrapping the script to the known amount of space on the screen.

As an aside, I also had to add a trailing space at the end of every line. Since the engine read the text two bytes at a time, without an extra byte the last character would sometimes be cut off. Just one of those things...

Button sizes

The spacing for Iteko's text was the most important modification to the executable, but the most interesting one was the tweak necessary for the button sizes. Their placements on screen were set in the script file, but their widths were automatically calculated by the engine according to the amount of text contained in the label. When we changed fonts, the button widths ended up being a little too small for the text.

Unfortunately, there was no single constant that could be changed, since the overall button size varies throughout the game: the text size, height, and width all change together. I eventually found the section of the code responsible for this, and indeed the width was just calculated directly from the height and the number of characters, in a sequence of instructions that couldn't be easily modified.

Fortunately, shortly afterwards, the compiler had inserted some extra boilerplate code to accomodate the case of negative values, which never would appear in the game. So I was able to replace those surplus instructions with a little post-processing to multiply the button width by an extra 25% and leave the height unchanged.

This is a relatively small change, of course, and games like True Tears have required much more extensive modifications. Still, I always feel pleased when I'm able to shoehorn a few extra lines of assembly into a game and fix a problem that under normal circumstances might have required asking Porn to patch the source code and recompile it for us.

Process organization

All of this was done on my Mac laptop, with the game itself played in VMWare. Since it was apparent that a lot of edits would be necessary to tweak everything properly, very early in the process I set up a utility which would encrypt the script files, merge the graphics, and copy everything to the VMWare shared directory, ready to run.

This saved a mountain of time over the whole process, and moreover gave it an extra degree of reliability, as I couldn't lose track of what had been edited but hadn't yet been updated.

Concluding thoughts

While I'm definitely disappointed that I didn't end up translating the full game as originally planned, the release itself is outstanding, containing the crystallized madness of three separate contributors: Porn's awesome creativity, Seung's superhuman linguistics, and my own... my own... stuff.

If you haven't already played it, you simply must do so right now.

La la la la la la... Time to SPLIT THE EARTH!

28 November 2008
Edward Keyes