This Week in Bevy

What happened this week in the Bevy Engine ecosystem

Links

Fallible Systems, Bindless, and Immutable Components

2024-12-09

Now that Bevy 0.15 is out, the PRs that were stacking up behind the release candidate are merging at a fast pace, making this week a very exciting week. Changes that stack up like this and don't make it into a release candidate tend to be interesting features and we really do have an interesting batch.

The Bevy Remote Protocol really struck a chord and has already inspired game debugging prototypes for emacs, neovim, egui, and more.

Half of Pounce Light, the makers of Tiny Glade, gave a talk on their rendering technology at the Graphics Programming Conference titled "Rendering Tiny Glades With Entirely Too Much Ray Marching".

tiny glade talk

Fallible Systems

Systems in Bevy have historically generally returned unit: () and as a consequence, typical error handling used in other areas, like using ? to return errors, hasn't seen as wide of a use at the system level as it could. #16589 details some of the alternative options currently available as well as introducing systems that can return Result.

app.add_systems(my_system)

fn my_system(window: Query<&Window>) -> Result {

    let window = query.get_single()?;
    // ... do something to the window here
    Ok(())
}

This is an early step towards some big plans for the future of error handling in Bevy.

Rendering

Multidraw for opaque meshes

#16427 adds support for multidraw, which is a feature that allows multiple meshes to be drawn in a single drawcall.

There are a number of restrictions for when this happens currently, such as only being implemented for opaque 3D meshes, so be sure to read the PR which has a great set of explanations for how you can take advantage of it and where the feature is headed in the future.

Bindless in AsBindGroup

#16368 adds the infrastructure required to support bindless resources in AsBindGroup. The #[bindless(N)] attribute specifies that, if bindless arrays are supported on the current platform, each resource becomes a binding array of N instances of that resource. A new example shader_material_bindless shows off the approach.

// `#[bindless(4)]` indicates that we want Bevy to group materials into bind
// groups of at most 4 materials each.
#[derive(Asset, TypePath, AsBindGroup, Debug, Clone)]
#[bindless(4)]
struct BindlessMaterial {
    // This will be exposed to the shader as a binding array of 4 *storage*
    // buffers (as bindless uniforms don't exist).
    #[uniform(0)]
    color: LinearRgba,
    // This will be exposed to the shader as a binding array of 4 textures and a
    // binding array of 4 samplers.
    #[texture(1)]
    #[sampler(2)]
    color_texture: Option<Handle<Image>>,
}

Immutable Components

With the advent of Observers and Hooks in Bevy 0.14 a question was quickly asked about a potential OnMutation event. Implementing this event contains certain challenges around performance but being able to use hooks and observers to guarantee that values are always up to date is still useful.

#16372 introduces immutable components which through preventing exclusive references enable fully capturing all values, since changes to values can only happen via removal (OnRemove) or replacement (OnInsert).

#[derive(Component)]
#[component(immutable)]
struct Foo {
    // ...
}

Box shadows

box shadows

Bevy 0.15 brought box shadows to UI, and now we have support for multiple box shadows. This is a technique used on the web to create better looking shadows.

StateScoped Entities derive

Bevy supports scoping entities to specific states. Previously to enable that you had to call App::enable_state_scoped_entities::<Scene>() when building the application. As of #16180, this is now available as a derive when deriving States and SubStates.

#[derive(Clone, Eq, PartialEq, Debug, Hash, Default, States)]
#[states(scoped_entities)]
enum MyStates {
    #[default]
    AssetLoading,
    Next,
}

bevy_input_focus

Keyboard focus is a critical component to user interface design, and #15611 introduces a new crate, bevy_input_focus, which includes a resource to tracking which entity has focus, methods for getting and setting keyboard focus, and a system for dispatching keyboard input elements to the focused entity.

Entity Cloning

#16132 adds an initial implementation of entity cloning, which is a new clone_entity command creates a clone of an entity with all components that can be cloned.

Performance optimizations are coming in followup PRs.

Misc

no_std

bevy_color, bevy_reflect, and bevy_math all got no_std support added!


Alice's Merge Train is a maintainer-level view into active PRs, both those that are merging and those that need work.

Alice also recently started a dogfooding game project currently called "Mischief in Miniature".

Showcase

Bevy work from the #showcase channel in Discord and around the internet. Use hashtag #bevyengine.

rusteroids

Rusteroids

showcase

Rusteroids is a minimalist, pixel art, Asteroids-like space shooter and is the author's first attempt as Rust and Bevy.

Source is available on GitHub

motion matching

Motion Matching demo

showcase

A motion matching demo of a (not yet production ready) implementation of motion matching.

console ui

bevy console screen

showcase

This console implementation has text and level filtering, deduplication, messages show call traces when hovered, and more.

retroid pocket mini

Retroid Pocket Mini

showcase

An experiment in running a Bevy app on a Retroid Pocket Mini. Its an Android-based 960p display and has working touch controls.

raymarched squid creaturesraymarched squid creatures

squid creatures terrain

showcase

This squid creature environment got an update to the terrain generation. the "grass" is a GPU buffer full of positions+normals and then a few blades of grass are generated for each element in a vertex shader.

lumina

Lumina

showcase

Lumina is a fast paced online multiplayer game that takes advantage of Radiance Cascades for 2d illumination.

water and tile textures

Water and Tile texturing

showcase

New water and a new approach to texturing tiles for Architect of Ruin.

flowfield debug display

Flowfield pathfinding

showcase

A demo for a new flowfield-based pathfinding crate meant to support RTS group movement and control. This demo showcases the debug UI and controls.

sync drift

sync drift

showcase

Sync Drift is an interesting single-button two player game where player 1 (left shift) and player 2 (right shift) team up to control the direction of a ship. It was made in one night (and the next morning) for the 1-Button Jam.

bevy remote protocol neovim

bevy remote protocol in neovim

showcase

A bevy remote protocol inspector prototype, this time in neovim.

space orbitsplanets

bevy spacesim

showcase

bevy_spacesim is an open-source solar system simulation that has been upgraded to Bevy 0.15 and now takes advantage of 0.15 features like chromatic aberration. The new version also takes advantage of multi-threading in the orbit update system which means you can now fast-forward 1000x to see the planets wizz by

brp egui

bevy remote inspector

showcase

An egui-based bevy remote protocol experiment.

minecraft in bevy

Recreating Minecraft in Bevy

showcase

A project focused on recreating Minecraft using Bevy.

The game is currently fully functional with

  • Biomes
  • Multiplayer
  • Block breaking and placing mechanics
  • An inventory system with a working hotbar
bevy_hui widgets

bevy_hui widgets

showcase

a prototype bevy_hui optional widget subcrate. The Idea is to provide just the bevy logic to make a widget work, for as long as your Template uses the defined hierarchy.

<node on_spawn="init_slider" tag:axis="x" >
    <button position="absolute">
        <slot />
    </button>
</node>
hierarchical pathfinding

Hierarchical Pathfinding Demo

showcase

This is an in-progress hierarchical pathfinding crate called bevy_northstar

brp in emacs

BRP in Emacs

showcase

Bevy Remote Protocol in Emacs. This list is showing all the entities with a Name component as well as their other components.

Crates

New releases to crates.io and substantial updates to existing projects

Bevy Replicon 0.29.0

crate_release

Bevy Replicon is a crate for server-authoritative networking. 0.29 brings API improvements intended to better support rollback-style networking crates. A number of dependent crates have also updated as a result.

iyes_progress 0.13.0

crate_release

iyes_progress'a goal is to help you implement loading screens where you might have all kinds of things happening (beyond just loading assets), such as custom systems to set up your map/game/multiplayer/whatever. Your systems can report their progress every time they run and iyes_progress will transition your app state for you when everything is ready. It can also give you the cumulative values so you can create a progress bar or other UI indicator.

0.13 is a major overhaul/rewrite of the crate. There is a migration guide in the repo.

jammars empty mapjammars generated map

jammars

crate_release

Introducing jammars: A rust-based partial MarkovJr implementation that uses grammars to do procedural generation.

bevy_ios_iap 0.5.0

crate_release

bevy in-app-purchase now supports subscriptions in 0.5 and exposes native APIs via observers.

leptos-bevy-canvas

crate_release

"Embed an idiomatic Bevy app inside your Leptos app."

This crate provides a BevyCanvas component for embedding Bevy applications and provides tools to help Bevy and Leptos communicate.

The crate is compatible with Bevy 0.15 as well as Leptos' recent 0.7 release.

bevy_ios_gamecenter 0.3.0

crate_release

Bevy Plugin and Swift Package to provide access to iOS native Gamecenter from inside Bevy. 0.3 brings a new observer-based API

bevy_transform_interpolation

crate_release

Gameplay systems and physics simulations often use a fixed timestep for consistent, frame rate independent behavior. However, this can lead to visual stutter when the timestep doesn't match the display refresh rate. bevy_transform_interpolation is a drop-in Transform interpolation solution for fixed timesteps in Bevy 0.15

bevy_heavy

crate_release

bevy_heavy is a crate for computing mass properties (mass, angular inertia, and center of mass) for the 2D and 3D geometric primitives in Bevy's math crate, bevy_math. This is crucial for things like accurate physics simulations.

No devlogs this week

Educational

Tutorials, deep dives, and other information on developing Bevy applications, games, and plugins

How to make a triple AAA game in rust? Playlist

educational

This tutorial series covers how to make a networked game with functional physics. There are a number of videos already added to the playlist and seemingly more to come.

Pull Requests Merged This Week
Contributing

Want to contribute to Bevy?

Here you can find two types of potential contribution: Pull Requests that might need review and Issues that might need to be worked on.

How do I contribute?

Pull Requests Opened this week

Issues Opened this week