•  


GitHub - PWhiddy/PokemonRedExperiments: Playing Pokemon Red with Reinforcement Learning
Skip to content

PWhiddy/PokemonRedExperiments

Repository files navigation

Train RL agents to play Pokemon Red

Stream your training session to a shared global game map using the Broadcast Wrapper

See how in Training Broadcast section

Watch the Video on Youtube!

Join the discord server

Join the Discord server!

Running the Pretrained Model Interactively ??

?? Python 3.10+ is recommended. Other versions may work but have not been tested.
You also need to install ffmpeg and have it available in the command line.

Windows Setup

Refer to this Windows Setup Guide

Linux / MacOS

  1. Copy your legally obtained Pokemon Red ROM into the base directory. You can find this using google, it should be 1MB. Rename it to PokemonRed.gb if it is not already. The sha1 sum should be ea9bcae617fdf159b045185467ae58b2e4a48b9a , which you can verify by running shasum PokemonRed.gb .
  2. Move into the baselines/ directory:
    cd baselines
  3. Install dependencies:
    pip install -r requirements.txt
    It may be necessary in some cases to separately install the SDL libraries.
  4. Run:
    python run_pretrained_interactive.py

Interact with the emulator using the arrow keys and the a and s keys (A and B buttons).
You can pause the AI's input during the game by editing agent_enabled.txt

Note: the Pokemon.gb file MUST be in the main directory and your current directory MUST be the baselines/ directory in order for this to work.

Training the Model ???

10-21-23: Updated Version!

This version still needs some tuning, but it can clear the first gym in a small fraction of the time and compute resources. It can work with as few as 16 cores and ~20G of RAM. This is the place for active development and updates!

  1. Previous steps 1-3
  2. Run:
    python run_baseline_parallel_fast.py

Tracking Training Progress ??

Training Broadcast

Stream your training session to a shared global game map using the Broadcast Wrapper on your environment like this:

env
 =
 StreamWrapper
(
            
env
, 
            
stream_metadata
 =
 { 
# All of this is part is optional

                "user"
: 
"pw"
, 
# choose your own username

                "env_id"
: 
id
, 
# environment identifier

                "color"
: 
"#0033ff"
, 
# choose your color :)

                "extra"
: 
""
, 
# any extra text you put here will be displayed

            }
        )

Hack on the broadcast viewing client or set up your own local stream with this repo:

https://github.com/pwhiddy/pokerl-map-viz/

Local Metrics

The current state of each game is rendered to images in the session directory.
You can track the progress in tensorboard by moving into the session directory and running:
tensorboard --logdir .
You can then navigate to localhost:6006 in your browser to view metrics.
To enable wandb integration, change use_wandb_logging in the training script to True .

Static Visualization ??

Map visualization code can be found in visualization/ directory.

Supporting Libraries

Check out these awesome projects!

About

Playing Pokemon Red with Reinforcement Learning

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
- "漢字路" 한글한자자동변환 서비스는 교육부 고전문헌국역지원사업의 지원으로 구축되었습니다.
- "漢字路" 한글한자자동변환 서비스는 전통문화연구회 "울산대학교한국어처리연구실 옥철영(IT융합전공)교수팀"에서 개발한 한글한자자동변환기를 바탕하여 지속적으로 공동 연구 개발하고 있는 서비스입니다.
- 현재 고유명사(인명, 지명등)을 비롯한 여러 변환오류가 있으며 이를 해결하고자 많은 연구 개발을 진행하고자 하고 있습니다. 이를 인지하시고 다른 곳에서 인용시 한자 변환 결과를 한번 더 검토하시고 사용해 주시기 바랍니다.
- 변환오류 및 건의,문의사항은 juntong@juntong.or.kr로 메일로 보내주시면 감사하겠습니다. .
Copyright ⓒ 2020 By '전통문화연구회(傳統文化硏究會)' All Rights reserved.
 한국   대만   중국   일본