Flappybird is a side-scrolling game where the agent must successfully nagivate through gaps between pipes.

FPS Restrictions

This game is restricted to 30fps as the physics at higher and lower framerates feels slightly off. You can remove this by setting the allowed_fps parameter to None.

Valid Actions

Up causes the bird to accelerate upwards.

Terminal states (game_over)

If the bird makes contact with the ground, pipes or goes above the top of the screen the game is over.


For each pipe it passes through it gains a positive reward of +1. Each time a terminal state is reached it receives a negative reward of -1.

class ple.games.flappybird.FlappyBird(width=288, height=512, pipe_gap=100)[source]

Used physics values from sourabhv’s clone.


width : int (default: 288)

Screen width. Consistent gameplay is not promised for different widths or heights, therefore the width and height should not be altered.

height : inti (default: 512)

Screen height.

pipe_gap : int (default: 100)

The gap in pixels left between the top and bottom pipes.


Gets a non-visual state representation of the game.



  • player y position.
  • players velocity.
  • next pipe distance to player
  • next pipe top y position
  • next pipe bottom y position
  • next next pipe distance to player
  • next next pipe top y position
  • next next pipe bottom y position

See code for structure.