News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Treasure of the Rudras question for Gideon Zhi (or anyone)  (Read 1158 times)

AWJ

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Treasure of the Rudras question for Gideon Zhi (or anyone)
« on: August 29, 2015, 06:20:30 pm »
I imagine you had to do some substantial reverse engineering to localize the Mantra system, so I wonder if you came upon the following in the game's internals:

An interpreted bytecode where the lower 5 bits of a byte indicate a statement (assign, jump, call subroutine, conditional expression, etc.) or an arithmetic operator (add, subtract, multiply, divide, bitwise and/or/xor, bitshift) and the upper 3 bits indicate the type of the following operand (direct address, indirect address, literal, random range) Assignment ("let") and conditional ("if") statements can consist of arbitrarily-long sequences of operators and operands, with an 0x1f byte indicating "end of statement".

I've discovered near-identical bytecode languages in three Square games now spanning two platforms: Final Fantasy Legend 2, Final Fantasy Legend 3 and Romancing SaGa. So I'm starting to wonder how many more of their games also use it. Rudra seems a likely candidate because AFAIK it was developed by a collaboration of the former-Xtalsoft team that developed FFL3 and the SaGa team.

Gideon Zhi

  • IRC Staff
  • Hero Member
  • *****
  • Posts: 3502
    • View Profile
    • Aeon Genesis
Re: Treasure of the Rudras question for Gideon Zhi (or anyone)
« Reply #1 on: August 30, 2015, 12:16:36 am »
It's been a really long time since I did anything with Rudra's internals, but I do remember that the dialog was stored much, much more sanely than Romancing SaGa 2's. It's the usual sort of back-to-back strings you tend to see in these sorts of games, and unlike SaGa there's no bytecode embedded in them. That said, the string lookups weren't based on array indexes but hardcoded addresses in the game's actual bytecode. I never had to delve too far into that though; every string lookup was prefixed with the same byte, so all I had to look for in the bytecode was the almost-always-unique four-byte string of lookup command + 24-bit string address.

The mantras were a totally different story. That's all based on the longest match against a binary search on a table of approximately 2,000 entries.

AWJ

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Re: Treasure of the Rudras question for Gideon Zhi (or anyone)
« Reply #2 on: August 30, 2015, 01:05:21 am »
It's been a really long time since I did anything with Rudra's internals, but I do remember that the dialog was stored much, much more sanely than Romancing SaGa 2's. It's the usual sort of back-to-back strings you tend to see in these sorts of games, and unlike SaGa there's no bytecode embedded in them. That said, the string lookups weren't based on array indexes but hardcoded addresses in the game's actual bytecode. I never had to delve too far into that though; every string lookup was prefixed with the same byte, so all I had to look for in the bytecode was the almost-always-unique four-byte string of lookup command + 24-bit string address.

The mantras were a totally different story. That's all based on the longest match against a binary search on a table of approximately 2,000 entries.

The bytecode I'm talking about has nothing to do with dialogs or event scripting; it's mainly used for the battle systems. All the weapon/spell/monster-attack-specific damage algorithms, etc., are bytecode programs. It's not a domain-specific scripting language (there aren't any instructions for "move sprite", "check if character x is in party", etc.) it's more like one of those stripped-down BASIC dialects used by graphing calculators. I figure they used it because it was more compact (and probably also easier to write and check for errors) than writing all those battle algorithms in straight assembly language would have been.

It sounds like if Rudra does use a similar bytecode it doesn't use it in any of the parts that you had to muck with to translate the game. Guess I'll have to look for it myself then. Thanks anyway.