Welcome to the exciting world of Godot RL Agents, an open-source package designed to help game creators, AI researchers, and hobbyists create intelligent behaviors for non-player characters (NPCs). This guide will walk you through the process of setting up and beginning your journey with this powerful library.
What is Godot RL Agents?
Godot RL Agents serves as an interface bridging games developed in the Godot Engine with machine learning algorithms running in Python.
- Compatible with four renowned RL frameworks: StableBaselines3, Sample Factory, Ray RLLib, and CleanRL.
- Supports memory-based agents using LSTM or attention interfaces.
- Works with both 2D and 3D games.
- Offers a variety of AI sensors to enhance agent observability.
- Completely free and open-source under the MIT license.
Getting Started: Quickstart Guide
This quickstart guide will help you set up and train your first agent using the StableBaselines3 backend, which is compatible with Windows, Mac, and Linux.
Installation Steps
- **Set Up a Virtual Environment**: If you are new to Python, consider using venv or Conda to manage dependencies.
- **Install the Godot RL Agents Library**: Run the following command:
- **Download Example Projects**: Choose from examples like BallChase, JumperHard, or FlyBy.
- **Set Executable Permissions**: Ensure you add executable permissions, where necessary:
- **Train and Visualize Your Agent**: Use the Stable Baselines 3 example script:
pip install godot-rl
gdrl.env_from_hub -r edbeeching/godot_rl_JumperHard
chmod +x examples/godot_rl/JumperHard/bin/JumperHard.x86_64
python examples/stable_baselines3_example.py --env_path=examples/godot_rl/JumperHard/bin/JumperHard.x86_64 --experiment_name=Experiment_01 --viz
In-Editor Interactive Training
If you’d prefer to train directly in the Godot editor:
- Download the Godot 4 Game Engine
- Import the JumperHard example and train with:
python examples/stable_baselines3_example.py
Creating Custom Environments
For those looking to create unique environments, check out the dedicated tutorial on custom environments here.
Troubleshooting Common Issues
As with any development tool, you may encounter some bumps along the way. Here are a few troubleshooting tips:
- If you’re running into permission issues when executing the game, remember to check if you’ve added the correct run permissions. Use the command from installation to fix it.
- If the ONNX model isn’t loading correctly, ensure you have installed the necessary plugins from the specified GitHub repository.
- If you experience any challenges, don’t hesitate to reach out on our Discord or raise an issue on GitHub.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Advanced Usage
Once you’ve successfully completed the quickstart guide, you can dive into advanced features. Godot RL Agents supports four RL training frameworks with detailed guides available for each:
Conclusion
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.
FAQs
Here are answers to some common questions:
- Why have we developed Godot RL Agents?
To offer a free and open-source tool for deep reinforcement learning research and game development. - Can you help with my game project?
If the information provided doesn’t suffice, reach out to us on Discord or GitHub.
Happy coding, and may your NPCs become smarter with every line of code!
