Community

SCI Programming => SCI Development Tools => Topic started by: DarkSoul on June 03, 2019, 12:30:35 PM

Title: Experiment translating SQ3 to Japanese
Post by: DarkSoul on June 03, 2019, 12:30:35 PM
Upon recommendation from someone over at the Sierra Help Pages, I decided to post about my little project here.

http://www.sierrahelp.com/forums/viewtopic.php?f=2&t=4886

Long story short, I'm a Sierra die-hard fan living in Japan, and I thought I'd try my hand at translating a few games to let my wife and Japanese family understand what this is all about (especially the QFG series).
I first stumbled upon the multi-language features of SCI when I found out about the Japanese versions of QFG1, PQ2, KQ5, SQ4 and such, and then I realized ScummVM can actually play these.

Afterwards, I found out about the SCI Companion, and attempted decompiling them to see how they ticked, realizing the syntax is "{English}%J{Japanese}" (or #J), and that ScummVM has an override for font 900 in the case of Japanese language.

I wanted to translate QFG2, but first I thought to try my hand with a smaller title such as Space Quest III.
(By the way, many thanks to the person who decompiled QFG2 here, I will probably be working off that, if that's all right)

The English to Japanese translation part won't be the problem, barring the time it requires, of course. The problems I have right now are essentially technical, so I thought I'd post about my progress here.

A bit of code grepping and poking around the code made me stumble upon the function used for most boxed dialog display, proc255_0 from Class_255_0, and I noticed they were similar enough that stealing logic from QFG1JP should work. This was when I realized the Game class also would require extra global variables.

I hit a few annoyances :
- I run on Linux, so I have to use WINE to run SCI Companion, and it seems to be buggy under that configuration. On the plus side, it's extremely easy to run under a SJIS locale, even easier than on Windows itself.
- Game text in Japanese is in SJIS is a pain to edit under the SCI Companion. I plan on making my own tool for decompiling text resources based on text patches, and another for recompiling them based on a "English|Japanese" Excel file.
- Running the compiler tends to crash SCI Companion under WINE, so I have to compile, leave, restart, compile the next file. (A CLI compiler that works under UNIX would be a real boon ; thankfully I won't need to recompile THAT many files, hopefully)
- Recompiling resources under SCICompanion causes ScummVM to break, so I have to compile every script I need from the start, export them as script.XXX patches; and then restore my original RESOURCE.xxx files.
- I had to hack ScummVM to recognize my patched game as Japanese, so I added an entry in the detection table based on my patched script.255.
- Space Quest III is too old to have all the SCI features required for multi-language (namely, the parserLang or subtitleLang global variable hooks, and the StrSplit kernel function 0x78; aka kernel_120), so I had to hack the language processing functions to force displaying Japanese when a) the game is SQ3, b) a Japanese string has been found; I managed to translate a few things, and to get results, which I displayed here : https://twitter.com/DarkSoul4242/status/1135097021302358016
- The problem now is that the patching of text resources corrupts the game when changing rooms (Crashes when getting to the robot head room, or when riding a trash basket); so I'm guessing there is a limit on how long a text resource can be, and that I'm causing memory corruption by having English and Japanese. I'll likely have to nix the English.
Title: Re: Experiment translating SQ3 to Japanese
Post by: OmerMor on June 03, 2019, 05:03:29 PM
Hi DarkSoul,
welcome to the SCI Programming forum! I'm glad you eventually came.
Regarding SQ3 - are you aware of the multi-lingual (German/English) version of this game?
Title: Re: Experiment translating SQ3 to Japanese
Post by: lskovlun on June 03, 2019, 07:08:30 PM
Was going to say the same thing, if you can get your hands on the German version, that might be a better starting point. It uses SCI01 so it has the necessary multilingual support, including the features you mention.
Title: Re: Experiment translating SQ3 to Japanese
Post by: DarkSoul on June 03, 2019, 08:03:59 PM
Thanks for the welcome, and for the advice.
I was nominally aware of it, having looked into ScummVM's detection tables, but I did not know it was more advanced.
I'll give that a try!
Title: Re: Experiment translating SQ3 to Japanese
Post by: EricOakford on June 04, 2019, 12:49:01 PM

I wanted to translate QFG2, but first I thought to try my hand with a smaller title such as Space Quest III.
(By the way, many thanks to the person who decompiled QFG2 here, I will probably be working off that, if that's all right)

The English to Japanese translation part won't be the problem, barring the time it requires, of course. The problems I have right now are essentially technical, so I thought I'd post about my progress here.

Yeah, I'm the one who decompiled QFG2. I also decompiled its demo and The Seasoned Professional.

They use what seems to be a very early version of SCI1 (also known as SCI01); from that point on, chances are good that Japanese support is integrated into the interpreter (if PQ2 is any indication).

I've put together an archive of SCI Japanese fonts. Maybe we could try to translate the QFG2 demo and Seasoned Professional into Japanese.
Title: Re: Experiment translating SQ3 to Japanese
Post by: Kawa on June 04, 2019, 02:36:13 PM
Yo hold up weren't the Japanese fonts in SCI games part of the PC-98 itself, drawn in 640x400 while the rest of the game was its usual 320x200?

(http://helmet.kafuka.org/logopending/wp-content/uploads/2018/12/tumblr_inline_pfnw8vhqez1qmrl2s_400.png)

...yeah, looking at the KQ5 fonts in this archive, that's European. Looking at the rest of 'em, I'd say Shift-JIS, but there's no way a DOS interpreter, or rather a non-PC98 interpreter is gonna support that properly. I'm not sure about SQ4, but I'd be impressed if the windowless outlined text is even physically capable of including kanji. What encoding is that anyway?

I'll also note that the SCI16 and SCI32 source archives have less than minimal support for Japanese -- both have the Japanese telephone country code 81, and SCI16 has the iskanji macro, but doesn't actually use it. Also SCI16's GRAPH.S has this line in the changelog, "Adding Japanese Display routine", but doesn't seem to actually contain such a thing. So the SQ4 style "dense kana" encoding is the only way you're gonna get Japanese on a DOS terp, and it'll read like a children's book. At those point sizes, you really don't want to include any kanji to be honest -- there's a good reason the PC-98 games have high-res text.
Title: Re: Experiment translating SQ3 to Japanese
Post by: lskovlun on June 04, 2019, 05:13:03 PM
Honestly, I'm surprised to not see a tilde in that line of text... if it says what I think it does.
Title: Re: Experiment translating SQ3 to Japanese
Post by: Kawa on June 04, 2019, 05:26:13 PM
Why would there be a ~ in "kiwotsukete! doku hebida!"?

Also, yes it says exactly (http://helmet.kafuka.org/logopending/2018/09/26/on-snakes/) what you think it does.
Title: Re: Experiment translating SQ3 to Japanese
Post by: DarkSoul on June 04, 2019, 08:41:15 PM
Indeed, I'm aware of the specifics of the PC98, namely the VROM for blitting kanji on an upscaled game (normally on an uniform background, which is why SQ4 needed a specific hiragana/katakana font for unboxed text).
My endgame here is to run the patch on ScummVM, which has routines to handle this. (JP language + font 900 will make ScummVM use sjis.fnt, that you have to build and provide)

Though I suppose DOSBox-X or other PC98 emulators could be doable too, but with more effort and more constraints.
Title: Re: Experiment translating SQ3 to Japanese
Post by: lskovlun on June 04, 2019, 08:50:12 PM
Why would there be a ~ in "kiwotsukete! doku hebida!"?

Also, yes it says exactly (http://helmet.kafuka.org/logopending/2018/09/26/on-snakes/) what you think it does.
Because Cedric doesn't say "doku hebida", he says "do~~~~~~ku hebida"?
Title: Re: Experiment translating SQ3 to Japanese
Post by: Kawa on June 05, 2019, 04:31:27 AM
Because Cedric doesn't say "doku hebida", he says "do~~~~~~ku hebida"?
I was not aware the PC-98 version was voiced 😏
Title: Re: Experiment translating SQ3 to Japanese
Post by: DarkSoul on June 05, 2019, 07:02:14 AM
I did get surprised hearing Vohaul's voice on the PocketPal when playing SQ4 for PC98 :D
(Basically, any voice effect that was in the floppy EGA versions should be in the PC98 versions)
Title: Re: Experiment translating SQ3 to Japanese
Post by: Kawa on June 05, 2019, 07:46:34 AM
Yeah, but they were being pretty damn extra when they got to that one scene in that one game.

Edit: fun fact about SQ4 in Japanese! Because it does its own thing with regards to the Japanese text encoding, exports are All Wrong™. The translation of the line "We have confirmation of his position, Master." shows up in SV as a jumble of mojibake, as one would expect... but if you export it to a TXT file and open it as Shift-JIS, you get 「ボス、ヤツ髯゙巫鋳瘋迄・懶憫。」 which is somewhat less than correct. "Bosu, yatsu[CARRIER LOST]" basically. I went through exactly the same process on KQ5 earlier, and that works fine, and PQ2 last year.

Compare that with "Off to Magmetheus with you then! It is time for Wilco to meet the fate which I have crafted for him." 「、マグメティウス梺・恪場゚笨・ ウィルコ熙オレ幢尤劣燗・憫尤難聳玻」, transliterated by Google Translate as `  , Magumetiusu fumoto Kaku-ba ゚ 笨   U~iruko hiro ore 幢尤 Retsu kan   憫尤-Nan 聳玻  ' and "translated" as "Amber, Ms. Magmetius, M. 恪, M. Wilco, Ms. Wilco"

Points for recognizing "Wilco", Googs.
Title: Re: Experiment translating SQ3 to Japanese
Post by: Daventry on June 05, 2019, 08:11:24 AM
OmerMor or DarkSoul
share here font SJIS.FNT, please. I tried a lot of *.ttf fonts, but the create_sjisfnt gives an error when converting.
Title: Re: Experiment translating SQ3 to Japanese
Post by: DarkSoul on June 05, 2019, 08:18:17 AM
Ah, yes, I thought they had branched off hankaku katakana (since THESE show just fine), because the bits that are wrong are rendered as hiragana. They must have cooked their own font and character table just for these. A conversion tool should be trivial enough.
Title: Re: Experiment translating SQ3 to Japanese
Post by: OmerMor on June 05, 2019, 11:15:29 AM
OmerMor or DarkSoul
share here font SJIS.FNT, please. I tried a lot of *.ttf fonts, but the create_sjisfnt gives an error when converting.

Here you go.
Title: Re: Experiment translating SQ3 to Japanese
Post by: DarkSoul on June 05, 2019, 11:19:08 AM
Sorry for not reacting, I wasn't sure if it was appropriate to post this file given ScummVM only provides generic instructions instead of bundling the file outright.
Title: Re: Experiment translating SQ3 to Japanese
Post by: Daventry on June 05, 2019, 12:31:56 PM
OmerMor
Thank you very much.

DarkSoul
On the forum ScummVM there is a similar question and he remained without answer. :(
https://forums.scummvm.org/viewtopic.php?f=1&t=10459&p=69461&hilit=sjis#p69461

Title: Re: Experiment translating SQ3 to Japanese
Post by: Kawa on June 05, 2019, 02:40:03 PM
It's this kind of ███████ that makes me glad SCI11+ supports UTF8. I may not have the screen space to show kanji, I could if I wanted really hard, and I can at least use kana without worrying.