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

Different plugin groups to support different use cases (diverse-defaults for short) #48

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

Conversation

colepoirier
Copy link

@colepoirier colepoirier commented Jan 24, 2022

Rendered

There are many different categories of bevy applications. Each use case has a sufficiently different commonsense default configuration to warrant different use case specific default plugins. This RFC is a proposal to consider making such a 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.

First round of feedback and clarity suggestions :)

rfcs/48-diverse-defaults.md Outdated Show resolved Hide resolved
rfcs/48-diverse-defaults.md Outdated Show resolved Hide resolved
rfcs/48-diverse-defaults.md Outdated Show resolved Hide resolved
rfcs/48-diverse-defaults.md Outdated Show resolved Hide resolved

## Implementation strategy

Each of the above outlined `Plugins` may have some combination of the following divergent platform configuration needs:
Copy link
Member

Choose a reason for hiding this comment

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

It's not clear how exactly this interacts with the "use case" plugins groups above 🤔 I agree that we want both, but they seem mostly orthogonal.

Copy link
Author

Choose a reason for hiding this comment

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

I think @mockersf proposal enables use to meld the two in a sensible way!

rfcs/48-diverse-defaults.md Outdated Show resolved Hide resolved
- `ApplicationPlugins`: Suitable for making CAD applicaions or something like excel.
- `SimulationPlugins`: Plugins that make writing scientific simulations easier like enhanced determinism and ordering guarantees.

## Implementation strategy
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be helpful hear to identify "axes of variation"; ways that each of the use cases commonly vary, so we can think about how to structure them.

Copy link
Author

Choose a reason for hiding this comment

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

I very much agree, though I don't know how to flesh this out.

- `MinimalPlugins`: The very basic internal structure required to ensure things like `Time` function properly.
- `GamePlugins`: Suitable for making both 2D and 3D real-time games with input handling, audio and rendering (note: previously `DefaultPlugins`).
- `2dGamePlugins`: Like `GamePlugins`, but limited to the systems and resources needed in a 2D game.
- `TuiPlugins`: Suitable for making TUI applications.
Copy link
Member

Choose a reason for hiding this comment

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

This needs a note in implementation details on what we should include to get this working.

Copy link
Author

Choose a reason for hiding this comment

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

What exactly would we need to include to get this working? I don't understand the details of the bevy DefaultPlugins code I guess.

Copy link
Author

Choose a reason for hiding this comment

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

Also would probably prefer to just migrate my initial proposal to the one @mockersf suggested which I think addresses the problem area even better! :)

Copy link
Member

Choose a reason for hiding this comment

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

The bigger problem is "I don't know how to make a terminal game in Bevy 0.6" at all. There were a few ecosystem crates, but they're no longer up to date.

rfcs/48-diverse-defaults.md Show resolved Hide resolved
rfcs/48-diverse-defaults.md Outdated Show resolved Hide resolved
@mockersf
Copy link
Member

Instead of having different PluginGroups, I think this would be better suited for compilation features:

  • they reduce compile time
  • they guarantee that the code won't be present
  • they are the only way to have different const values
  • they work well with compilation target, which is what you call "divergent platform"
  • they are already present and mostly usable that way in Bevy

For example, for a 2d game that won't use UI but will still display text in the 2d world, I use only those features: "bevy_core_pipeline", "bevy_sprite", "bevy_winit", "bevy_render", "bevy_text", "png".

Features are probably not documented enough and not really friendly, Bevy could add meta features to group them into logical groups like you describe here.

colepoirier and others added 4 commits January 24, 2022 16:35
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
@colepoirier
Copy link
Author

Instead of having different PluginGroups, I think this would be better suited for compilation features:

* they reduce compile time

* they guarantee that the code won't be present

* they are the only way to have different `const` values

* they work well with compilation target, which is what you call "divergent platform"

* they are already present and mostly usable that way in Bevy

For example, for a 2d game that won't use UI but will still display text in the 2d world, I use only those features: "bevy_core_pipeline", "bevy_sprite", "bevy_winit", "bevy_render", "bevy_text", "png".

Features are probably not documented enough and not really friendly, Bevy could add meta features to group them into logical groups like you describe here.

That's a really nice idea @mockersf and I think this solves the problem I am seeking to address in an even nicer way with the additional benefits you outlined!! :) 💯


The primary drawback I can see is the need for Bevy to maintain the multiple `PluginGroups`, however, I foresee the maintenance burden of this to be exceedingly minimal.

## Rationale and alternatives
Copy link
Member

Choose a reason for hiding this comment

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

I think you should discuss the pros and cons of plugin groups vs. feature groups in this section.

Copy link
Author

Choose a reason for hiding this comment

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

How would you define FeatureGroups?

Copy link
Member

Choose a reason for hiding this comment

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

Rust features can enable other features, allowing users to toggle them on and off as needed. We can also

See: https://doc.rust-lang.org/cargo/reference/features.html for a basic introduction.
https://docs.rs/cfg_feature_groups/latest/cfg_feature_groups/ or the like may be helpful to improve ergonomics.

colepoirier and others added 3 commits January 25, 2022 16:36
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
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.

4 participants