[//]: <> (This readme is in the markdown format. Please preview in a markdown parser.)

# Time Twist: English Version 1.0

Source code: [https://github.com/romh-acking/time-twist-fds-en](https://github.com/romh-acking/time-twist-fds-en)

## About
This is a translation patch for Time Twist on the Famicom Disk System. 

It's a game co-developed between Pax Softnica and Nintendo. While this game is rather infamous for its subject matter, most of the development came from Pax Softnica, not Nintendo. Aside from the original conception and music, it's all Pax Softnica's work here.

This game, as hinted by the manual amusingly enough, covers historical atrocities. From World War II to the post-Civil War era, player discretion is advised, and you should probably think twice about streaming this game. While playing this game, it's amazing Nintendo put their name on it. While hacking the credits, [I discovered two entries from the credits were removed. One was for Shigeru Miyamoto](https://tcrf.net/Time_Twist:_Rekishi_no_Katasumi_de...). This is less of a comment on him and more of a comment on the fact that Nintendo had practically zero involvement on this game. To this day, Nintendo hardly acknowledges this game. By virtue of technically being developed by Nintendo, [it has a dedicated webpage along with their other titles](https://www.nintendo.com/jp/famicom/software/fmc-ttw/index.html).

This game was an obscure curiosity but received minor public attention due a YouTuber, "Dungeon Chill", covering the game. Afterwards, a couple of vibe coded and AI translated projects were published. These projects ran into the FDS's harsh RAM limitations and had some major problems such as crashing and dropping dialogue lines.

As for the game itself, ignoring the atrocities, it's an ambitious game for the console. It has your typical adventure game cryptic puzzles, but there's some decent logic puzzles later, especially in the Georgia chapter.

This project started a year prior and uses [sudgy](https://github.com/sudgy/nintendo_translations)'s translation and the project was coded by me. The project was halted for a year because, while my script dumper and inserter were functional, I was apparently missing a pointer or two. After referencing the first AI translation through byte-diffing, I wasn't accounting for a pointer table for the menu options. With that out of the way, the project continued.

Sudgy's translation is fine, however, by their own admission, it's not perfect. It lacks regional dialects, misses a few lines, and contains a few mistranslations; which were accounted for.

This patch is not for rehosting on romhacking.net.

## Technical Details

### How the Game Stores Text
While the game itself is an attractive candidate for a translation, people in the rom hacking community quickly noticed how hard it was to hack. The game's text is bit-packed. Additionally, there's dozens of pointers to account for. A lot of stages write an initial script file before overwriting it with another smaller script file. This smaller file can have pointers to the initial file. All of this had to be accounted for. Because I have prior experience making my own script dumping and insertion utilities, I managed. I used static analysis, some dynamic analysis, and a good amount of dumping and reinserting to see how it broke the game.

### How I Fit The Text In
There were a few methods I leveraged to fit all the text in:
* The game encodes hiragana characters and their corresponding dakuten and handakuten characters differently. The former as 6-bits per character and the latter as 9-bits per character. To expand the dictionary, I repurposed the 9-bit format and code. This greatly limited the amount of characters I can print, so all text is uppercase.
* A lot of script file have assembly code at the end of the files. This complicates expanding the script. However, I relocated data after the assembly code to the extent RAM would allow.
* For the Greek chapter, I split the file into two. There was practically no free RAM for this chapter. Every chapter is split up into multiple files except for this one, and it appears that the game had an entry in the filelist for an extra file, so it worked out. This involved getting my hands dirty and understanding the game's scripting language that runs the game. When transitioning from one file to another, game state is not preserved. So certain scenarios had to be extracted from the original file to the new file.
* For script files on part 1, I had to make script sacrifices. This involved making the text less verbose, but the meaning was kept. Of course this could be handled by splitting up the files, however, this involves adjusting the game's internal file list, which isn't exactly trivial to expand.

### Changes
* Text prints as single-spaced.
* Text scrolling occurs on the middle of the textbox instead of the bottom. This is to prevent there from being too much text on screen while the textbox is scrolling. The textbox does fill at the end of a text line.
* The dictionary is expanded.
* Menu options are expanded. In the original game, options were in two columns. In this translation, they are in a single column.

### Quirks

#### Text Printing Sound
The sound for text print will often start way before the actual text prints. It usually happens after follow up lines

This is because:
* Sometimes it's because a line starts with `(LINE)(LINE)`, which contribute to the sound effect being played. The game also doesn't differentiate between empty rows / empty spaces / already printed characters, so those get printed and reprinted all the same. This issue is also exacerbated due to the amount of lines being available on screen is doubled from 4 to 8. So the further done the second line printed is, the more this issue is evident.
* Because of the single line hack, resuming text from a `(WAIT)` control code throws a wrench into the whole text printing routine. I have a routine to calculate what text row to resume from, which influences the sound effect. This helps limit the pause and sound effect you hear, but the issue is that, natively the game support 4 lines, not 8. So you will get a slight pause and text printing sound for certain line numbers. 

##### Case #1
Line #1: `Hello there.(STOP)`<br/>
Line #2: `(LINE)Another line.(STOP)`

When printing the second line, the game will reprint the first line, which you don't see. But it will play a sound effect.

##### Case #2
```
Hello there.(WAIT)
Another line.(STOP)
```

Line resuming operates with the assumptions from the original Japanese game. Odd line numbers are assumed to be diacritics and even lines are assumed to be hiragana. Therefore, the line resuming routine resumes on even numbered lines. I made this work with the single-spacing hack, but when resuming on odd lines, the previous line will be printed.

### Pausing before printing text
Before printing text onscreen, there is a noticeable pause due to the dictionary being expanded. This is because:
* There are more dictionary entries to iterate through. I make up for this by sorting dictionary entries in terms of usage. So the most common dictionary entry will be first and the least common will be last.
* The dictionary has a single pointer, so the game iterates through the entire bitstream to locate the required index. The applies to dialogue lines as well, however, for these, the game has a pointer table that points to indices `0`, `32`, `64`, and so on to reduce the amount of time iterating. I do not do this for the expanded dictionary because I prioritized space over performance.
* The dictionary I use is far more aggressive compared to the original game. I use a mix of words, phrases, and two letter entries, so most dialogue lines are mostly dictionary tokens.

Most of the time, this pause is a non-issue. It will be noticeable for certain menu options. For one scene where there's scrolling, text compression is disabled to not impact the visual presentation.

## Patching Instructions
The patch expects one single FDS disk image. Given this game is shared online as multiple disk image files, you can merge them on Windows using `merge.bat`. Make sure to have your disk image files named like so:
* `Time Twist - Rekishi no Katasumi de... - Zenpen (Japan).fds`
* `Time Twist - Rekishi no Katasumi de... - Kouhen (Japan).fds`

The patch is a [Beat patch](https://romhack.ing/utilities/893). Either use the Beat patcher or patch your rom here:

[https://romhack.ing/tools/patcher](https://romhack.ing/tools/patcher)

## Manual
Much thanks to Dustin Hubbard from Gaming Alexandria for providing the scans of the manual. Check out the original scans here:

[https://www.gamingalexandria.com/wp/2019/02/time-twist-rekishi-no-katasumi-de-zenpen](https://www.gamingalexandria.com/wp/2019/02/time-twist-rekishi-no-katasumi-de-zenpen)

While there's a manual which came with the game and the disk fax pamphlet, I only did the manual. The pamphlet practically has the same content as the manual.

## Changelog
* 2026 October 27th: 1.0
    * Initial release

## Credits

### Main Team
* FCC
    * Initial ASM work
    * Utilities
    * Proofreader
    * Manual
* sudgy
    * [Initial translation](https://github.com/sudgy/nintendo_translations)
* Her-saki
    * Manual translation

### Support
* Bunkai
    * Spot translation

### Beta Testers
* ppltoast
* Missile
* Bro3256
    * Real hardware tester
