返回资讯中心
外部精选
软件工程
#社区热议

Bevy 0.20

have the correct ordering because of which sync point it uses. We hope to fix this in the future.In addition, the multi-threaded executor executes systems greedily: it looks for the first unexecuted system whose depende…

Hacker NewsPhilpax2026/10/8 · 22 天前13 分钟阅读

以下正文同步自 Hacker News,版权归原站所有,已转换为易读排版。

have the correct ordering because of which sync point it uses. We hope to fix this in the future.In addition, the multi-threaded executor executes systems greedily: it looks for the first unexecuted system whose dependencies are finished and that has no other conflicting systems running. The result is that even if the shuffle results in the order (A, B, C), C could run before B if A and B conflict. This can be desirable to test, but consider using the single-threaded executor to avoid this case.This tool is complementary to the existing system order ambiguity detection, which analyzes the graph of systems statically. Ambiguity detection cheaply generates a (sometimes large!) list of potential problems, not all of which may correspond to meaningful bugs in your project. Real test failures in some permitted orderings give you more actionable information about which of these problems are real, and the correct ordering. Furthermore, ambiguity detection can have false negatives, typically when ambiguities are incorrectly ignored, or in the presence of interior mutability mechanisms that do not require write-access (from the scheduler's perspective).Catching Panics #

Authors:@SpecificProtagonist

PRs:#24240

For long-running programs, crashing can be unacceptable. If, for example, there is a bug in one of your image editor's tools, it's better for that tool to fail or to produce wrong results than to lose all your unsaved work.Bevy's systems, commands and observers are able to return errors. You can either set an error handler case-by-case, or let the FallbackErrorHandler deal with it. But this used to only work for explicitly returned errors: Panics used to bring down the entire app.In Bevy 0.20, these panics now get turned into errors and passed to the fallback error handler. By default this re-panics, but now you can choose whether to log an error and continue, or whatever else you want.Faster Bulk Despawning #

Authors:@loreball

PRs:#25743, #25851

Sometimes, you just want to despawn a ton of things at once. This is reasonably common: Bevy's own DespawnOnEnter and DespawnOnExit allow you to quickly clean up entities as you swap the state of your game, tidying up menus or resetting the game after a loss. While this isn't that much work in total, it's concentrated all at once: if that process is slow, you could see hitches, or longer loading screens.If you use the new despawn_all<F: QueryFilter> command (or one of its siblings) to batch this work, the ECS can speed things up through reduced overhead: sharing steps across related operations.Entitiesdespawndespawn_allSpeedup1003.68 µs2.84 µs1.30×1,00025.2 µs15.3 µs1.65×10,000254.9 µs149.7 µs1.70×100,0003.17 ms2.07 ms1.53×Median of five benchmark runs, AMD Ryzen 9 9950X3D.If you're using DespawnOnEnter or DespawnOnExit you'll see this performance gain for free; no changes to your code needed.Better Texture Compression #

Authors:@JMS55, @cwfitzgerald

PRs:#24223

Textures are a huge part of the memory footprint for most 3D games. Smaller textures means smaller downloads, faster loads and bigger scenes. Bevy 0.20 tackles this on two fronts, with an improved compression approach and automatic mipmap generation during asset processing.Bevy's CompressedImageSaver asset processor has been significantly upgraded with a new compression backend powered by the ctt library. The new compressed_image_saver feature compresses textures into BCn formats (for desktop GPUs) or ASTC formats (for mobile GPUs), producing higher-quality output than the previous Basis Universal approach: more bang for the byte. The compressor automatically selects the best output format based on the input texture's channel count and type — for example, single-channel textures get BC4, HDR textures get BC6H, and standard RGBA textures get BC7.Try out the new compressed_image_saver example to see it in action.Automatic Mipmap Generation #

No more manually generating mipmaps (scaled down versions of each texture for viewing at a distance)! The new backend automatically produces a full mip chain during compression. This means less aliasing when textures are viewed at a distance and better GPU cache utilization — all for free, just by running your textures through the asset processor.Image compression on other platforms #

To target mobile GPUs, set the BEVY_COMPRESSED_IMAGE_SAVER_ASTC environment variable with your desired block size (e.g. 4x4, 6x6, 8x8). Larger blocks give smaller files at the cost of quality. All 14 ASTC block sizes are supported.The previous Basis Universal compression behavior has been moved to the compressed_image_saver_universal feature. This remains the best choice for cross-platform distribution (including WebGPU), since UASTC can be transcoded at load time to whatever format the target GPU supports.Bevy Error Context Messages #

Authors:@cookie1170

PRs:#24528

Similar to the popular anyhow crate, BevyError now provides an ergonomic way to attach extra context to an error using the context method, which also allows creating a Result<T, BevyError> from an Option<T>.This makes it easier to trace back errors with human-readable messages without looking at verbose backtraces.fn fallible() -> Result<(), BevyError> { // This produces the error message Failed to parse number: invalid digit found in string let parsed: usize =

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →