#bevy_cli

1 messages · Page 5 of 1

twilit dew
#

Just stuff like "Aaah it’s no longer working with the newest Bevy / newest Rust" would be nice to have fixed

pale viper
rocky oxide
#

Yep!

pale viper
#

Is it mainly the web bundling + testing stuff you find the most valuable?

twilit dew
#

Great heart_lime

twilit dew
pale viper
#

I'm mostly in agreement, although I do think our support for bevy new is somewhat lacking

twilit dew
#

The linter is low because it almost never failed on CI for me, but that’s probably on me because I should enable the nursery lints (I like them and am fine with the limitations)

twilit dew
molten merlin
#

I use bevy new with the minimal template daily, but could easily just grab the cargo generate template if it wasn't upstreamed immediately

pale viper
rocky oxide
twilit dew
twilit dew
rocky oxide
#

See, bevy new is basically worthless to me, because I make a new Bevy project like... once every 6 months?

#

Useful for onboarding, and useful for the editor though!

twilit dew
rocky oxide
#

The really bad ones get spun out though, to be fair

twilit dew
molten merlin
twilit dew
molten merlin
#

its very nice to have bevy new be the start of workshops and such

#

and crate instructions, etc

rocky oxide
#

or bevy new leafwing_input_manager/examples/simple

#

Being able to use examples as templates is actually a pretty slick idea

twilit dew
pale viper
pale viper
molten merlin
#

subfolders are supported

pale viper
#

We've been benefiting so much from their work, I'd love to give something back

twilit dew
rocky oxide
twilit dew
molten merlin
#

one of the downsides of whitelabelling cargo-generate the way bevy new does is passing the options has to be enabled specifically (for ex: subfolders afaik)

rocky oxide
#

I do like white-labelling it though

#

(being sure to credit generously)

#

It creates a much clearer new user experience

#

And allows us to seamlessly swap backends as needed

pale viper
molten merlin
#

I guess I don't know if the intent is to remove it and reimplement in the long-term though. that's what most projects end up doing for this kind of functionality, for better or worse

pale viper
#

cargo-generate provides a nice experience to both template users and authors already

rocky oxide
#

It's just nice to have the option

limber wedge
#

im not sure how the upstreaming process worked for the other crates but something that's important to me is that all contributors (not necessarily all individual contributions) are also "upstreamed" ^^ We had many one time contributors who might not actively contribute to the new repository, but i think they should still be acknowledged there.

pale viper
#

I'm ranking various issues on their impact, and this is my scale lol

#

My personal favorites are "Forest" and "Big Forest"

#

From the list, there's still a few high-impact low-difficulty things we can do, which is exciting :D

rocky oxide
#

Here's a good lint for y'all: spawning a component of type ()

#

Or inserting / removing it

twilit dew
#

jk, that sounds like a sensible lint

#

e.g. in spawn(tranform.look_at(...))

#

instead of spawn(transform.looking_at(...))

#

though I suppose in specifically that case there is already a should_use in place

twilit dew
rocky oxide
twilit dew
rocky oxide
#

!!

rocky oxide
pale viper
foggy basin
# pale viper

Is it now possible to add issues from other organizations to your personal project? I think I couldn't get that to work in the past

foggy basin
#

I'm so happy that we can finally use let chains!

pale viper
pale viper
#

I made the PR as easy to review as possible, so please give it a look if anyone has the time :)

pale viper
foggy basin
pale viper
#

There will be a PR tomorrow, insert_unit_bundle is getting a makeover! 💅

limber wedge
# pale viper

Thats so cool! I had it setup for nvim aswell a few months ago but then sadly i no longer have the clippy diagnostics (since i use clippy as an override command)

twilit dew
#

How do I use the Bevy Linter in a project that uses the newest stable Rust?

#

If I install the linter with nightly-2025-04-03 it will yell at me because let-chains are unstable, from its point of view

#

But from the POV of the current stable rust, they are stabilized

#

I just tried migrating Chainboom to the newest stable version and am hitting a roadblock there

#

Also, minor annoyance on the SEO here:

#

Hmm, I suppose I should try 0.4.0-dev

#

But it seems this is invalid for the workflow? uses: TheBevyFlock/bevy_cli/[email protected]

#

Hmmm when using the bevy_cli from main and typing bevy lint --yes, it uses the outdated bevy_lint that was already installed on the system before upgrading my CLI to main

#

Uninstalling bevy_lint 0.3 and then runnign bevy lint --yes with the newest main gives me this 👀

limber wedge
#

The cli only supports installing the latest release of the linter yet sadly

#

You could try the action.yaml from main. There we updated to nightly-2025-05-14

twilit dew
#

I'll try with cargo install --git https://github.com/TheBevyFlock/bevy_cli --branch main --locked bevy_lint

#

Oh hey I can also point it to rev 9a24ac4a555f028f9d32017e95fcd1efcee1d3d3

#

Which is the commit that uses the newer toolchain

#

cc @near mist this is also relevant for the 2D template

pale viper
#

You can install from main, but I haven’t fully upgraded the linter to the latest tool chain yet

limber wedge
#

I thought so too at first but dont we use 1.89 nightly?

pale viper
#

So let chains are still unstable, from the linter’s perspective

pale viper
#

Actually that should work

twilit dew
pale viper
#

@twilit dew #![cfg_attr(bevy_lint, feature(let_chains))] should fix it

pale viper
#

I take it back, let chains work off of bevy_lint's main branch! Sorry about that ^^'

#

v0.3.0 won't work, but v0.4.0-dev will

#

But looks like you already figured that out. Sorry for the confusion!

twilit dew
#

Still, this is a big awkward for people using the 2D template from the CLI now

#

As they are almost guaranteed to get a broken CI

#

@pale viper what should we do about it? I can think of the following

  • Remove bevy_lint from the 2D template for now
  • Install bevy_lint from main with the rev 9a24ac4a555f028f9d32017e95fcd1efcee1d3d3
  • Do nothing and wait for a new bevy_lint release
pale viper
#

I think I also should make the Github Action a little more usable, it's very brittle right now

pale viper
limber wedge
pale viper
pale viper
twilit dew
pale viper
#

Yup, I’ll let you know when it’s merged!

near mist
twilit dew
twilit dew
pale viper
#

I really outdid myself with the PR description, although the diff for the lint itself isn't great

limber wedge
pale viper
limber wedge
whole iris
#

The cli is so nice to run on web, I hated fiddling with trunk

pale viper
limber wedge
pale viper
#

You're the only other local CI wizard I know that isn't Francois :)

pale viper
pale viper
#

I think we're getting pretty close to the next release of bevy_lint! The milestone of completed things is shaping up quite nice!

#

Are there any features / fixes we should try to get in before preparing the v0.4.0 release? Anything that's missing or less-than-desirable?

#

Also, should we release with support for Bevy 0.16 or 0.17? We currently support 0.16, but the release candidates for 0.17 are going to start at the end of the month

#

We'll want to update to support 0.17 relatively quickly: it's just the question of whether we should support 0.16 for people who want the new linter features but haven't updated

#

@limber wedge, @foggy basin, and @rocky oxide if you find the time I'd like your thoughts on this! :D

rocky oxide
#

It's really nice to get the testing earlier on full code-bases

rocky oxide
#

bevy lint --fix in particular is a really nice accomplishment

foggy basin
#

I would also say 0.16. As we don't have a fixed release schedule, we can just release again once 0.17 is out :)

foggy basin
#

On the latest main, I'm getting this weird issue:

$ cargo check
error: the 'cargo' binary, normally provided by the 'cargo' component, is not applicable to the 'nightly-2025-06-26-x86_64-unknown-linux-gnu' toolchain

I already tried rustup update and manually installing the toolchain.
Does anyone else get this?

#

Nevermind, looks like uninstalling the toolchain and installing again fixes it :)

foggy basin
#

Alright, I have a first working version of the experimental multi-threading support:
https://github.com/TheBevyFlock/bevy_cli/pull/499
We now need to find Bevy apps that have implemented Wasm multi-threading (it's not supported natively yet) to test it properly.

foggy basin
#

@pale viper @limber wedge we also need to discuss how to name experimental / unstable features in general and how they should be enabled.
Currently in the PR I named the feature "experimental" and the flags --experimental-multi-threading so the user always sees the "experimental" part and is not confused if it doesn't work.

@pale viper suggested to align more closely with cargo/Rust and name it "unstable" and using the -Z multi-threading syntax that's familiar from cargo.
With the -Z part I am a bit worried that we might create confusion with the Cargo flags itself as we also support them.
But I'm not opposed to change the syntax/naming :)

#

(The reason why I want the multi-threading to be marked experimental/unstable is that it requires nightly Rust and that it doesn't make the app multi-threaded by itself, you still need to manually implement the multi threading at this point)

limber wedge
#

Im pretty open about the syntax. I think i like having „unstable“ in the argument name the least. I rather have something like -Z (or out own flag) for experimental features. But since we already try to follow cargo i think reusing -Z makes sense (as long as its behind a subcommand of ours so its clear that its a bevy_cli flag)

pale viper
#

Yup, that's my sentiment as well! Do we support any of Cargo's -Z flags out-of-the-box? If not, that could reduce confusion

#

Ohhh right, we pass our flags directly to Cargo

foggy basin
#

Yea I think they can change relatively often so we don't really do any validation, we just pass them on

#

And I'm a bit hesitant to make the behavior dependent on the flag position (e.g. if its before or after the web), users already sometimes pass e.g. --release after web instead of before

pale viper
#

Yeah, positioning flags with bevy build web can be a bit tricky

#

We could eliminate it if we made a build-web subcommand, however

foggy basin
#

What would you think about using a different letter than Z? So keeping the syntax kinda similar but with still having a distinction?

pale viper
#

Would -U / --unstable work?

foggy basin
foggy basin
foggy basin
#

We'll also have to consider the config. How would unstable flags look there?

tight shore
#

I wanted to share this with everyone since we are talking about Bevy web builds
https://github.com/mate-h/bevy-webgpu

This uses Vite dev server to exchange the hot-module-reload files with the filesystem. so it's useful for during development of web builds. I implemented hot module reload for shader files in the web build this way.

twilit dew
foggy basin
#

The repo is a good reference, I didn't know about AssetServer::reload!
So far, my plan is to add a file watcher on the CLI side, forward the events via websocket to the app and then trigger the reload there

pale viper
#

Cross-posting this here: #general message

#

It's a poll to try to see how many people use Nix, and whether they'd like better support with the CLI / linter

#

Please fill it out if you get the chance! If we get a lot of responses asking for better support, we could possibly include Nix flakes in v0.4.0 of the linter

gleaming plank
#

I'm kinda an option 5: if native support for the Bevy CLI was added to Nix, I might start using Nix and encouraging my group to get it as well

rocky oxide
limber wedge
rocky oxide
limber wedge
#

But since you can return Result from systems whats the reason to use the silently panicking one instead of just using get_resource()?`?

pale viper
#

I’m open to changing the lint, I just don’t understand the reasoning yet!

#

Ah, wait, I see

#

In the code Alice linked, it’s running app.get_resource::<T>().unwrap(). We should recommend they use app.resource::<T>() instead

#

This is unrelated to panicking_methods, although it looks very similar!

limber wedge
#

Oh i just saw „world“ somewhere and thought its about that my bad

pale viper
#

You’re good! I was confused too!

limber wedge
# pale viper You’re good! I was confused too!
GitHub

Objective

Clean up usage of BlitPipeline

Solution

add create_bind_group method
adjust some field and variable names for clarity

Testing

ran 3d_scene

twilit dew
pale viper
limber wedge
#

Imo the first one is better but i guess thats just a matter of taste

pale viper
#

I like the second one because of the custom panic message it gives you:

#
    pub fn resource<R: Resource>(&self) -> &R {
        match self.get_resource() {
            Some(x) => x,
            None => panic!(
                "Requested resource {} does not exist in the `World`.
                Did you forget to add it using `app.insert_resource` / `app.init_resource`?
                Resources are also implicitly added via `app.add_event`,
                and can be added by plugins.",
                DebugName::type_name::<R>()
            ),
        }
    }
vast vine
limber wedge
vast vine
#

kinda, I think what I would like is that lints like that are only enabled in a "release-ready" level lint or something like that. I think some lints are good even when hacking around because they highlight mistakes

limber wedge
#

Its always also important to keep in mind that lints are also helping new users learn

rocky oxide
#

Which is bad!

#

I personally prefer .get_resource() + ?

#

But when I tried to remove .resource upstream (to match the newly fallible .single), rendering was very "you'll pry it from my cold dead hands"

#

Because in many cases they don't have a reasonable recovery method, or adding one is a huge pain

limber wedge
#

I think we want to provide a method to configure some allow lints anyway and for this one it would make sense to be able to configure what methods are allowed without allowing the complete lint. Similar to: https://github.com/TheBevyFlock/bevy_cli/issues/399

GitHub

It should be possible to configure what traits are being checked with the unconventional_naming lint in the Cargo.toml. A configuration could look like: [package.metadata.bevy_lint] unconventional_...

rocky oxide
pale viper
rocky oxide
pale viper
#

Yup!

#

And crate-level overrides. Both are specified in Cargo.toml

rocky oxide
#

Excellent: clippy doesn't 🙃

#

Ideally we ban panicking_methods completely at the workspace level

pale viper
#

Yeah ^^'
I bypassed Cargo's normal method for setting workspace lints because I thought it was really annoying

rocky oxide
#

And then allow .resource inside the rendering crates

pale viper
vast vine
pale viper
foggy basin
#

@twilit dew at a later time I will also run an idea by you regarding better web GPU support.
I think we could probably support feature detection and dynamically loading either the webgl or webgpu version of the app depending on browser support for release builds :)
But would take a bit of implementation work

twilit dew
#

So for people targetting WebGPU exclusively (like me), it would be nice to just have an error message on WebGL

#

Which our current itch.io builds for example don't have. You just get a window that never loads.

foggy basin
#

I'm once again facing the problem of too many ideas, too little time!
There's still so many goodies we can put in the CLI...

pale viper
#

Well I meant to send it here, but accidentally sent it in #1374187654425481266:

#

Should we release a small v0.1.0-alpha.2 that just includes the updated linter version number? Or should we get a better system setup for querying toolchain versions?

limber wedge
#

Im also okay if only main installs 0.4.0 but regardless we definitely need a better system.

limber wedge
#

I have been thinking a bit about bevy test web and I think it's easier to implement bevy check / bevy check web.

If we run cargo test --target --target wasm32-unknown-unknown, it compiles and tries to run the .wasm file and errors out.

There are a few methods on how to get cargo test working, but none seem optimal for us.

  1. Use wasm-bindgen-test.
  2. Write your own test harness (what wasm-bindgen-test does in the end).

The reason wasm-bindgen-test is not an option for us is that it requires you to annotate the tests you want to run with wasm_bindgen_test instead of test on top of other limitations. In my opinion, if we support a cargo test for the web, I would like to provide an experience where the user does not need to make any changes and can simply run all their tests for this target.

We could read the wasm binary and create our own test harness from that (like wasm-bindgen-test, but I think many built-in functions like assert! would not work in wasm32-unknown-unknown so it will not be a clean experience.

So I think it's easier to provide a bevy check web command that lets users test if their game still builds for the web in CI.

twilit dew
#

Or bevy lint web

#

which would encompass check

limber wedge
#

Yea bevy lint web makes more sense

rocky oxide
#

Both Template and GetTemplate are blanket-implemented for any type that implements both Clone and Default. This means that most types are automatically usable as templates. Neat!
I smell a new lint...

rocky oxide
#

I think that in the long-term we would want a lint for "all components (and maybe all resources) should implement Clone + Default XOR GetTemplate"

lapis fjord
#

Is it possible to do that in the type system? Like, checking if a type implements a A or B trait but not both?

rocky oxide
#

And we don't want to do a Component: FromTemplate bound, because this is only "best practice", not mandatory

foggy basin
#

I updated the Wasm multi-threading PR to the new syntax:
-U web-multi-threading in the CLI or

[package.metadata.bevy_cli.unstable]
web-multi-threading = true

in Cargo.toml.
https://github.com/TheBevyFlock/bevy_cli/pull/499

What's left now is to add the changelog and documentation to the book :)

foggy basin
twilit dew
#

Potential lint?

#
fn on_add(trigger: On<Add, Foo>, query: Query<&Foo>) {
  let foo = query.get(trigger.target()).unwrap();
  // ... 
}

Looks innocent, right? This crashes with Disabled entities

#

Early return would also probably leave your entity in an invalid state once the Disabled is removed, since invariants from the observer are not held up

#

The correct thing is

fn on_add(trigger: On<Add, Foo>, query: Query<&Foo, Allow<Disabled>>) {
  let foo = query.get(trigger.target()).unwrap();
  // ... 
}
#

@slim pine am I getting this right?

#

Same on other hooks like Remove

slim pine
#

My specific case was an On<Add, Disabled> observer and then querying for trigger.target(), but the query failing because it is a disabled entity and I didn't explicitly include disabled entities in the query

twilit dew
slim pine
#

But I think it would apply to your example too, yeah

twilit dew
#

Two potential lints then 👀

slim pine
#

I think it's just rarer to add or remove components from disabled entities so your case seems relatively rare

twilit dew
#

(I think?)

slim pine
twilit dew
#

let me check

#

Yep, this code here panics on 0.16:

use bevy::{ecs::entity_disabling::Disabled, prelude::*};

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_systems(Startup, setup)
        .add_observer(print_transform)
        .run();
}

fn setup(mut commands: Commands) {
    commands.spawn((Transform::default(), Disabled));
}

fn print_transform(trigger: Trigger<OnAdd, Transform>, transform: Query<&Transform>) {
    let transform = transform.get(trigger.target()).unwrap();
    println!("Transform: {:?}", transform);
}
#

@rocky oxide I assume this is not addressed by any observer overhaul, right?

twilit dew
# slim pine My specific case was an `On<Add, Disabled>` observer and then querying for `trig...

For others reading this, to be explicit, this is the footgun:

fn print_transform(trigger: On<Add, Disabled>, anything: Query<&AnythingWhatsoever>) {
  let foo = anything.get(trigger.target());
  // foo will ALWAYS be `Err`!
}

Need to instead do

fn print_transform(trigger: On<Add, Disabled>, anything: Query<&AnythingWhatsoever, Allow<Disabled>>) {
  let foo = anything.get(trigger.target());
}
#

By just discovering this, I have realized that nearly none of my plugins properly deal with disabled entities 😅

#

CLI gang, should I open up two issues for these?

foggy basin
#

Sure, go ahead :)

twilit dew
#

Cross-post: #ecs-dev message

twilit dew
foggy basin
#

i believeThat works for now, thanks!

limber wedge
#

@shrewd monolith Tim linked your jam submission to test a PR and its so pretty and funky i love it! jammin

shrewd monolith
#

We felt like we were so close to locking in on its potential. But uh, game jams are hard 😅

limber wedge
#

yea but the theme and the art + music is so good it really hits the vibe

foggy basin
#

Just doubled my laptop RAM to 32 GB so I can finally open the CLI and the testing workspace without risking crashing Linux 🎉

Next step will be upgrading my desktop PC as well (which is also still at 16 GB), but that one also needs a new CPU

limber wedge
#

Congrats!

foggy basin
#

I feel like 16 GB should be enough for just two projects with rust analzer, but who am I to judge :D

limber wedge
#

I dont think my pc could start RA ferris_sob

#

Yea but for some reason 16GB these days is not even enough for someone who only uses word (and teams) as a job

foggy basin
#

I remember when 16 GB was a lot... time flies by

limber wedge
#

True.. its a bit sad but maybe the electron hype goes away

foggy basin
#

I wonder if the recent optimizations to the reflect macro expansion also helps with rust analyzer memory for Bevy...
If so, it would be worth investing more effort into it probably

foggy basin
#

(Although I'm not sure how much memory Bevy apps are actually using... but surely less than Electron)

limber wedge
#

We will never know

#

But im glad that the MacBooks since apple silicon are so powerful it has never been an issue

#

And we have BYOD at work so its not as expensive

foggy basin
limber wedge
#

Yes!

foggy basin
#

Neat! At my job, the work machines are not for private use unfortunately

limber wedge
#

Well funny thing is i now work mostly for government contracts and there i got a different machine lol so i only use my BYOD device for private use lol

foggy basin
#

Good thing I can use Bevy as an excuse for "having" to upgrade my hardware for important "non profit work"

limber wedge
#

Hahaha truee!

limber wedge
#

Maybe i need to use that excuse to also upgrade my pc then it doesn’t not feel that bad

foggy basin
limber wedge
#

True truee! And maybe i also magically learn how to do rendering stuff so perhaps a better gpu would be good

foggy basin
#

I mean, for testing the CLI properly, you need to be able to run all the Bevy games, past and future. So a GPU would be a worthwile investment for sure!

limber wedge
#

Thats a good Argument!

limber wedge
#

its getting so much smarter 🍎

pale viper
twilit dew
slim pine
limber wedge
slim pine
#

cc @plush spade

plush spade
#

i think we can do some hacks using the cargo api to query the metadata for the main bevy crate even if you are just using bevy_* variants, i've done something similar before in another project

#

i guess in theory figuring out the target bevy version requires knowing at least one bevy crate that's present

#

but i feel like using heuristics (possible crate names x known valid bevy versions) we can make it work in 99.99% of cases

#

am going to cook a little 🍳

pale viper
near mist
#

because if it was just a binary, i would have expected a bigger speedup

pale viper
#

The current slowest part is installing the toolchain every time, however I bet I could cache that as well!

#

Yup: ~20s to install the nightly toolchain, less than a second to restore the cached bevy_lint and bevy_lint_driver

near mist
pale viper
#

Yup!

#

Another reason the speedup isn't more is probably because bevy_lint has very few dependencies (on purpose)

#

Compared to caching the entirety of the Bevy engine, the savings just aren't going to be as great

near mist
#

well ~47s -> under 1s is pretty big

#

looking only at the compilation of bevy_lint vs downloading it from cache

pale viper
#

Totally

upbeat yew
#

I am noticing an error in chrome with bevy_run_web
Content Security Policy of your site blocks the use of 'eval' in JavaScript

#

although this doesn't seem to prevent the app from working

upbeat yew
#

also, it would be nice to be able to listen on all addresses, but I cannot figure out a way to do it
looks like -host :: does work with both ipv6 and ipv4 addresses, and it was actually my nat to blame

limber wedge
#

yes exactly there is --host and --port

limber wedge
twilit dew
#

Since we’re so close to the RC, I thought it would be best to use that

limber wedge
#

That explains 😄

twilit dew
#

Note that Allowed is also 0.17

#

Though it’s just an alias for Any<(With<T>, Without<T>)>

limber wedge
#

Yeye makes sense! Thanks

pale viper
#

I think that error occurs when you enable stricter browser settings, but I don't know of anything bevy run web would be doing that would be causing issues with it

upbeat yew
#

in _wbg_get_imports() in corn_game.js

#
    imports.wbg.__wbg_eval_e10dc02e9547f640 = function() { return handleError(function (arg0, arg1) {
        const ret = eval(getStringFromWasm0(arg0, arg1));
        return ret;
    }, arguments) };
upbeat yew
#

I think I need to set a CPS directive to get chrome to allow eval. but it doesn't seem to be working

upbeat yew
#

I have it set by the web server

#

still not working

#

well, the error turned out to be for an extension and not the bevy app.

#

that would have been nice information to have in the error

vast vine
#

Is it possible to use the bevy cli in a watch mode for the web option? I can't find any mentions of that in the docs but it would be very useful

#

Also, there's something wrong with the default css/html when the devtools are open. It tries to use a canvas the size of the full page and doesn't account for the devtools

vast vine
twilit dew
near mist
#

bevy run --verbose should help with this

limber wedge
vast vine
#

I tried wrapping my bevy run web command in bacon but it didn't work. Not sure what I did wrong, I feel like it should have worked.

limber wedge
vast vine
#

oh, I didn't try the background and on_change stuff

#

good idea

#

Would be nice if I could also pass in an example name separately but I don't think that's possible since web needs to come after

limber wedge
#

you can run bevy run --example ui_texture_atlas web or what do you mean?

vast vine
#

You can't do that with bacon is what I mean. You can't have a placeholder example_name in the command that gets replaced once you call the job

vast vine
#

So I need to create a new job for each example

#

I mean, it's not too bad, I rarely work on more than 1 or 2 at the same time, but still, that's a bit annoying

foggy basin
vast vine
#

Nope, but it's for wasm, would that even work?

#

But also, it's for work stuff and we are still on 0.15, so not sure if subsecond would work?

#

Anyway, in this case I want a full app restart for what I'm doing

#

I'm changing code that runs on startup

foggy basin
foggy basin
vast vine
#

I don't know about supporting bacon, but supporting a full reload should definitely be part of it

limber wedge
#

I think once im done setting up my new machine I would start preparing for the release of bevy_lint 0.4.0 @pale viper

#

I would also like a review for: https://github.com/TheBevyFlock/bevy_cli/pull/523 its mostly just boilerplate but it would make it easier to continue with: https://github.com/TheBevyFlock/bevy_cli/pull/529 broovy

GitHub

Objective
Support bevy lint and bevy lint web just like build and run.
Solution
I added the same configuration logic to the lint command that we use in the other commands.
Additionally, I removed t...

GitHub

Goal
Support listing and installing the available bevy_lint versions without hard-coding them.

Solution
The main goal of bevy lint install is to help users install the linter on their local machi...

foggy basin
#

Sorry I didn't have much time for open source recently.
Hopefully I can review PRs and finish the multi threading one soon!

pale viper
# limber wedge I think once im done setting up my new machine I would start preparing for the ...

You read my mind! I've been enjoying summer, so I haven't spent much time working on open-source recently, but we definitely should try to release v0.4.0 before Bevy 0.17 is out. I had started working on the release branch a while back, so I picked it back up today and opened up https://github.com/TheBevyFlock/bevy_cli/pull/533 :D

GitHub

It&#39;s been just about 4 months since we released v0.3.0 of the linter, and there are several new features and useful changes that have been introduced since then! Additionally, with Bevy 0.1...

#

<@&1064695155975803020> Hi! The Bevy Linter is ready to release v0.4.0, but per our release process we need at least one maintainer approval on https://github.com/TheBevyFlock/bevy_cli/pull/533 before we can move forward. I'd greatly appreciate it if you would test out the new features and make your last-minute change requests so that we can get this released before Bevy 0.17. Thanks!

limber wedge
twilit dew
pale viper
#

Looks like @rocky oxide merged https://github.com/TheBevyFlock/bevy_cli/pull/533, so the v0.4.0 release is underway! (Thanks for the reviews Alice and @limber wedge!) Give me an hour or so to create the Github release, as I'm not in a good position to do it right now :)

pale viper
#

I just realized I left this in

limber wedge
#

Wow alice is so fast ferris_spooky

#

Was approved before GitHub mobile finished loading

pale viper
#

Merge train? More like bullet train 🚄 😆

pale viper
#

It's officially out! Woohoo 🎉

shrewd monolith
#

Hm, would it be possible to emit a warning if you pass an unstable flag that doesn't exist? I keep on forgetting the exact web-multi-threading flag, and only realize until after I've recompiled the whole project 💀

Currently, it both successfully completes and doesn't emit a warning, so it's impossible to know from the tool itself if the flag was valid! Maybe I should mention this on the mutli threading PR.

pale viper
limber wedge
# shrewd monolith Hm, would it be possible to emit a warning if you pass an unstable flag that doe...

Yes i think in the open PR thats one of the open points: https://github.com/TheBevyFlock/bevy_cli/pull/499#discussion_r2217341946 so you get auto completion and validation of your flags too

GitHub

Objective
Closes #226.
Currently, all web apps are running on a single thread, which leaves a lot of performance on the table.
One of Bevy&#39;s premises is that it makes multi-threading automa...

foggy basin
#

Yea I think I'll try to implement it with an enum instead :)

#

Sorry for the delay on the PR, I will still address all the feedback!

foggy basin
shrewd monolith
foggy basin
pale viper
limber wedge
#

Thats perfect! Now i can continue on the linter installation branch broovy

pale viper
limber wedge
#

I would still also like a better way to share Clap argument types. Like we have quite a few duplicated types just for their doccomment and therefore the help message to change

limber wedge
pale viper
twilit dew
#

@shrewd monolith and CLI friends, what's the current way to get the experimental smooth audio in Wasm using bevy_seedling? I'm a bit out of the loop 🙂

foggy basin
foggy basin
twilit dew
#

I'll try when I hear from our friendly crow how to plumb it 🙂

#

Maybe setup a minimal repo so others can copy it if they want

foggy basin
twilit dew
#

And probably also add it to bevy_new_2d

foggy basin
#

I'm hoping to find some time this weekend to finish up the PR so we can merge it.
I'm super excited for the multi-threading stuff!

twilit dew
#

I think given that bevy_seedling upstreaming is nearly inevitable at this point, it would be alright to depend on it imo

foggy basin
twilit dew
#

Fair enough

foggy basin
#

Well bevy_seedling doesn't (AFAIK), but wasm multithreading does

twilit dew
#

Makes sense

foggy basin
#

Basically you need to activate some wasm features and also rebuild std with these features enabled.
That's currently nightly only, but according to François it might come to stable in the mid term

twilit dew
#

Definitely something that is worth it for me, but I see how it shouldn't be the default yet 🙂

#

(I use nightly all the time anyways because of the compile time improvements)

foggy basin
#

Sorry it was Miles, not François

foggy basin
# foggy basin

If we're lucky, seedling will also be upstreamed within that time frame, and then we'll really have a nice UX for all of this :D

#

I think the next year or two will be a huge leap for Bevy web apps

shrewd monolith
#

I should probably add an example for how to do it in bevy_seedling. The basic idea is that we're just swapping out the audio backend. bevy_seedling's main plugin is generic over the backend.

You'll probably want something like this in your app setup:

#[cfg(not(target_arch = "wasm32"))]
app.add_plugins(bevy_seedling::SeedlingPlugin::default());

// right now, `Default` isn't implemented for any non-cpal backend
#[cfg(target_arch = "wasm32")]
app.add_plugins(
    bevy_seedling::SeedlingPlugin::<firewheel_web_audio::WebAudioBackend> {
        config: Default::default(),
        stream_config: Default::default(),
        spawn_default_pool: true,
        pool_size: 4..=32,
    },
);

And then something like this for your toml:

[target.'cfg(target_arch = "wasm32")'.dependencies]
firewheel-web-audio = "0.1.0"

And, thanks to the CLI, it should be much easier to build and serve it :)

#

There's probably a more elegant way to do this. Although it seems like it would be kinda tricky to hide the details -- I like the plugin being generic over any backend.

foggy basin
shrewd monolith
foggy basin
#

With the CLI you can also set up that some features are automatically activated when you build for the web, which would play nicely with this

strong summit
#

for some reason building clippy utils for bevy_lint is failing with 79 errors, and if i run bevy cli it complains about not having rustup. building from the main branch

limber wedge
strong summit
#

im using a newer version which i assumed would be ok, should i try that one?

limber wedge
#

Yes you need to use the exact version specified in the rust-toolchain.toml

strong summit
#

ok

limber wedge
#

And are you on nixos?

strong summit
#

yeah

limber wedge
twilit dew
#

@foggy basin

#

I assume by "add to the rustflags" you mean "replace the original rustflags", right? :/

#

Or do you have some nifty additive rustflags hack?

twilit dew
#

If my hunch is correct, is there a way to set the relevant headers in the web dev server and leave the rustflags to me?

limber wedge
twilit dew
limber wedge
#

I thought you couldn’t pass all rustflags over the cli?

twilit dew
#

I don't know, I avoid it 😄

twilit dew
#

And maybe even for -Z build-std=std,panic_abort?

limber wedge
#

But ye we should definitely support your case

twilit dew
#

Oh, or hack in a --no-rustflags-env that just omits the RUSTFLAGS env var right before finishing 😄

#

Since any CLI command appending to that is a footgun for my setup

#

You know what? That's my feature request of the day ⭐

limber wedge
#

Its always hard to choose the right path between being flexible for powerusers / custom setups and easy out of the box experience for regulars

#

But we have to support config.toml somehow anyway in the long term.

twilit dew
twilit dew
shrewd monolith
twilit dew
shrewd monolith
#

(there are more target features and build steps than required in here though)

twilit dew
shrewd monolith
twilit dew
shrewd monolith
#

it just describes how you can run the web build with manually provided headers, which the CLI supports

twilit dew
#

Ooooh --headers="Cross-Origin-Opener-Policy:same-origin" --headers="Cross-Origin-Embedder-Policy:require-corp"

#

I didn't know about that 😄

#

great!

#

Thanks for the pointers!

twilit dew
#

this is perfect!!

#

Thanks a bunch 😄

twilit dew
#

oh my bad I already had an unstable table

#

@limber wedge do you know if this is still blocked?

#

If not, I'll open another feature request for setting headers in the config

#

@shrewd monolith is there some easy way to test whether it's working?

#

Because it seems like it's working for me

#

But since it's a minimal app there's no stutter there anyways

shrewd monolith
#

if audio is playing (and you're sure it's actually using the firewheel web audio backend), then it's necessarily working

#

With the way it sets up the audio, it will only play audio if the whole thing's working

twilit dew
#

Great!

#

In that case, everything is working heart_lime

shrewd monolith
twilit dew
#

I don't even need that specific branch of the CLI thanks to you 🙂

shrewd monolith
#

true

twilit dew
#

any way to silence that? hmm

shrewd monolith
#

no idea 😅

#

it never triggers any of my ci so blobshrug

twilit dew
#

But eh, just a warning, I can live with that

#

I get like 3 useless warnings per minute from winit anyways bavy_spin

shrewd monolith
#

it also seems to trigger kinda randomly
i never know at what crate the atomics warning will pop up

twilit dew
#

Alright, now step 2: integrate this into Foxtrot 🙂

limber wedge
foggy basin
foggy basin
#

@twilit dew so your use case is you have a single .cargo/config.toml in the project that has a top level rustflags attribute?
That shouldn't be too hard to support, but the edge cases are painful

twilit dew
#

With different rustflags depending on the target

foggy basin
twilit dew
#

I don't expect to see it within the next decade given Cargo's iteration speed

#

but lots of people want this upstream

twilit dew
twilit dew
foggy basin
#

Thanks!

twilit dew
foggy basin
#

(Well it is for web, but not for native)

twilit dew
limber wedge
#

like

❯ rustup show | grep "Default host:" | cut -d' ' -f3
x86_64-unknown-linux-gnu
shrewd monolith
limber wedge
rocky oxide
#

FYI

#

I've been thinking about this problem a bit more

#

And from the bevy_cli perspective, what would be ideally is if we could read the existing rustflags, append to them, and then restore them to their original state

#

I haven't worked with environment variables enough to know how hard that would be though

#

But this gets around the stupid problems with just overwriting any flags

limber wedge
twilit dew
#

I believe I linked my global config (~/.cargo/config.toml) in the issue

#

If it works with that, I'm more than happy!

limber wedge
#

i think it should will add tests later ^^

twilit dew
#

Thanks for tackling it!

#

That also means no more footguns for getrandom bs

foggy basin
limber wedge
foggy basin
foggy basin
#

So basically instead of the env we could inject something like

[build]
rustflags = [...]

into the config via --cfg.
It still wouldn't merge, we'd have to do that manually, but then it's part of the command invocation instead of env :)

foggy basin
#

I created a project board for bevy_cli web things, since it's a big part of the CLI and relates to many issues that need to be organized and prioritized
https://github.com/orgs/TheBevyFlock/projects/4
@pale viper @rocky oxide making it public requires more permissions than I have, what do you think? :)

rocky oxide
#

Ping me Sunday if you need help

pale viper
pale viper
#

It basically lets us run span_panic! and friends to include the piece of code that caused the panic

twilit dew
#

Did anyone ever look into improving the error: failed to obtain package metadata, are you in a cargo workspace? message?

#

I get that a lot when I heck up my Cargo.toml by e.g. pointing to a wrong dep and then have to use cargo check for better messages

#

I remember there was an issue about this hmm

limber wedge
foggy basin
foggy basin
#

Alright, I reworked the multi threading PR according to the review feedback.
The unstable features are now specific to the web commands and implemented with an enum to get better help output directly from clap.
I also renamed the option to multi-threading since it's web-specific now (except in the config, it's still web-multi-threading there).
I also tried to simplify how the option is applied to make it easier to track what's necessary for the multi threading :)
https://github.com/TheBevyFlock/bevy_cli/pull/499

twilit dew
foggy basin
twilit dew
twilit dew
foggy basin
foggy basin
twilit dew
#

Much much much better 😄

#

Though the "are you in a cargo workspace" error is still misleading haha

#

Could we remove that error if there is already an stderr?

foggy basin
twilit dew
foggy basin
twilit dew
#

Presumably, this would be printed in that case, no?

foggy basin
#

Yea, right

#

Maybe I'll keep the "failed to obtain package metadata" since it might not be clear which command failed, but remove the "are you in a cargo workspace" part

twilit dew
#

Right now nothing is differentiating it from the regular cargo output

foggy basin
#

Oh it's merged already, nevermind lol

twilit dew
#

bevy failed to obtain package metadata

foggy basin
twilit dew
#

bevy_cli failed to obtain package metadata

foggy basin
#

I'm also reconsidering that the cargo metadata has tracing level for logging. I think it should just be debug like the rest, so you can easily see it with the --verbose flag

#

I'll create a follow-up PR :)

twilit dew
foggy basin
#

So after the rustflag merging, what would be your next top requested CLI feature @twilit dew ? :)

twilit dew
#

I know we have API for that theoretically, but it's virtually useless IME

#

Like, it's certainly something nice to work upon in the future, but as a current user, it's not workable.

#

I remember Cart saying that it hurts a bit to see that nearly all 3D showcases of Bevy he sees have aliased textures in them, because there's no easy way to generate mips

#

And yeah, that kind of thing should be part of a preprocessing pipeline

#

I don't expect any newcomer to be able to do this

foggy basin
#

How would you envision the asset preprocessing to work?
Would the hooks feature serve your needs, which could execute arbitrary commands before or after building?

twilit dew
#

also, take a look at our oldest issues in the CLI 😄

twilit dew
#

For my current asset baking, I convert all textures to KTX2, compress them, and generate mips for them. This process can take up to a minute

#

So that should not be running before every build haha

foggy basin
twilit dew
#

In this very specific case, having a command that I can run manually would be nice

#

So I can run it locally to test the baked assets, or run it as part of the release workflow

#

For a long time, we had basically no way at all to generate a cubemap for Bevy without a PhD, but mateh created his cool Blender script a while ago

#

So now we can actually convert regular EXRs found off PolyHaven and co. to a Bevy format

foggy basin
twilit dew
#

Let's start at mips

#

Mips are something every 3D dev wants, otherwise they get this kind of aliasing

#

Unfortunately, the "classic" formats people know like PNG and JPG don't support mips

#

The "canonical" format for those in Bevy is KTX2

#

Which not many viewers support. e.g. you cannot just double click on the files to see them

#

So there is some buy-in cost. Most people will probably not want KTX2 files in tree, but only in the released game

#

Now whether it needs Bevy config, there are two situations

#

If you simply load the image, then the ending has to match. So, you may have to write something like this:

let path = #[cfg(feature = "dev")] { "foo.png" } #[cfg(feature = "release")] { "foo.ktx2" };
#

Fortunately, the CLI helps a lot with these features 🙂

#

But as you see, its not exactly plug-and-play

#

The other situation is glTFs referencing textures

#

That part is much better

#

Rob Swain has had a brilliant idea for that

#

You can just change the reference inside the glTF file, and Bevy will happily follow it

#

So, if you load a glTF file referencing PNGs, you can just edit the glTF itself to point to KTX2 files after baking. No changes in Bevy needed!

foggy basin
#

Tbh I previously thought mipmaps are generated at run-time (or rather startup/loading screen)
So it's more common to preprocess them?

twilit dew
foggy basin
twilit dew
twilit dew
#

Locally, you can work with symlinks

#

Have an assets_raw and assets_baked dir or something like that, where assets_baked is in your .gitignore

#

Then have a symlink from assets to assets_raw or assets_baked

#

This is not something I would advise for the CLI, as this completely breaks down on Windows bavy

#

So instead, it seems to me like the simplest solution is to just create a dir called assets_baked and let the user deal with it

#

You can also use an env var to set the assets dir to be used BTW

#

lots of stuff the user could do: symlink, env var, configure the plugin to point to assets_baked, etc.

#

Again, I think it's enough for the CLI to generate a assets_baked 🙂

#

Does that make sense so far?

foggy basin
foggy basin
#

I think the CLI will also have to have a cache folder, so we can hash the original assets and only reprocess when things changed

twilit dew
foggy basin
twilit dew
#

Oh, there is one more issue about mips.
When generating KTX2s you need to differentiate between diffuse textures, linear textures, and normal maps

#

This means using some kind of heuristic for "regular" images, like looking at their names

#

But again, trivial for glTFs, as they already tell you how they use their textures 🙂

#

Here's the relevant tool

foggy basin
#

So all in all this sounds like a high effort high impact situation

twilit dew
#

So that's mips

#

Now cubemaps

#

Cube maps are needed for skyboxes and environment lights. Both are really really important in 3D. But when you google for them, you will almost always find HDRis or EXR files. Bevy can't read those directly, yet.
The authority here is @tight shore. I believe he's planning on implementing direct HDRI / EXR cubemap reading in Bevy. In the meantime, he already implemented a very easy to use tool here: https://github.com/mate-h/blender-envmap

GitHub

Environment Cubemap difuse irradiance and specular radiance MIP maps generation with Blender - mate-h/blender-envmap

#

That one just spits out Bevy-compatible cubemaps

#

Once you have those, there's no reason to keep the original HDRis around, to my knowledge

#

So implementing this is low effort, high impact. BUT there's a chance it's obsolete soon anyways. I'll let mateh speak on that

#

Last one is meshlets

#

This is the one that cannot be solved by third party tools

#

Meshlets are their own custom format for Bevy's meshlet feature

#

You need to create them from Bevy Meshes

#

Those only exist at runtime, they intentionally have no form on disk

#

So you need to create a little Bevy app to even be able to process meshes to meshlets

#

This barrier means that nearly no one I know ever worked with meshlets in a real project

#

Which is a shame, given what they offer

#

In a nutshell, in 3D you at some point in your project will reach a stage at which your scene runts too slow because all your stuff uses a lot of triangles

#

The solution for that is historically to create LODs, those are 3D models that have lower resolution. Then you use those at a distance where the player doesn't notice.

#

Trouble is that those need to be made by hand

#

You can easily end up with like 4 LODs for a given model, so this is a lot of time you need to invest

#

Meshlets / Nanite is revolutionary in that it simplifies the geometry automatically

#

Even better, it simplifies it where needed. If a part of a big mesh is far away and another part of the same mesh is close by, only the far away part gets simplified

#

That is my nutshell explanation of meshlets

#

So this is really really valuable for a subset of developers. Namely, those that use 3D with enough models and / or enough details and / or enough render distance to suffer performance issues
Edit: also, meshlets allow culling parts of the mesh that are not visible!

foggy basin
#

(I'll be afk for a while, will be back later. Thanks for putting this together!)

twilit dew
#

But, as I said, they're have quite a bit of a barrier of entry in Bevy

#

Given that the vast majority of 3D Bevy devs I've talked to use glTFs for their models, I believe the CLI could do a great service if it had some way of converting a glTF to a meshlet mesh

#

Since glTFs are exported data and not authoring data, you can also safely delete the original glTF after this process

#

Well, of course you should let the user decide and not just delete stuff without them knowing

#

But I mean that in contrast to the texture mips, you don't need a separate assets_baked dir

#

If you're fine with putting the glTF in your repo, you should be fine with putting the meshlet in the repo instead

#

Now the effort of all this is probably the most annoying, since you have to wrangle the asset preprocessing API. These parts of Bevy are not well-explored and you might run into things that don't work, or work differently than you expect, or have hidden limitations, etc.

twilit dew
# twilit dew Now the effort of all this is probably the most annoying, since you have to wran...

So I'd say that this is unknown-effort (maybe low, maybe high, I just know it's annoying), and mid-to-high impact. The important thing to keep in mind is that there is currently no other tool that is capable of doing this, to my knowledge. There is https://github.com/zeux/meshoptimizer, but it uses a different meshlet representation than Bevy and I think Jasmine didn't manage to reconcile those. But I may be out of the loop

#

To expand on this, this is low (or even zero) impact for people just prototyping things, and high impact for people doing something in 3D that they want to publish

#

And that's my TED-talk 🙂

#

So if I had to pick one, I'd be most interested in meshlet conversion, followed by mip generation, followed by cubemap (cubemap is this low because mateh did a fantastic job on his current tool, otherwise this would be at the top)

twilit dew
#

@slim pine We're discussion asset preprocessing in the CLI alpha 🙂

#

Probably not entirely relevant until we have first-party collider types in Bevy, but still worth mentioning

#

Also yoinking in @shrewd monolith

shrewd monolith
#

oh yes it would be so convenient to be able to process audio files into ogg vorbis

#

for probably 95% of audio files, ogg vorbis is the correct choice, but it can be really annoying to convert a heap of wav files to it, especially during development

#

My DAW of choice can't even output oggs

twilit dew
shrewd monolith
twilit dew
#

So the bevy cli could in principle just wrap ffmpeg for this

#

sweet!

shrewd monolith
#

yes, or we could use symphonia too

#

which might be a little more reliable (no runtime tool dependencies)

worthy widget
#

Encoding is actually leagues harder than decoding. Which is why there aren't many projects that do it.

twilit dew
#

I assume you meant encoding is harder than decoding 😛

worthy widget
#

Lol, typo

#

(ogg is the file format, whereas vorbis is the actual encoding/decoding algorithm typically used in ogg)

shrewd monolith
#

i wonder what the policy for C wrappers is in the cli
is that more or less sinful than using ffmpeg? 😅

worthy widget
#

I guess the main advantage is that the user won't have to install the ffmpeg dependecies.

#

Also, don't forgot about the Opus codec. It's higher quality than vorbis for the same bitrate.

limber wedge
#

If possible i would like to avoid cli tools that aren’t very well established in the ecosystem. The end goal is still to be upstreamed and i think we should avoid bus effects if possible. (Not only related to ffmpeg vs rust impls)

twilit dew
worthy widget
#

Though personally I would be fine with relying on ffmpeg. It is an industry standard library after all.

twilit dew
#

Oh are you referring to something like "we should use ffmpeg instead of some homemade Rust port"?

limber wedge
limber wedge
#

For the asset stuff you showed two repos from active bevy maintainers so i think it would make more sense to just include it rather then depend on it i guess

twilit dew
#

Which makes sense for C / C++ stuff, you cannot get that on Wasm, you have to RiiR it

#

But IMO the CLI doesn't need to have those restrictions

shrewd monolith
twilit dew
#

Which is to say, I would rather depend on wrapping a battle-tested existing tool than doing our own thing

#

Though maybe you're agreeing with that @limber wedge? Not sure I completely got you 🙂

twilit dew
limber wedge
twilit dew
#

Ah okay, then we're in agreement 😄

#

I think I just misread your earlier comments, don't mind me

worthy widget
#

Yeah, ffmpeg would make it easier to support both vorbis and opus.

limber wedge
#

Ment more that if its not a well known tool and its rather small i think it could make sense to do it ourselves so its its under the bevy org and that one has a lot of active maintainers 😄

worthy widget
#

Though keep in mind ffmpeg has a steep learning curve (it's meant to handle every file container format and codec under the sun, so there are a lot of parameters).

#

It would be handy to have an easy-to-use wrapper around ffmpeg that can automatically convert your audio assets into ones best suited for games.

foggy basin
twilit dew
foggy basin
#

In that case, the audio processing might actually be a decent starting point for the asset processing capabilities.
Sounds relatively easy to go through all audio files and convert them to opus or vorbis ogg.
Then we could use it to set up the workflow and then refine / extend it iteratively

shrewd monolith
twilit dew
foggy basin
twilit dew
#

@shrewd monolith it shouldn’t go through all audio, right?

foggy basin
#

And then it should be possible to define the asset folder to use in the CLI config, then you could for release builds define the processed asset directory

twilit dew
#

IIRC some things are better in WAV?

foggy basin
#

Do we need glob-like ignore patterns?

twilit dew
#

I imagine that users would have their wavs in a different dir, since they are semantically different, think music vs sfx

#

@shrewd monolith please correct me

shrewd monolith
#

well very short sfx are actually a prime wav candidate, whereas music is often so big it would be irresponsible not to compress it!

shrewd monolith
#

(short sound effects benefit less from compression, and since they're often played in rapid succession, using an easily decodable format can sometimes make sense)

foggy basin
#

I'm thinking more and more the first iteration will probably not handle all use-cases :D

twilit dew
#

Anyways, a simple solution would be to leave it up to the user to organize their files and just let them point the CLI at some dir

#

^ same for meshlets btw

twilit dew
#

The API hole is in having something that works easily for the 95% of users

#

For example, I believe a non-goal for the CLI is to define a file that lists all assets and how to process them. That is something we already conceptually have: .meta files

foggy basin
foggy basin
foggy basin
twilit dew
# foggy basin One question would be if we should take the time to build the CLI solution or if...

In an ideal world, the builtin preprocessing would have so many builtins that as a user I should be able to just write a little meta file and be done with it. In that sense, I believe that the CLI preprocessing is ultimately temporary.
But the only person who really pushed for preprocessing was Cart, as part of the infamous Assets V2 monster. Since he has bigger fish to fry, I believe it will be long until preprocessing will ever be touched again in-engine. Of course, there can always be a random contributor who is passionate about that and spearheads development, but I wouldn’t count on it.
So I'd personally estimate we are at least one, probably more than two years away from having a good builtin preprocessing pipeline API that is batteries included, i.e. I don’t need to go and write code for destructuring glTFs and such by hand.

#

Given that many CLI preprocessing tasks can right now be implemented as "wrap this other command", I believe we can get something very usable out very soon if someone takes some time to implement them

#

Also, some features like meshlets essentially don’t really exist for most users while we are stuck without preprocessing

stone steppe
stone steppe
stone steppe
stone steppe
stone steppe
# twilit dew <@145540119141679105> mind correcting any mistakes I made in my assessment? Cont...

Think I got them all. Overall pretty accurate. I will say that the main blockers I had when I tried to do this in https://github.com/bevyengine/bevy/pull/13431 is that:
*glTF is a pain to write. It's easy enough to add the processed meshlet mesh appended to the file, but removing the original mesh and rewriting all references to it to the meshlet mesh is really really difficult

  • We don't have a clear path towards processing glTFs. E.g. you can process the glTF to convert meshes to meshlet meshes, but then what about all the images in it? How do you map those to seperate assets to process? Might not be as big a deal for the CLI as it was in an asset processor
GitHub

Objective

Allow importing GLTF scenes (gltf + separate bin, gltf embedded, or glb) and converting all meshes to MeshletMeshes

Solution

bevy_gltf has two new features - meshlet, and meshlet_proce...

rocky oxide
#

I would appreciate your reviews on this please 🙂

buoyant jasper
#

Hi folks! Is there any ETA for a new (alpha) release of the CLI? I'm still pinned to a specific commit that has the wasm-opt parameters feature in it and it would be nicer to just depend on a tag.

pale viper
#

I definitely want to check in with @foggy basin and @limber wedge, though, since they're more involved with the CLI side of things than I am

#

I think there's a good chance that v0.1.0-alpha.2 will be the last release before we get upstreamed, though

foggy basin
vast vine
#

Has there been talk about automated migrations using the cli? I think it might be possible to at least automate some migration path using a tool like https://ast-grep.github.io/ It's a rust based project that can transform patterns to a new pattern. It uses AST instead of just regex which means it's a lot more flexible. It will likely require manual work, but the community could slowly build up migrations and it would still be better than nothing.

#

I don't know if ast-grep can be used as a library, but I used it at work to do a bunch of bevy migrations

foggy basin
# pale viper I think there's a good chance that v0.1.0-alpha.2 will be the last release befor...

Tbh I'm still a bit fuzzy on how exactly the upstream process will work.
If we completely stop work on the prototype until everything is upstreamed, if/how we transfer commits to retain all original contributors (also for small fixes), how the CLI repo will operate once it's upstreamed (e.g. who will have merge rights and what will the review policies be) and how we would chunk up the upstream PRs

foggy basin
# vast vine Has there been talk about automated migrations using the cli? I think it might b...

It has definitely been discussed before, but not in too much detail AFAIK.
So far I think it mostly focused on integrating more deeply in the Rust syntax, basically similar to how the linter is set up.
Until now, it has been dismissed as too challenging IIRC.

But I definitely see a lot of value in it if we could get it to work. I guess it also wouldn't have to get you 100% there, 80% would probably already help a lot

vast vine
#

Honestly, just having repository of ast-grep files preconfigured for a specific migration would be super nice, but having that as a feature of the cli would be even nicer

#

I don't think it would ever be a full migration, but at least handle the trivial migrations

buoyant jasper
foggy basin
buoyant jasper
#

But I don't know what would be the cons of that. To me it makes sense to maintain it as a separate thing.

foggy basin
vast vine
#

But I guess even if it's not, since it can be installed through cargo it woudln't be too hard to install automatically and call out to it

foggy basin
vast vine
#

Right, good point

foggy basin
vast vine
#

Oh, neat, didn't know that, even better

foggy basin
#

Since we need wasm-bindgen, wasm-opt, etc

vast vine
#

I think I should start a separate intiative to have a repository to host ast-grep files for specific migrations in a repo and then eventually letting the cli use that. That way we can keep the cli more focused for now

foggy basin
#

@vast vine would you like to open a new issue on the CLI repo regarding the migrations?
I would be especially interested in reference configs that you used for the ast-grep tool if you have any available

foggy basin
#

The migration files would be most of the work anyway, calling the CLI tool with the correct args seems trivial in comparison

vast vine
#

I'm planning on being a bit more structured with it once I migrate out work codebase to 0.16

foggy basin
#

The "good" part about migrations is, even if they take a long time after release to put together, there would probably still be a good amount of projects who could benefit from them

vast vine
#

Yeah, exactly, I'm hoping this help reduce my workload if I don't have to come up with new migration file on my own every time. And as more people use it we'll likely be able to generate them fairly quickly

#

#1404563804947353742

sturdy tapir
#

Opinions from those who have dealt with rustc drivers?

whole narwhal
whole narwhal
#

ffmpeg could be installed by using winget on Win11, even without admin permission: winget install ffmpeg . Not sure about Win10.

pale viper
foggy basin
#

"I want to build this Bevy example for the web, how do I do it"?
CLI "I got you bro"

debug: running: `cargo build --config profile.web.inherits="dev" --config profile.web-release.inherits="release" --config profile.web-release.opt-level="s" --config profile.web-release.strip="debuginfo" --config dependencies.getrandom_02.package="getrandom" --config dependencies.getrandom_02.version="0.2.12" --config dependencies.getrandom_02.features=["js"] --example breakout --profile web --target wasm32-unknown-unknown`
debug: with env: RUSTFLAGS= --cfg getrandom_backend="wasm_js"
pale viper
foggy basin
#

A bit unhinged, but it works!

limber wedge
#

i will update my pr and review yours tomorrow morning Tim! it has been sooo hot here that i dont really feel like thinking in the evening ^^

sturdy tapir
dusky onyx
pale viper
#

And what specifically do you need this reflection data for? (In the terms of the editor)

sturdy tapir
#

This is cause bsn spec doesn't require things to be exhaustive
So gotta get info elsewhere

foggy basin
#

@silk delta I now have something testable for the getrandom stuff.
It's still blocked by another PR, but unless you have other rustflags defined in your project it should already work.
If you want you can take a look here: https://github.com/TheBevyFlock/bevy_cli/pull/547
I included instructions on how to try it out, but let me know if you have any questions!

pale viper
#

Are you trying to use reflection to auto-complete BSN in the editor?

sturdy tapir
# pale viper Are you trying to use reflection to auto-complete BSN in the editor?

yes thatd be the first big usecase
Bsn will get loaded into the editor in a pre-world state (still waiting on exact details from cart but he likens it to a ast of the bsn)but if a loaded file doesnt contain all the data the editor needs for a component we need to fill in the gaps with reflection data, but rn theres now way to get said data without a full successful compile of the user's game, so want to explore dumping that data via a rustc driver

twilit dew
#

Ooooooh rustflag merge landed 😄 🎉

limber wedge
#

broovy im fighting against the heat

twilit dew
#

Just went on galaxus for ACs

#

nearly all sold out

#

Send help

limber wedge
#

Lol i have one fan that is so useless and super loud. Not sure if its making me more crazy then just taking the heat

twilit dew
#

No more debugging my stuff for 30 minutes only to discover the issue was rustflags

#

thanks heart_lime

limber wedge
#

No worries!cheeseman

#

Hope it works for your config too lol

twilit dew
limber wedge
#

Yes that one is soo cool! Looking at it right now

rocky oxide
#

We need to send the Europeans heat pumps pensive_cowboy

silk delta
#

We will send back steam in return

foggy basin
twilit dew
limber wedge
#

it just adds all the rustflags defined in Cargo.toml to the once that get resolved from cargo config

twilit dew
foggy basin
limber wedge
#

or obv create a local cargo/config.toml bavy_spin

sturdy tapir
foggy basin
#

Let me know how it works for you :)

whole narwhal
#

What is the current incantation to run a sample in web including getrandom? bevy run -r --sample animation_graph web --open gives the usual getrandom problems. Thought that was included in current main?

foggy basin
whole narwhal
#

Thank you!

whole narwhal
#

This is so much easier, works like a charm

silk delta
#

Does the CLI work with building an existing project?

#

Because I might test it with some bevy_rand examples

foggy basin
twilit dew
#

Added this to my Cargo.toml:

[package.metadata.bevy_cli.unstable]
web-multi-threading = true
#

but bevy run web is not running with audio

#

Oh wait I need -U multi-threading

#

can I enable that for all my web builds automatically?

#

hmm still not working

#

I'll set up a branch of foxtrot

#

okay it works now, idk why hmm I blame caching

#

@foggy basin it all looks good, I just have one concern

#

RUSTFLAGS=--cfg getrandom_backend="wasm_js" --cfg getrandom_backend="wasm_js" --cfg web_sys_unstable_apis -Ctarget-feature=+bulk-memory,+sign-ext,+nontrapping-fptoint,+atomics -Zshare-generics=y -Zthreads=8 -C target-feature=+atomics,+bulk-memory

#

This is my merged RUSTFLAGS

#

What happens to the two -Ctarget-features?

#

Do they get merged by rustc or does the second overwrite the first

#

I assume they get merged

#

But I'm not sure hmm

foggy basin
foggy basin
#

We could try to detect the duplicates and filter them out, but it's probably not trivial given the different Syntax you can use

twilit dew
#

let me try doing one where I set one to atomics and one without atomics

foggy basin
#

And actually for the get random backdnd flag I already implemented that it shouldnt add it if its already included but looks like that doesn't work lol

foggy basin
#

So there is still hope for my code 🤞

twilit dew
#

RUSTFLAGS=--cfg getrandom_backend="wasm_js" --cfg getrandom_backend="wasm_js" --cfg web_sys_unstable_apis -Ctarget-feature=+atomics -C target-feature=+bulk-memory -Zshare-generics=y -Zthreads=8

#

this here has atomics on

#

let me flip the order, just to make sure

foggy basin
twilit dew
#

but works with --features foo,bar too

foggy basin
foggy basin
#

But I won't complain if it merges :D

twilit dew
#

would have to check source to be sure

twilit dew
#

which sounds good 🙂

#

BTW how come the CLI doesn't activate --cfg web_sys_unstable_apis?

#

I heard that's also needed?

#

But idk 😄

foggy basin
#

Maybe its only needed when you use the web sys crate?

twilit dew
#

It was needed for bevy_egui in Wasm

#

Or Hanabi

#

one of those

foggy basin
#

For multi threading or something else?

twilit dew
#

Can't remember

#

But it's been a while

#

I think maybe clipboard support?

#

Something like that

#

Anyways, nothing relevant to the CLI 🙂

#

Ah btw, are you aware that these options here make the generated Wasm faster?
"-Ctarget-feature=+sign-ext,+nontrapping-fptoint"

#

Don't ask me what they do lol

#

But they but passed around (in addition to +bulk-memory, but I think that is the default now) during the jam for people to improve their performance

#

And I can confirm it worked for us

limber wedge
#

so are rustflags good? sweatingatm

twilit dew
#

At least on my end, it seems good

limber wedge
twilit dew
#

so it runs on the GH runner

twilit dew
#

Well now it stopped working again 👀

#

Can someone try Foxtrot's main?

#

with bevy run web

#

It's not playing audio in the browser for me

#

RUSTFLAGS=--cfg getrandom_backend="wasm_js" --cfg getrandom_backend="wasm_js" --cfg web_sys_unstable_apis -Ctarget-feature=+bulk-memory,+sign-ext,+nontrapping-fptoint,+atomics -Zshare-generics=y -Zthreads=8 -C target-feature=+atomics,+bulk-memory

#

It's definitely merging the RUSTFLAGS

#

Is it maybe not settings the headers?

#

It's probably also overriding my config.toml's build-std, come to think of it

limber wedge
#

i think --verbose logs the headers?

twilit dew
#

drum roll

#

My headphones turned themselves off ._.

limber wedge
#

oh

twilit dew
#

🎉

limber wedge
#

dont forget to open an issue for that (;

twilit dew
#

can confirm that bevy run web works with the new option on main when used in conjunction with the firewheel web backend hahaha

limber wedge
#

nice!!

#

thanks so much for testing!!

twilit dew
#

Itch.io release should be ready in like 20 mins

twilit dew
foggy basin
twilit dew
silk delta
foggy basin
silk delta
#

Is the next CLI version being targetted for Bevy v0.17? If so, I might put a reference in my example docs on how to build with the CLI

limber wedge
#

The CLI can be used with any bevy version

silk delta
#

Aight, so then I'll just wait until the getrandom PR gets merged, since it is worth mentioning it in any case

pale viper
#

Just a heads up: I’m going to be a bit busy in the next few weeks! (I’m moving to college!) I’ll keep up with Discord, but probably won’t have time for Github until things settle down

#

Let me know if y’all need anything, though! :)

limber wedge
#

Is the college near your parents place?

pale viper
#

It’s a bit of a drive, so I’ll be living in dorms, but it’s not so far that I’ll be stuck in case there’s trouble

#

I’m excited, it’s going to be fun!

#

(And there’s some cool cybersecurity classes I’ll be taking there too)

limber wedge
#

Im studying cyber security bavy

stone steppe
pale viper
pale viper
stone steppe
#

Ah, I went to UMD for cybersecurity lol, I was curious if it was the same place

foggy basin
limber wedge
#

is there a way to also disable this behavior? (not sure if it needs to exist since its required for getrandom)

foggy basin
silk delta
#

For custom builds like embedded, that's probably when you want your own setup anyway

limber wedge
#

ah i see makes sense!

foggy basin
#

Before tackling any new bigger topics for the CLI, I plan to do some polishing and cleanup in preparation for a potential new release

#

For example, I finally want to have build times and binary sizes logged at the end of the command

pale viper
#

Totally! I think things are shaping up nicely, looking at the changelog

limber wedge
#

looking at https://github.com/TheBevyFlock/bevy_cli/pull/547 in one of my projects i also used bevy_rand:

bevy_rand = { version = "0.10", features = ["wyrand"] }
rand_core = "0.6"
rand = "0.8"
```  and here it does not work is this expected? 

```error: The "wasm_js" backend requires the `wasm_js` feature for `getrandom`. For more information see: https://docs.rs/getrandom/0.3.3/#webassembly-support```
GitHub

Objective
Closes #546.
Automatically configure the getrandom web backend when necessary, to avoid build failures.
Solution

Detect usage of getrandom (and whether the backend is applied) via cargo ...

silk delta
#

Oh, using older bevy_rand version hmm

#

Wait, it should still work

limber wedge
#

yea i used to set ```toml
[target.wasm32-unknown-unknown.dependencies]
getrandom = { version = "0.3.2", features = ["wasm_js"] }

#
[dependencies]
bevy = "0.16"

bevy_rand = { version = "0.10", features = ["wyrand"] }
rand_core = "0.6"
rand = "0.8"
``` just this in an new project
#
debug: running: `cargo build --config profile.web.inherits="dev" --config profile.web-release.inherits="release" --config profile.web-release.opt-level="s" --config profile.web-release.strip="debuginfo" --config dependencies.getrandom_03.package="getrandom" --config dependencies.getrandom_03.version="0.3.3" --config dependencies.getrandom_03.features=["wasm_js"] --bin test_project --profile web --target wasm32-unknown-unknown`
debug: with env: RUSTFLAGS=-Zshare-generics=y -Zthreads=8 --cfg getrandom_backend="wasm_js"```
silk delta
#

Also, if you are using bevy_rand from v0.10 onwards, you can use latest rand

#

And it will be made compatible with bevy v0.16

limber wedge
#

oh good to know thanks! but it should still work

silk delta
#

That pr should set the feature for both versions of getrandom in any case

limber wedge
#

yea i will check maybe while reviewing i can spot it bavy

silk delta
#

Also, don't you just love this getrandom update? bavy_spin

limber wedge
#

seems pretty... random

pale viper
#

If you haven’t been watching #engine-dev, there’s been a bit of discussion on the CLI’s getrandom support

#

I think we should consider releasing soon, as this feature is so big that some people are installing the CLI from main

pale viper
#

Ohhh right 😅