2d Lighting, Particle Systems, Meshlets, and more
2024-04-01
Welcome to another week in the Bevy ecosystem!
This week we've got a number of 2d lighting examples, deep dives into GPU particles and bevy_ecs, as well as dialogue systems, and some exciting new Bevy merges.
Have you ever had trouble reading type errors? Argus is a trait debugger for Rust that was released this week, with first-class VSCode integration. Give it a try and see if it helps you identify system errors in your next Bevy App.
Multithreaded WASM
Bevy was designed to run well in parallel environments, but when targeting WebAssembly Bevy only runs single-threaded. This wasm multithreading PR takes a first step towards multithreading on WASM.
Meshlets
meshlets got merged as experimental behind a feature flag! This is in the same category as "nanite" and meant for scenes with so much geometry that a single triangle can be a single pixel. There was a lot of work put into this one over many months and there is still plenty of work to follow up on. Having this feature integrated into the codebase will make future collaboration on it easier.
Seeded Rng in CI
Its nice if CI runs of Bevy's examples are deterministic, which can make it easier to identify changes. This can be confusing to new users so its nice that there are now explanations where this approach is used.
Archetypes and EntityLocations
Under the hood Bevy uses the concept of Archetypes which are collections of entities that have the same set of components. The metadata structs (&Archetype
and EntityLocation
) implement QueryData
as of #12398
, which enables querying for this data in systems.
Miscellaneous
- A new 2d primitive, the Annulus was added to
bevy_math
. An Annulus is a ring: the space between two circles. - The Point trait also got moved, made a bit more generic, and is now named VectorSpace.
- Line Gizmos now implement solid and dotted styles.
- A new audio example shows off how to play a soundtrack with fade-in and fade-out.
- 2d meshes now support wireframes.
Alice's weekly Merge Train is a maintainer-level view into active PRs, both those that are merging and those that need work.
Showcase
Bevy work from the #showcase channel in Discord and around the internet. Use hashtag #bevyengine.
bevy_worldswap
showcase
bevy_worldswap is an experiment in swapping a Bevy App's World
at runtime. It currently uses a fork of Bevy, although there are a few PRs in trying to get back to depending on main.
3d character and environment
showcase
character, dungeon assets combine in this person's attempt to learn Bevy and Rust. It takes advantage of bevy_tnua for character control and bevy_hanabi for particles.
Drop match game
showcase
This showcase puts a twist on the popular drop match game, using different shapes, buffs, and debuffs. Its released on Android and has a YouTube video preview
Particles
showcase
An in-progress 2d particle-system plugin that calculates particles on the CPU before taking advantage of GPU instancing. One of the main goals is webgl support.
A later update included a custom particle material trait that enables you to add your own fragment shader to any particle spawner.
Uniform mesh sampling
showcase
This showcase plays with uniform mesh sampling for grass/vegetation placement. The Discord thread has a number of great suggestions for different algorithms and approaches including R2, a witness blogpost, and blue noise.
2d mining, crafting, and magic
showcase
The idea for this game is an ARPG with light survival mechanics. Classes, crafting, towns, questing, procedural dungeons, loot, skill tree style progression, etc. Single player or online with a party. So far its only been a few weeks of work.
The beautiful lighting is powered by a fork of bevy-magic-light-2d which includes a few changes.
soft-body simulation
showcase
The goal of these simulations is to build something like jelly car which has very bouncy physics. Currently collision resolution, internal springs, and internal gas pressure and all implemented and stable.
2.5D shmup
showcase
This 2.5D shoot 'em up (shmup), takes advantage of Blender_bevy_components_workflow to create some really nice intro animations. level-specific animations (or set-pieces) is one of the goals of the project.
Crates
New releases to crates.io and substantial updates to existing projects
space_editor 0.5
crate_release
space_editor enables the creation or modification of levels, scenes, and prefabs in gui based way.
0.5 brings support for sprites and animations, bevy_xpbd_2d, and a number of quality of life changes.
bevy_enoki first release
crate_release
The 2d particle system we saw showcased this week got a first crate release right at the end of the cycle. The Enoki particle system is a CPU-calculated particle system, that uses GPU Instancing and works well with wasm. It provides a material trait that lets you implement your own fragment shader. Additionally, spawner configuration are provided via ron files, which can be hot reloaded.
bevy_defer 0.8
crate_release
bevy_defer is an asynchronous runtime integrated with bevy. 0.8 brings:
- Push Resources or even &World onto thread local storage and get instant access.
- Cancellable async tweening
- React to with bevy_mod_picking states with signals.
Hexx 0.16.0
crate_release
hexx is a utility crate for working with hexagons.
The 0.16 release brings a complete rework of the edge/vertex direction system and the addition of Grid features with orientated vertices and edges. These grid features are particularly useful for strategy/building games on hexagonal maps.
Also notable is that hexx now has 12 bevy examples showcasing usage, making it easier to onboard to using the crate.
Educational
Tutorials, deep dives, and other information on developing Bevy applications, games, and plugins
YarnSpinner-Rust Tutorial
educational
YarnSpinner is a tool and textual format for constructing game dialogue. YarnSpinner-Rust is an integration of the tool for Bevy.
This tutorial covers using YarnSpinner's basic features including hooking into events, displaying dialogue lines when requested.
How to deploy Bevy to Android and WASM
educational
This tutorial covers building and deploying Bevy to Android and WASM (itch.io) targets.
A Tour of bevy_ecs
educational
Bevy has a number of different crates and it can be hard to get a deep view into what each one is doing. This post dives into the 0.12.1 version of bevy_ecs
and covers entities, archetypes, tables, queries and more.
Add iOS to synchronous_pipeline_compilation docs authored by JMS55
fix: make WebGPU shader work again authored by pietrosophya
FIX12527: Changes to make serde optional for bevy_color authored by mghildiy
Support calculating normals for indexed meshes authored by tygyh
Remove unnecessary executable flags from Rust source files authored by mamekoro
Add `Annulus` primitive to `bevy_math::primitives` authored by Chubercik
Restore pre 0.13.1 Root Node Layout behavior authored by StrikeForceZero
fix: correctly handle UI outline scale authored by notmd
Gizmo line styles authored by solis-lumine-vorago
Get Bevy building for WebAssembly with multithreading authored by kettle11
Fix fetching assets in Web Workers authored by allsey87
Meshlet rendering (initial feature) authored by JMS55
Set the logo and favicon for all of Bevy's published crates authored by james7132
Remove duplicate cfg(wasm32) attribute authored by aj377
Added an `init_bundle` method to `World` authored by 13ros27
Add padding to new text in `ui` example authored by rparrett
bevy_reflect: Rename `UntypedReflectDeserializer` to `ReflectDeserializer` authored by MrGVSV
Adding explanation to seeded rng used in examples authored by andristarr
rename `debug_overlay` to `ui_debug_overlay` in bevy_dev_tools authored by matiqo15
Add entity id to hierarchy propagation error message authored by cBournhonesque
Fix CI for wasm atomics authored by james7132
Fix `Ord` and `PartialOrd` differing for `FloatOrd` and optimize implementation authored by Kanabenki
Forbid unsafe in most crates in the engine authored by james7132
Move FloatOrd into bevy_math authored by OneFourth
Math tests fix authored by bugsweeper
Implement `From<Vec2>` for `AspectRatio` authored by mamekoro
Move `Point` out of cubic splines module and expand it authored by mweatherley
Allow converting mutable handle borrows to AssetId. authored by andriyDev
fix example mesh2d_manual in wasm/webgl2 authored by mockersf
Add Debug to Has Query type authored by Testare
Fix TypeRegistry use in dynamic scene authored by cBournhonesque
updated audio_source.rs documentation authored by Remi-Godin
Remove redundant doc_auto_config authored by james7132
Move PanicHandlerPlugin into bevy_app authored by gabrielkryss
Fix unhandled null characters in Android logs authored by james7132
Implement QueryData for &Archetype and EntityLocation authored by james7132
Update image requirement from 0.24 to 0.25 authored by mnmaita
Programmed soundtrack example authored by Remi-Godin
Clean up WinitWindows::remove_window authored by UkoeHB
Update the `Children` component of the parent entity when a scene gets deleted authored by cBournhonesque
Make PersistentGpuBufferable a safe trait authored by james7132
Fix `Triangle2d`/`Triangle3d` interior sampling to correctly follow triangle authored by mweatherley
Implement Clone for ManualEventReader authored by james7132
Add QueryState::contains, document complexity, and make as_nop pub(crate) authored by james7132
Fix ambiguities causing a crash authored by s-puig
Move accessibility setup to accessibility module authored by UkoeHB
Add Clone to WinitSettings authored by UkoeHB
Support wireframes for 2D meshes authored by msvbg
Pack the `StandardMaterialKey` into a single scalar instead of a structure. authored by pcwalton
Torus benchmark authored by gibletfeets
Remove `InstanceId` when Scene Despawn authored by 341101
Fix crash on Linux Nvidia 550 driver authored by eero-lehtinen
Added a small comment to post_processing example with instructions on how to make it work for 2d authored by agiletelescope
Add `AsyncSeek` trait to `Reader` to be able to seek inside asset loaders authored by BeastLe9enD
Remove VectorSpace impl on Quat authored by vertesians
Vectorize reset_view_visibility authored by james7132
Improve performance by binning together opaque items instead of sorting them. authored by pcwalton
Store only the IDs needed for Query iteration authored by james7132
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.
Pull Requests Opened this week
0.13.1 Root Node `style.position_type` not set to `Position::Absolute` regression warning authored by StrikeForceZero
Use same docs, for CI and deployment authored by ameknite
fix: avoid wasm panic without GL context (WebGL2 only) authored by pietrosophya
Add `Tetrahedron` primitive to `bevy_math::primitives` authored by Chubercik
ignore lost surface error on exit for xwayland authored by deltanedas
Meshing for `Triangle3d` primitive authored by mweatherley
Error info has been added to LoadState::Failed authored by bugsweeper
Support window-independent scaling for text authored by floppyhammer
add `ExtractEventPlugin` for extracting events to the render world authored by atornity
fix: incorrect sprite size for aabb when sprite has rect and no custom_size authored by MarcoMeijer
Meshing for `Annulus` primitive authored by mweatherley
Add `World::run_system_set` to run only the systems in a `SystemSet` authored by cBournhonesque
Fix UI border artifacts caused by incorrect blending authored by floppyhammer
reexported image crate from bevy_render as bevy::render::util::image authored by stinkytoe
2D top-down camera example authored by theredfish
Meshlet continuous LOD authored by JMS55
Manual SystemState + SystemMeta ref methods authored by ecoskey
Add the annulus shape to the `2d_shapes` example authored by Chubercik
Normalization anchor for sprite slice in dimensions of this slice authored by bugsweeper
FSR 2.2 temporal upscaling and antialiasing authored by JMS55
Uniform mesh sampling authored by mweatherley
Clarify that the plugin registry doesn't work inside Plugin::finish and Plugin::cleanup authored by cBournhonesque
Update glam version requirement from 0.25 to 0.27 authored by mnmaita
Synchronize system states to world changes in the winit loop authored by UkoeHB
Refactor non-eventloop setup logic from WinitPlugin into WinitCorePlugin authored by UkoeHB
Export CachedWindow authored by UkoeHB
Generate `MeshUniform`s on the GPU via compute shader where available. authored by pcwalton
Moves intern and label modules into bevy_ecs authored by mnmaita
Implement gamepads as entities authored by s-puig
Don't make an AssetServer in AssetPlugin if one already exists authored by UkoeHB
Avoid reallocations of access buffers when updating archetypes authored by james7132
Micro-optimize `queue_material_meshes`, primarily to remove bit manipulation. authored by pcwalton
Implement Auto Exposure plugin authored by Kurble
[bevy_ui/layout] Replace unwrap, expect, and panic with Result authored by StrikeForceZero
Equirectangular skybox authored by solis-lumine-vorago
Refactor primitive meshing authored by gibletfeets
Dynamic Component Id type authored by ecoskey
Tie accesskit root nodes to winit's WindowId instead of window entity authored by UkoeHB
[bevy_ui/layout] Extract UiSurface to its own file authored by StrikeForceZero
[bevy_ui/layout] Update tests to get GlobalTransform properly authored by StrikeForceZero
[bevy_ui/layout] Adds tests and missing asserts to UiSurface authored by StrikeForceZero
[bevy_ui/layout] UiSurface update internal mappings authored by StrikeForceZero
Issues Opened this week
IOS Audio stops if user switches receives a call authored by Braymatter
Make `Typed`, `TypePath`, `GetTypeRegistration`, etc etc supertraits of `Reflect` authored by SkiFire13
Consider re-exporting image crate authored by stinkytoe
WASM: let the app work if the GL context is lost authored by beoboo
Sliced scaling does not play well with `Anchor` authored by Cyborus04
Frame rate drop caused by high polling rate mouse authored by benkyoujouzu
`AudioSource` docs should mention that you need to enable features authored by alice-i-cecile
Introduce an `app::run_system_set()` function authored by cBournhonesque
Revert "Support calculating normals for indexed meshes" authored by alice-i-cecile
Make an example for bevy_ui gizmos layout overlay authored by pablo-lua
Split apart and reorganize gizmo examples authored by alice-i-cecile
UI Borders leave artifacts authored by asafigan
[iOS Simulator] 0.13.1 regression: calling requestReviewInScene stops app ticking authored by extrawurst
2D shapes demo renders all shapes with same color on Dx12 backend authored by ByteNybbler
wasm: Page shows behind skybox when skybox brightness is low authored by rparrett
Windows 11 Unable to find a GPU (with workaround using DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1) authored by Clonkex
Sprite with rect and custom anchor doesn't render when it should authored by MarcoMeijer
Loading an asset and one of its subassets causes two loads of the same asset to occur. authored by andriyDev
Fix bevy plugin dependency crashes authored by s-puig
Upstream `bevy_command_non_send` authored by BD103