Horrible hacks and Language Support in BEP
Usually I don’t do too many updates anymore because I’m afraid of just running out of material and showing the whole game off before it’s done, but this should be fun.
So one thing I noticed with IWBTG is that it was very popular in Japan and the Japanese fans of my work are super cool. While this popularity probably won’t extend over to BE:P, I still always wanted the game to be easily localizeable for them. Unfortunately, far too late in the development, I discover Construct Classic doesn’t support unicode. Brutal!
So in the last two days I implemented a hack I’ve been thinking about for awhile. Construct uses the ANSI character set, provides 217 characters. BE:P uses 83 of those characters by default. The rest of the characters are accented letters and bizzare stuff like § or † or even ‡! Really wacky symbols. So most of that could all go. Unfortunatey, even if I used all 217 characters, that would be an insignificant amount of kanji. FORTUNATELY, basically all NES games were written, due to space issues, in kana. Kana lends it’s self better to this, being two syllabic character sets. Between alternative characters and japanese diacritic marks, the set comes out to 100ish characters, just barely squeezing in. In fact this is apparently how any “English -> JP” fan translations end up being done.
So the next step would be keying ansi characters to kana. Fortunately, BE:P doesn’t use a real font or anything so it’s easy for me to make a character appear however I’d like. Characters are searched for on a big key string and that index is used to set the text objects frame. The character key when Japanese is enabled looks like….
Everything up to ? and ” ” is represented in game in english. @ and ` are controller characters for linebreaks in the dialog engine and everything after that is dedicated to kana. So if we were to search for “©” on this string it would come up as character 120. Frame 120 of the text object is the pixel version of “は”. Easy breezy! The dialog file also has support for easily creating additional text boxes. This is going to be important for Japanese because “kana only” japanese is, screen space wise, pretty inefficient and the kana font I’m using now only allows for 3 lines of text to english’s 4. Still, it ends up looking really nice! Also in this setup, I can easy change the secondary characters. The game can only display one set at a time, but that still allows me to implement all accented latin characters, or Cyrillic or any other non-logographic character set.
Of course this brings up the issue… if construct can’t handle UNICODE, how can I even read the dialog? Oh, well I had to hack together a crummy little python script that’ll read a file and “encode” it into the hacked ANSI characterset setup. So when release is near (it isn’t) I’ll make that available to help people localize the game in other languages if they want without having to resort to dealing with super gross hacks directly.
Not sure if the Katakana is even right, but it’s looks pretty cool!
originally posted from my official blog. Feel free to go over here to leave comments.
Oh gosh, what are you doing Kayin XD
Trying to hack in other language sets in game that is unable to support unicode. Actually if you could hop on skype at some point I probably will have like a bazillion questions for you. ;_;