All Projects → godot-rust → Godot Rust

godot-rust / Godot Rust

Licence: mit
Rust bindings for GDNative

Programming Languages

rust
11053 projects
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Godot Rust

Godot 2d global illumination
2D Global Illumination shader in Godot.
Stars: ✭ 106 (-94.76%)
Mutual labels:  gamedev, godot
godot-gameshell
Godot export templates and instructions for the GameShell portable game console and other single-board computers
Stars: ✭ 34 (-98.32%)
Mutual labels:  gamedev, godot
Luascript
Lua language support for Godot Engine
Stars: ✭ 240 (-88.14%)
Mutual labels:  gamedev, godot
Pixelorama
A free & open-source 2D sprite editor, made with the Godot Engine! Available on Windows, Linux, macOS and the Web!
Stars: ✭ 2,535 (+25.25%)
Mutual labels:  gamedev, godot
Mdframework
A multiplayer C# game framework for Godot 3.2 Mono.
Stars: ✭ 34 (-98.32%)
Mutual labels:  gamedev, godot
Godot Sqlite
GDNative wrapper for SQLite (Godot 3.2+)
Stars: ✭ 142 (-92.98%)
Mutual labels:  gamedev, godot
MySQL Module
MySQL connector to Godot Engine.
Stars: ✭ 30 (-98.52%)
Mutual labels:  gamedev, godot
godot-shotgun-party
An evolving multiplayer project for Godot Engine 3.
Stars: ✭ 171 (-91.55%)
Mutual labels:  gamedev, godot
Space rocks
Asteroids-like game made with Godot Engine 3.0.
Stars: ✭ 20 (-99.01%)
Mutual labels:  gamedev, godot
Godot Open Rpg
Learn to create turn-based combat with this Open Source RPG demo ⚔
Stars: ✭ 855 (-57.76%)
Mutual labels:  gamedev, godot
Godot Ink
Ink integration for Godot Engine.
Stars: ✭ 129 (-93.63%)
Mutual labels:  gamedev, godot
Godot3 procgen demos
Exploring Procedural Generation algorithms in Godot
Stars: ✭ 85 (-95.8%)
Mutual labels:  gamedev, godot
Gamedev4noobs
Olá, sejam bem-vindos ao repositório _gamedev4noobs_ do Estúdio Vaca Roxa. O propósito desse repositório, além de contribuir para o projeto 4noobs, é ensinar o básico do desenvolvimento de jogos para iniciantes. Apresentando boas práticas e insumos para criar games incríveis.
Stars: ✭ 122 (-93.97%)
Mutual labels:  gamedev, godot
Godot Kickstarter 2019
Create your Own Games with Godot, the Free Game Engine: sources from the January Kickstarter project from GDQuest
Stars: ✭ 194 (-90.42%)
Mutual labels:  gamedev, godot
Godot tutorials
Code and examples for KidsCanCode Godot Tutorials.
Stars: ✭ 119 (-94.12%)
Mutual labels:  gamedev, godot
Godot Nim
Nim bindings for Godot Engine
Stars: ✭ 274 (-86.46%)
Mutual labels:  gamedev, godot
3d Game Shaders For Beginners
🎮 A step-by-step guide to implementing SSAO, depth of field, lighting, normal mapping, and more for your 3D game.
Stars: ✭ 11,698 (+477.96%)
Mutual labels:  gamedev, godot
Godot
Godot Engine – Multi-platform 2D and 3D game engine
Stars: ✭ 44,556 (+2101.38%)
Mutual labels:  gamedev, godot
Evennia
Python MUD/MUX/MUSH/MU* development system
Stars: ✭ 1,309 (-35.33%)
Mutual labels:  gamedev
Entitas Sync Framework
Networking framework for Entitas ECS. Targeted at turnbased games or other slow-paced genres.
Stars: ✭ 98 (-95.16%)
Mutual labels:  gamedev

GDNative bindings for Rust

Docs Status

Website | User Guide | Stable Docs | Latest Docs

godot-rust is a Rust library that implements native bindings for the Godot game engine. This allows you to develop games or other applications in Godot, while benefiting from Rust's strengths, such as its type system, scalability and performance.

Stability

The bindings cover most of the exposed API of Godot 3.4, and are being used on a number of projects in development, but we still expect non-trivial breaking changes in the API in the coming releases. godot-rust adheres to Cargo's semantic versioning.

Engine compatibility

We are committed to keeping compatibility with the latest stable patch releases of all minor versions of the engine, starting from Godot 3.2:

  • Godot 3.4 (works out-of-the-box)
  • Godot 3.3 (needs api.json adjustment)
  • Godot 3.2 (needs api.json adjustment)

For versions 3.2 and 3.3, some extra steps are needed, see Custom builds below.

The bindings do not support in-development Godot 4 versions at the moment. Support is planned as the native extensions become more stable.

Requirements

The generator makes use of bindgen, which depends on Clang. Instructions for installing bindgen's dependencies for popular OSes can be found in their documentation.

bindgen may complain about a missing llvm-config binary, but it is not actually required to build the gdnative crate. If you see a warning about llvm-config and a failed build, it's likely that you're having a different problem!

'Header not found' errors

When building the library, bindgen may produce errors that look like this:

godot-rust\gdnative-sys/godot_headers\gdnative/string.h:39:10: fatal error: 'wchar.h' file not found

This means that bindgen was unable to find the C system headers for your platform. If you can locate the headers manually, you may try setting the C_INCLUDE_PATH environment variable so libclang could find them. If on Windows, you may try building from the Visual Studio "developer console", which should setup the appropriate variables for you.

Usage

Latest master version + Godot 3.4

After bindgen dependencies are installed, add the gdnative crate as a dependency, and set the crate type to cdylib:

[dependencies]
gdnative = { git = "https://github.com/godot-rust/godot-rust.git" }

[lib]
crate-type = ["cdylib"]

Godot 3.2.3-stable

To access the last released version on crates.io, use the following. If you are starting, we recommend using the master version at this point, as there have been significant API changes since v0.9.3.

[dependencies]
gdnative = "0.9.3"

[lib]
crate-type = ["cdylib"]

Custom builds

To use the bindings with a non-default Godot version or a custom build, see Using custom builds of Godot in the user guide.

In short, you will need to generate api.json manually, using godot --gdnative-generate-json-api api.json to replace the file in the gdnative-bindings directory.

Async / yield support

Async support is a work-in-progress, with a low-level API available in the gdnative-async crate. This crate is re-exported as gdnative::tasks, if the async feature is enabled on gdnative. See this page in the book for an introduction to use the async feature with Tokio.

Example

The most general use-case of the bindings will be to interact with Godot using the generated wrapper classes, as well as providing custom functionality by exposing Rust types as NativeScripts.

NativeScript is an extension for GDNative that allows a dynamic library to register "script classes" to Godot.

As is tradition, a simple "Hello World" should serve as an introduction. For a full tutorial, check out "Getting Started" from the user guide!

use gdnative::prelude::*;

#[derive(NativeClass)]
#[inherit(Node)]
pub struct HelloWorld;

#[methods]
impl HelloWorld {
    fn new(_owner: &Node) -> Self {
        HelloWorld
    }

    #[export]
    fn _ready(&self, _owner: &Node) {
        godot_print!("Hello, world.");
    }
}

fn init(handle: InitHandle) {
    handle.add_class::<HelloWorld>();
}

godot_init!(init);

Further examples

IMPORTANT NOTE

Before launching the examples in the godot editor, you must first run cargo build and wait for the build operations to finish successfully.

At startup, the Godot editor tries to load all resources used by the project, including the native binary. If it isn't present, the editor skips properties or signals associated with the missing NativeScripts in the scene. This will cause the scene tree to be non-functional for any sample that relies on properties or signals configured in the editor.

The /examples directory contains several ready to use examples, complete with Godot projects and setup for easy compilation from Cargo:

Third-party resources

See also (work-in-progress): Third-party projects in the book.

Tools and integrations

  • godot-egui (setzer22, jacobsky) - combine the egui library with Godot
  • ftw (macalimlim) - manage your godot-rust projects from the command line

Open-source games

Tutorials

Contributing

See the contribution guidelines.

License

Any contribution intentionally submitted for inclusion in the work by you shall be licensed under the MIT license, without any additional terms or conditions.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].