Rust Conf, Space Games, and UI crates
2024-09-16
Back from Rust Conf its time to catch up on another week in Bevy!
A Bevy meetup happened in-person at Rust Conf featuring Tiny Glade demos and a Q&A session from Alice, and there was a Bevy talk “Shooting Stars! Livecode a Game in 30 Minutes” presented at the conference. Videos will go out sometime in the future.
The community also responded to Bevy's 4th birthday post this week. The posts were collected in the Community Reflection on Bevy's Fourth Year post on the Bevy blog including Alice's Dream Job post and more from the community.
Assets
Asset documentation is getting a boost in a number of PRs (including #15057 (AssetMode)) and with that newfound clarity some modifications are being made as well. In #15090 the LoadAndSave
asset processor was deprecated and replaced with LoadTransformAndSave
, with IdentityAssetTransformer
being a nice tag along.
AspectRatio
#15091 improves AspectRatio with a few new constants: SIXTEEN_NINE
(16:9), FOUR_THREE
(4:3), ULTRAWIDE
(21:9), and some great error messages. These are used under the hood for various image and projection use cases and can also be used standalone.
UiImage rect
2d rendering and UI get closer together as UiImage
gets a rect
field, allowing the selection of areas of an image. There's a full demo in the PR for this one.
Ui Material border
#15120 adds to the ui/ui_material
example by drawing a border in a UiMaterial using the uv coordinates and a fragment shader.
StateScoped Events
#15085 added state scoped events that will be automatically cleared when exiting a state. Useful when you want to guarantee clean state transitions. Currently you can add events with add_event
.
fn setup(app: &mut App) {
app.add_event::<MyGameEvent>();
}
In 0.15 you will be able to add a state-scoped event, which will cause events to be automatically cleared when exiting a state.
fn setup(app: &mut App) {
app.add_state_scoped_event::<MyGameEvent>(GameState::Play);
}
Observers
#15066 adds an observer
function to the Trigger
type that is required to be the first argument in an Observer. This returns the entity observing the triggered event, which in turn would allow an Observer to delete itself.
fn my_observer(trigger: Trigger<MyEvent>, mut commands: Commands) {
if trigger.event().done {
commands.entity(trigger.observer()).despawn();
return;
}
}
Projections
The OrthographicProjection
default values have been oriented around 3d for awhile now, with the 2d defaults being set by the Camera2dBundle
default instead. This has caused 2d users to need to re-define the near and far clipping plane values when setting other fields like OrthographicProjection::scale
.
There is no good near and far values that work for 2d and 3d at the same time, so in #15073, the default was split into default_2d
and default_3d
.
There's also a new projection_zoom example showing off Orthographic and Perspective zooms and the orbiting example now lives in camera/camera_orbit
EntityRef::components
#13127 describes new methods for fetching components focusing on a specific ergonomic approach: accessing components related to an Entity
more directly.
#15089 implements ready-only access in this way on EntityRef
.
let (transform, player) = world.entity(entity).components::<(&Transform, &Player)>()
More triangles/vertices per meshlet
In #15023 meshlets gained an increase in max vertices/triangles from 64/64 to 255/128. This results in a greater percentage of triangles with a maximum triangle count (128).
As usual the PR has great descriptions of what tradeoffs are being made and additional details.
Alice's 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.
Procedurally Generated Terrain
showcase
bevy_terrain_test is terrain deformation with splines and shapes.
Project Harmonia: editing, undo, and redo
showcase
Project Harmonia added the ability to edit and remove previously spawned walls, along with an undo/redo system.
The undo/redo system implementation is linked in the Discord thread.
4-up cameras
showcase
Early problem solving for a future Bevy app: 4 viewports and bevy_panorbit_camera plugin for the orbiting.
Stars and Planets
showcase
A screenshot from Cosmos: A multiplayer block-based space exploration game in active development. The skybox was enabled by spacescape
Generic stat tracking
showcase
An unreleased crate that powers arbitrary stat collection that can be modified through commands or events. The crate can be used to track player play time, enemies defeated, crops planted, games won, different types of crops harvested, etc
commands
.entity(entity)
.modify_stat::<EntityStats>(
EnemiesKilled,
ModificationType::add(5u64)
);
Untold Dawn
showcase
After several months of hard work, Untold Dawn is getting ready to open for pre-alpha this October 5. Untold Dawn is a next-generation Role-Play Intensive (RPI) Multi-User Dungeon (MUD) game developed in Rust, using Bevy as its engine.
MUDs are multiplayer, persistent text-based games, which can trace their origins back to 1975. They are played through telnet or dedicated MUD clients, making them ideal to work on nearly any device without requiring any graphics cards or the like. If your device is connected to the internet, it's very likely you can play a MUD.
devlogs are also available.
Fast fracture simulation
showcase
Morningstar is a fast dynamic fracture using position-based rod-bonded discrete method. Links to the relevant PDFs are available in the GitHub repo.
Marching cubes or Surface Nets?
showcase
This demo started out using the Marching Cubes algorithm before trying out a new Surface Nets based approach using fast-surface-nets-rs
.
Surface Nets is an algorithm for extracting an isosurface mesh from a signed distance field sampled on a regular grid.
Cars on Destructible Planets
showcase
The large-scale destruction of planets using user-driven choices. Following the decimation of the planet, a car drives around the planet and can fall off into the gaps that were created.
More updates were posted in a Discord thread later this week.
Radiance Cascades and bevy_motiongfx
showcase
A demo of bevy_radiance_cascades combined with bevy_motiongfx.
Crates
New releases to crates.io and substantial updates to existing projects
unbug
crate_release
unbug provides programmatic breakpoint macros in a similar fashion to some of the asserts in Unreal engine. Breakpoints require nightly Rust and the core_intrinsics feature.
avian_interpolation
crate_release
Ever had your character jitter around when making the camera follow them? Is your game using Avian
sliiiightly choppy whenver something moves? avian_interpolation
may be for you!
If you use Avian physics and don't directly mutate any rigid body's Transform
manually, adding this plugin will automagically make stuff smoother for you.
Note that this was developed for the coming Avian release and as such depends on Avian's main
branch until then. This also means no crates.io release until then.
bevy_rustysynth
crate_release
bevy_rustysynth allows you to play MIDI files and soundfonts in your game! The demo in Discord has some scary monsters and nice sprites.
Unify crate-level preludes authored by BD103
More triangles/vertices per meshlet authored by JMS55
remove cfg-check in ci tool authored by mockersf
Fix error link authored by rparrett
Register reflect type `CursorIcon` authored by eero-lehtinen
Fix comment in example authored by AlexanderStein
Split OrthographicProjection::default into 2d & 3d (Adopted) authored by Azorlogh
bevy_reflect: Refactor `serde` module authored by MrGVSV
Deprecate `LoadAndSave` Asset Processor authored by bushrat011899
Add common aspect ratio constants and improve documentation authored by miniex
Add rect field to UI image authored by MarcoMeijer
Retrieve the `stack_index` from `Node` in `extract_ui_material_nodes` instead of walking `UiStack` authored by ickshonpe
Use associated type bounds for `iter_many` and friends authored by tim-blackbird
Add `observer` to `Trigger` authored by bushrat011899
Add a border to the UI material example authored by ickshonpe
bevy_reflect: Update `on_unimplemented` attributes authored by MrGVSV
Add state scoped events authored by UkoeHB
EntityRef/Mut get_components (immutable variants only) authored by ItsDoot
honour NoFrustumCulling for shadows authored by robtfm
Fix Welcome Contributors CI authored by DasLixou
Fix `AsBindGroup` sampler validation. authored by tychedelia
Remove remnant `EntityHash` and related types from `bevy_utils` authored by ItsDoot
Simplify `pick_rounded_rect` authored by CrazyboyQCD
Remove deprecated `SpriteSheetBundle` and `AtlasImageBundle` authored by benfrankel
Add basic docs to AssetMode authored by alice-i-cecile
Sorts the scene entries by path before serializing. authored by Wiwip
Add convenience methods for constructing and setting storage buffer data authored by tychedelia
Make QueryFilter an unsafe trait authored by chescock
Replaced implicit emissive weight with default. authored by dragostis
Add set_state extension method to Commands authored by UkoeHB
bevy_reflect: Contextual serialization error messages authored by MrGVSV
ui material node border calculations fix authored by ickshonpe
Remove OrthographicProjection.scale (adopted) authored by richchurcher
Add examples for orthographic and perspective zoom authored by richchurcher
Fix screenshot example authored by akimakinai
Enhance ReflectCommandExt authored by miniex
bevy_pbr: Make choosing of diffuse indirect lighting explicit. authored by cryscan
Split zoom/orbit into separate examples authored by richchurcher
bevy_reflect: Mention `FunctionRegistry` in `bevy_reflect::func` docs authored by MrGVSV
Remove `ReceivedCharacter` authored by chompaa
Improve first person camera in example authored by janhohenheim
Rename rendering components for improved consistency and clarity authored by Jondolf
fix spelling mistake authored by ickshonpe
Trim cosmic-text's shape run cache authored by UkoeHB
Fix typo in bevy_reflect/src/reflect.rs authored by mamekoro
Finish enhancing `ReflectCommandExt` to work with Bundles authored by Niashi24
Fix "game_menu" example buttons not changing color on Interaction authored by K-JBoon
Removed Type Parameters from `Observer` authored by bushrat011899
`TrackedRenderPass` internal tracking state reset authored by PPakalns
Fix mesh 2d non indexed draw. authored by tychedelia
Micro typo in `bevy_ecs` authored by RobWalt
2580 Split examples PR feedback authored by richchurcher
bevy_reflect: Add `DynamicTyped` trait authored by MrGVSV
ParsedPath::try_from<&str> authored by crvarner
Reccomend using `AssetPlugin.file_path` instead of CARGO_MANIFEST_DIR authored by Wcubed
Remove border radius scaling authored by ickshonpe
Optimize observer unregistration authored by SpecificProtagonist
Added ordering information to observer tests (#14332) authored by Wcubed
Improve schedule note of .after/.before & encourage to use .chain ins… authored by kivi
Fix `Capsule2d::sample_interior` authored by Jondolf
Reflected traits for resources and components: bevy_a11y authored by blazepaws
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
Improve type inference in `DynSystemParam::downcast()` by making the type parameter match the return value. authored by chescock
Reorganize SystemParamBuilder docs and examples. authored by chescock
Clear view attachments before resizing window surfaces authored by akimakinai
Migrate `#[allow(...)]` to `#[expect(...)]` authored by BD103
bevy_reflect: Add `FunctionRegistry::call` authored by MrGVSV
bevy_reflect: Automatic arg count validation authored by MrGVSV
Add a `TimedCommands` `SystemParam` authored by ItsDoot
Add examples for runtime manipulation of asset handles (WIP) authored by richchurcher
Add `Mutated` query filter and `DetectChanges::is_mutated` authored by ItsDoot
bevy_reflect: Deserialize dynamics authored by MrGVSV
Add missing insert API commands authored by crvarner
Visibility range takes the model aabb into acount authored by JoNil
use precomputed border values authored by ickshonpe
Enable `clippy::check-private-items` so that `missing_safety_doc` will apply to private functions as well authored by 13ros27
Use `HashTable` in `DynamicMap` and fix bug in `remove` authored by SkiFire13
Do not re-check visibility or re-render shadow maps for point and spot lights for each view authored by coreh
Enable/disable UI anti-aliasing authored by patrickariel
Rotation api extension authored by RobWalt
Increase border_rect for TextureSlicer to match image authored by tjlaxs
Use `FromReflect` when extracting entities in dynamic scenes authored by yrns
UI material border radius authored by ickshonpe
Choose more descriptive field names for `ReserveEntitiesIterator` authored by RobWalt
Fixing text sizes for examples authored by tjlaxs
System param for dynamic resources authored by chescock
Support systems that take references as input authored by ItsDoot
bevy_reflect: Add `Function` trait authored by MrGVSV
box shadow authored by ickshonpe
Fix bevy_picking sprite backend panic in out of bounds atlas index authored by s-puig
Add Transform Helper methods authored by Bayslak
Add various methods to get reflected components from `EntityRef` & friends authored by SkiFire13
Additive blending within animation graphs authored by aecsocket
Rename push children to add children authored by nealtaylor98
Issues Opened this week
`add_child` and `push_children` are inconsistently named authored by alice-i-cecile
Use `OnAdd` hooks to verify that state-scoped entities are only spawned during the correct state authored by alice-i-cecile
`AssetServer::is_loaded_with_dependencies` should return a `LoadState`. authored by alice-i-cecile
Rename `List::iter` and friends to avoid auto-import conflicts authored by MrGVSV
Add support for letterboxing authored by alice-i-cecile
Add a `TimedCommands` `SystemParam` for easier delayed operations authored by ItsDoot
Direct users to commands.set_state instead of NextState authored by alice-i-cecile
Main branch fails to compile on Rust beta. authored by github-actions[bot]
Rename `EntityCommands::add` to `EntityCommands::queue` authored by janhohenheim
Add missing insert APIs for predicates authored by janhohenheim
non-root `TargetCamera`s are not ignored authored by ickshonpe
When using multiple canvas, an error is displayed authored by zhuliang198754
different wgpu_backend render total different with the same gltf model authored by ChenHuaYou
Remove `StateTransition` schedule in favor of using observers authored by alice-i-cecile
Resource doesn't get dropped on panic in system. Is this expected? authored by navneetankur
Instance example magically inherits transform information of a random entity if any number of new pbr bundles is spawned authored by Cazadorro
overflow evaluating the requirement &_: IntoIterator authored by ShadowMitia
ImageAddressMode::Repeat "twitchy" texture rendering authored by IvoryDuke
bevy_ptr: unused align_of import in release mode authored by JMS55
Mention `DynamicTyped` in docs authored by MrGVSV
On Steam Deck in gaming mode the screen does not update authored by tad-lispy
Reflect derived traits on all components and resources authored by blazepaws
Make `reflect::Map::drain` and `reflect::List::drain` take a mutable borrow instead of `Box<Self>`. authored by andriyDev
overlapping viewport from different camera causes over-culling of entity rendering authored by JonnyPower
`HeadlessPlugins` for headless apps, rather than `MinimalPlugins` authored by Aceeri
`RenderTarget::Image` doesn't support `Rgba8Unorm` and `Bgra8Unorm` texture formats (non-srgb formats) authored by MatrixDev
Text wiggle in text_debug example authored by tjlaxs
The program statements in the novice tutorial are no longer applicable in the latest version. It is recommended to modify them | 新手教程中的程序语句在最新版本中不在适用,建议修改。 authored by molinghu