Replies: 17 comments 56 replies
-
Asset Preprocessing: it should be possible to "preprocess" / "compile" / "crunch" assets at "development time" rather than when the game starts up. This enables offloading expensive work from deployed apps, faster asset loading, less runtime memory usage, etc. |
Beta Was this translation helpful? Give feedback.
-
Asset .meta files: asset configuration files stored adjacent to the asset in question, which both assigns them a unique and stable asset id and allows the user to configure asset-type-specific settings. These settings should be accessible during the pre-processing phase. Modifying a .meta file should trigger a re-processing / re-load of the asset. |
Beta Was this translation helpful? Give feedback.
-
Asset Dependencies: assets should be able to define dependencies on other assets. this might be split out into "hard" and "soft" dependencies, where "hard" dependencies must be available during pre-processing and invalidate parent assets when they change. And "soft" dependencies are just loaded when the parent is loaded (at runtime). |
Beta Was this translation helpful? Give feedback.
-
Runtime Asset Loading: it should be (optionally) possible to load arbitrary assets dynamically at runtime. This necessitates being able to deploy and run the asset server alongside Bevy Apps on all platforms. For example, we should be able to invoke the shader compiler at runtime, stream scenes from sources like the internet, etc. To keep deployed binaries (and startup times) small, the runtime asset server configuration should be configurable with different settings compared to the "pre processor asset server". |
Beta Was this translation helpful? Give feedback.
-
Multiple Backends: It would be nice if we could load assets from a variety of sources (filesystems, the internet, remote asset servers, etc). |
Beta Was this translation helpful? Give feedback.
-
Not included in the main requirements, but one key thing to think of is developer UX. Asset loading in bevy right now is pretty involved and error prone, even for simple dependent asset loads. We can obviously build more user friendly asset APIs on top of a low level core, but building the right user-facing abstractions here can go a very long way. |
Beta Was this translation helpful? Give feedback.
-
I think one oversight in bevy_assets is that it's impossible to load/process a source file and an asset (or a graph of assets) without having it become visible to the running app state. |
Beta Was this translation helpful? Give feedback.
-
Efficient handling of CPU -> GPU dataflow
The new asset system needs to support at least the following types of asset dataflows:
For GPU-only assets, the ownership of the data should be inserted into the render world directly without requiring an extra copy step on the CPU through the main world. We also need to be forward-looking here and consider RDMA / DirectStorage where the asset data gets streamed and decompressed directly from SSD to VRAM with minimal intervention from the host. |
Beta Was this translation helpful? Give feedback.
-
Asset Unloading: It should be able to unload certain assets from memory temporarily but still retain a handle to it. The user can then use that handle to load it back up from disk on demand. |
Beta Was this translation helpful? Give feedback.
-
I didn't see anyone mention hot-reloading, which is pretty important considering almost every suggestion here would complicate it in some way. |
Beta Was this translation helpful? Give feedback.
-
I see that you mentioned replacing current asset handler with distil; From my experience of porting rust, bevy and general gamedev ecosystem to PlayStation consoles (not homebrew), distil causes some problems which prevents you from loading assets on console(s). Distil uses daemon as IPC system for managing assets from external process, this is main problem on consoles, you are not allowed to use any kinds of daemons which are living next to your game. Each process is sandboxed for security reasons and you will have to exploit runtime to send assets between daemon and the game, of course no one wants to do that. |
Beta Was this translation helpful? Give feedback.
-
Feel free to remove this if this isn't high level enough (and/or outdated; I last used bevy in like February). I think it's worth considering that an asset's file extension doesn't necessarily determine the asset type. Motivating example: I was trying to write a Minecraft client, and the data pack format uses .json files for multiple different types of asset (e.g., block model and animation). As far as I could tell, the AssetServer dispatches load requests based on the file extension. And the information in each .json isn't enough to (easily) determine which type of asset it is. So that precluded me from using the AssetServer to load data pack files. |
Beta Was this translation helpful? Give feedback.
-
More asynchronous/ability to control loading files into memory on a per asset type basis. Right now the AssetLoader::load gets passed the entire file so getting a small part of a very large archive would waste a lot of memory. A custom AssetIO can be used, but as I understand it's a global resource. It would also break the separation of AssetIO handling loading from any path, unaware of the type. I would highlight 3 layers to describe an asset: source (local file, network, another asset), format (json, png), actual game asset type (as mentioned: a model json vs an animation json). It would be nice if it was possible to change a layer to something else easily. An extension could just be used to set a "default" format and game asset type. |
Beta Was this translation helpful? Give feedback.
-
Integration with a version control system. Unity has integration with Perforce and Plastic SCM Godot has a Git Plugin to enable version control in the editor: Bevy does not have an editor yet, but integration with a version control system would still enable features such as:
|
Beta Was this translation helpful? Give feedback.
-
Loading partial asset data. The main use case that comes to my mind is loading array textures, from multiple files, which may happen distributed over the lifecycle of the application. |
Beta Was this translation helpful? Give feedback.
-
WASM support: As the requirements for serving the game on the web are quite different, I think it's worth to list this as separate requirement. Ideally, it would be very easy to apply different asset loading/preprocessing techniques on WASM builds compared to "normal" builds. |
Beta Was this translation helpful? Give feedback.
-
Better APIs for loading custom assets Currently loading assets for built-in types such as images or meshes is pretty simple. You just load the asset, get a handle, and then you can plug that handle directly into the various systems that consume them. Those systems know how to check when the asset is loaded, and can utilize the data once it is available. However, for custom assets - things like game maps, quests, dialogue trees, inventory items, skill and spell definitions, the process is much more complicated:
This is a lot of moving parts, but the situation is even more complicated if you're trying to use the asset inside of an async task - now you have to clone handles and possibly use some combination of Mutex/Rc to actually use the data within the task closure. One thing that would simplify this is the ability to Another improvement would be to have some easier way to insert assets into the world once loaded. In JavaScript, you'd do something like this:
In other words, rather than having to build a separate system which polls the loading state, have some async closure which triggers when the load is done and which can issue commands. |
Beta Was this translation helpful? Give feedback.
-
In the very near future I will be shifting my focus to evolving Bevy's asset system to better accommodate our needs. This will either involve iterating on
bevy_asset
or replacing it with distill.This is a place to lazily collect and discuss requirements and scenarios over time, not a formal design document. This is also not a place to dictate particular implementations. High level requirements and scenarios only at this point please!
Some initial high level requirements to get the ball rolling:
.meta
files: asset configuration files stored adjacent to the asset in question, which both assigns them a unique and stable asset id and allows the user to configure asset-type-specific settings. These settings should be accessible during the pre-processing phase. Modifying a.meta
file should trigger a re-processing / re-load of the asset.Some history:
bevy_asset
's capabilities andatelier
(which was renamed to distill).bevy_asset
to add support for nested asset loading, imports,.meta
config files, and asset redirects (a precursor to asset preprocessing). Ultimately I ported aspects of this to upstreambevy_asset
, such as nested asset loading, which enabled things like "gltf scene loading".Beta Was this translation helpful? Give feedback.
All reactions