besteon / Ironmon-Tracker

A Lua script for the Bizhawk/mGBA emulator compatible with Pokemon Fire Red, Leaf Green, Ruby, Sapphire, and Emerald that tracks relevant data for the IronMon challenge.
MIT License
126 stars 45 forks source link

Support for non-English Pokémon versions #62

Open Siphonay opened 2 years ago

Siphonay commented 2 years ago

Hi! I intend to strat streaming IronMon to my Fracophone audience, and as such I would like to be using the French version of the games. It would be even better if the tracker had translated Pokémon, abilities names…

I tried to edit the code to force the script to load with a French LeafGreen ROM, trying 1.0 and 1.1 variables, unfortunately the tracker does not work beyond detecting the Pokémon species and crashes the emulator in battle, so I assume memory addresses are different for every release.

Besides English, Pokémon FR, LG and E have been released in the following languages:

I looked around at the code and I think (this maybe wrong or incomplete) implementing multi-language support would entail f all required memory addresses for all revisions of every language release (according to TCRF, the Japanese version has V1.0 and V1.1 releases, while the European languages did not receive a revision)

If we also want to go the route of adding names of Pokémon, Abilities, Moves, Items, Natures, Statuses and types in several languages (note that Spanish and Italian use English Pokémon names), they would need to be added to the data files.

I would definitely be willing to contribute to this should you decide that this is within the scope’s project. Depending on the approach for doing the second part, I could try to write automated scripts with PokéAPI to add variables with names in other languages.

If you know how to find the memory addresses, adding them to the GameSettings.lua would be trivial if not a little time-consuming, but unfortunately at the moment I wouldn’t know where to look for to find the right addresses, but this is something I can learn.

Sorry, this is very wordy! As this is something I really want to see added to the tracker, I made sure to research the feasibility, and as I said I would be willing to contribute as much as possible to realize it. I think it would help the IronMon open up to broader audiences outside of the Anglophone streamers and players. I would understand if you would consider this too heavy to support though − in that case I would certainly do my own fork that supports at least French language games.

Thanks for reading!

bdjeffyp commented 2 years ago

Multi-language support is definitely something that I'd love to see implemented at some point! I envision having a file that stores all of the Pokémon names and abilities in different languages so that the PokemonData.lua and MoveData.lua files could reference this file to get the correct name for the version of the ROM that is loaded.

The big blocking issue with this right now is the support for extended characters beyond the A-Z/a-z/0-9. The tracker/BizHawk already has problems rendering the é in Pokémon, such as for items like Poké Doll and Poké Flute, that we had to name them Poke Doll and Poke Flute in the code. I haven't had a chance to look at if the extended character issue stems from BizHawk, the tracker's font choice, or something else entirely.

You are correct about the memory values. Each game version across the various releases will have a lot of memory differences. I'm seeing that in implementing Ruby/Sapphire as well. When getting memory values, we use the symbol tables located here:

You can see that the first two don't have any other languages, though Ruby/Sapphire does have German. Ruby/Sapphire itself isn't as fully documented as FRLG and Emerald are. So adding other languages becomes a much larger issue than just adding the appropriate text and determining how to get the tracker to render extended characters. Finding these memory values outside of the symbol tables will be the largest endeavor in all of this.

If you are willing to support this effort, I would be happy to help in any way that I can. I am currently involved in a couple of projects at the moment (getting Ruby/Sapphire fully working, adjusting tracker settings in-game, and Desmume support for Gen 4), but if you need resources, tips, or have questions, I'm more that happy to give any info you need to get you started. Another resource that may potentially have figured out some of the memory addresses already is the RetroAchievements project. If you download their RALibretro emulator to load up a Pokémon ROM, you can see notes that various achievement developers have made on memory addresses. Perhaps they have discovered the memory locations we need already!

I apologize for my wordiness as well. Again, if you have any questions about how to get started, let me know!

GB127 commented 2 years ago

I believe the best would be to not use an api while running this. Some users have noticed some lags after logging a couple of notes. So we want to reduce the CPU power to a minimum while running the game.

bdjeffyp commented 2 years ago

Oh yes, we absolutely will not use APIs to fetch data. All data must be stored within our *Data script files.

Siphonay commented 2 years ago

Oh yeah definitely @GB127, sorry I didn't make this clear enough, I wanted to mean that I'd use an API in a separate one-shot script I'd write to add the multilingual data to the files instead of doing it manually, but that wouldn't be shipped with the tracker

Siphonay commented 2 years ago

@bdjeffyp I completely forgot to reply, but I'm very glad to hear that you were already considering this! I hope you manage to find a solution for non-ASCII characters, in the meantime I'll try what you suggested to see if I can find the right memory addresses for several releases. Thank you!

bdjeffyp commented 2 years ago

I forgot that the RetroAchievements site has each games' code notes available to view on the website rather than only via the emulator. Here is where the notes for FireRed are. It doesn't look like they ever got support for other languages off the ground, but it is still a potential resource.

Siphonay commented 2 years ago

Hi there, it seems RetroAchievements only support US releases if available, so I don’t think I can really get other languages’ addresses working from there. I think I’m just going to have to hunt with an emulator’s memory search feature.

Also, I’m sorry I haven’t looked into this since, I’ve been busy with a few things in my life, but I hope I can get working on this soon!

bdjeffyp commented 2 years ago

Please, no apologies needed. This is a fan project. Life comes first, so enjoy it! 🥰

UTDZac commented 2 years ago

Just chiming in here, as of today v0.6.0 has support for the following languages of FireRed:

This includes being able to run the game with the Tracker loaded, as well as localization of text on the tracker screen to match the game's language. Huge shoutout to @thisisatest1900 for their great work on getting these added.

As for Japanese, unsure how possible that one is because of the character script used that isn't supported by Bizhawk text drawing (I think).

thisisatest1900 commented 2 years ago

a bit more info about the why we can't draw japanese the current api to drawtext we have from bizhawk passes a lua string and draw that string lua strings are array of bytes so each char has value of 0-255 c# strings are utf16 so the current way to draw the other languages is by luck the chars that needed to be drawn are in the range of 0-255 so i build lua string to have the utf16 value japanese chars in utf16 start at value of 0x3041 which is way above 255 i couldnt find a way to bypass that problem so i see less reason to add japanese becuase i think it wouldn't be useful without the move name localization

Mo892DD commented 1 year ago

Multilingualism is indeed a difficult project, and as a native Japanese speaker, I still look forward to the day when it supports Japanese

UTDZac commented 1 year ago

After quite a long delay, Bizhawk 2.9 finally offers support for displaying Japanese characters. I've worked with a few different Tracker devs today to get a stable, compatible Tracker built for playing the Japanese version of Pokemon FireRed (J) 1.0.

It mostly just displays the Pokemon names, the move names, ability names, and item names in Japanese, similar to the language support offered with the other four languages.

image

This will be releasing soon, but if you would let to help test it, it's available on the dev branch through the Tracker's built-in updater.