This project enables the use of evolutionary algorithms (EAs) within the Godot game engine. It's specifically designed for:
- Maximization problems, where one defines a function F(x), and the optimizer aims to find x such that F(x) is maximal.
- Reinforcement learning problems, where one defines a Gym, and an agent that obtains a fitness value over a run. The neural network acting as the state-action function is trained using EAs. The project includes logging functionality to track the training progress and tools to visualize the results.
- Evolutionary Algorithms: Implements various evolutionary strategies for training.
- Neural Network: A simple custom feed-forward neural network implementation.
- Logging: Logs training data for later analysis.
- Godot Engine written for c++
- Python
- Python libraries:
pandas
,matplotlib
- Outputs are CSV, alternatives can be used.
⚠️ Important Ensure that the .gdextension file and its sibling folders/files are in the following folder:res://addons/evolutionary_agents/
, otherwise it is not guaranteed to work.- If available for your platform, consider using one of the provided prebuilt releases on the github page.
- Alternatively, clone the repository, and build using scons as described in the Godot documentation.
- Please checkout the demos provided to learn how to structure the problems. To run them, just run the godot as a scene. The project is designed to work in editor, and training may not be reliable as a standalone application.
- Initialize Training:
- Configure the neural network and evolutionary algorithm parameters in Godot by creating resources.
- Run the training by executing the main scene in Godot.
- Run the visualization script:
python plot_fitness.py path/to/your/log.csv
Contributions are welcome! Please fork the repository and submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by various neural network and evolutionary algorithm implementations and papers.
- Special thanks to the Godot community for their support and resources.