#bird #reinforcement-learning #game #tcp-server #agent #play #applications

app rusty-bird

Rusty bird is a simple flappy bird implementation that can be controlled by external applications via TCP. So the user is able to plug a reinforcement learning agent to it and play the game

1 unstable release

0.2.0 Jun 14, 2021
0.0.1 Jun 8, 2021

#494 in Games

GPL-3.0-only

46KB
457 lines

Rusty Bird

Github testing GitHub issues GitHub Latest version

Another Flappy Bird clone? 🦆 Rusty bird is more than a Flappy Bird clone. Rusty bird was programmed to make your entry into reinforcement learning as easy as possible. With the help of Rusty Bird you can train your own independent agent to play the game.

Want to build an agent classically in Python? Maybe something more exotic like Haskell or Elixir? No problem. Rusty Bird uses a TCP stream that you can simply connect to and get the state and current score of the game.

You should definitely try Elixir! 👀

Table of contents

Features

  • Full fledged Flappy bird game
  • TCP Server to extract the state and score out of the game

Usage

Rust bird is a CLI application which starts the flappy bird game. Currently the only thing you need is the executable and Rust installed.

For precompiled versions:

You can start the game with rusty-bird start.

To run the app from source:

Clone the repo and execute the crate with cargo run -- start or build your own executable with cargo build

FAQ

How does the state information look like?

The state is send as a JSON struct. It contains the y-position of the Player, the score and the distance of the first three pipe obstacles and the player.

This is how the schema is looking:

{
  "player": <player y-position>,
  "score": <int>,
  "pipes": [
    [
      [<lower x distance>, <lower y distance>],
      [<upper x distance>, <upper y distance>]
    ],
    [
      [<lower x distance>, <lower y distance>],
      [<upper x distance>, <upper y distance>]
    ],
    [
      [<lower x distance>, <lower y distance>],
      [<upper x distance>, <upper y distance>]
    ]
  ]
}

This is example data:

{
  "player": 103.79996,
  "score": 0,
  "pipes": [
    [
      [168.0, 267.20004],
      [168.0, -182.79996]
    ],
    [
      [418.0, 98.20004],
      [418.0, -351.79996]
    ],
    [
      [668.0, 111.20004],
      [668.0, -338.79996]
    ]
  ]
}

Will you add new features to Rusty Bird?

Definitely! This project is a great learning experience for me. There are already a few features planned to make the development for your agents easier. Since I'm not a data scientist, I need your help! 😊

License

Rusty Bird is release under the GNU GPLv3

Dependencies

~28–66MB
~1M SLoC