This project implements a simple neural network-based agent to play a Flappy Bird-inspired game environment. The goal is to train multiple agents to navigate through the environment and achieve the highest score possible by avoiding obstacles.
The project is implemented in C# using the Raylib library for rendering and visualization.
- Neural Network Agents: Each agent is equipped with a simple feedforward neural network that learns to play the game through reinforcement learning.
- Replay Buffer: Agents use a replay buffer to store and learn from past experiences.
- Training and Testing: The project includes both training and testing phases, allowing you to observe how well the agents have learned.
- Multiple Agents: The environment supports multiple agents training simultaneously.
- Customizable Parameters: You can adjust the number of agents, network structure, learning rate, and other hyperparameters.
Program.cs
: The main entry point for the application. This file contains the logic for training and testing the agents.FlappyBirdEnvironment.cs
: Defines the game environment in which the agents operate. It includes the rendering logic, physics simulation, and interaction with agents.Agent.cs
: Defines the agent class, including the neural network, decision-making process, and training logic.ReplayBuffer.cs
: Implements the replay buffer that stores the agent's experiences for training.
- Raylib-cs: A C# binding for Raylib, used for graphics and window management.
- .NET Core 3.1 or later: The project is built on .NET Core, so you'll need a compatible version installed.
-
Clone the repository:
git clone https://github.com/yourusername/Simple_Neural_Network.git cd Simple_Neural_Network
-
Install dependencies:
Make sure you have .NET Core and Raylib installed.
-
Build and run the project:
dotnet run
- Training: The agents are trained for a specified number of episodes (
episodes
variable inProgram.cs
). During training, the agents learn to navigate through the game environment by avoiding obstacles. - Testing: After training, you can test the performance of the trained agents in the environment.
- Rendering: The environment is rendered using Raylib, allowing you to visually observe the agents' performance.
You can customize various aspects of the project:
- Network Structure: Modify the
networkStructure
array inProgram.cs
to change the architecture of the neural network. - Hyperparameters: Adjust the learning rate, discount factor, and replay buffer size in
Program.cs
. - Number of Agents: Change the
numAgents
variable to train multiple agents simultaneously.
If you'd like to contribute to this project, feel free to fork the repository and submit a pull request with your changes.
Feel free to adjust the details or add any additional information specific to your project!