VibeBuilders.ai Logo
VibeBuilders.ai
Teaching an AI to Play Mario: A Learning Journey

Teaching an AI to Play Mario: A Learning Journey

CivilLifeguard189
April 15, 2025
reddit

TLDR:
I've always wanted to learn reinforcement learning, but the notation and concepts often seemed overwhelming (and scary).

So, ~3 months ago, I set myself a challenge: Train an AI to Speedrun Mario

Watch the progression here: https://youtu.be/OQitI066aI0

​

Full Story:

Three months ago, I stared at the dense forest of Reinforcement Learning (RL) papers and felt like Mario facing Bowser for the first time: unequipped and overwhelmingly outmatched. The notation seemed like hieroglyphics, and terms like "policy gradients" felt like they belonged in a sci-fi novel, not a beginner's project.

But RL always seemed so cool, and I was really determined to achieve my goal. So, I started with the Sutton & Barto RL textbook, learning things like the Multi-Armed Bandit problem and MDPs working my way up to Actor-Critic methods.

That book is literal gold & I highly recommend you work through it (even though it can be tough at times). I tried everything from random courses online to books on amazon & this textbook has been by far the most clear and effective way to learn RL.

The biggest issue with the textbook is you learn a lot of theory, but don't learn implementation. So, I would go through a chapter a week & set aside Friday + the weekend to actually implement what I learned (usually by watching youtube tutorials & looking at Github Repos).

Eventually, while searching for practical resources for implementing PPO, I stumbled upon a GitHub repository that literally trained an AI to play Mario. Rather than just cloning and running the code, I took a deeper approach. I aimed to understand the repository thoroughly, ensuring each line of code made sense in the context of what I had studied.

But of course, this wasn't easy. One of the biggest issues was my hardware limitation. I was working on an old Mac. So, I started using Google Collab, but that had its own problems (session timeouts & limited GPU access). Ultimately, I found AWS Sagemaker to be pretty good.

​

After rewriting the code, I felt confident it would work because I understood every aspect of it. So, I trained the AI to play Mario across a variety of different levels (took a long time and a lot of trial and error with the learning rate). It feels amazing seeing your theoretical knowledge translate into tangible results & this project gave me a big confidence boost.

​

Anyways I made a video showing off the results (Note that I simplified the technical parts for it to reach a wider audience): https://youtu.be/OQitI066aI0

​

Feel free to drop any questions or feedback, I'm more than happy to help or chat about my experiences. I hope my journey can inspire some of you who might be feeling overwhelmed with the idea of diving into reinforcement learning or any other area of AI. Remember, the hardest part is often taking the first step. Once you start, the momentum will carry you forward.

Thank you for reading my super long post and sharing in my little success story! đŸš€đŸ•šī¸đŸŽŽ

Vibe Score

LLM Vibe Score

0

Sentiment

Human Vibe Score

1

Rate this Resource

Join the VibeBuilders.ai Newsletter

The newsletter helps digital entrepreneurs how to harness AI to build your own assets for your funnel & ecosystem without bloating your subscription costs.

Start the free 5-day AI Captain's Command Line Bootcamp when you sign up:

By subscribing, you agree to our Privacy Policy and Terms of Service.