godot_rl_agents  by edbeeching

Open source package for game AI/NPC behavior learning

created 4 years ago
1,214 stars

Top 33.0% on sourcepulse

GitHubView on GitHub
Project Summary

This package provides an interface between the Godot game engine and Python-based machine learning frameworks, enabling game developers and AI researchers to train complex behaviors for NPCs or game agents. It offers wrappers for StableBaselines3, Sample Factory, Ray RLLib, and CleanRL, supporting memory-based agents and both 2D and 3D games.

How It Works

The library facilitates reinforcement learning by acting as a bridge between a Godot game environment and Python RL algorithms. It exposes game states and actions through a defined interface, allowing agents trained in Python to interact with and learn within the Godot game world. This approach allows leveraging powerful, established RL libraries within the flexible and accessible Godot engine.

Quick Start & Requirements

  • Install via pip: pip install godot-rl
  • Requires Python. Virtual environment recommended.
  • Download example environments (e.g., gdrl.env_from_hub -r edbeeching/godot_rl_JumperHard).
  • Training script: python examples/stable_baselines3_example.py --env_path=<path_to_game_executable> --experiment_name=<name> [--viz] [--onnx_export_path=<model_name.onnx>]
  • For in-editor training, download the Godot 4 Engine (.NET version).
  • Official quickstart: https://github.com/edbeeching/godot_rl_agents#quickstart-guide
  • Video tutorial available.

Highlighted Details

  • Supports StableBaselines3, Sample Factory, Ray RLLib, and CleanRL backends.
  • Offers memory-based agents (LSTM, attention).
  • Includes AI sensors for enhanced agent observation.
  • Experimental ONNX export for trained models.
  • In-editor training is supported.

Maintenance & Community

  • Active Discord server for support and discussions.
  • Open to contributions (new environments, code improvements).
  • Development inspired by Unity ML Agents Toolkit.

Licensing & Compatibility

  • MIT License.
  • Permissive for commercial use and closed-source linking.

Limitations & Caveats

  • Example environments are primarily available for Linux and Windows.
  • The environment may periodically freeze during training with default scripts, which is normal as the model updates.
Health Check
Last commit

4 days ago

Responsiveness

1 day

Pull Requests (30d)
2
Issues (30d)
0
Star History
71 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.