{"id":19820276,"url":"https://github.com/strcoder4007/mario-reinforcement-learning","last_synced_at":"2026-04-17T05:02:08.604Z","repository":{"id":247049937,"uuid":"824894922","full_name":"strcoder4007/Mario-Reinforcement-Learning","owner":"strcoder4007","description":"Training a Mario reinforcement learning agent using Open AI Gym and Stable Baselines 3 PPO algorithm.","archived":false,"fork":false,"pushed_at":"2024-07-12T18:59:43.000Z","size":2264,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-28T20:22:55.115Z","etag":null,"topics":["mario","openai-gym","ppo-agent","pytorch","reinforcement-learning","stable-baselines3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/strcoder4007.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-06T08:43:18.000Z","updated_at":"2024-07-12T18:59:46.000Z","dependencies_parsed_at":"2024-07-12T21:04:53.046Z","dependency_job_id":"75d8438e-4f9a-4e58-a1fe-0d537af6cf1f","html_url":"https://github.com/strcoder4007/Mario-Reinforcement-Learning","commit_stats":null,"previous_names":["strcoder4007/mario-reinforcement-learning"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/strcoder4007/Mario-Reinforcement-Learning","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strcoder4007%2FMario-Reinforcement-Learning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strcoder4007%2FMario-Reinforcement-Learning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strcoder4007%2FMario-Reinforcement-Learning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strcoder4007%2FMario-Reinforcement-Learning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/strcoder4007","download_url":"https://codeload.github.com/strcoder4007/Mario-Reinforcement-Learning/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strcoder4007%2FMario-Reinforcement-Learning/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31915900,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"online","status_checked_at":"2026-04-17T02:00:06.879Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mario","openai-gym","ppo-agent","pytorch","reinforcement-learning","stable-baselines3"],"created_at":"2024-11-12T10:22:35.124Z","updated_at":"2026-04-17T05:02:08.584Z","avatar_url":"https://github.com/strcoder4007.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mario Reinforcement Learning\n\nThis project aims to train an artificial intelligence (AI) agent to achieve proficiency in playing Super Mario Bros. through the application of reinforcement learning techniques. Specifically, it utilizes the Proximal Policy Optimization (PPO) algorithm from Stable Baselines 3. \n\n![Playing GIF 1](/images/mario_ppo.gif)\n\nThe AI agent learns to navigate the iconic game environment, surmount obstacles, and strategically collect rewards such as coins and power-ups. This project not only demonstrates the capabilities of modern reinforcement learning algorithms but also explores their application in mastering complex, real-time video game scenarios.\n\n## Training\n\nIt total it took around 10 hours of training on a local Nvidia RTX 4070 Ti Super (16GB) for 2.5 million timesteps. \n\n![Training Photo 1](/images/mario_ppo_training_1.png)\n![Training Photo 2](/images/mario_ppo_training_2.png)\n\n\n## Installation\n\nTo install the required dependencies, you can use `pip` with the provided `requirements.txt` file.\n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/strcoder4007/Mario-Reinforcement-Learning.git\n   cd Mario-Reinforcement-Learning\n   ```\n\n2. Install the required dependencies:\n\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n   This command will install all necessary packages including `gym`, `gym-retro`, and `stable-baselines3`.\n\n3. Import the ROM: The ROM for Super Mario Bros. can be found in the repo itself, use the following command to import it into gym-retro:\n\n   ```bash\n   python -m retro.import\n   ```\n\n## Pre-trained Model\n\nCheckpoint for a trained Mario: https://drive.google.com/file/d/1RRwhSMUrpBBRyAsfHLPGt1rlYFoiuus2/view?usp=sharing\n\n\n## Usage\n\n1. After installing the dependencies, you can train the agent by running:\n\n   ```bash\n   python train.py\n   ```\n\n   This command will start the training process using the PPO algorithm.\n   After/during training the best model will be saved in `/tmp/` directory.\n\n2. Monitor training progress and visualize results using Tensorboard visualizations. Logs are stored in the `board` folder. Use it by running:\n\n    ```bash\n    tensorboard --logdir \"board\"\n    ```\n\n3. You can watch the agent playing the game using the `best_model.zip` in `/tmp/` directory by running:\n\n    ```bash\n    python run.py\n    ```\n\n## Credits\n\n- [Stable Baselines 3](https://github.com/DLR-RM/stable-baselines3): For providing efficient implementations of reinforcement learning algorithms.\n- [OpenAI Gym](https://github.com/openai/gym) and [gym-retro](https://github.com/openai/retro): For providing the environments to train and test the AI agent.\n- Nintendo: For creating the classic game Super Mario Bros.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrcoder4007%2Fmario-reinforcement-learning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstrcoder4007%2Fmario-reinforcement-learning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrcoder4007%2Fmario-reinforcement-learning/lists"}