Monday, December 30, 2013

Better Than Nothing

After much delay and procrastination, I am proud to finally present... a not yet complete undub of Grandia II. I'm sorry about this guys, I promised on many occasions that I would have this done by the end of the year, but this just wasn't a good time for me, and nothing has really gotten done in months. I don't want to make excuses, but the truth is I've been having a lot of difficulty in my personal life, the least of which is that my finances have been severely depleted by unexpected expenses, and it's very difficult for me to justify spending time on anything that doesn't have at least the potential to make money. I have added a Paypal donate button the to upper right corner of this blog in case anyone wants to help out. I'm not really asking for money in return for completing the patch or anything, but I'm not going to lie, this is likely not going to get done until my financial situation improves pretty dramatically...

Well, enough about that. I'd like to take a little time to talk about the background of this project and just exactly why it has taken so long for an undub of this game to appear. Grandia II on the Dreamcast was my first experience with the Grandia series. I was a die hard fan of the Dreamcast while I was in my teens, and as an avid RPG fan, buying Grandia II when it came out was pretty much a given. I'm not going to say the English voices ruined my experience, because they aren't the worst I've ever heard by any means, and Grandia II was the first RPG I played that even had voice acting so I didn't have much to compare it with. But the fact remains, when you listen to the Japanese voices of Grandia II, it's obvious which voices you would want to play the game with if you had a choice.

As undubs began to appear on the internet, I began to take notice. The first undub I can recall playing was Xenegears for the Playstation, and in my opinion it massively improved the experience of playing the game. I am not really fundamentally opposed to English voice acting or anything, it's just that most attempts to dub Japanese RPGS go horribly, because either the voice actors phone it in, or the lines they are given to read just sound unnatural in English no matter what you do. I actually preferred to play the Kingdom Hearts games in English because the English voices were much closer to those used in the movies the game was based on, so it's not like I never enjoyed playing a dubbed JRPG. However, Grandia II always stuck out in my mind as a game I would really like to be able to play with the original Japanese voices. I decided that it was worth my time and effort to at least attempt to undub the game.

Unable to find any existing dumps of Grandia II in the usual places, I bought a copy of the Japanese version on eBay and dumped it myself. I was already aware that in some cases undubbing can be achieved simply by copying files between versions of a game. After some experimentation I discovered that you could get the cutscene voices to be in Japanese by copying the GR2.AFS file from the Japanese to English version. But there were a lot of problems. First of all the voices were not synced with the English text. The English text would typically go by more quickly than the Japanese voices, causing the end of sentences to be cut off. Additionally, the battle voices were still in Japanese, there were cutscenes that needed to be subtitled, and the English translation was somewhat liberal, making it not sync up well with what was actually said in Japanese. The battle voices weren't too difficult to fix, as they were just located in different files and worked by simply copying them over. The cutscenes subtitles were doable as well, because Sega's encoder for the SFD video file format had been floating around the internet for years. But editing any resyncing the English text to match the Japanese voices? That was going to be a problem. To give you an idea, here is the overall picture of what has to be done to get at the actual English text.

The Grandia II game engine stores most of it's data in map files, located in the "MAP" folder on the root of the disc. This folder contains a series of files, with names following the format of "(4-digit hexidecimal number).AFS". For example, "3E01.AFS". There is no external indication what data each file actually holds. All of the game's script is located within those files, in addition to textures, geometry, and other miscellaneous data for each map in the game. AFS files are actually package files, which contain other files (similar to a ZIP file). If you can extract one, it will leave you with a series of unnamed files that contain the data for one map. The first file will always be the one that contains the script (don't ask me why). However, it will be compressed in a proprietary format called L62C, a variation of the LZW compression scheme. If you can somehow manage to decompress the files, you will be left with a file that contains the script, but also contains much incomprehensible data necessary for the map to function. Additionally, the text itself will contain special control characters that control how it is displayed, at what speed, and even what is happening in the actual game while the text is being displayed. If you can figure all that out, you will still need to figure out how to modify the pointer tables within the file containing the text, because unless you do, it will cause the game to freeze if you attempt to load a script file that has had text inserted. Even if you can figure out how to to all of that, you still have to figure out how to recompress the file in the L62C format so the game will be able to load it, and then repackage it in it's original AFS file.

Yea, there's a reason no one has undubbed this game yet. On an undubbing difficulty scale of 1 to 10, 1 being a game where you only have to copy a file from the Japanese version for it to work, and 10 being a game that requires hacking close to the level of what would be required in a full translation, Grandia II is about a 9. And actually, because I did end up re-translating the parts of the game with spoken dialog, this is in actuality a partial retranslation. It was very lucky for me, that I ran across a set of tools programmed by an Italian hacker named Mat for the specific purpose of allowing the game to be translated into other languages, because without those tools this undub would have never happened. I have some skill as a hacker, but reverse engineering proprietary compression formats from scratch is a little beyond me. So special thanks to Mat, because without his work this project would not have been possible.

If you have the tools you need to edit the game's script and reinsert it into map files, that should be all you need to fix the text to sync up with the Japanese voices... or so I thought. But as I discovered there were still cases where inserting text caused problems, as was stated in the documentation for Mat's tools. I had initially thought it was just an issue that could be fixed by inserting or removing bytes from the end of script section I modified, since that seemed to fix the problem in most cases. But then I ran into a map file where this was not effective, and any changes to the script that modified it's size caused the game to hang no matter what I did. I eventually figured out that this could be fixed by modifying a certain control code in the script that contained a pointer to an arbitrary location. While exactly why they though this was a good idea eludes me, it was an easy fix once I figured out what was going on. It was the figuring out what was going on part that took me so long.

I thought after fixing that issue a completed undub would follow in a relatively short period of time, but things didn't quite work out that way. For one thing, I'd forgotten that the amount of spoken dialog increases notably toward the end of the game. That combined with personal issues that have kept my very occupied lately have delayed this project too long in my opinion, and I felt like the people who have been following it deserved something, even if I couldn't deliver what I'd originally promised. So, I am releasing this preview version of my undub for you all to enjoy. ;) I haven't tested this patch as much as I would have liked to, so don't be surprised if there are still bugs or other issues. Please report any problems/mistakes you may encounter in the comments. This will also help ensure a higher level of quality for the eventual final release. Additionally, if you would like to help me out and possibly motivate me to get the final version done a little sooner, please consider donating. Donating is entirely optional and I can't promise it will dramatically impact my time frame for finishing this project, but it would really help me out in general.

Okay, so without further ado, here is a link to the patch:

Grandia II Undub Patch 0.90