amc-flappy-ai-a-20 / README.md
amc-madalin's picture
Update README.md
30ea1bc verified
metadata
license: mit
language:
  - en

README for Flappy-AI with Reinforcement Learning

Model for the repository flappy-ai, an project that utilizes reinforcement learning, to train an AI agent to master the game of Flappy Bird. This model is the 20th episode for the following hyperparameters:

File: config.yml

game_screen:
  width: 800
  height: 600

game_mechanics:
  gravity: 5
  flap_strength: 20
  pipe_speed: 2
  pipe_width: 100
  pipe_gap: 200
  character_size: 50
  collision_penalty: -1  # Penalty for hitting a pipe
  pass_reward: 1          # Reward for successfully passing a pipe
  height_penalty: -0.1    # Penalty for flying too high or too low

initial_positions:
  character_x: 350
  character_y: 250
  pipe_x: 800
  pipe_height_min: 100
  pipe_height_max: 400

ai_config:
  epsilon: 0.3
  epsilon_min: 0.01
  epsilon_decay: 0.98
  gamma: 0.1
  learning_rate: 0.0001
  batch_size: 32
  buffer_size: 5000
  num_episodes: 500

other_settings:
  random_seed: 42

model:
  save_path: ./experiments/
  load_path: ~

Project Structure

  • ai/: This directory houses the core AI components, including the Q-network for decision making, the replay buffer for learning from past actions, and the training logic essential for the agent's learning process.
  • assets/: Here, you'll find all the graphical and audio assets utilized in the project, enriching the game's visual and auditory experience.
  • configs/: Contains various configuration files that allow customization and fine-tuning of the AI agent and the game environment.
  • environment.yml: A comprehensive list of dependencies required for the project, ensuring consistent setup across different environments.
  • experiments/: This section includes experimental code and data, showcasing the trials and tests conducted during the development process.
  • game/: Contains the game's logic and rendering code, the heart of the Flappy Bird game that the AI interacts with.
  • model/: Here lies the trained AI model, a testament to the learning and adaptation achieved through reinforcement learning.
  • runs/: Stores outputs from various training runs, providing insights into the AI's performance and learning progression.
  • utils/: A collection of utility scripts and modules that support various functionalities across the project.
  • train.py: The primary script used to kickstart the AI agent's training process.
  • test_game.py: A testing script to run the game independently of the AI agent, useful for debugging and game playthroughs.

Installation

To set up this project on your local machine, follow these steps:

  1. Clone the repository:
git clone https://github.com/amc-madalin/flappy-ai.git
  1. Navigate to the project directory:
cd flappy-ai
  1. Install the required dependencies:
conda env create -f environment.yml

Usage

Once the installation is complete, you can start exploring Flappy-AI.

  1. Activate the project environment:
conda activate flappy-ai
  1. To begin training the AI agent, execute:
python train.py
  1. To test the game mechanics without the AI agent, run:
python test_game.py

License

This project is released under the MIT License, promoting open-source collaboration and sharing.