Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Mega Man 2 (NES) password algorithm and code (github.com/kpshek)
197 points by kpshek on Jan 4, 2013 | hide | past | favorite | 50 comments


There is an amazing port of Mega Man 2 for iOS. It autosaves however, so there is no way to enter the code. I play it all the time. My record for beating it is under 20 minutes on normal. Greatest NES game of all time, and also the greatest 8-bit music. I still get the airman theme stuck in my head sometimes.


If you like the music from the game, check out the remixes at ocremix. The Mega Man remixes tend to be really good.


I'd like to bump my friend's band:

http://www.youtube.com/watch?v=FOt6EGgBnQs

Bit Brigade - they speedrun NES games while playing the music live, metal style.


That's quite an innovative concept, and execution is really good!


> My record for beating it is under 20 minutes on normal.

Does the iOS port leave out some of the levels or bosses? The world record for the original NES game stands at 27:49.


No all levels and bosses are intact...It may be easier though. On 'hard' it takes me about an hour! maybe it was lightened up for the iOS port.


The MM2 game in the app store has a classic mode, which is the original game w/o modification, and an easier mode which modifies number of enemies, enemy strength, and other things.


I'm sure that the lasers in Quick Man's level were made easier too... That would be nearly impossible with a touch-dpad


It would have to be if it's being played with that crappy on-screen d-pad.


I've always been more of a Bubbleman theme guy myself.


I heard each of these themes in my head as I read them here.


After reading this thread I can't get them out. Thanks.


Megaman 2 Robot Master's Level Themes

http://www.youtube.com/watch?v=KRbsJ0Kx8Ws


Airman theme has been my ringtone for the last year. :)


My ringtone has been Dr. Willy's first stage for quite some years :)

It's great that there are so many creative covers out there. Metal versions, piano, etc


Another Dr. Willy ringtone here.


Nice! Flash man here :)


Many NES games have had their password systems cracked:

Mega Man 3: http://www.mmhp.net/Passwords/MM3/

Metroid: http://www.gdward.plus.com/site/flash/metroid/

Kid Icarus: http://www.geocities.ws/passgens/pages/Kid_Icarus.htm

Castlevania III: http://castlevaniadungeon.net/forums/index.php?topic=4659.0

Google for pretty much any popular NES game + "password generator" and you'll find something.



Metroid! I haven't thought about that game for years! I loved it. I played through a ton of it.. but what was that pw? Justin Bailey? TIL(this only reddit?) "Justin Bailey is a term used to refer to the bikini swimsuit that Samus Aran wore during the endings of Metroid, Metroid II: Return of Samus, Super Metroid and Metroid Fusion." I can't even remember how I learned of that code..


The password is JUSTIN BAILEY ------ ------ . Metroid has been disassembled to prove that there's nothing special about those words in the code. The password is a coincidence, that the bit pattern happens to pass the checksum and produces a Samus who possesses most of the powerups in the game.

There's no meaning to it. It's not anybody's name, and anything about the swimsuit is fan retcon. You probably learned about it from either Nintendo Power or one of the many unofficial NES game guidebooks. They invented all sorts of urban legends around it, but modern eyes on the cold code can prove it's just a fluke.

It actually gives an impossible game state: Samus has 255 missiles current but 205 max, and some of the combinations are inconsistent like a set of missiles acquired behind a door that remains locked.


Awesome. It is interesting thinking about these childhood days. Yea I did have a subscription to Nintendo Power. I actually got in it on the time trial of a mario cart level(i think the first). It is crazy that I actually remembered the code. That is how the brain works I guess.. I do remember one time I guessed a code: Turbo graphics 16, Military Madness: Neptune I completely guessed it as a child and it was like.. uhh. amazing!


While the "JUSTIN BAILEY" code is meaningless, Metroid does have an actual pre-programmed "cheat" password in it: NARPAS SWORD0 000000 000000 . It was intentionally placed into the game (src: http://metroid.wikia.com/wiki/Narpas_Sword ), and it gives you infinite energy and other powers you can't get conventionally or with any other (generated) password.


>They invented all sorts of urban legends around it, but modern eyes on the cold code can prove it's just a fluke.

Yes.

The legend as passed to me on my first hearing of this code in 1988 or so was that Justin Bailey had been a game tester/developer.



He licensed his code, which is kinda strange since he took the algorithm from another program which he didn't owns. I wonder the real legal status of his code and license


Unless there was a Mega Man code patent (clearly expired if there was) then it would seem just fine. Nothing wrong/illegal with re-implementing an algorithm in another language.


Algorithms are patented, not copyrighted.


strictly speaking, in theory, algorithms aren't patentable, only specific implementations of algorithms. In practice, it would seem, lawyers figured out a way to do it with some clever wording. "Method and Apparatus"- You see because the method on its own is not enough to patent you have to include the computer that the algorithm runs on in the patent, in order to patent it.


When I got a Super Famicom from Super Potato in Akihabara, I got a copy of Rockman 7 (known as Mega Man 7 in the English localization) too, and that was my first time playing a game that old. It was so weird seeing the password system, rather than saving in-game. They used a 4x4 (or 5x5?) grid of faces of characters from the game. I wonder why they didn't just use a text password - perhaps because it removed the need for localization.

Another game I got, The Legend of Zelda: The Triforce of the Gods (known as A Link to the Past in the West), had a great in-game save system. It seems like there should have been enough storage for that with Rockman 7 too.

Edit: my bad, 7, not X7.


Cost savings, most likely. Supporting saving in the SNES era required a physical battery in the cartridge. Passwords were rarer in the SNES days than in the NES days, but there were still several developers who figured they'd save a few bucks by omitting the battery-backed memory.


I'm guessing you're thinking 7, sans the X as X7 was a PS2 game. Off the top of my head, I'd guess it would be a matter of cost and possibly convention.

You wouldn't spend the money on the requisite cartridge save hardware unless you had to.

At the time those 128KB PS1 memory cards were a revelation and quite expensive. Games in the cartridge era generally used battery-backed saves.


Kudos for recreating the algorithm ... Too bad there is no details if it is by inspecting the assembly code or by external observation ...

Now ... if someone could do the same with the name of the worlds in the original Populous ...


The algorithm was published in Nintendo Power. Even 14-year-olds could figure it out.

Once you knew MM2 had such an easy system, you could figure out MM3's password system by itself on your very first playthrough just as long as you wrote things down.


I figured out Mega Man 3's without even trying. The patterns were just really obvious. I remember I thought it was kind of cool that the passwords actually "meant" something.


Thanks for the info, slightly less amazing then :)


While MM2's password system seems pretty straightforward, I've always been fascinated with how other games managed to track state with a 10-24 letter password. Metroid, for example...IIRC, didn't the game also keep track of your current health, besides the progress you made in the game? I guess that state could be encapsulated in just a few of those letters. And the state of progress would be pretty easy to do (A = Kraid beaten, B = Ridley beaten, and so forth) as each individual "scene" resetted its state as soon as you left it.


You only received a password when you died in Metroid; the password would track how many energy tanks you'd collected, but not your current energy level (because at the time you receive the password, that energy level is zero).


What about missiles?


It not only tracked your missile count, it tracked which missile tanks you picked up, as well as which doors you had blown open. There's a lot in there.


You only need a single bit to keep track of whether or not a door was blown open. I'd imagine the missiles worked the same way, and they just computed the total as the number of missile bits set times 5.


This is quite interesting... I wonder if anyone 'cracked' it when it was new... :)


>I wonder if anyone 'cracked' it when it was new... :)

Certainly.

For years I maintained a ragged spiral notebook of video game info which contained among other things some extensive, entirely handwritten reverse engineering of the password systems for MegaMan 2 and Metal Gear.


You can see on this live implementation that it's not a great system in practice:

http://www.mmhp.net/Passwords/MM2/

Check boxes and see how the pattern changes, which is like how we wrote down the codes when we were kids after we beat a boss. It's easy to see that generally only the position of one red dot changes after each level. So it makes it very easy to brute force more options.

Not hacking the system properly, but enough so that you could get past levels you were stuck on.


Mega Man 2 will always be new in my heart. =)


It was published in Nintendo Power for the entire world to see.

When Mega Man 3 came out, I decided I was going to the "the first" to figure out how its password system worked. But it was incredibly easy. It was already published in the magazine before I could write my letter.


I love this stuff. Fun project.

Some day I need to get around to releasing the X-wing save game editor I wrote... in JavaScript. (So it can run directly on GitHub.)


Has anyone else noticed that the music playing during the MM2 password screen is remarkably similar to the end of Nine Inch Nails' "Closer"?


Anybody think implementing the Mega Man in browser would be a cool side project?


This site[1] has a couple games emulated in javascript. Just select Mega Man from the list and start playing.

[1] http://fir.sh/projects/jsnes/




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: