Author Archives: Kingcom

One year later

I’m aware it’s been a full year since my last post. I apologize for the long silence. As usual, real life and gaming studying used up a lot of the time. Also sorry for the unapproved comments, I didn’t pay attention to them for a while. Most of the progress was made on the projects covered by Absolute Zero, but the others were also not forgotten. Today I want to focus on Dragon Quest Monsters 1&2. I know that the length of the project is almost comical at this point, so I want to give some insight into what problems there were to solve and why it takes a long time, often resulting in extended stretches with little motivation to work on it.

Dragon Quest Monsters 1&2 is undoubtedly among the nastiest games I’ve worked on. It needed many major programming changes that all came with their own set of resulting issues. Some systems of the game were  just entirely unsuited to languages other than Japanese and needed a lot of manual work to get them working. Here I want to summarize a few of the things that needed to be done, some of the issues along the way, and what we still have left to do at this point.

Names

The Japanese version used 5 bytes/characters for player and monster names. This has been extended to 6 letters by compressing every letter down to 6 bit, at the cost of the size of the input alphabet. The game originally stored location names as plain text in saves, in around 10 bytes. It copied them from the text of the specific map. No compressing method would allow the longer location names to fit in there, so now instead an index gets written to the saves and a new list of location names was created to be referenced by that. Key names in part 2 were also stored as plain text, in just a handful of bytes. These couldn’t be referenced by an index due to the vast number of possible variables, so instead all the variables are encoded in a way that allows dynamically recreating the key name on demand.

Menus

The Japanese version uses tile maps to display the background and text. The screen is divided into 10×10 pixel blocks and each block can get one value assigned, ie. the graphic of a single letter. As this obviously doesn’t work well at all with proportional text, the entire system has seen a major rewrite, now dynamically drawing text, storing it in VRAM, and freeing it when it’s no longer needed. This was necessary, but it also caused a severe number of bugs. Some of them resulted from flawed logic in the original game. I’ll explain it with an example of a bug that I recently fixed, which had troubled me for a very long time.

2

Here you can see the status menu. Note the list on the left, which is a list of your monsters, with another option to show an overview of all your monsters at the same time. Now, when you press O you can see the ancestors of the selected monster.

3

And then this happens. Note the same menu on the left, now in the background. What should show “All” actually shows “24” in this case. At first it looks fine, this only happens when you press any buttons. So what happened? After a lot of debugging, I figured it out. This is the sequence of events:

  • the player presses O, entering the ancestor menu
  • the game draws the new foreground menus, and at the same time creates a backup copy of the background menu
  • whenever the user presses a button, all menus are redrawn, including the background menu. At this point my new system frees the previously displayed text, allowing it to be overwritten by new text
  • after all menus have been redrawn, the final image is created. But instead of using the newly drawn version of the background menu, the game instead uses the backup copy. As the text it displayed has long been invalidated, the result is garbage

This is just one of many examples where the game works in, let’s say, a less than intuitive way. It’s a very time consuming process to identify and fix these issues.

Battle Text

This is the single most time consuming part of the game. When the game displays battle text, it doesn’t fetch any complete sentences. It doesn’t fetch any sentences with some placeholders either. It instead pieces the sentence together bit by bit, splitting it into the small parts mirroring sentence fragments of the Japanese grammar. Here’s a simple example to illustrate this:

<Var:10><Var:30>は <Var:20><Var:35>を <nl>ぱふぱふした!
<Var:10><Var:30> gave <Var:20><Var:35> a puff puff!

The Japanese text is split up into three parts, the first two of which are used by hundreds of strings:

<Var:10><Var:30>は
<Var:20><Var:35>を
<nl>ぱふぱふした!

Now there is a problem – the Japanese text just puts the names of the two monsters right next to each other, but in English we need to insert an extra “gave” inbetween them. To do this we can’t just change the string. Instead, we need to add another sentence fragment and adjust the battle script to piece the sentence together in the right way. This process needs to be done with a lot of strings. Some don’t need any changes, some can be solved by slight wording changes (ie. active instead of passive, or vice versa), while many others need to have their script adjusted. It’s a time consuming and error-prone process, and every single string the game can display needs to be checked and verified for this reason.

Additionally, support for pronouns was added. The monsters in your party use their respective gender, while enemies are universally referred to as “it”.

What’s left at this point

  • finish checking/fixing all battle text strings
  • replace Japanese graphics, ie. the title screen or the background graphic for the appraising results
  • fix remaining menu issues (most of them should be squashed by now)
  • text editing (mostly to avoid ugly text formatting, currently around 1/3 through the first game)
  • testing

A special thanks goes to Lord Oddeye, who joined the project after the Oriental Blue release. He continued testing just as thoroughly as before, and this time around also helped fix the issues. He brought the majority of the system text formatting up to shape and is now doing the same for the story text.

So much for today. I hope it was an interesting insight into the project, and I’ll try not to take another year for the next update.

More exciting tools updates

Due to popular request, it’s time for more armips news! The changes this time around aren’t as big as last time, but they are still notable developments. It can now be used for PS2 games, and also on Unix platforms! Finally you aren’t restricted to just Windows anymore. Make sure to grab the latest revision on GitHub.

Speaking about PS2 games, some of you may know that I spent a lot of time on improving PPSSPP’s debugger last year, to help with a PSP project. Unfortunately, PSP wasn’t the only platform lacking a good debugger. The PS2 was especially poor off, the only PCSX2 version to have a debugger – and a pretty poor one at that – was several years old. Recent versions completely removed it. There was nothing left.

… until recently! I took it upon myself to write a completely new debugger for PCSX2, and a much better one than before. It has almost all the features PPSSPP had, including a builtin assembler and conditional breakpoints. So far it only works for the R5900, but that’s where most of the interesting stuff happens anyway. This will hopefully help future PS2 translation projects. You can get it by building PCSX2 or by downloading a prebuilt version.

pcsx2deb

As for project updates, there’s not a lot to say. I just finished my Bachelor Thesis, so time was rather scarce lately. One notable development, though, is that dds continued working on Kyuuyaku Megami Tensei 1 & 2. See this thread for updates, and he will comment on it on this blog later on too.

armips news

I hope you’ve all been enjoying Oriental Blue! There hasn’t been much progress on the other translations this time, but those are far from the only things I work on! In the last six months I’ve spent a lot of time on improving my assembler. I rewrote about half of it, added a few very neat new features, and made it open source on a GitHub repository. If anyone wants to contribute to it, pull requests are welcome. Otherwise you can just check out the latest stuff. It needs Visual Studio 2013 to compile, and the Visual C++ 2013 redistributable to run.

Here are the currently notable changes since the last release:

  • it is now possible to load (non relocateable) PSP ELFs via .loadelf name. This takes care of any address calculations. Many more PSP specific opcodes are also supported, though not at all yet
  • now fully UCS2 compatible. Can read from UTF8 and UTF16LE/BE by detecting the byte order mark. Can be told to interprete a file as Shift-JIS, too. If no BOM is found, it defaults to UTF8
  • the biggest new feature: importing static libraries compiled for PSP or GBA/NDS. armips takes care of relocating it to the current address, resolves external symbols using the user defined labels, and makes all exports visible to the rest of the assembly code. Essentially this allows you to write a lot of your code in C/C++, and then easily link it into the existing game using armips. The usage is .importlib name.
  • new -sym2 format, which adds support for functions that PPSSPP can interprete. .function name to start a function, and .endfunc to end it. .function will implicitly end any previous function.
  • new directives: .function, .endfunction, .stringn, .sjis, .loadelf, .importlib

I’m not sure how long it’ll take to wrap things up for the next proper release, but it will definitely be the biggest update so far.

Oriental Blue Release

obtitle

Admit it! You didn’t think it would happen. But as I’m sure you all know, it’s still summer! At least for most of this week.

Oriental Blue is an RPG that’s part of the popular Tengai series, also known as Far East of Eden to most (see the Readme for details on that). It features non-linear gameplay, an intelligent battle system with a unique magic system, and near endless replayability due to countless minor and major choices that you knowingly or unknowingly make.

The translation project was started on October 16 2008, and was announced to the public on March 15 2009. Tom, who is known for translations such as Dragon Quest Monsters: Caravan Heart and Persona 2: Innocent Sin translated it. It has obviously been a long project, taking much longer than I would have liked or expected. While the translation was finished relatively early on, the hacking dragged on for a long time… other projects were close to release and had to be finished, university took a lot of time away, etc.

We eventually reached a stage where it was ready to be tested on April 9 this year. It’s a massive game, so it was always the plan to have a long and thorough test. I didn’t expect it to be perfect, but as is always the case, the amount of issues that were found was pretty disheartening. A total of 130 issue tickets were opened on our bug tracker, of which 53 were technical issues. A huge thanks goes out to our beta testers for this amazing performance. I especially want to highlight Lord Oddeye, who played the game more thoroughly than anyone else and did his best to try every single possible outcome of all events, and made sure to catch all instances of the ever changing NPC text.

And now, make sure to read the Readme and enjoy the game!