Hacking the Grisaia
April 16, 2012 21 Comments
So recently the translator Koestl contacted me for some help with the hacking for ‘Grisaia no Kajitsu’ (or ‘Fruit of the Grisaia’), since the game uses the CatSystem2 game Engine. CatSystem2 was used by Kamikaze Explorer, which I released tools for before. The tools didn’t work very well with Grisaia however, so some work was needed to get things playing smoothly. In the end I volunteered to help out making the game run well in English.
I should keep in mind that Koestl is the one doing the bulk of the heavy lifting, since translating the game, and it’s a huge ass game, is all his work. I’m just working on the technical parts. His translation is great and he does a really good job making it work in English. He must keep an editor in his pocket because his translation comes out quite polished. Look forward to playing it in English way (waaaay) down the road. At the moment, the translation is 10.5% complete.
So anyways, that out of the way, onto the hacking stuff!
CatSystem2 is a really finicky game engine to run English on, because the scripting system generally relies on text being in Japanese. Lots of things you’d take for granted, like word wrap, the ability to use quotes and apostrophe’s, or just right out displaying English text at all, don’t work out of the box. The system differentiates what lines are script commands and what lines are text to display in game by what language it’s written in. More annoyingly, quotes and apostrophe’s don’t work properly, and there is no word wrapping by default.
To make the text work well in game, I first extracted all of the game text out of the scripts into their own files, and then made a tool to insert text from those files back into the original script with some modifications to make them display properly in game. Koestl can then just translate those text files without worrying about the silly technical workarounds, and then run compile and have it work in game immediately.
Solving some of the limitations was a bit of a challenge. For quotes, we’ve ended up relying on the original Japanese quotes for the script. After a while we realized that we could use unicode directional quotes to surround sentences, but we decided to stick with the Japanese style quotes. Apostrophe’s we’ve had to convert to backquotes. It’s not pretty, but our font choice cloaks it well enough. For word wrapping, originally we relied on automatic line breaks after a set number of characters, but we changed the system we were using part way. CatSystem2 allows you to mark a word or sentence to be wrapped as a single unit by surrounding it in square brackets, like [this]. Getting word wrapping working was simply a matter of bracketing each word with square brackets so the game wraps them as one would expect in english. And lastly, to make the engine pick up our English sentences, we prepend an unnoticeable script command to the start of each line.
The resulting script looks almost unreadable, and it would be almost impossible to write it all directly if it weren’t for the text insertion tool doing the heavy lift it. It looks good in game though!
Making it Look Good
Text Insertion is only part of making a game work in English. There’s many other things that need to happen, such as updating the UI, the game engine interface, and making text that isn’t in the dialog box itself accessible. I figured having access to Debug Mode would make fixing these a bit easier, but debug mode is locked behind a key file. This is where hacking gets real.
I haven’t really done any serious reverse engineering of executable files before. Breaking CatSystem2’s script files was more of a matter of just prodding the data file until it caughs up the right info… actually changing the executable was on a completely different level. It was a good learning experience, and it took a fair bit of time, but I managed to modify the exe to launch the game in Debug Mode!
Debug mode actually gives you access to a lot of cool features. For one, you can instantly jump to any file, and even any line in any file. It has an in interface button to recompile the game script, which I mapped to run a batch file that does all the text insertion too. It gives you a debug message window that gives output from the commands the engine is given, and it even allows you to see all of the engine variables and open image and plane resources. It’s fun stuff.
Armed with debug mode, I’ve been working on translating on screen text and spoken dialog that is in the background and not listed in the dialog box for normal display. What I’ve done is made a small slide down panel that appears in the top right corner that shows the translation of the background dialog. It’s non intrusive and it looks pretty good to see it in action.
The rest of it is just UI modification. It’s kind of tedious work, but in the end it’s important to having a good play experience.
So yeah, the game is starting to look pretty amazing in English, and Koestl’s translation is all kinds of awesome. Actually, the game itself so far has been great, and it’s really exciting to see it slowly take shape in English.
Right now the project is at 10.5%, with the common route being almost half translated. I’ve been impressed with Koestl’s work so far, and I’ll do what I can to help out as the project goes on. I don’t think he plans on any intermediate release however, since the common route betrays the overall intent of the game (the ‘comedy’ common route versus the ‘heavy’ character stories), so we’ll have to work towards a final translation. It’ll be a long term project, and certainly the release is a long ways off, but hopefully, you’ll be able to see this screen too: