Skip to content

OutFerz/indigoRL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

17 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

IndigoRL - Pokรฉmon Yellow Deep Reinforcement Learning ๐Ÿง ๐ŸŽฎ

IndigoRL Banner

Neuro-Symbolic Vision + RAM Reinforcement Learning Agent
Autonomous completion of Pokรฉmon Yellow using long-term memory (LSTM) and direct memory access.

Agent Gameplay Demo


๐Ÿ“š Table of Contents


๐ŸŽฏ Project Overview

IndigoRL is an autonomous Artificial Intelligence agent designed to complete Pokรฉmon Yellow using Deep Reinforcement Learning.

Unlike generic agents that randomly press buttons, IndigoRL implements a Neuro-Symbolic Architecture combining:

  • ๐Ÿ–ผ๏ธ Computer Vision: CNN processing over resized game frames.
  • ๐Ÿง  Symbolic State: Direct RAM memory inspection (event flags, battle state, map data).
  • ๐Ÿ” Long-Term Memory: Recurrent Neural Networks (LSTM via Recurrent PPO).

This allows the agent to reason about story progression, battles, and exploration in an extremely sparse, long-horizon RPG environment.


โœจ Key Features

๐Ÿง  LSTM Brain (Long-Term Memory)

  • Uses RecurrentPPO (PPO + LSTM).
  • Enables maze navigation, backtracking, and objective persistence.
  • Solves the "memoryless" limitation of standard RL agents.

๐Ÿงฉ Neuro-Symbolic Reward System

  • Story Progress
    • Reads event flags directly from game RAM.
    • Rewards badges, key items, and narrative milestones.
  • Battle Awareness
    • Reads enemy HP, player HP, and battle states.
    • Learns combat strategies instead of brute-force button mashing.
  • Exploration
    • Rewards discovering new Map IDs.
    • Penalizes stagnation and looping behavior.

โšก Extreme Efficiency

  • State Loading
    • Skips Oakโ€™s intro using a clean save-state.
    • ~20% reduction in compute per episode.
  • Headless Training
    • SDL disabled during training for maximum FPS.
  • Parallel Training
    • Supports multiple emulator instances.

๐Ÿ› ๏ธ Technology Stack

Component Technology
Language Python 3.10+
RL Algorithm Stable-Baselines3 Contrib (Recurrent PPO)
Emulator PyBoy 2.0+
Vision OpenCV, NumPy, Scikit-Image
Logging TensorBoard

๐Ÿš€ Installation & Setup

Prerequisites

  • Python 3.10+ (Conda recommended)
  • Pokรฉmon Yellow ROM (.gb) โ€” legally owned

Setup

git clone https://github.com/OutFerz/indigoRL.git
cd indigoRL
conda create -n indigoRL python=3.10
conda activate indigoRL
pip install -r requirements.txt

ROM

Place your ROM at:

roms/PokemonYellow.gb

๐Ÿ•น๏ธ Usage

1๏ธโƒฃ Generate Initial Save State (Optional)

python record_state.py

Play the intro manually and close the window once you gain control of the player.


2๏ธโƒฃ Train the Agent

python train_lstm.py

Models and logs are saved to:

experiments/poke_lstm_v1/

3๏ธโƒฃ Watch the Agent Play

python play.py
  • Real-time 60 FPS playback
  • Neural network input overlay
  • Live RAM debugging info

๐Ÿ“ˆ Monitoring & Metrics

Monitor training in real time using TensorBoard:

tensorboard --logdir experiments/poke_lstm_v1/logs

Open your browser at:

http://localhost:6006

๐Ÿง  Agent Architecture

Policy: Multi-Input Recurrent Policy

  • Visual Encoder (CNN)
    • Grayscale, downsampled game frames
  • Symbolic Encoder (MLP)
    • RAM vector:
      • X, Y, Map ID
      • Player HP, Enemy HP
      • Party Levels
      • In-Battle Flag
  • Memory Core
    • LSTM (256 units)
  • Action Head
    • Discrete GameBoy button actions

๐Ÿ“‚ Project Structure

indigoRL/
โ”œโ”€โ”€ assets/                 # README images
โ”œโ”€โ”€ experiments/            # Models and logs
โ”œโ”€โ”€ roms/                   # Game ROMs
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ environment/
โ”‚       โ””โ”€โ”€ pokemon_env.py  # Gym environment & RAM reader
โ”œโ”€โ”€ states/                 # Save states
โ”œโ”€โ”€ train_lstm.py           # Training entry point
โ”œโ”€โ”€ play.py                 # Visualization script
โ”œโ”€โ”€ record_state.py         # Save-state utility
โ””โ”€โ”€ requirements.txt

๐Ÿค Credits

  • PyBoy Emulator
  • Stable-Baselines3 Contrib
  • pret/pokeyellow disassembly project

๐Ÿ“œ Disclaimer

This project is for research and educational purposes only.
You must legally own a physical or digital copy of Pokรฉmon Yellow to use the ROM.
The authors do not encourage or support piracy.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages