Videos

Super Mario Bros AI: Arduino and Python



Lawrence Maceren

This is my high school Semester 1 project at the Science and Engineering Learning Center.

My partner and I worked together to create a program that automatically plays through the first level of Super Mario Bros on an actual NES.

We wrote a Python script that tracks the locations of different objects on the game screen using OpenCV and an EasyCap capture card. It then controls our Arduino, which is connected to an NES controller to simulate pressing and releasing buttons. As a result, we can control the game and play through the level without physically pressing any buttons.

This project took 5 months to create and get to the state its currently in.

Source

Similar Posts

14 thoughts on “Super Mario Bros AI: Arduino and Python
  1. Hey, I'm doing something very similar for a project at university, could I see the source code or maybe we could Skype? I have some questions about your awesome program, thanks! 🙂

  2. Does your script learn about the dynamics of the game as it progresses, gradually becoming better at beating it? Or does the OpenCV library only allow you to directly influence it's video tracking capabilities? I'm curious as to how the RGB parsing data is being organized; does it account for CRT scan-line fluctuations in 240p/480i? This could be really interesting to the TAS community as this seems to be able to interpret the kinetic flow of the player's POV/experience.

    From what I barely understand this is in contrast to Lua scripting which mainly is utilized for high-bandwidth throughput via the controllers input leads. Also, are you aware of the open source project by "jaburns" called NintendoSpy? I believe his sketch allows the Arduino to monitor inputs by cycling shift registers on only the "latch" and "data" leads. Yet, I do think it's a tad bit slower if you don't account for the sync data provided by the "clock" wire, which also provides a more accurate bit-count. You can find his source on github. – https://github.com/jaburns/NintendoSpy

    Nonetheless, awesome project! I'm really interested on how your work can be expanded upon, maybe even making a framework that can be formatted with a "sprite-watchdog" widget; so an end-user can make the script work on many different types of 8~16bit 2D games. So cool that you're using raw NTSC capture as your source feed!!!

  3. wow, the audio of this video is so good, i instantly muted my volume because i thought my headphones were malfucntioning

Comments are closed.

WP2Social Auto Publish Powered By : XYZScripts.com