bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
35k stars 3.43k forks source link

Upstream asset loading solutions #14368

Open janhohenheim opened 1 month ago

janhohenheim commented 1 month ago

What problem does this solve or what need does it fill?

Loading a list of assets in a loading screen is a very common pattern that is needed for a wide array for games and applications. Beginners run into this fairly quickly. In fact, you basically need to do this if you want to support audio on web per @alice-i-cecile. Bevy should provide some easy way of implementing this.

What solution would you like?

Upstream some or all of the following well-known, battle-tested and widely used crates. In order of increasing controversy according to my intuition:

Of course, we have to get the authors' permissions first.

What alternative(s) have you considered?

Additional information

These methods tend to work better on native than on Wasm since the latter famously does not allow deallocating memory. If you load all of your assets in one go, your RAM will be exhausted since there is only 4 GiB available on Wasm.

mockersf commented 1 month ago

Do nothing and leave it at https://github.com/bevyengine/bevy/blob/main/examples/asset/multi_asset_sync.rs

  • While the code itself is not overly complex or anything, I think something so common should probably have a solution that requires less boilerplate

I would prefer to have a generalisation of this example in Bevy

alice-i-cecile commented 1 month ago

IMO we should be able to upstream bevy_common_assets (behind feature flags) into bevy_asset without much controversy.

mockersf commented 1 month ago

IMO we should be able to upstream bevy_common_assets (behind feature flags) into bevy_asset without much controversy.

the "controversy" there is adding more code in engine to maintain when it works as a third party dependency, and all the formats it adds are not useful to everyone