Message Boards Message Boards

5
|
9801 Views
|
1 Reply
|
5 Total Likes
View groups...
Share
Share this post:

Translating English <-> Al Bhed from Final Fantasy X game

Posted 10 years ago
In the classic PlayStation 2 game (and recent PlayStation 3/Vita port) Final Fantasy X by game maker Square Enix, there is a crypto-language called "Al Bhed." The language is spoken by one of the game's main characters, Rikku, as well as numerous non-playable characters. It's a "crypto-language" in that it is not a true language, but is actually encrypted English, similar to ROT-13 except that it's strangely pronounceable, and not based on any obvious mathematical rules.

Now, there is a system in-game that deciphers the language for you, but it requires collecting 26 items, 4 of which can be easily missed & can't be acquired once missed, and the final item doesn't show up until the end of the game, which doesn't help you figure out what the Al-Bhed-speaking characters are saying at the beginning of the game. So I wrote a series of functions in Mathematica that translate from English to Al Bhed, and another series that handles the other way around. The system works!

Now, in the game, the Al Bhed speakers intentionally don't encrypt proper nouns, and these functions ignore that particular rule, so there is room for improvement. There is also a Japanese language version of Al Bhed, which I didn't cover here, but could be done. I would, of course, appreciate comments on how to improve this.

How to translate English to Al Bhed:
 ToAlBhedLowercaseChar[x_] :=
  Switch[x, "a", "y", "b", "p", "c", "l", "d", "t", "e", "a", "f",
   "v", "g", "k", "h", "r", "i", "e", "j", "z", "k", "g", "l", "m",
   "m", "s", "n", "h", "o", "u", "p", "b", "q", "x", "r", "n", "s",
   "c", "t", "d", "u", "i", "v", "j", "w", "f", "x", "q", "y", "o",
   "z", "w", _, x]
 
 
 ToAlBhedChar[x_] :=
If[UpperCaseQ[x],
  ToUpperCase[ToAlBhedLowercaseChar[ToLowerCase[x]]],
  ToAlBhedLowercaseChar[x]]


ToAlBhedString[x_] := StringJoin[Map[ToAlBhedChar, Characters[x]]]


ToAlBhedString["How razorback, jumping frogs can level six piqued \
gymnasts!"]


"Ruf nywunpylg, zisbehk vnukc lyh majam ceq bexiat koshycdc!"

How to translate Al Bhed to English:
 FromAlBhedLowercaseChar[x_] :=
  Switch[x, "a", "e", "b", "p", "c", "s", "d", "t", "e", "i", "f",
   "w", "g", "k", "h", "n", "i", "u", "j", "v", "k", "g", "l", "c",
   "m", "l", "n", "r", "o", "y", "p", "b", "q", "x", "r", "h", "s",
   "m", "t", "d", "u", "o", "v", "f", "w", "z", "x", "q", "y", "a",
   "z", "j", _, x]
 
 
 FromAlBhedChar[x_] :=
If[UpperCaseQ[x],
  ToUpperCase[FromAlBhedLowercaseChar[ToLowerCase[x]]],
  FromAlBhedLowercaseChar[x]]


FromAlBhedString[x_] := StringJoin[Map[FromAlBhedChar, Characters[x]]]


FromAlBhedString["Ruf nywunpylg, zisbehk vnukc lyh majam ceq bexiat \
koshycdc!"]


"How razorback, jumping frogs can level six piqued gymnasts!"

(edit: add a hyperlink)
POSTED BY: Nick Zitzmann
I would recommend not using Upper first letter case to name functions and variables.

Even if there is small chance of name clash with Mathematica's own commands, it is not good practice to follow. Simply because when a reader looks at code fragment and sees a command or a symbol that starts with UpperCase, the natural thing is to assume these belong to the Wolfram language and are build-in the system or part of its official packages.

With thousands of commands in Wolfram language, and hundreds added each new version, all following the same UpperCase convention, it is best not to add your own with UpperCase as well to reduce confusion to the reader at least if nothing more.
POSTED BY: Nasser M. Abbasi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract