This Week in Bevy

What happened this week in the Bevy Engine ecosystem

Links

Component Hooks, Quill UI Demo, and Procedural applications

2024-07-15

This week in Bevy we've got people making use of Observers and Hooks, first games, procedural generation and animation, and more.

The #rendering channel has been talking about technology like MaterialX. We'll see number of different UI showcases including bevy_ui, text-to-speech, and Quill. While other people are implementing papers and talks including destructible stress environment systems and water simulation.

Bevy game jam 5 theme voting is underway. You can sign up to participate here on Itch.io, vote on themes in the #jam-theme-voting Discord channel, and find a team to participate with in #jam-find-a-team.

The Bevy jam starts on the 20th so get your voting in if you want to and get ready to make a game!

Component Hooks

Bevy 0.14 introduced Component Hooks which enable upholding invariants when Components are added, inserted, and removed. Defining these hooks required forgoing the automatic deriving of the #[derive(Component)] and using a manual implementation.

As of #14005, new attributes have been added to the Component macro, which enable defining hooks as regular functions that are attached to an implementation using the new component attribute.

#[derive(Component)]
#[component(on_add = my_on_add_hook)]
#[component(on_insert = my_on_insert_hook)]
struct ComponentA;

fn my_on_add_hook(world: DeferredWorld, entity: Entity, id: ComponentId) {
    // ...
}

Uniform mesh sampling

#14071 enables random sampling from the surfaces of triangle meshes with a new Mesh::triangles method. The implementation of UniformMeshSampler caches the triangles' distribution of areas so that after its initial setup, sampling is allocation-free.

let triangles = my_mesh.triangles().unwrap();
let mut rng = StdRng::seed_from_u64(8765309);
let distribution = UniformMeshSampler::try_new(triangles).unwrap();
// 10000 random points from the surface of my_mesh:
let sample_points: Vec<Vec3> = distribution.sample_iter(&mut rng).take(10000).collect();

Fixed Timestep Movement

A new demo, physics_in_fixed_timestep how to properly handle player input, advance a physics simulation in a fixed timestep, and display the results. The classic source for how and why this demo exists the way it does is Fix your Timestep! and more bevy-centric fixed-timestep information is available in the Bevy Cheatbook. One especially useful section is the "Should I put my systems in Update or FixedUpdate" section.

Virtual Geometry

meshlets

Virtual Geometry work continues with mixed software/hardware rasterization. Its already much faster than hardware and there's plenty of opportunity for optimization. More information in the Discord thread

MaterialX

materialx

MaterialX is a rendering-related technology for well, materials. It recently got added to Blender's USD export (USD).

MaterialX has been getting a few mentions in the #rendering channel in the Bevy Discord lately, and an initial parser for the spec was created (discord link). The repo with the bevy loading example seen here lives on GitHub.

Whether or not MaterialX makes an impact on Bevy's Rendering implementation is yet to be seen, but for those that are interested there is some interesting development and discussion happening.

Automated feature testing

Testing all of the combinations of all of the different ways Bevy's features can be enabled or disabled in combination can be hard to do manually. Worked to automate this kind of testing can be found in the TheBevyFlock/flag-frenzy repo. This work-in-progress has already caught its first bug.

Showcase

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

quillquill color picker

Quill Demo

showcase

The latest demo for Quill, a reactive UI framework. Node graphs, rounded corners, color pickers, and more that are reminiscent of polished UIs like Blender's node graphs.

quartz

Quartz Spectral Delay

showcase

quartz v0.6.1 has rfft() and ifft() nodes (fourier transform) which enables spectral processing. In the video you hear the input signal analyzed, then each bin is delayed by a different time (spectral delay)

a capsule following a player

Avian Sensors and Observers

showcase

Avian physics sensors and collision events (CollisionStarted/Ended) used to power higher-level enter/exit region observer triggers. Allowing "follow player if close enough" behavior and generalizable to other ideas like stationary turrets with distant sensors.

rain world kelp creature

Rain World Kelp Creature

showcase

Rain World is known for its procedural animation. This demo recreates the kelp creature from Rain World using Avian physics.

mining ship 8space economy sandbox

space economy sandbox

showcase

An X4 map inspired space economy sandbox simulation. The code is available on GitHub under an AGPL3 license.

druid's quest

Druid's Quest

showcase

This puzzle game is the author's first. Published after 6 month's of work, push crates around as a Druid to solve puzzles. Downloadable for Windows on Itch.io.

procedural forest sundownprocedural forest

Procedural forest day/night cycles

showcase

This procedurally generated forest was built using Perlin noise from the noise crate and has a day/night cycle. It hosts 75k entities.

waving foliage

Waving Foliage for a Sandbox Voxel Game

showcase

Waving foliage implemented with a custom vertex shader that offsets the position over time. The code is on GitHub and the current build of the game is available in releases

shipship physicsloop

Scriptgrip's physics update

showcase

Scriptgrip is a ship physics based puzzle game that got some updates to its physics model this week resulting in smooth sliding on surfaces and no ghost collisions.

mappingsoptions

Menu text-to-speech

showcase

eerii/hello-bevy is a bevy game template that recently got key mappings and text-to-speech support. text-to-speech is powered by tts and works with keyboard and gamepad navigation. Navigation is powered by bevy-alt-ui-navigation-lite and a custom input system powered by leafwing-input-manager.

n puzzle with walls

N Puzzle with Walls

showcase

An n-puzzle with "stuck" tiles done as a final project for a computer science degree. The code is expected to be shared after submission, and in the meantime the game is downloadable on Itch.

plotter

Plots over debugging

showcase

Instead of logging out large amounts of data, this demo uses a custom plotter.log("Speed", speed) implementation to show graphs when things go wrong, allowing the introspection of large amounts of data.

water simulationshallow water

Water Simulation

showcase

More progress on the water simulation we saw last week. Including an implementation of the Phillips oceanographic spectrum in 2D using rustfft for the inverse fast-fourier transform on the CPU.

The diagnostics display on the shallower water is powered by iyes_perf_ui and more information available about the techniques used are available in the Discord thread.

buttonsslidersmenus

native bevy_ui

showcase

ui built with vanilla bevy_ui. The interactive audio is nice and thocky.

sky gradientunderground

sky gradient

showcase

A 2d tile-based game with a gradient in the sky. The line gizmos in this image showcase a chunking mechanism.

buildingstresswall

destruction system and stress simulation

showcase

Destructible environment based on a 2011 GDC talk by one of the developers of Red Faction Armageddon called "Living in a Stressful World: Real-time Stress Calculation for Destroyable Environments". The "stress" system is what causes hanging pieces to fall off since they weigh too much for the supporting pieces to hold.

html + css displayhtml rendering hyda

Hyda: HTML+CSS to Bevy UI

showcase

An in-progress demo for an HTML + CSS to bevy_ui system called Hyda. This demo shows off <h1>, <p>, <b>, and font-weight.

Crates

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

wgsl_ln

crate_release

Write wgsl in rust! With support for compile time error checking and global imports.

pub static MANHATTAN_DISTANCE: &str = wgsl!(
    fn manhattan_distance(a: vec2<f32>, b: vec2<f32>) -> f32 {
        return abs(a.x - b.x) + abs(a.y - b.y);
    }
);

bevy-autoplay

crate_release

Automated integration testing based on recorded play-testing sessions.

This plugin allows you to record playtest sessions, save them to a file, and then write feature/integration tests that assert against that session. This allows you to perform automated testing on real play sessions, including being able to test for regressions in a CI for example. The sessions can also be played back at a multiplied speed

bevy-translation-table

crate_release

Bevy Translation Tables is a crate for performing simple Key-Value translations with only the currently needed locale loaded into memory.

bevy_gltf_trait

crate_release

A fork of bevy_gltf, but customizable through a trait on load.

No devlogs this week
No Educational this week
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