Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

PyGame Learning Environment (PLE) -- Reinforcement Learning Environment in Python.

License

NotificationsYou must be signed in to change notification settings

ntasfi/PyGame-Learning-Environment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Games

PyGame Learning Environment (PLE) is a learning environment, mimicking theArcade Learning Environment interface, allowing a quick start to Reinforcement Learning in Python. The goal of PLE is allow practitioners to focus design of models and experiments instead of environment design.

PLE hopes to eventually build an expansive library of games.

Accepting PRs for games.

Documentation

Docs for the project can befound here. They are currently WIP.

Games

Available games can be found in thedocs.

Getting started

APLE instance requires a game exposing a set of control methods. To see the required methods look atple/games/base.py.

Here's an example of importing Pong from the games library within PLE:

fromple.games.pongimportPonggame=Pong()

Next we configure and initialize PLE:

frompleimportPLEp=PLE(game,fps=30,display_screen=True,force_fps=False)p.init()

The options above instruct PLE to display the game screen, withdisplay_screen, while allowing PyGame to select the appropriate delay timing between frames to ensure 30fps withforce_fps.

You are free to use any agent with the PLE. Below we create a fictional agent and grab the valid actions:

myAgent=MyAgent(p.getActionSet())

We can now have our agent, with the help of PLE, interact with the game over a certain number of frames:

nb_frames=1000reward=0.0forfinrange(nb_frames):ifp.game_over():#check if the game is overp.reset_game()obs=p.getScreenRGB()action=myAgent.pickAction(reward,obs)reward=p.act(action)

Just like that we have our agent interacting with our game environment.

Installation

PLE requires the following dependencies:

  • numpy
  • pygame
  • pillow

Clone the repo and install with pip.

git clone https://github.com/ntasfi/PyGame-Learning-Environment.gitcd PyGame-Learning-Environment/pip install -e.

Headless Usage

Set the following in your code before usage:

os.putenv('SDL_VIDEODRIVER','fbcon')os.environ["SDL_VIDEODRIVER"]="dummy"

Thanks to@wooridle.

Updating

cd into thePyGame-Learning-Environment directory and run the following:

git pull

Todos

  • Documentation is currently in progress.
  • Tests
  • Parallel Learning (One agent, many game copies)
  • Add games
  • Generalize the library (eg. add Pyglet support)

Citing PLE

If PLE has helped your research please cite it in your publications. Example BibTeX entry:

@misc{tasfi2016PLE,  author = {Tasfi, Norman},  title = {PyGame Learning Environment},  year = {2016},  publisher = {GitHub},  journal = {GitHub repository},  howpublished = {\url{https://github.com/ntasfi/PyGame-Learning-Environment}}}

About

PyGame Learning Environment (PLE) -- Reinforcement Learning Environment in Python.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors17


[8]ページ先頭

©2009-2025 Movatter.jp