Imagine watching Mario play himself โ learning from experience, tracking performance, and celebrating every mushroom and level cleared like it’s a milestone. Welcome to my latest project: an AI-powered real-time dashboard that turns classic Super Mario Bros. into a living lab of machine learning, memory, and game analytics.
๐ View the full project on GitHub
๐ฎ What Is It?
This project uses Python, RAM state parsing, AI logic, and a fully interactive Flask + Socket.IO dashboard to control and visualize an AI agent playing Mario.
It started as a small AI experiment. Now itโs a full command center:
- ๐ Live Reward Graphs
- ๐ง AI Thought Feed
- ๐ Achievement Toasts
- ๐ Level Completion Tracking
- ๐ฆ Exportable Gameplay Sessions
๐ง What Powers It?
- Python โ AI loop, control logic, reward engine
- RetroArch โ NES emulator backend
- Flask + Socket.IO โ Live dashboard
- Plotly.js โ In-browser visual stats
- JSON Logs โ All gameplay and AI memory
- Local AI โ (DeepSeek via Ollama or Transformers if desired)
๐บ Key Features
โ AI State + Reward Dashboard
See Marioโs:
- Live screen
- Current decision
- Score over time
- Frame-by-frame commentary
๐ ๏ธ Full AI Control from Your Browser
Pause the AI. Reset the game. Log an episode. Save or load savestates โ all without touching your terminal.
๐ Toast-Powered Achievements
Real-time popups for:
- ๐ Mushroom collected
- ๐ฅ Fire flower
- ๐ Level completion
- โ ๏ธ Death & ๐ Retry
- ๐ New high score
- ๐ Longest survival streak
๐ Stats & Graphs
Auto-generated graphs show:
- Level attempts vs completions
- Reward trends
- Survival history (coming soon)
๐ค Session Export
Download a full ZIP with:
- Screenshots
- Reward logs
- Chat log
- AI stats
- Achievements
๐ GitHub Structure
game_memory/
logs/
frame_###.png # Screenshots
chat_log.txt # Live thought log
achievements.json # Unlocked trophies
ai_stats.json # Score & survival records
level_stats.json # Attempts & completions
utils/
reward_dashboard_live.py # Full Flask dashboard
main.py # Core AI gameplay loop
๐ง How the AI Thinks
No vector store is required โ but you could add one.
Currently, the AI:
- Reads RAM from RetroArch saves
- Describes state in natural language
- Logs rewards and performance
- Optionally uses prompts or LLMs to generate input
You can enhance this with RAG, fine-tuning, or real-time retrieval.
๐ Try It Out
- Clone the repo: bashCopyEdit
git clone https://github.com/CptNope/game_ai_rag_reproach_livechat cd game_ai_rag_reproach_livechat
- Install dependencies: bashCopyEdit
pip install flask flask-socketio plotly pillow
- Launch the dashboard: bashCopyEdit
python utils/reward_dashboard_live.py
- Run the AI player: bashCopyEdit
python main.py
Visit http://localhost:5000 and watch your AI go!
๐ Whatโs Next?
- Add real-time training visualization
- Support multiple savestate slots
- Serve frame stream as MJPEG video
- Connect to a vector store (Reproach, ChromaDB, FAISS)
- Enable fine-tuning via JSONL logs and LoRA
๐พ Why I Built It
I love merging AI with retro games. Thereโs something special about watching an old classic teach a modern model. This project blends:
- Game design
- Machine learning
- Interface dev
- Real-time systems
โฆand itโs just the beginning.
๐ Check it out on GitHub
๐ข Feel free to fork, remix, or hit me up with your mods!
Leave a Reply