Skip to main content

An OpenAI gym environment for the Flappy Bird game.

Reason this release was yanked:

binary is broken

Project description

Flappy Bird for OpenAI Gym

Python versions PyPI License

This repository contains the implementation of two OpenAI Gym environments for the Flappy Bird game. The implementation of the game's logic and graphics was based on the FlapPyBird project, by @sourabhv.

The two environments differ only on the type of observations they yield for the agents. The "FlappyBird-rgb-v0" environment, yields RGB-arrays (images) representing the game's screen. The "FlappyBird-v0" environment, on the other hand, yields simple numerical information about the game's state as observations. The yielded attributes are the:

  • horizontal distance to the next pipe;
  • difference between the player's y position and the next hole's y position.

         

Installation

To install flappy-bird-gym, simply run the following command:

$ pip install flappy-bird-gym

Usage

Like with other gym environments, it's very easy to use flappy-bird-gym. Simply import the package and create the environment with the make function. Take a look at the sample code below:

import time
import flappy_bird_gym2
env = flappy_bird_gym2.make("FlappyBird-v0")

obs = env.reset()
while True:
    # Next action:
    # (feed the observation to your agent here)
    action = ...  # env.action_space.sample() for a random action

    # Processing:
    obs, reward, done, info = env.step(action)
    
    # Rendering the game:
    # (remove this two lines during training)
    env.render()
    time.sleep(1 / 30)  # FPS
    
    # Checking if the player is still alive
    if done:
        break

env.close()

Playing

To play the game (human mode), run the following command:

$ flappy_bird_gym2

To see a random agent playing, add an argument to the command:

$ flappy_bird_gym2 --mode random

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flappy-bird-gym2-0.0.1.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flappy_bird_gym2-0.0.1-py3-none-any.whl (25.0 kB view details)

Uploaded Python 3

File details

Details for the file flappy-bird-gym2-0.0.1.tar.gz.

File metadata

  • Download URL: flappy-bird-gym2-0.0.1.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.6

File hashes

Hashes for flappy-bird-gym2-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a2bed0ed88511f1f68b9ef40a1eebfa66019fb4489ab339a33ed9038bd28f6d8
MD5 07186d53f9d6d6d3ec9f5e6d03dc2429
BLAKE2b-256 de3d901c0a5809551738cd50bc11046c71a70a7ba05e9188649439461780f8e4

See more details on using hashes here.

File details

Details for the file flappy_bird_gym2-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for flappy_bird_gym2-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 65502fba4df085b72993ba1382cf253ff5c4f495797a38843d00c5114082a76f
MD5 eccbd4039e0aa86df2cdca42aa2bfda9
BLAKE2b-256 878902ccf775e24c26b436c1f0fc8bb5f7ed0b9ab723be3e8fe4c25ae587d196

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page