Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add asset_processor feature and remove AssetMode::ProcessedDev #10194

Merged
merged 3 commits into from Oct 20, 2023

Conversation

cart
Copy link
Member

@cart cart commented Oct 19, 2023

Objective

Users shouldn't need to change their source code between "development workflows" and "releasing". Currently, Bevy Asset V2 has two "processed" asset modes Processed (assumes assets are already processed) and ProcessedDev (starts an asset processor and processes assets). This means that the mode must be changed in code when switching from "app dev" to "release". Very suboptimal.

We have already removed "runtime opt-in" for hot-reloading. Enabling the file_watcher feature automatically enables file watching in code. This means deploying a game (without hot reloading enabled) just means calling cargo build --release instead of cargo run --features bevy/file_watcher.

We should adopt this pattern for asset processing.

Solution

This adds the asset_processor feature, which will start the AssetProcessor when an AssetPlugin runs in AssetMode::Processed.

The "asset processing workflow" is now:

  1. Enable AssetMode::Processed on AssetPlugin
  2. When developing, run with the asset_processor and file_watcher features
  3. When releasing, build without these features.

The AssetMode::ProcessedDev mode has been removed.

@cart cart added the A-Assets Load files from disk to use for things like images, models, and sounds label Oct 19, 2023
@cart cart added this to the 0.12 milestone Oct 19, 2023
@cart
Copy link
Member Author

cart commented Oct 19, 2023

In the future we can consider gating the AssetProcessor code behind this feature (in the interest of slimming down the binary), but I believe that isn't trivial with the current module structure.

@cart
Copy link
Member Author

cart commented Oct 19, 2023

I think we should ultimately add one or more "full recommended dev experience" meta-features for simplicity and ergonomics. Ex: dev would enable file_watcher, embedded_watcher, asset_processor, tracing features, etc.

I think the dev experience is still "in flux" enough that we should wait a bit before defining these.

@github-actions
Copy link
Contributor

You added a new feature but didn't update the readme. Please run cargo run -p build-templated-pages -- update features to update it, and commit the file change.

Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes seem fine. Should asset_processor be on by default? I'd like to think we should generally prioritize new users for default features, rather than shipped games (which will be more deliberate).

@alice-i-cecile alice-i-cecile added C-Usability A simple quality-of-life change that makes Bevy easier to use S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it labels Oct 20, 2023
@cart
Copy link
Member Author

cart commented Oct 20, 2023

Should asset_processor be on by default? I'd like to think we should generally prioritize new users for default features, rather than shipped games (which will be more deliberate).

If it is on by default, it means that shipping would require disabling default features, which opens a huge can of worms that most users won't be equipped to manage. We aren't really even equipped to manage that, given the frequency of regressions we experience with non-default cargo feature configurations.

I think we should encourage the dev workflow as opt-in, as it is a cleaner approach, and also a better mental model (ex: please add in the "dev" features). Once we have the Bevy Editor we can hide this from most users with our "Play Button".

Additionally, I think we shouldn't yet encourage most people to turn asset preprocessing on by default. So far we've only built the image processor and it is pretty bare bones. Idk if the value prop is fully there yet for most people.

@cart cart enabled auto-merge October 20, 2023 20:50
@cart cart added this pull request to the merge queue Oct 20, 2023
Merged via the queue into bevyengine:main with commit 6f27e0e Oct 20, 2023
27 checks passed
ameknite pushed a commit to ameknite/bevy that referenced this pull request Nov 6, 2023
…yengine#10194)

# Objective

Users shouldn't need to change their source code between "development
workflows" and "releasing". Currently, Bevy Asset V2 has two "processed"
asset modes `Processed` (assumes assets are already processed) and
`ProcessedDev` (starts an asset processor and processes assets). This
means that the mode must be changed _in code_ when switching from "app
dev" to "release". Very suboptimal.

We have already removed "runtime opt-in" for hot-reloading. Enabling the
`file_watcher` feature _automatically_ enables file watching in code.
This means deploying a game (without hot reloading enabled) just means
calling `cargo build --release` instead of `cargo run --features
bevy/file_watcher`.

We should adopt this pattern for asset processing.

## Solution

This adds the `asset_processor` feature, which will start the
`AssetProcessor` when an `AssetPlugin` runs in `AssetMode::Processed`.

The "asset processing workflow" is now:
1. Enable `AssetMode::Processed` on `AssetPlugin`
2. When developing, run with the `asset_processor` and `file_watcher`
features
3. When releasing, build without these features.

The `AssetMode::ProcessedDev` mode has been removed.
rdrpenguin04 pushed a commit to rdrpenguin04/bevy that referenced this pull request Jan 9, 2024
…yengine#10194)

# Objective

Users shouldn't need to change their source code between "development
workflows" and "releasing". Currently, Bevy Asset V2 has two "processed"
asset modes `Processed` (assumes assets are already processed) and
`ProcessedDev` (starts an asset processor and processes assets). This
means that the mode must be changed _in code_ when switching from "app
dev" to "release". Very suboptimal.

We have already removed "runtime opt-in" for hot-reloading. Enabling the
`file_watcher` feature _automatically_ enables file watching in code.
This means deploying a game (without hot reloading enabled) just means
calling `cargo build --release` instead of `cargo run --features
bevy/file_watcher`.

We should adopt this pattern for asset processing.

## Solution

This adds the `asset_processor` feature, which will start the
`AssetProcessor` when an `AssetPlugin` runs in `AssetMode::Processed`.

The "asset processing workflow" is now:
1. Enable `AssetMode::Processed` on `AssetPlugin`
2. When developing, run with the `asset_processor` and `file_watcher`
features
3. When releasing, build without these features.

The `AssetMode::ProcessedDev` mode has been removed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Assets Load files from disk to use for things like images, models, and sounds C-Usability A simple quality-of-life change that makes Bevy easier to use S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants