5

To continue a game in Mega-Lo-Mania (AKA Tyrants) on the Sega Megadrive/Genesis, you would enter an eight digit code into the interface and then you could resume a session.

Presumably, the code contains information about the state of the game since neither the Megadrive nor the cartridge had no means to persist data for the game between power cycles. I also suspect that the code includes a sort of parity check to prevent random codes from being used.

What is the breakdown of the Mega-Lo-Mania code data format, and how can a custom save state be generated to target a particular world and set of circumstances?

1
  • 2
    Do you think the code contains state information, or is it just a lookup table? There might only be 40 bits of information, less any CRC, which doesn't sound enough for a full game state. However, if there was a code for the start of each epoch, plus a bit of extra information for the number of men left over, this might be enough to restart a level? – Mark Williams Jul 14 at 12:58
8

The password is made of 11 capital letters (A to Z) and encodes the following values:

  • A value from 0 to 3 that indicates the selected player (red, green, yellow, or blue).

  • A value from 0 to 9 that indicates the starting epoch (1st to 9th epoch or Megalomania).

  • The number of men, from 0 to 999.

  • Four unknown values, each from 0 to 49. (I haven't played the game to confirm where these values are used, but a hypothesis is that some of these values may be related to the number of men you put into suspended animation in the 7th, 8th, and 9th epochs. In the password lists below, the unknown values are zero until the passwords for starting on the 8th epoch.)

The encoding process includes the following kinds of steps:

  • The last character of the password is a checksum generated with addition and exclusive or operations.

  • The bits of data are obfuscated with bit rotation and exclusive or operations.

  • Some of the unused bits that would have normally been zero are instead filled with amounts based on counting the number of "1" bits in segments of the data.

I created a simple Mega-Lo-Mania Password Generator in HTML and JavaScript. Here are some JavaScript snippets adapted from it that show the encoding process:

player = 0;
epoch = 0;
men = 100;
w = 0;  // unknown values
x = 0;
y = 0;
z = 0;

d0 = 40 * men + 4 * epoch + player;
d1 = 50 * w + x;
d2 = 50 * y + z;

k = d0;  // checksum
k ^= 0x2435;
k += d1;
k ^= 0x2435;
k += d2;
k ^= 0x2435;
k &= 0xFFFF;
k %= 26;

d1 = (d0 & 0xFFF) ^ d1;
d2 = ( (d0 >> 3) & 0xFFF ) ^ d2;
d0 = ( ((d0 & 0xF800) >> 11) | ((d0 & 0x07FF) << 5) ) ^ 0x2435;

d1 = ((count_bits(d1) & 3) << 12) | d1;
d2 = ((count_bits(d2) & 3) << 12) | d2;

password = "";
password += base26(d0, 4);  // 4 letters, A to Z, little-endian
password += base26(d1, 3);  // 3 letters
password += base26(d2, 3);  // 3 letters
password += base26(k,  1);  // 1 letter

Here are some example passwords and the data they contain.

From IGN Genesis Cheats - MEGAloMANIA: Jikuu Daisenryaku:

Password Player Epoch Men Unknown
NZUCWTIAEHV Red 2nd 148 0 0 0 0
ARTCKXKNMND Red 3rd 184 0 0 0 0
YLGBUMQZKNL Red 4th 176 0 0 0 0
IHUBUGQULTB Red 5th 172 0 0 0 0
COCAKLDWEBX Red 6th 160 0 0 0 0
EBWROLJUHNJ *
EBWAOLJUHNJ ** Red 7th 159 0 0 0 0
QPIAXODAHHM Red 8th 163 5 1 0 0
ZBLDRNIHGTY Red 9th 143 5 1 0 0
CPFDVMRBYST Red Megalomania 100 10 1 0 1

* sic, invalid password
** corrected

From GameFAQs Tyrants: Fight Through Time (Genesis) - Cheats:

Password Player Epoch Men Unknown
SIZCSVLOPNL Red 1st 200 0 0 0 0
SMLCUQKDKHH Red 2nd 999 0 0 0 0
WQICAUWQIBN Red 3rd 999 0 0 0 0
UVICOPEQIBJ Red 4th 999 0 0 0 0
SAJCSPEFKHV Red 5th 999 0 0 0 0
QFJCKRKFKHR Red 6th 999 0 0 0 0
OKJCAQEGKHX Red 7th 999 0 0 0 0
MPJCDWEGKHK Red 8th 999 5 1 0 0
KUJCTYQVLNW Red 9th 999 5 1 0 0
IZJCJKXGKHD Red Megalomania 999 10 1 0 1
3
  • 1
    Amazing work. I deleted my answer, as it couldn't have been more wrong! When the question specified 8 digits, I didn't believe that was enough bits to allow for meaningful game state plus a checksum to avoid random guesses, so I just assumed they were hard coded (like Desert Strike etc). – Mark Williams Jul 18 at 12:29
  • Very well done, I am amazed at your effort! – Nicholas Hill Jul 18 at 17:50
  • Having played around a little, I strongly suspect that the remaining four values are relevant to how many men have been "put aside" for the final battle in the previous couple of epochs. 49 = max 999. An interesting situation results when all are set to zero: you play the game with no men, and none of the AI players have any men, and the game cannot be won or lost. – Nicholas Hill Jul 18 at 18:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.