View on GitHub

NEAT-Flappy-bird

A Python implementation of the classic Flappy Bird game using Pygame for graphics and NEAT (NeuroEvolution of Augmenting Topologies) for AI-based gameplay. Watch AI agents learn to play the game automatically, or play yourself and see how high you can score!

NEAT Flappy Bird

This project implements a Flappy Bird clone using the NEAT (NeuroEvolution of Augmenting Topologies) algorithm for AI-driven gameplay. The game allows users to experience the classic Flappy Bird mechanics while showcasing the capabilities of neuroevolution in training AI agents. Players control a bird navigating through pipes, with the goal of achieving the highest score possible. The project demonstrates the integration of Pygame for game development and NEAT-Python for evolving intelligent agents.

Table of Contents

  1. Introduction
  2. Gameplay
  3. Game Components
  4. Features
  5. Installation
  6. Usage
  7. How It Works
  8. Configuration
  9. Contributing
  10. Creadits
  11. Acknowledgments

Introduction

The NEAT Flappy Bird project implements a neural network approach to train agents to play the classic Flappy Bird game using the NEAT (NeuroEvolution of Augmenting Topologies) algorithm. This project demonstrates the application of evolutionary algorithms in game AI, allowing the birds to learn and adapt to the game environment.

Gameplay

Flappy Bird

Game Components

Features

Installation

Follow these steps to set up and run the project on your local machine.

Prerequisites

Make sure you have the following installed:

Steps

  1. Clone the Repository:

    Clone this repository to your local machine:

    git clone https://github.com/charang2003/NEAT-Flappy-bird.git
    cd NEAT-Flappy-bird
    
    
  2. Install Dependencies:

    pip install -r requirements.txt
    

Usage

To train the AI agent and watch it play Snake game:

python flappy_bird.py

How It Works

The project uses Pygame for rendering the game and NEAT for evolving a population of birds. Each bird is represented by a neural network that makes decisions based on its position relative to the pipes. The birds are trained over multiple generations, improving their performance with each iteration.

Key Components

Configuration

Before running the project, you’ll need to configure the config-feedforward.txt file. This file contains the settings for the NEAT algorithm. Customize parameters such as:

Feel free to explore the various configurations and experiment with different settings to see how they affect the performance of your neural networks!

Contributing

Contributions are welcome! Please follow these steps to contribute:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Make your changes and commit them (git commit -m 'Add new feature').
  4. Push to the branch (git push origin feature-branch).
  5. Create a pull request.

Creadits

This project was inspired by NeuroEvolution of Augmenting Topologies (NEAT) a genetic algorithm (GA) developed by Kenneth Stanley and Risto Miikkulainen in 2002. Special thanks to the following resources that contributed to the development of this project:

And special thanks to Tech with Tim –> Watch the Video

Acknowledgments