3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.


NESBot: Arduino Powered Robot beating Super Mario Bros for the NES

NESBot: Arduino Powered Robot beating Super Mario Bros for the NES
This guide will take you through the steps to build an NES playing robot. 


You will need:

An Arduino Duemilanove (other boards will probably work, but you will have to adjust the steps for your device)
Working NES Console
Super Mario Bros. (Note: this must be only the single game, not the two- or three-in-one cartridge)
A controller you can cut the cord from
Two LEDs (two different colors are recommended but not required)
2x ~390 ohm resistors
3x 1.6k ohm resistors
3x 3.3k ohm resistors
4021 (16 pin Shift Register. Note: the 74xx series will not work)
SD Card slot (more on this later)
A pushbutton (not required, but recommended)
A switch (not required, but recommended)
A soldering iron (you'll probably need one)
Multimeter
Hookup wire

Software needed:
Arduino Interface, available from http://arduino.cc/ 
Processing, available from http://processing.org/
FCEUX, available from http://fceux.com/ (you probably want the windows binary unless you know what you're doing)
 
Remove these adsRemove these ads by Signing Up
 

Step 1Background information

This project is based off the efforts of the people at TASVideos . For a full description of what they do, take a look at their Welcome Page .

Every approved submission (called "movies", even though they contain no audio or video data) on their website is simply a series of recorded button presses that in theory can be played back on the actual console for which they are intended. In most cases however the emulator differs too greatly from the actual consoles to make this possible, but in the case of the NES the difference is significantly smaller.

The game choice also makes a big difference as to whether the button presses can be played back or not. If the game relies on any uninitialized memory for randomness, or if it is heavily based on console timing, it may not work. In the case of Super Mario Bros however, as long as the button presses start play back at the right time, the movie will play back correctly.

These button presses are based on frames on the console. Almost every time the console redraws the screen (~60 times a second), the controller is polled for input. However, there are times when the screen is redrawn, but the controller is not polled. These are called lag frames. Due to the difference in the way the emulator handles these lag frames, any movie must be modified to run correctly on the console. This is handled later on. 

To turn "in theory" into reality, we will start by modifying the controller. 
« Previous StepDownload PDFView All StepsNext Step »
46 comments
1-40 of 46next »
Dec 20, 2011. 5:40 PMGASSYPOOTS says:
can you fix it to use the duckhunt/mario one? or possibly a DSI game
Oct 27, 2011. 7:03 AMKingpin3k says:
Why does the 7421 not work and is it possible to drop the ShiftRegister if you are using the shiftout function of the arduino?
Feb 13, 2011. 9:37 AMelijahlucian says:
now try that without cheats.
Feb 20, 2011. 8:00 PMskitchmusic says:
There were no cheats used in this run. It's a Tool-Assisted Run, but there are no external cheats modifying the game's actual code to make it run this way.
Apr 20, 2011. 12:16 AMvader406 says:
Well this whole thing is still an external cheat lol.
Feb 13, 2011. 2:01 PMFlyinseamnky says:
right!
Mar 17, 2011. 6:34 AMSgt. Cookie says:
The world is going to hell in a handbasket and you created SkyNet. Thank you.



On a serious note:

Cool, all you need now is one that can play brawl and you will be champion of the world, at brawl.
Feb 22, 2011. 2:38 AMThisIsFake1 says:
So you are still saying this is not fake? And that it's your code playing it? So in 4-2, your robot just happens to use a glitch? You just happen to be jumping in the exact interval to use a glitch??
Feb 28, 2011. 2:14 PMkellykel says:
It is just playing back button presses, no robot is figuring out what to do.
Feb 27, 2011. 10:59 AMkellykel says:
There are so many noobs here. This is real. Those are just glitches that are hard to do unless you are TASing. Talk about something you know about.
Feb 15, 2011. 1:10 AMsaintneko says:
Sorry, this is faked.

At 4:50, notice how the Piranha Plant disappears when Mario jumps up onto the tube. It doesn't retract, it just disappears as he lands on it.
Feb 20, 2011. 8:02 PMskitchmusic says:
No, it's not faked. Anything that appears to be an oddity are side effects of glitches within the game itself.
Feb 13, 2011. 3:58 PMlioneyexp says:
Next Instructible from him should be "How to heavily mod Super Mario Bros. so that you can phase through walls, disregard Piranha Plants, and ignore virtually any other threat in the game."
Feb 20, 2011. 8:01 PMskitchmusic says:
The game was not modded, and none of the techniques demonstrated involved modding the game.

These are all exploits that existed in the original game, but are generally difficult/impossible to generate under normal circumstances.
Feb 10, 2011. 2:54 PMgossumx says:
Why don't the Piranha flowers hurt him?
Feb 10, 2011. 3:21 PMpatrick p f says:
its a cool skill to have in super mario. because of how mario jumps, if you time it right, you can just make it over a piranha. i can do it without even thinking
Feb 13, 2011. 2:04 PMFlyinseamnky says:
no man he touched them. he did not make it over them.
Feb 20, 2011. 7:59 PMskitchmusic says:
Yes, but the way collision detection works in Super Mario Bros, that specific type of collision does not result in death.

It's a known glitch in the game.
Feb 19, 2011. 9:13 AMpopscott3 says:
WWWOOOOHHHH!!!!
Feb 13, 2011. 1:16 PMlioneyexp says:
Mario can wall jump?? 3:55

did you just jump off of lava? O_o 4:49
touched the flame rope? 5:11. 5:14
touched the squid? 5:12, 5:15
Feb 17, 2011. 2:30 PMthealeks says:
there was a platform in the lava.

the flame rope and squid, i have no explanations for.
Feb 13, 2011. 2:03 PMFlyinseamnky says:
Yeah I noticed that none of the plants hurt him, that he was running across gaps, and could run through walls that as far as I know of you could not do before. Like the first warp zone. Usually you have to use the moving platforms to get on top of the bricks and run across.
Feb 14, 2011. 5:03 AMmdmetzger says:
For the jumping off lava, there's a platform down there that's difficult to see in the real game. Almost everyone spent way too long trying to figure that out unless you spot it early on.

As for apparent collisions with squid / ropes / piranha plants / etc, the collision detection algorithms aren't perfect in this game (remember, this was made in 1985...) so if you time it right you can seemingly pass by the edges of something.

Running across gaps works fine as long as there's only a single block gap on a panel (ie, several in world 8, etc.)

And you can definitely slide through bricks - the trick in 1-2 is actually a method to get to the so-called minus world (-1) that is a never ending water world.

It looks weird, and part of the oddity with this is the 'perfect" computer controlled player, but every one of these tricks can be done by a human with the right timing. I've done all of these at one time or another save for the jumping out of the large gap - now I'm really tempted to try it...
Feb 17, 2011. 2:31 PMthealeks says:
i know the minus world trick, but how come it didnt send the computer there? this whole thing is fishy
Feb 17, 2011. 9:35 PMmdmetzger says:
Because if you go far enough to the right, it treats it as a normal warp zone rather than the minus world / level 5 warp zone.
Feb 15, 2011. 2:36 PManthnysantos says:
Nice project, but the instructable needs some work. Mostly, you fail to list several components and never really mention them. For example, wouldn't I need an SD card? Also, you never list the part you used to connect the Micro SD adapter to the breadboard. Normally, this is not a huge deal, but is definitely aggravating to someone who has not used an Adruino controller before or has little experience in wiring SD cards. There definitely needs to be some clarity around the use of the SD card.

Other than those details, it seems to read pretty well for a novice audience.
Feb 11, 2011. 3:22 AMAntzyP says:
was pretty sure he'd be dead meat at 3:53...
Feb 15, 2011. 10:01 AMfadeddeath says:
He would also have died in the under water scene at 5:05 5:10 5:11 5:12 5:14 and 5:16 but that's not the biggest tell that it is fake. Since when does an NES system start up that quickly. . .
Feb 15, 2011. 10:43 AMPaulMakesThings says:
Also Mario doesn't move forward, at least not nearly that far, while facing backwards.
Feb 15, 2011. 12:20 PMAntzyP says:
nah, its not fake. Check out the site he mentions. It's really a sequence of key-presses created after using a very complex emulator which allows us to rewind time and remove our mistakes(kinda like braid, i guess)...
Feb 14, 2011. 12:18 AMfaxwork says:
There are a lot of glitches and tricks you can do in SMB. This is real. It is apparent that the robot in this instructable is better at this game than we can possibly ever be, with such perfect timing and execution of said glitches.
Feb 14, 2011. 8:09 PMNarlo11 says:
I agree.
Feb 13, 2011. 4:41 PMironorr84 says:
For all you "too young to know the original Mario game", Mario can't "wall jump" like he does @ 3:54. I call BS on this. It's either fake or the game was altered, which doesn't merit a WIN in my books. I say FAIL...
Feb 14, 2011. 8:07 PMNarlo11 says:
He can so. I havent done it but playing with my friend he did a single wall jump. I am 34 BTW.
Feb 14, 2011. 12:58 PMfungus amungus says:
Mar 13, 2011. 8:00 AMpaplo says:
OMG thanks for that link, it was a hole new dimension of SMB, I've no idea you can do that on the game. Before I've read the post I thought the game was cheated, but I think it is real, but I can't stop thinking on the SMB personalized games I've see on youtb. Awesome
Feb 14, 2011. 9:00 AMfctw says:
This is AWESOME(as TAS videos tend to be)!

It probably shouldn't(but does) amaze me at all the folks that don't know about these glitches. As mdmetzger poignantly illuminated, this game was made while game development and even software development was in it's infancy. I've performed most of these bugs at one time or another. The frequency and skill with which they are performed in this video has nothing to do with anyone's physical ability. The title and description should have made that clear. This video wasn't made to show off that the glitches could be performed. This video was made to show that you can do TAS runs on actual hardward, not just through emulation(which is clearly, vastly easier.)

pjgat09, awesome, awesome job! I look forward to being able to afford these components so I can try to learn more about how this is done. I'm so WAY jealous of the things that you know! :-)
Feb 14, 2011. 8:56 AMrhololkeolke says:
When I saw the title I thought that it was making decisions to play the game not just playing back a macro. Its still cool that you're emulating a controller with an arduino. However, as mentioned in earlier comments i have some problems with your video. Mario can't wall jump. People were also commenting on the Piranha plants but it is possible to jump next to them but not die (Although its really hard to do).
Feb 13, 2011. 10:06 PMmastamuzz says:
guys there are a lot of bugs and stuff you can do in SMB and the first warp can be accessed like that the difference here is that Mario is small, I saw it with a tall Mario ducking and releasing at the right time it's all it needs, look for other videos in youtube!

not because you can't it means it's impossible!
1-40 of 46next »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
5
Followers
1
Author:pjgat09