Coder Social home page Coder Social logo

shankjbs571 / flappyai Goto Github PK

View Code? Open in Web Editor NEW

This project forked from iusekarma/flappy_bird_ai

0.0 0.0 0.0 260 KB

FlappyAI is our exploration of the NeuroEvolution of Augmenting Topologies (NEAT) algorithm. Using this algorithm, we built the Flappy Bird game with Pygame and trained a neural network to play the game autonomously. This project showcases NEAT's capability in creating adaptive and intelligent game-playing systems.

Python 100.00%
ai game matplotlib neat-python neural-network pygame python

flappyai's Introduction

Flappy AI Project

This project aims to develop an AI agent capable of autonomously playing the game Flappy Bird using the NEAT (NeuroEvolution of Augmenting Topologies) algorithm. The agent learns optimal strategies for navigating the game environment and achieving high scores through reinforcement learning.

Screenshots

  • Manual Gameplay

Manual Gameplay

  • NEAT Training

Manual Gameplay

  • Line Graph

Manual Gameplay

Project Structure

  • flappy_bird_manual.py: A file in the root directory that contains the standard Flappy Bird game, playable by a human using the spacebar key.
  • neat_game.py: A file in the root directory that implements the game and the NEAT algorithm. Running this file starts the training of the Neural Network.
  • config_feedforward.txt: A file in the root directory that houses all configurations for the NEAT algorithm, such as population size and fitness threshold.
  • visualize.py: A file in the root directory that shows a line graph after training the NEAT for specific generations, displaying the best fitness, average, and standard deviation.

How to Execute

  1. Manual Gameplay:

    • To play the game manually, use the following command:
      python flappy_bird_manual.py
      
    • Use the spacebar key to control the bird's flap and navigate through the pipes.
  2. Training the Neural Network:

    • To train, use the following command:
       python neat_game.py
      
    • This will start the training process, where the Neural Network learns to play Flappy Bird by Augmenting Topologies.
  3. Visualization:

    • After training, you can visualize the results after TOTAL_GEN have completed A line graph will show the best fitness, average fitness, and standard deviation over generations.

Requirements

  • Python 3.x
  • NEAT Python library
  • Pygame library
  • Matplotlib library

Future Scope

  • Implementing more advanced neural network architectures, such as CNNs or RNNs, could enhance the AI's ability to learn and improve its gameplay.
  • Developing more sophisticated fitness functions that consider factors like obstacle spacing, speed, and patterns could lead to more strategic gameplay.
  • Expanding the game to include multiplayer or competitive modes, where AIs compete against each other or against human players, could add an exciting dimension to the game.
  • Applying the skills and strategies learned by the AI in playing Flappy Bird to real-world problems, such as autonomous navigation or optimization tasks.

Contributors

License

This project is licensed under the MIT License.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.