Bring Bevy's ECS to Godot4

Overview

bevy_godot4

Bring the design power of Bevy's ECS to the mature engine capabilities of Godot 4.

WARNING: This crate is very early in development, and is very untested.

The architecture in this crate and most code is shamelessly taken from bevy_godot, a similar crate for working with Godot 3 and gdnative. This crate will most likely be merged back into that one at some point.

Setup

  • Follow the steps outlined in the GDExtension setup

  • Add this line to your cargo dependencies (along with the godot dependency from GDextension setup):

[dependencies]
godot = { from gdext setup }
...
bevy_godot4 = { git = "https://github.com/jrockett6/bevy_godot4", branch = "main" }
  • Create a function that takes a &mut App and builds your bevy app, and annotate it with #[bevy_app]:
#[bevy_app]
fn build_app(app: &mut App) {
    app.add_system(my_system)
        .add_system(my_other_system)
}
  • Cargo build your project, and make sure the dll is found by Godot via the .gdextension file. You should now have the BevyApp node avaiable to you in the Godot editor (though you may need to restart the editor). You can now add this BevyApp node as a Godot autoload.

Features

At it's core, this crate is just a rust Godot node holding a bevy app that you can add as an autoload (singleton) in your Godot app.

This crate also provides utilities to be able to work with Godot's systems from within the Bevy framework, such as:

Godot nodes as components

ErasedGd is a Bevy component that holds Godot node instance id's. You can Query for these and get::<T: Node>() the node in your systems, e.g:

fn set_positions(mut erased_gds: Query<&mut ErasedGd>) {
    for mut node in erased_gds.iter_mut() {
        if let Some(node2D) = node.try_get::<Node2D>() {
            sprite.set_position(Vector2::ZERO)
        }
    }
}

Schedule systems for the _process or _physics_process frames

Use as_visual_system() and as_physics_system() to schedule your systems to run on the desired Godot frame, e.g:

app.add_system(set_positions.as_physics_system())

Preload godot PackedScene resources in bevy loading states, and spawn scenes as ErasedGd components

Godot scenes (.tscn files) can be "preloaded" (loaded in a dedicated Bevy loading State) in an AssetCollection with the use of bevy_asset_loader.

The scenes can then be queued for "spawning" (instantiate the PackedScene resource and add it to the Scene Tree) with the use of the GodotScene, e.g:

fn spawn_sprite(mut commands: Commands, assets: Res<MyAssets>) {
    commands.spawn(GodotScene::from_handle(&assets.sprite));
}

Checkout the examples folder for more.

You might also like...
tr-lang is a language that aims to bring programming language syntax closer to Turkish.

tr-lang Made with ❤️ in 🇹🇷 tr-lang is a language that aims to bring programming language syntax closer to Turkish. tr-lang is a stack based language

An experimental transpiler to bring tailwind macros to SWC 🚀

stailwc (speedy tailwind compiler) This is an experimental SWC transpiler to bring compile time tailwind macros to SWC (and nextjs) a-la twin macro. T

A bring-your-own-mutex version of once_cell.

generic_once_cell generic_once_cell is a generic no_std version of once_cell. Internal synchronization for initialization is provided as type paramete

Remember how cool smlinux was? It's now time to bring it back.

smbuilder Remember how cool smlinux was? It's now time to bring it back. What is smbuilder? In short, smbuilder (stylized as all lowercase) is an app

Bring the power of pre-signed URLs to your apps. Signway is a gateway for redirecting authentic signed URLs to the requested API
Bring the power of pre-signed URLs to your apps. Signway is a gateway for redirecting authentic signed URLs to the requested API

A gateway that proxies signed requests to other APIs. Check the docs for more info. If you are looking for the managed version checkout this link http

Bring your blog to Fediverse. [WIP]

Hatsu Bring your blog to Fediverse. [WIP] Development Hatsu is in the early stages of development, PR welcome. Setup # clone project git clone http

The ultimate Data Engineering Chadstack. Apache Airflow running Rust. Bring it.

RustOnApacheAirflow The ultimate Data Engineering Chadstack. Apache Airflow running Rust. Bring it. This is part of a larger blog post trying to do so

Specs - Parallel ECS

Specs Specs Parallel ECS Specs is an Entity-Component System written in Rust. Unlike most other ECS libraries out there, it provides easy parallelism

High performance Rust ECS library
High performance Rust ECS library

Legion aims to be a feature rich high performance Entity component system (ECS) library for Rust game projects with minimal boilerplate. Getting Start

A minimalist and safe ECS library for rust!
A minimalist and safe ECS library for rust!

The full ECS (Entity-Component-System) library. Support an Open Source Developer! ♥️ Composed of two smaller libraries: world_dispatcher: the System p

A tilemap rendering crate for bevy which is more ECS friendly.
A tilemap rendering crate for bevy which is more ECS friendly.

bevy_ecs_tilemap A tilemap rendering plugin for bevy which is more ECS friendly by having an entity per tile. Features A tile per entity Fast renderin

Creative Coding Framework based on Entity Component System (ECS) written in Rust
Creative Coding Framework based on Entity Component System (ECS) written in Rust

creativity creativity is Creative Coding Framework based on Entity Component System (ECS) written in Rust. Key Features TBA Quick Start TBA How To Con

ECS-friendly ldtk plugin for bevy, leveraging bevy_ecs_tilemap
ECS-friendly ldtk plugin for bevy, leveraging bevy_ecs_tilemap

bevy_ecs_ldtk An ECS-friendly ldtk plugin for bevy. Uses bevy_ecs_tilemap as a base. Not released yet, still in development. bevy_ecs_tilemap once sup

🤹‍ 2D sprite rendering extension for the specs ECS system

specs-blit 2D sprite rendering extension for the Specs ECS system. All sprites are loaded onto a big array on the heap. Example // Setup the specs wor

A collection of components and widgets that are built for bevy_ui and the ECS pattern

Widgets for Bevy UI A collection of components and widgets that are built for bevy_ui and the ECS pattern. Current State This was started recently and

Write Cross-platform application with React-like decralative UI framework and scalable ECS architecture all in Rust.

bevy_dioxus Dioxus Plugin for Bevy Write Cross-platform application with React-like decralative UI framework and scalable ECS architecture all in Rust

Learning Rust and ECS by implementing an emulator for Silkroad Online.

Skrillax Learning Rust and ECS by implementing an emulator for an MMORPG. Skrillax is my learning project for playing around with Rust, learning about

🏷️ Markers for Bevy ECS Entities

Bevy ECS Markers Adds the support for marking entites and fetching them in queries Example View the whole example here #[derive(EntityMarker)] enum Pl

Minimalistic implementation of entity kinds for Bevy ECS.

Bevy 💖 Kindly This crate is a minimalistic implementation of Kinded Entities for Bevy game engine. In summary, it allows the user to define, construc

Owner
JR
right gud code, plz
JR
Specs - Parallel ECS

Specs Specs Parallel ECS Specs is an Entity-Component System written in Rust. Unlike most other ECS libraries out there, it provides easy parallelism

Amethyst Engine 2.2k Jan 8, 2023
High performance Rust ECS library

Legion aims to be a feature rich high performance Entity component system (ECS) library for Rust game projects with minimal boilerplate. Getting Start

Amethyst Engine 1.4k Jan 5, 2023
A tilemap rendering crate for bevy which is more ECS friendly.

bevy_ecs_tilemap A tilemap rendering plugin for bevy which is more ECS friendly by having an entity per tile. Features A tile per entity Fast renderin

John 414 Dec 30, 2022
Creative Coding Framework based on Entity Component System (ECS) written in Rust

creativity creativity is Creative Coding Framework based on Entity Component System (ECS) written in Rust. Key Features TBA Quick Start TBA How To Con

Chris Ohk 9 Nov 6, 2021
🤹‍ 2D sprite rendering extension for the specs ECS system

specs-blit 2D sprite rendering extension for the Specs ECS system. All sprites are loaded onto a big array on the heap. Example // Setup the specs wor

Thomas Versteeg 8 Aug 14, 2022
🏷️ Markers for Bevy ECS Entities

Bevy ECS Markers Adds the support for marking entites and fetching them in queries Example View the whole example here #[derive(EntityMarker)] enum Pl

Chopped Studio 2 Dec 23, 2022
Minimalistic implementation of entity kinds for Bevy ECS.

Bevy ?? Kindly This crate is a minimalistic implementation of Kinded Entities for Bevy game engine. In summary, it allows the user to define, construc

null 10 Jan 26, 2023
A direct ecs to low-level server implementation for Godot 4.1

godot_ecs What if Godot 4.1 and Bevy got married? Well, you'd get one interesting duo of data driven goodness. In Development This crate is not produc

null 5 Oct 6, 2023
A simple type safety solution for Bevy ECS.

?? Moonshine Kind A simple type safety solution for Bevy ECS. Overview An Entity is a generic way to reference entities within Bevy ECS: #[derive(Comp

null 8 Nov 3, 2023
wecs (wckd-ecs) is a simple ECS library suitable for general use.

wecs wecs (wckd-ecs) is a simple ECS library heavily based on bevy_ecs. Motivation As part of my "Road to Rust GameDev" journey, I wanted to learn how

João Victor 9 Jul 2, 2023