Flappy Bird for Gymnasium
This repository contains the implementation of Gymnasium environment for the Flappy Bird game. The implementation of the game's logic and graphics was based on the flappy-bird-gym project, by @Talendar.
State space
The "FlappyBird-v0" environment, yields simple numerical information about the game's state as observations or RGB-arrays (images) representing the game's screen.
FlappyBird-v0
- option
- The LIDAR sensor 180 readings
- option
- the last pipe's horizontal position
- the last top pipe's vertical position
- the last bottom pipe's vertical position
- the next pipe's horizontal position
- the next top pipe's vertical position
- the next bottom pipe's vertical position
- the next next pipe's horizontal position
- the next next top pipe's vertical position
- the next next bottom pipe's vertical position
- player's vertical position
- player's vertical velocity
- player's rotation
- option
- or RGB-array (image) representing the game's screen
Action space
- 0 - do nothing
- 1 - flap
Rewards
- +0.1 - every frame it stays alive
- +1.0 - successfully passing a pipe
- -1.0 - dying
- −0.5 - touch the top of the screen
Installation
To install flappy-bird-gymnasium, simply run the following command:
$ pip install flappy-bird-gymnasium
Usage
Like with other gymnasium environments, it's very easy to use flappy-bird-gymnasium.
Simply import the package and create the environment with the make function.
Take a look at the sample code below:
import flappy_bird_gymnasium
import gymnasium
env = gymnasium.make("FlappyBird-v0", render_mode="human", use_lidar=True)
obs, _ = env.reset()
while True:
# Next action:
# (feed the observation to your agent here)
action = env.action_space.sample()
# Processing:
obs, reward, terminated, _, info = env.step(action)
# Checking if the player is still alive
if terminated:
break
env.close()
Playing
To play the game (human mode), run the following command:
$ flappy_bird_gymnasium
To see a random agent playing, add an argument to the command:
$ flappy_bird_gymnasium --mode random
To see a Deep Q Network agent playing, add an argument to the command:
$ flappy_bird_gymnasium --mode dqn
Metadata
Release files for flappy-bird-gymnasium 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| flappy-bird-gymnasium-0.4.0.tar.gz | 37.3 MB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flappy_bird_gymnasium-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 74.7 MB
Release files / flappy-bird-gymnasium-0.4.0.tar.gz
| Download URL | flappy-bird-gymnasium-0.4.0.tar.gz |
|---|---|
| Size | 37.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
78358e9a73740e5214b6bb7d965971bc645d9baecc092c86ef02726b9d62347b
|
|
BLAKE2b-256 checksum How to use checksums |
6a46de0965899428dccfe14d9f5242f7fbaca91d66a083d6bcbc380567cffcdd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.8
|
Release files / flappy_bird_gymnasium-0.4.0-py3-none-any.whl
| Download URL | flappy_bird_gymnasium-0.4.0-py3-none-any.whl |
|---|---|
| Size | 37.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f215be1d747320a3b07b6934ed0d08ac7ee8fbf50dd45a5be77b7381a6ebf880
|
|
BLAKE2b-256 checksum How to use checksums |
ad8621717daf58d737671f5f08f8bd2e39cabe401f9c17a9d97765bfb81eb858
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.8
|
Security for flappy-bird-gymnasium 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.