Environments#

This library contains different environments built on top of the gymnasium library. The environments are:

Flappy Bird#

Flappy Bird
class envs.flappy_bird_gymnasium.flappy_bird_env.FlappyBirdEnv(render_mode=None, gap=125, observation_mode='simple', debug=False)#

Gymnasium environment for the Flappy Bird game.

The environment is a clone of the original Flappy Bird game, with the same rules and mechanics.

The observation space is a 8-dimensional vector containing the following values:

Action Space:#

Num

Action

0

No flap

1

Flap

Reward:#

The reward is 1 if the bird passed a pipe, 0 otherwise.

Observation:#

There are two observation modes: simple and image.

For simple, the observation is a 8-dimensional vector containing the following values:

Num

Observation

Min

Max

0

Bird Vertical Position

0

1

1

Bird Vertical Velocity

-inf

inf

2

Next Pipe Horizontal Distance

0

1

3

Next pipe Top Elevation

0

1

4

Next pipe Bottom Elevation

0

1

5

Next next pipe Horizontal Distance

0

1

6

Next next pipe Top Elevation

0

1

7

Next next pipe Bottom Elevation

0

1

For image, the observation is a 512x288x3 RGB image of the current frame.

Debug:#

If debug is set to true, the boxes defining the bird and the pipes will be drawn on the screen, as well as the actions taken and the current render fps.

Example:#

import gymnasium
import rlib.envs

env = gymnasium.make("FlappyBird-v0", gap=125, observation_mode="simple", debug=False)