explaingit

godot-rust/gdext

4,786RustAudience · developerComplexity · 4/5LicenseSetup · hard

TLDR

A Rust library that connects Rust code to the Godot 4 game engine via its official GDExtension API, letting you write high-performance game logic in Rust while keeping simpler gameplay in GDScript.

Mindmap

mindmap
  root((repo))
    What it does
      Rust for Godot 4
      GDExtension bindings
      Performance scripting
    Features
      Rust-GDScript interop
      Panic safety
      Type-safe calls
      Mobile export support
    Use Cases
      Game logic in Rust
      Editor plugins
      Performance-critical systems
    Tech Stack
      Rust
      Godot 4
      GDExtension
      GDScript
    Getting Started
      Godot 4 install
      Rust toolchain
      GDExtension config file
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Write a performance-critical system like pathfinding or physics in Rust and call it from GDScript in your Godot 4 game

USE CASE 2

Build a Godot editor plugin entirely in Rust using gdext GDExtension bindings

USE CASE 3

Mix Rust and GDScript in the same Godot project, using Rust where speed matters and GDScript for simpler game logic

USE CASE 4

Export a Godot 4 game with Rust logic to Android or iOS using gdext experimental mobile support

Tech stack

RustGodotGDExtensionGDScript

Getting it running

Difficulty · hard Time to first run · 1h+

Requires both Godot 4 engine and Rust toolchain, mobile export targets need additional cross-compilation toolchain setup.

Commercial and private game code is allowed, any changes you make to the library source files themselves must be shared under MPL 2.0.

In plain English

godot-rust/gdext is a library that lets you use the Rust programming language to write game logic for the Godot 4 game engine. Godot is a free, open-source tool for making 2D and 3D games, and it normally uses its own scripting language called GDScript. This library adds Rust as an alternative. The main benefit of using Rust instead of GDScript is stricter type checking and better performance for demanding parts of a game. The two languages can coexist in the same project: you can write performance-critical systems in Rust while keeping simpler game logic in GDScript. Rust code you write can also be called from GDScript in a type-safe way. The library works through Godot's GDExtension API, which is Godot's official mechanism for integrating languages other than GDScript. You define Rust structs that represent Godot objects (like sprites or player characters), apply some special annotations, and the library handles the connection between your Rust code and Godot's internal systems. Inheritance from Godot's built-in classes is done through composition: you include a Base field in your struct rather than subclassing in the traditional sense. As of 2023 the library has matured enough for use in real projects, including games, editor plugins, and other Godot-based tools. Most of Godot's built-in APIs have been mapped to Rust. The development team notes that occasional breaking changes do happen, but they provide migration guides and follow standard versioning rules. There is experimental support for building games for web browsers, Android, and iOS, though documentation for those platforms is still limited. To get started, the README points to a dedicated book with tutorials and API reference documentation, plus a repository of demo projects and example games. The license is the Mozilla Public License 2.0, which allows commercial use and lets you keep your own game code private as long as any changes to the library itself are shared.

Copy-paste prompts

Prompt 1
Create a Godot 4 GDExtension in Rust using gdext that defines a Player class with health and speed properties callable from GDScript
Prompt 2
How do I write a gdext Rust class that inherits from CharacterBody2D and handles _physics_process from Rust?
Prompt 3
Set up a new Godot 4 project with a gdext Rust extension from scratch, what files do I need and how does the .gdextension file work?
Prompt 4
Call a Rust function from GDScript with typed parameters using gdext and return a typed result safely
Prompt 5
Export a Godot 4 plus gdext Rust project to Android, what extra steps are needed beyond a normal Godot Android export?
Open on GitHub → Explain another repo

← godot-rust on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.