Skip to content

Introduce Bevy-specific requirements #9

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

CorvusPrudens
Copy link

This PR provides a few guidelines for audio engines with respect to Bevy integration.

@alice-i-cecile please feel free to suggest further changes! If we want to expand more on these points, Alice will do a better job than me. However, the requirements really aren't that onerous, so I doubt there's too much more to say.

Closes #5.

@CorvusPrudens
Copy link
Author

Okay, I think I've captured all the feedback that's actionable for audio engine authors. The justification for each point is still fairly minimal, so we can expand on those further if we want.

Copy link
Collaborator

@dvdsk dvdsk left a comment

Choose a reason for hiding this comment

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

Currently this is written expecting the reader to know some ECS. I've just looked at ECS for the first time (reading the Bevy quick start guide).

To me its reasonable to require readers to put in that effort, though having just done that myself the ECS driven design section is still not clear to me.

Specifically the section about keeping track of emitter positions and transform. Why is that easy when the components share the same entity?

Is entity sharing something that the audio engine needs to be written for or is that just a detail of how a bevy user interacts with the audio system? If its just a detail of how the user sets things up I would propose removing the sentence. Otherwise I would suggest clarifying it.


*TODO*
Bevy is a popular game engine built around the ECS paradigm.
Copy link
Collaborator

Choose a reason for hiding this comment

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

(nitpick) lets link to the Bevy ECS guide (probably this one right? https://bevyengine.org/learn/quick-start/getting-started/ecs/) since its required reading to understand this section.

deeply with the ECS; they are choosing _ECS-driven_ design.
This provides quite a few advantages to both crate authors and users.
For example, keeping track of emitter positions for spatial audio is easy
when emitter and transform components share the same entity.
Copy link
Collaborator

Choose a reason for hiding this comment

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

with transform components you mean effects like low_pass?

Copy link
Contributor

Choose a reason for hiding this comment

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

No, Bevy's GlobalTransform.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggestion:

  • replace 'transform' with a link to bevy's GlobalTransform.
  • replace emitter with 'sound emitter' (though that's clear if you keep reading it lowers cognitive load to have the word sound here).

@dvdsk
Copy link
Collaborator

dvdsk commented Apr 13, 2025

Specifically the section about keeping track of emitter positions and transform. Why is that easy when the components share the same entity?

maybe we can feature this in the demo and then link to that code section from here?

@CorvusPrudens
Copy link
Author

@dvdsk It's easy to keep track of positions in relation to emitters because a single entity owns both. That means you can query for both at once:

fn emitters(emitters: Query<(&SpatialNode, &GlobalTransform)>) {
    for (spatial_node, transform) in &emitters {
        // ...
    }
}

The spatial_node and transform components come from the same entity, so storing and accessing them together is easy and natural. If you opt for a less ECS-driven design, you'll need to maintain some secondary structure to keep track of which entities (and positions) correspond to the emitters in your audio engine. This is just one among many points in favor of ECS-driven.

The above is a more complete explanation, but I'm not sure it's appropriate for the section on ECS here. If you think the sentence on this will throw some readers off, it may be better to simply remove it and link to a more thorough ECS overview. In any case, people looking to implement a Bevy-native-feeling audio integration will need a solid understanding of Bevy's ECS and the community's general patterns -- and these people probably don't need to be told why an ECS can be nice!

@CorvusPrudens
Copy link
Author

Alternatively, if we feel the ECS section really should have some justification on why ECS-driven is preferred, I could add a more thorough explanation and possibly even a handful of other examples that really demonstrate the principle. We could even tuck it into a details element to not distract from the rest of the document.

@dvdsk
Copy link
Collaborator

dvdsk commented Apr 24, 2025

@dvdsk It's easy to keep track of positions in relation to emitters because a single entity owns both. That means you can query for both at once:

fn emitters(emitters: Query<(&SpatialNode, &GlobalTransform)>) {
    for (spatial_node, transform) in &emitters {
        // ...
    }
}

Very clear, thanks for the example. I agree that we should not explain the finer details of ECS here. I'll see if I can find a small tweak to the text that would help a bit with understanding without distracting.

@dvdsk
Copy link
Collaborator

dvdsk commented Apr 24, 2025

We could even tuck it into a details element to not distract from the rest of the document.

Some sort of requirements appendix might work?

edit: we could then go into a little more detail on other elements too, such as channel order/masking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need input from Bevy on requirements
5 participants