Replies: 2 comments 1 reply
-
I'm thinking maybe what I'm actually looking for are Scenes. In my use-case I'm going for an entirely asset-driven approach to the game, where everything except logic ( and after I figure out scripting, even some of the logic ) is loaded entirely through assets so that you can make different games without having to re-compile any Rust. So what I'm wanting is to be able to define whole sets of component information in an asset, pretty much just like scenes. The existing scene setup is just way more verbose than I want it to be for exposing to users for modding, etc. Maybe I'll experiment with a simpler scene system that isn't as verbose. |
Beta Was this translation helpful? Give feedback.
-
Could you take a look at the GLTF asset loader? It feels like it has a lot of similarity to what you want. For example, it is loading another asset (an image) from within the loader, and getting it's handle: bevy/crates/bevy_gltf/src/loader.rs Lines 263 to 270 in 1d7196d Or it's adding a loaded asset as a labeled asset from the main handle: bevy/crates/bevy_gltf/src/loader.rs Line 201 in 1d7196d Labeled assets can be reached from the asset server by adding bevy/examples/asset/asset_loading.rs Line 20 in 1d7196d |
Beta Was this translation helpful? Give feedback.
-
I want to start a discussion on how we might be able to solve a real pain point I have with the current Bevy asset system: the need to ergonomically load nested assets into a flat bundle structure. Let's walk though a simple example.
Say I have two asset types:
SpriteSheet
, andSprite
.Sprite
is an asset that can be loaded from.png
files, andSpriteSheet
is an asset that can be loaded from.spritesheet.yml
files.Now let's say I have these two assets:
player.spritesheet.yml
:player.png
: A sprite sheet image with a 16x16Now, in my code I want to be able to spawn a bundle that looks like this:
The issue here, is that because we have a nested structure where
player.spritesheet.yml
referencesplayer.png
, there is no way to load the assets into the flat structure of theSpriteSheetBundle
. We've got sort of a fundamental disconnect between wanting to have a nice nested asset structure, but needing to load into the flat structure that makes sense to the ECS.I feel like my desire for nested assets on disk feels right from a user experience standpoint, I want to be able to say "spawn a sprite sheet!" not "load a sprite and load a spritesheet and add them to an entity", but it feels contrary to the ECS design and I'm not sure if it's right to try to marry them or to force my assets into a flat structure. 🤷♂️
Ideally I really wanted something like this:
But maybe that doesn't actually make sense.
Anyway, just opening this discussion to see if anybody has any perspectives on this.
Beta Was this translation helpful? Give feedback.
All reactions