About this project

godot-rust is a library that integrates the Rust language with Godot 4, an open-source game engine focused on a productive, batteries-included 2D and 3D experience. It uses Godot's GDExtension API, which allows third-party languages and libraries to be integrated into the engine. Philosophy The binding is positioned as an alternative to GDScript, emphasizing type safety, scalability and performance. The two languages can be mixed in a project, and custom Rust APIs can be called type-safely from GDScript. The stated primary goal is to provide a pragmatic Rust API for game developers: recurring workflows should be simple and require minimal boilerplate, and APIs are designed to be safe and idiomatic Rust wherever possible. Because it interacts with Godot as a C++ engine, the project sometimes follows unconventional approaches to improve user experience. Features shown in the README example The motivating example registers a Godot class Player that inherits from Sprite2D. It demonstrates: - Class declaration via the GodotClass derive macro with automatic initialization and a base class. - Inheritance via composition, giving access to base class methods. - Attribute-based field initialization, including a default hitpoints value. - OnReady child node access, auto-initialized when _ready() is called. - Implementing Godot virtual methods through predefined traits (e.g. overriding _ready). - Type-safe signal connections, such as connecting to a health bar's value_changed signal. - Custom methods exposed to GDScript via the #[func] attribute. - Calling Node methods on self through mutable base access. Development status The README states the library has evolved considerably since 2023 and is now usable for projects such as games, editor plugins, tools and other Godot-based applications. It notes that breaking changes are occasionally introduced, usually minor and accompanied by migration guides; crates.io releases follow SemVer but lag behind the master branch. The vast majority of Godot APIs have been mapped to Rust. Current development focus is on a more natural Rust experience and design patterns useful for day-to-day game development. An elaborate CI suite includes clippy, unit tests, engine integration tests and memory sanitizers, and even hot-reload is tested. Experimental support exists for Wasm, Android and iOS, though documentation and tooling are still lacking. Getting started and resources The README points to the godot-rust book as the best place to start, to be used alongside the API docs. Practical examples and small games are available in the demo-projects repository. Help is offered via a Discord server with a #help channel. License and contributing The project uses the Mozilla Public License 2.0, described as balancing permissive and copyleft licenses. Users can use the library commercially and keep their own code closed-source; the main condition is that modifications to godot-rust itself must be made available. Contributions are welcomed, with pointers in Contributing.md.