bevyengine / bevyengine/bevy

Assets as asset sources for labeled assets

Open
#25,517 3 comments 0 reactions 0 assignees View on GitHub
A-Assets C-Feature S-Needs-Design X-Contentious
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

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

We cannot lazily load labeled assets from so-called "random access" root assets such as archives (see #21641). Currently all labeled assets must be eagerly loaded when the root asset is loaded.

## What solution would you like?

I would like an `LabeledAssetReader` so that I can register a root asset as an asset source for labeled assets. I'm not sure about the API but ultimately I would like to lazy load a labeled asset. eg, I would like `asset_server.load("Fallout New Vegas/Data/FalloutNV - Textures2.bsa#textures\\interface\\main\\main_title.dds");` to read some bytes from a BSA root asset via `BsaLabeledAssetReader` which defers to `ImageLoader`.

## What alternative(s) have you considered?

Asset sources (and especially runtime asset sources, see #21758) indeed solves this issue; I was able to move forward by loading the "random access" root assets outside the asset system and using those "random access" root assets in an asset reader. However I'm not satisfied with this alternative because it circumvents the asset system.

## Additional context

I am working with Bethesda Software Archive (BSA) data files which contain an index with file records with the offset of files within the archive. This is pretty typical for so-called "random access" root assets. As I mentioned in an earlier section, I implemented a `bsa://` asset source.

Contributor guide

Open the contributing guide

Research direction

Start by reading the existing asset sources and runtime asset sources discussed in #21758, then trace how asset_server.load handles labeled assets and root assets. Compare the proposed LabeledAssetReader, BsaLabeledAssetReader, and ImageLoader roles. Done means a documented API can lazily load a labeled asset from a random-access root asset without circumventing the asset system.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.