- Dec 28, 2023
- 85
- 39
While most of this guide is formatted as a case study, this is more of an information sharing thread for the original Japanese nscripter game engine and how to work with it using a particular title as an example.
The documentation for the original nscripter engine is all in Japanese, so this post aims to have essential information about the nscripter game engine in English to use as a reference for translating. If you are only looking for updated tips and examples for how to translate nscripter script text, then just scroll down past the case study posts to the tips at bottom.
There is a translated version of some outdated reference material available in the nscripter.insani sdk and online reference for the nscripter insani fork, but that is not really relevant when translating especially when only using original Japanese version of nscripter.
For this case study, the game in question is おばけ王女は墓の下, Obake Oujo Hahaka no Shita, which could be translated as Ghost Princess Under the Grave. This post is the story of how the game patch that translates the game was created.
VNDB: https://vndb.org/v10687
Download: https://www.freem.ne.jp/win/game/3290
Additional game resources:
Translation (TL): https://archive.org/details/ghost-princess-under-the-grave
Thread: https://www.anime-sharing.com/threa...in-obake-oujo-wa-haka-no-shita-v10687.1541060
TL DL: https://archive.org/download/ghost-princess-under-the-grave
TL raw text: https://archive.org/download/ghost-princess-under-the-grave/ghost-princess.txt
TL Patch: https://archive.org/download/ghost-princess-under-the-grave/zompri-patch.rar
Thread: https://www.anime-sharing.com/threa...in-obake-oujo-wa-haka-no-shita-v10687.1541060
Text-based English translation of a short freeware yuri visual novel, Obake Oujo wa Haka no Shita (おばけ王女は墓の下). The game is still available to download on Freem. The translator's LiveJournal, where the English translation was published, became unavailable sometime after 2020, and the translation was not preserved in the Wayback Machine.
TL DL: https://archive.org/download/ghost-princess-under-the-grave
TL raw text: https://archive.org/download/ghost-princess-under-the-grave/ghost-princess.txt
TL Patch: https://archive.org/download/ghost-princess-under-the-grave/zompri-patch.rar
The game seems to be a short story with supernatural and yuri themes.
After extracting the archive using 7-Zip, the following files are inside of the zompri folder.
Code:
00.ns2
nscript.dat
nsogg2.dll
read_me.txt
zompri.exe
Launch it to make sure it works and then close it after the first few lines of dialogue appear. Like many eastern visual novels, it requires a locale emulator to display the characters properly.
So, how is it possible to start translating it? The first step is always to figure out the game engine in use. The simplest way to figure that out for VNs is usually to use Garbro and also to look at the files in the main game folder. Let's look at the files first before using Garbro.
- zompri stands for "zombie princess" maybe? That sequence of characters is used for the folder name and the main executable, so it should have some relationship with the game title. Obake means ghost, not zombie though. For simplicity's sake, I will refer to this game as "zompri" for the rest of this guide since that is easier for westerners to type and understand compared to Obake Oujo.
- nscript.dat probably has the game's dialogue scripts because it has "script" in the name.
- It is not clear what 00.ns2 is for, but it is a fairly large file relative to the other game files. Perhaps that is the main data archive for the game's assets?
- What is nsogg2.dll? right-click->Details shows the following information.
So it is file version 1.0.0.1, copyright by Xiph.org Foundation, and related to libogg. I happen to know that libogg is related to the vorbis audio codec and .ogg containers. Xiph.org also has some information about it for anyone unfamiliar with audio codecs.
.dll stands for "Dynamic Link Library" which is a way of linking software libraries to programs at runtime. This allows zompri.exe program the ability to access functions external to the executable file itself. In other words, nsogg2.dll probably has something to do with providing audio services to zompri.exe, likely related to the ogg vorbis audio codec. If there are a lot of .dll files in the game folder or subfolders, it is usually a good idea to ignore them since they tend to be plugins for the game engine, not unique to the game engine itself.
If ogg is short for "ogg vorbis" and ".dll" is a library linking format, then what do the rest of the characters in "nsogg2.dll" refer to, the "ns" and the "2"? Do these characters appear elsewhere? "00.ns2" has both of those characters together and "nscript" has the "n" character. In other words, the characters "ns" likely have special meaning to this game and provide an important clue when trying to figure out what game engine it might be using.
Next is read_me.txt. Since .txt means it is likely a text file, open it in Notepad++. Most text files for Japanese games are encoded in either utf-8 or shift-jis. utf-8 supports all languages. shift-jis is an older encoding intended to support only Japanese. Notepad++ should display "Shift-JIS" at the bottom right corner for read_me.txt. Notepad++ has some autodetection code, but it does not always work. If the bottom right corner does not say utf-8 or shift-jis when reading files in Japanese, then select the correct encoding manually. Encoding->Character sets->Japanese->Shift-JIS. That tells Notepad++ which character set to use so it can display the text properly. It does not alter the original text, only the way characters are displayed.
Code:
--------------------------------------------------
Windows対応 百合ファンタジー短編ノベル
----------------------------------------2011/06/18
タイトル:おばけ王女は墓の下
バージョン:Ver1.0
■はじめに
DLして頂き、誠にありがとうございます。
短く拙い作品ですが、少しでも何か心に残れば幸いです。
■動作環境
DirectX8以上 Windows98/Me/2000/XP/Vista/7
640x480(VGA)でフルカラー(24bit)表示可能な環境
■基本操作
左クリック・エンターキー・スペースキー等で読み進めて下さい。
■ゲームを始めるには
まずは、圧縮ファイルをフォルダごと解凍して下さい。
フォルダ内の「zompri.exe」を起動すればゲームが始まります。
アンインストールは、フォルダごとゴミ箱へポイっと。
■ご注意下さい
本ゲームを使用したことによるいかなる損害についても、ユキ子は責任を負えません。
本ゲームの著作権はユキ子に、使用素材の著作権は各製作者様にあります。
これらの無断転載・再配布・二次加工はご遠慮下さい。
ご理解の上、ゲームをプレイして下さいますようお願い致します。
■ご協力に感謝!(順不同、敬称略)
Takahashi's Web
http://www.nscripter.com/
NEO HIMEISM
http://neo-himeism.net/
G2-MIDI
http://guru2.nobody.jp/
WEB WAVE LIB
http://www.s-t-t.com/wwl/
■製作元・連絡先
ご意見、ご感想、誤字脱字の報告などはこちらへ。
制 作:晴れ時々グラタン/ユキ子
http://hanikamuaisuman.web.fc2.com/game.html
連絡先:[email protected]
一週間経っても返信が無い場合、再度ご連絡下さい。
Code:
-------------------------------------------------- Yuri Fantasy Short Novel for Windows
----------------------------------------2011/06/18
Title: The Ghost Princess Under the Grave
Version: Ver1.0
■ Introduction Thank you very much for DL. It's a short and clumsy work, but I hope it will leave a lasting impression on you.
Operating environment DirectX8 or higher Windows98/Me/2000/XP/Vista/7 640x480 (VGA) full-color (24-bit) display environment
■ Basic operation Please read with left-click, enter key, space key, etc.
■ How to start the game First, unzip the compressed file as a folder.
Launch "zompri.exe" in the folder to start the game.
To uninstall, pop the entire folder into the trash.
■ Please be careful Yukiko cannot be held responsible for any damage caused by the use of this game. The copyright of this game belongs to Yukiko, and the copyright of the materials used belongs to each producer. Please refrain from unauthorized reproduction, redistribution, or secondary processing. Thank you for your understanding before playing the game.
■ Thanks for your help! (In no particular order, titles omitted)
Takahashi's Web http://www.nscripter.com/
NEO HIMEISM http://neo-himeism.net/
2-MIDI http://guru2.nobody.jp/
WEB WAVE LIB http://www.s-t-t.com/wwl/
■ Manufacturer and contact information
If you have any comments, comments, or reports of typographical errors, please click here.
Production: Sunny Sometimes Gratin / Yukiko http://hanikamuaisuman.web.fc2.com/game.html
Contact: [email protected]
If you do not receive a reply within a week, please contact us again.
It is always nice when game developers properly document the tools they used to create their game. The first link in the readme leads to https://www.nscripter.com/ which says ゲーム/ゲームエンジン/ライブラリの制作・配布サイトです。 which could be translated to "This is a site for the production and distribution of games, game engines, and libraries." Thus, it looks like the game's read_me.txt file implies that it is using game engines and libraries related to NScripter.com. In other words that string that keeps repeating, "ns", in all the game files likely refers to "nscripter".
Here are some random websites that pop up when searching for nscripter.
- https://en.wikipedia.org/wiki/NScripter
- https://ja.wikipedia.org/wiki/NScripter
- http://nscripter.insani.org/
- http://nscripter.insani.org/about.html
- https://kaisernet.org/onscripter
- https://github.com/Galladite27/ONScripter-en
- https://github.com/YuriSizuku/OnscripterYuri
That is a lot of information to read through, but once complete, the initial conclusions are that nscripter has a lot of forks and that it looks like a nightmare to deal with all of them. Yikes. The original nscripter is probably also the least friendly to use for translation given that there are so many forks stated for the purpose of improving the ability to translate nscripter games because the original engine is lousy at it.
Which one is zompri using? Well, if the read_me.txt points to nscripter.com, then it likely uses whatever version is on that site. Which version or versions are on that site?
Under the ソフトウェア, software, heading nscripter.com has download links for nscripter 2018, nscripter 2015, nscripter2, something related to unity, something related to ruby, a mysterious link that has a similar archive name to the ruby archive, and some documentation. Unity is a game engine. Ruby is a general purpose scripting language.
The read_me.txt says the game was released on 2011-06-18 and wikipedia says the NScripter2 engine was not released until 2012-August-31, so one year after the game was released. That means it is highly unlikely that zompri was created on NScripter2.
Technically, there is no confirmation yet that zompri uses the nscripter game engine or which version it is using. Considering the read_me.txt points to nscripter.com, that makes it very likely zompri uses the original and latest version of the Japanese NScripter game engine as of 2011. Is there any way to falsify that hypothesis?
Back inside of Garbro, clicking on all of the files in the game directory asks Garbro to open them as text files, pictures, or archives. Garbro cannot open the nscript.dat file, but it does open that 00.ns2 file as an archive. At the bottom left, Garbro displays the file is an "NScripter game engine resource archive".
In addition, after looking around for a bit, one of the nscripter forks makes multiple references to an nscript.dat file which is indeed found in the zompri game directory. http://nscripter.insani.org/sdk.html says,
nscmake.exe -- takes your script file (0.txt) and converts it into compiled bytecode for the runtime binary (nscript.dat).
[...]
NSDec
[...]
Contents: extracts the script from any given nscript.dat.
Taking all of that information together, that makes it overwhelmingly likely that this game uses the nscripter game engine. With that confirmed, it is time to figure out how nscripter assets, like images and the game script, can be extracted and packed again so the zompri game can read them.
Extracting contents from the 00.ns2 file is easy since Garbro has already shown it can peak into the archive. Browsing around, it also seems to render the images correctly meaning that they are not obfuscated or encrypted.
Obfuscated means the bits are manipulated in an obscure way to make them difficult to render for someone unfamiliar with the series of steps, the algorithm, used to obscure them. Encrypted means the contents are permanently altered using an algorithm, also called a "cipher", while under the influence of an encryption key. For encrypted contents, it is impossible to recover the original contents perfectly without knowing the encryption key even if the cipher is known.
Just extract the contents of 00.ns2 to a folder named zompri\extracts\00.ns2 or similar.
Next is the script. Does the original game engine provide a way to unpack the script? Usually the answer is no.
Game developers have the original assets they packed into archives for distribution, so they do not usually need unpacking tools at all. While such tools are useful for obscure debugging, usually only the creator of the engine will have that, if they created it at all, and there is no expectation of them including such an engine debugging tool in the engine's software development kit (sdk) since that is not very useful to game developers.
The original game engine and related sdk tools are preferred when packing assets because that was the software that originally created them and it already knows how to do it without producing any additional bugs in a compatible way. The issue with this approach is that the original engine may not be published or otherwise available. It means the engine's archive and script formats need to be reverse engineered which can be very messy, buggy, and difficult, especially when packing.
Due to the above dynamics, it is normal to look for third party unpackers, like Garbro, since they are unlikely to be part of the original engine sdks and to try to use the original engine's tools for packing, provided the engine sdk is available. If the original engine sdk is not available, such as because the engine developer never published their engine as an sdk, then looking for third party packing tools may be necessary, but this is never ideal. Using the original engine sdk is almost always ideal because that is the way the assets were meant to be packed.
http://nscripter.insani.org/sdk.html has their own "Development and Translation Utilities" for working with nscripter, but that is a fork. The original engine is over at nscripter.com although it has had some updates since 2011.
Let's download nscripter.insani's NSDec script unpacking tool because that is unlikely to be part of the game engine and the Japanese nscripter 2018 sdk. If the latest 2018 sdk is not compatible with zompri, a 2011 game, then we can try the 2015 sdk version. If that fails too, then we could try using the nscripter insani fork sdk version from 2005. Since it might be useful, here is the nscripter documentation archive as well.
Here is what those archives look like in 7-Zip.
All of the file names are in mojibake which indicates character set decoding errors. Just like text files have character encoding, the metadata of .zip files that determines the name of each file and folder in the .zip also has an associated encoding. 7-Zip and Windows Explorer assume the encoding of the files is in either utf-8 or the local Windows/ANSI code page. If the metadata was encoded as utf-8, then it would always work, but since it is not utf-8, then the local code page is used instead. If the local code page is English/cp437 but the .zip file was created by Windows under Japanese/cp932/shift-jis, then neither Windows nor 7-Zip will be able to properly decode the file names using the local English/cp437 code page. That is not the correct way of decoding those characters.
The only valid encoding for Zip files since 2006 is utf-8 which is a character set that supports all languages.
However, all versions of Windows up to and including Windows 10 22H2 that support creating zip files with Windows Explorer use the local ANSI/Windows code page for the file and folder name encoding. I did not test Windows 11. For versions of Windows with the region set to Japanese (Japan), that means the .zip files are always encoded with cp932/shift-jis. In other words, all .zip archives created by Windows Explorer are always malformed if they contain non-ascii characters.
There is no technical reason for this incorrect behavior. Microsoft could have been updated Windows sometime during the last two decades to fix this incorrect non-standards compliant behavior, but they never did until at least up to Windows 10 22H2. This problem of having incorrect .zip file encodings really only occurs because Windows has the ability to create malformed .zip files. WinRar and newer versions of 7-Zip do not have this problem because they always create archives, including .zip, using utf-8 encoding. The archive formats .rar and .7z also mandate utf-8, so they never experience this problem which leaves Windows Explorer as the remaining culprit. Note that older versions of 7-Zip (<21.02 alpha) also have this incorrect behavior but that was fixed years ago. Only Windows Explorer continues to create these malformed .zip files.
Technically, only the names are malformed, not the underlying data. However, leaving the names malformed is not advisable because sometimes files look for or require other files based upon their name which means the extracted files may not work without the correct name. Even if they do work, having the folder names correctly decoded can provide hints as to what the different files and folders contain.
Recommendations:
- Never use Windows Explorer to create .zip files because it does not encode file metadata correctly which results in it producing malformed .zip files which require users to guess the correct encoding to decode them.
- Use a newer version of WinRar or a version of 7-Zip newer than 21.02 alpha to create .zip files.
- Consider using the .7z or .rar archive formats instead of .zip because these formats effectively side-step .zip file encoding issues. They are also known to be incompatible with Windows Explorer which should encourage others to use dedicated archiving software that is not Windows Explorer.
The rationale for the above recommendations is that it is overly cumbersome to change the local code page to whatever the zip file was encoded with every time. In general terms, it is also a better idea to forgo using broken software completely and not encourage its use further. Windows Explorer's zip file functionality is broken and should therefore be treated that way.
Viable options for decoding malformed zip files:
7-Zip's graphical user interface (GUI) does not support manually specifying the zip file metadata character encoding. The 7-Zip GUI, 7zFM.exe, will read the encoding correctly if the correct code page is used on the local system. In situations where the .zip file has metadata encoded with a different code page than the local code page, 7-Zip's GUI will not be able to extract the files with the correct names. 7-Zip does support specifying the correct code page in the command line interface (CLI) using the undocumented -mcp= switch. The number of the Windows code page should be specified after the -mcp= as in -mcp=932 or -mcp=65001.
An example of a code page number is 932 which is more or less equivalent to ANSI Shift-JIS encoding. 437 is English/DOS. To check the active code page, open a command prompt and type "chcp". A list of encodings is available in the Python documentation.
Linux users can use the cli program "unzip" with the -I (capital i) or -O (uppercase o) options to specify shift-jis encoding.
Python 3.11+ also works for as a cross-platform solution since the zipfile module was updated in Python 3.11 to support the --metadata-encoding cli option.
Summary:
- Windows: WinRar GUI, 7-Zip's CLI, or Python 3.11+'s zipfile module.
- Linux: "unzip" CLI, 7-Zip's CLI, or Python 3.11+'s zipfile module.
However, all versions of Windows up to and including Windows 10 22H2 that support creating zip files with Windows Explorer use the local ANSI/Windows code page for the file and folder name encoding. I did not test Windows 11. For versions of Windows with the region set to Japanese (Japan), that means the .zip files are always encoded with cp932/shift-jis. In other words, all .zip archives created by Windows Explorer are always malformed if they contain non-ascii characters.
There is no technical reason for this incorrect behavior. Microsoft could have been updated Windows sometime during the last two decades to fix this incorrect non-standards compliant behavior, but they never did until at least up to Windows 10 22H2. This problem of having incorrect .zip file encodings really only occurs because Windows has the ability to create malformed .zip files. WinRar and newer versions of 7-Zip do not have this problem because they always create archives, including .zip, using utf-8 encoding. The archive formats .rar and .7z also mandate utf-8, so they never experience this problem which leaves Windows Explorer as the remaining culprit. Note that older versions of 7-Zip (<21.02 alpha) also have this incorrect behavior but that was fixed years ago. Only Windows Explorer continues to create these malformed .zip files.
Technically, only the names are malformed, not the underlying data. However, leaving the names malformed is not advisable because sometimes files look for or require other files based upon their name which means the extracted files may not work without the correct name. Even if they do work, having the folder names correctly decoded can provide hints as to what the different files and folders contain.
Recommendations:
- Never use Windows Explorer to create .zip files because it does not encode file metadata correctly which results in it producing malformed .zip files which require users to guess the correct encoding to decode them.
- Use a newer version of WinRar or a version of 7-Zip newer than 21.02 alpha to create .zip files.
- Consider using the .7z or .rar archive formats instead of .zip because these formats effectively side-step .zip file encoding issues. They are also known to be incompatible with Windows Explorer which should encourage others to use dedicated archiving software that is not Windows Explorer.
The rationale for the above recommendations is that it is overly cumbersome to change the local code page to whatever the zip file was encoded with every time. In general terms, it is also a better idea to forgo using broken software completely and not encourage its use further. Windows Explorer's zip file functionality is broken and should therefore be treated that way.
Viable options for decoding malformed zip files:
7-Zip's graphical user interface (GUI) does not support manually specifying the zip file metadata character encoding. The 7-Zip GUI, 7zFM.exe, will read the encoding correctly if the correct code page is used on the local system. In situations where the .zip file has metadata encoded with a different code page than the local code page, 7-Zip's GUI will not be able to extract the files with the correct names. 7-Zip does support specifying the correct code page in the command line interface (CLI) using the undocumented -mcp= switch. The number of the Windows code page should be specified after the -mcp= as in -mcp=932 or -mcp=65001.
An example of a code page number is 932 which is more or less equivalent to ANSI Shift-JIS encoding. 437 is English/DOS. To check the active code page, open a command prompt and type "chcp". A list of encodings is available in the Python documentation.
Code:
"C:\Program Files\7-Zip\7z.exe" x -mcp=932 nscr_2018.zip
Linux users can use the cli program "unzip" with the -I (capital i) or -O (uppercase o) options to specify shift-jis encoding.
Code:
unzip -O shift-jis nscr_2018.zip
Python 3.11+ also works for as a cross-platform solution since the zipfile module was updated in Python 3.11 to support the --metadata-encoding cli option.
Code:
python --version
python -m zipfile --help
python -m zipfile -l nscr_2018.zip --metadata-encoding shift-jis
python -m zipfile -e nscr_2018.zip . --metadata-encoding shift-jis
Summary:
- Windows: WinRar GUI, 7-Zip's CLI, or Python 3.11+'s zipfile module.
- Linux: "unzip" CLI, 7-Zip's CLI, or Python 3.11+'s zipfile module.
To fix the malformed encoding, use archiving software that allows specifying code pages for .zip metadata. On Windows, the laziest solution is to use a newer version of WinRar. If you are comfortable with a command line, 7z.exe and Python 3.11+ are viable alternatives as well. For the CLI syntax for 7z.exe and Python, open the spoiler above. Alternatively, use WinRar.
For newer versions of WinRar:
1. Open the archive using WinRar
2. Options->Name encoding->932 (OEM/ANSI Japanese Shift-JIS)
3. "Extract to"
4. OK
5. Repeat for all 3 archives
Last edited: