Hi #opensource #rust #gamedev s :) It's Monday morning, which means it's time for a quick #bevymergetrain. There's a good chance I punt some of the higher risk PRs for next week: more time to bake on main is often very effective for sanding off the rough edges (bugs, docs, API cleanup).
8 PRs are ready this week, one of which is even in the milestone: let's take a look! https://github.com/bevyengine/bevy/pulls?q=is%3Aopen+is%3Apr+label%3AS-Ready-For-Final-Review+-label%3AS-Controversial+-label%3AS-Blocked+-label%3AS-Adopt-Me+
1. https://github.com/bevyengine/bevy/pull/11498
Shuffling some types around: `EntityHashMap`, our extra-fast hash map specifically designed to hash `Entity` keys quickly, should probably live in `bevy_ecs`, since, you know, that's where `Entity` is defined. Makes sense to me.
James tried to merge this yesterday, but it failed due to CI: this is why you check default features. Been fixed up since (thanks SkiFire13 for the help in reviews!): sanity checking and merging.
2. https://github.com/bevyengine/bevy/pull/11622
Ah, `bevy_dynamic_plugin`, one of the darkest and most forgotten corners of Bevy. Dynamically reload Rust code, but neglected and probably UB. I still think we should rip this out and tell devs to use `dextrous_developer` instead for safer(slightly) and more featureful hot reloading, but eh.
Anyways, `unsafe_op_in_unsafe_fn` is a great lint. I wish this was mandatory behavior! Safety comments look sensible, and this is a clear improvement. Merging.
3. https://github.com/bevyengine/bevy/pull/11687
A niche but helpful and simple little ECS feature: temporarily pretend like your code is running in the past! (For the purpose of change detection only).
This is a nice API: I really love `resource_scope` (I *promise* it's officially called the hokey-pokey pattern), and this API is just a nice. We even have an internal use of it. Great docs, tests, great PR description. There's a reason jojojet is an SME-ECS! Merging.
4. https://github.com/bevyengine/bevy/pull/11698
Pixels are usually discrete, we should represent that in the type system where we can. This PR changes to a `UVec2` for texture dimensions, only swapping to f32 later in the pipeline if we absolutely need it to handle things like monitor scaling.
I'm pleased with the type safety and clarity here, and it's easy for consumers to convert to f32 when they need it. Also uh yeah, padding for texture atlases should be strictly positive.
CI failures are real; pinging.
5. https://github.com/bevyengine/bevy/pull/11777
Code quality PR for `bevy_reflect`'s macro code. Yay! I care a lot about code quality everywhere in Bevy, but that's especially true for the tricksy bits.
It's a bit of a larger PR (439 lines), but meticulously documented with nice commit history. I'm also okay to merge larger, more intrusive refactors like this in code that *isn't* being modified by 8 open PRs at once (hi ECS).
Changes are quite nice! Merging.
6. https://github.com/bevyengine/bevy/pull/11800
james7132, one of my co-maintainers, *loves* optimizing things. Wasted cycles? Banned! Generally admirable, but particularly valuable in games.
In this PR, we're showcasing the performance value of run conditions for short systems. Because run conditions are evaluated on the main thread, we can early out before we have to spawn a new system at all. Some pretty histograms showing the effect on a real scene, and a detour about overhead from granular spans. Merging.
7. https://github.com/bevyengine/bevy/pull/11801
What's that, another perf PR from James? It's good to see him active again :D Real life happens to all of us: the ability to just fluidly ramp up and down your activity levels is one of my favorite things about the large informal nature of Bevy's open source.
Like James says:
> At the start of every schedule run, there's guaranteed overhead as the async executor spawns the task onto one of the threads.
By polling first, we can reduce latency. Neat! Merging!
8. https://github.com/bevyengine/bevy/pull/11822
And a perf triple-whammy to round things off. Deep within the dark unsafe bowels of the ECS, we're passing in a `World` to a `CommandQueue`, so it can apply the changes generated by `Commands`.
The actual issue is pretty simple: `&mut Option<&mut T>` is pretty much always a code smell for double indirection. `as_deref_mut` to the rescue.
Some fun generated assembly analysis by James for those who click through :) Merging!
Alright, that's all of the community-reviewed PRs in our backlog this week :) Time to check out https://github.com/bevyengine/bevy-website/pulls, and start working on the release notes for Bevy 0.13!
There's only a few items left in the code milestone: https://github.com/bevyengine/bevy/milestone/17
Some rendering PRs in there which need eyes though, just saying... ;)
@alice_i_cecile@mastodon.gamedev.place woah time travel?? you need a license for that you know
@alice_i_cecile Hey this happens to be applicable to one of my projects! Thank you!