amc-madalin
commited on
Commit
•
30ea1bc
1
Parent(s):
dd67cf8
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,103 @@
|
|
1 |
---
|
2 |
license: mit
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
+
language:
|
4 |
+
- en
|
5 |
---
|
6 |
+
|
7 |
+
# README for Flappy-AI with Reinforcement Learning
|
8 |
+
|
9 |
+
Model for the repository [flappy-ai](https://github.com/amc-madalin/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:
|
10 |
+
|
11 |
+
# File: config.yml
|
12 |
+
```
|
13 |
+
game_screen:
|
14 |
+
width: 800
|
15 |
+
height: 600
|
16 |
+
|
17 |
+
game_mechanics:
|
18 |
+
gravity: 5
|
19 |
+
flap_strength: 20
|
20 |
+
pipe_speed: 2
|
21 |
+
pipe_width: 100
|
22 |
+
pipe_gap: 200
|
23 |
+
character_size: 50
|
24 |
+
collision_penalty: -1 # Penalty for hitting a pipe
|
25 |
+
pass_reward: 1 # Reward for successfully passing a pipe
|
26 |
+
height_penalty: -0.1 # Penalty for flying too high or too low
|
27 |
+
|
28 |
+
initial_positions:
|
29 |
+
character_x: 350
|
30 |
+
character_y: 250
|
31 |
+
pipe_x: 800
|
32 |
+
pipe_height_min: 100
|
33 |
+
pipe_height_max: 400
|
34 |
+
|
35 |
+
ai_config:
|
36 |
+
epsilon: 0.3
|
37 |
+
epsilon_min: 0.01
|
38 |
+
epsilon_decay: 0.98
|
39 |
+
gamma: 0.1
|
40 |
+
learning_rate: 0.0001
|
41 |
+
batch_size: 32
|
42 |
+
buffer_size: 5000
|
43 |
+
num_episodes: 500
|
44 |
+
|
45 |
+
other_settings:
|
46 |
+
random_seed: 42
|
47 |
+
|
48 |
+
model:
|
49 |
+
save_path: ./experiments/
|
50 |
+
load_path: ~
|
51 |
+
```
|
52 |
+
## Project Structure
|
53 |
+
|
54 |
+
- `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.
|
55 |
+
- `assets/`: Here, you'll find all the graphical and audio assets utilized in the project, enriching the game's visual and auditory experience.
|
56 |
+
- `configs/`: Contains various configuration files that allow customization and fine-tuning of the AI agent and the game environment.
|
57 |
+
- `environment.yml`: A comprehensive list of dependencies required for the project, ensuring consistent setup across different environments.
|
58 |
+
- `experiments/`: This section includes experimental code and data, showcasing the trials and tests conducted during the development process.
|
59 |
+
- `game/`: Contains the game's logic and rendering code, the heart of the Flappy Bird game that the AI interacts with.
|
60 |
+
- `model/`: Here lies the trained AI model, a testament to the learning and adaptation achieved through reinforcement learning.
|
61 |
+
- `runs/`: Stores outputs from various training runs, providing insights into the AI's performance and learning progression.
|
62 |
+
- `utils/`: A collection of utility scripts and modules that support various functionalities across the project.
|
63 |
+
- `train.py`: The primary script used to kickstart the AI agent's training process.
|
64 |
+
- `test_game.py`: A testing script to run the game independently of the AI agent, useful for debugging and game playthroughs.
|
65 |
+
|
66 |
+
## Installation
|
67 |
+
|
68 |
+
To set up this project on your local machine, follow these steps:
|
69 |
+
|
70 |
+
1. Clone the repository:
|
71 |
+
```sh
|
72 |
+
git clone https://github.com/amc-madalin/flappy-ai.git
|
73 |
+
```
|
74 |
+
2. Navigate to the project directory:
|
75 |
+
```sh
|
76 |
+
cd flappy-ai
|
77 |
+
```
|
78 |
+
3. Install the required dependencies:
|
79 |
+
```sh
|
80 |
+
conda env create -f environment.yml
|
81 |
+
```
|
82 |
+
|
83 |
+
## Usage
|
84 |
+
|
85 |
+
Once the installation is complete, you can start exploring Flappy-AI.
|
86 |
+
|
87 |
+
1. Activate the project environment:
|
88 |
+
```sh
|
89 |
+
conda activate flappy-ai
|
90 |
+
```
|
91 |
+
2. To begin training the AI agent, execute:
|
92 |
+
```sh
|
93 |
+
python train.py
|
94 |
+
```
|
95 |
+
3. To test the game mechanics without the AI agent, run:
|
96 |
+
```sh
|
97 |
+
python test_game.py
|
98 |
+
```
|
99 |
+
|
100 |
+
## License
|
101 |
+
|
102 |
+
This project is released under the MIT License, promoting open-source collaboration and sharing.
|
103 |
+
|