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

Convenient way to add minimal plugins for a headless server #767

Merged
merged 5 commits into from
Nov 3, 2020
Merged

Convenient way to add minimal plugins for a headless server #767

merged 5 commits into from
Nov 3, 2020

Conversation

CleanCut
Copy link
Member

@CleanCut CleanCut commented Nov 2, 2020

It might be useful to make a way for folks to easily run a minimal bit of bevy (think headless server, CI job, etc.).

In that context, would this be a good approach? I based the actual minimal bit of plugins on #739 (comment) My biggest concern is that the loop duration is hard-coded.

Is there a more ideal way to solve this problem? Maybe in a separate module+trait? Or just document how to do this? Something else?

@cart
Copy link
Member

cart commented Nov 2, 2020

I definitely think something like this would be useful. I want to move off of the "configure plugins in the constructor" pattern as much as possible in favor of "configuration resources" (ex: AssetServerSettings) to solve problems like what we're seeing here with ScheduleRunnerPlugin.

I think the real fix here is to migrate ScheduleRunnerPlugin to the "configuration resource" pattern.

@cart
Copy link
Member

cart commented Nov 2, 2020

I'm not super sold on adding another "helper method" like add_minimal_plugins(). I'm heavily considering deprecating add_default_plugins() in favor of add_plugin_group(DefaultPlugins) in future releases.

@CleanCut
Copy link
Member Author

CleanCut commented Nov 2, 2020

@cart -- ...and here I thought I was going to make a tiny little contribution today 😝

  • Removed the new helper method I had added in this PR
  • Added MinimalPlugins to the prelude so it can be used as add_plugin_group(MinimalPlugins)
  • Introduced a ScheduleRunnerSettings resource and refactored ScheduleRunnerPlugin to use it similar to the AssetServerSettings pattern.
  • Moved the run_once() and run_loop() methods to ScheduleRunnerSettings.
  • Removed the hard-coded 1/60s loop duration in favor of inheriting the RunMode enum's default of looping with no delay.
  • Removed the existing helper method add_default_plugins() and its trait in favor of add_plugin_group(DefaultSettings). ⚠️Fair warning: This will probably break every project / tutorial / guide ever created.
  • Updated all the examples to fix the breakage caused by ☝️

The current windows nightly seems to be unable to compile rusty-xinput. That seems unrelated to this PR.

@CleanCut
Copy link
Member Author

CleanCut commented Nov 2, 2020

Reported the ICE for windows nightly at rust-lang/rust#78660

@cart
Copy link
Member

cart commented Nov 2, 2020

thanks! we might need to disable windows nightly builds in the interim.

@CleanCut
Copy link
Member Author

CleanCut commented Nov 2, 2020

Upstream fix is out for review: rust-lang/rust#78663

@Moxinilian Moxinilian added core C-Feature A new feature, making something new possible labels Nov 2, 2020
@cart
Copy link
Member

cart commented Nov 3, 2020

Yeah I'm thinking we might as well make the hard add_default_plugins break now. Earlier is better

@zicklag
Copy link
Member

zicklag commented Nov 3, 2020

@CleanCut I definitely have a use-case for this with the Bevy benchmark games. It was really annoying to take out the add_default_plugins and then have to figure out what plugins depended on each-other and that I needed to enable to get a basic headless game going. Thanks!

Yeah I'm thinking we might as well make the hard add_default_plugins break now. Earlier is better

👍 I'm a strong believer of breaking it early.

@cart
Copy link
Member

cart commented Nov 3, 2020

Yeah the one thing im not super sold on is the MinimalPlugins name. "minimal" in what context? Like in this case its clearly a "headless context". But I'm also not sure I want to call this HeadlessPlugins. I think that should be probably be reserved for "headless version of full bevy game", which would include shims for rendering/audio/windowing etc.

@zicklag
Copy link
Member

zicklag commented Nov 3, 2020

But I'm also not sure I want to call this HeadlessPlugins. I think that should be probably be reserved for "headless version of full bevy game", which would include shims for rendering/audio/windowing etc.

Yeah, I think that's a good idea for headless.

Maybe CorePlugins?

@cart
Copy link
Member

cart commented Nov 3, 2020

Yeah I thought about that too. But ScheduleRunner isn't "core" (CorePlugins should be a subset of DefaultPlugins imo).

@cart
Copy link
Member

cart commented Nov 3, 2020

On that note something like default_plugins.extend(CorePlugins) in PluginGroupBuilder might be useful ... although that probably doesn't give enough control over plugin order.

@cart
Copy link
Member

cart commented Nov 3, 2020

BaseHeadlessPlugins
CoreHeadlessPlugins
ScheduleRunnerPlugins (probably too similar to ScheduleRunnerPlugin?)
CoreScheduleRunnerPlugins
BaseScheduleRunnerPlugins

Lol naming is hard. I'm also not super worried about needing the name MinimalPlugins for anything else, so we don't necessarily need to make the decision now. But if we can find a clearly better name today we might as well use it

@zicklag
Copy link
Member

zicklag commented Nov 3, 2020

Maybe HeadlessPlugins and ShimmedHeadlessPlugins for the version with shims? Shimmed doesn't seem too professional, though. Is that even a word? 😛

@cart
Copy link
Member

cart commented Nov 3, 2020

Yeah thats not a bad train of thought. Or maybe HeadlessPlugins and HeadlessDefaultPlugins?

@zicklag
Copy link
Member

zicklag commented Nov 3, 2020

Or maybe HeadlessPlugins and HeadlessDefaultPlugins?

I'd be confused at what the difference is, though.

Maybe HeadlessPlugins and VirtualizedHeadlessPlugins? Virtualized sounds fancier than it is though.

Hmm, MinimalPlugins is actually sounding kind of good now. Maybe DefaultSlim?

@cart
Copy link
Member

cart commented Nov 3, 2020

Haha yeah every alternative we've come up with has too many downsides. Lets just stick with MinimalPlugins for now. I guess @CleanCut was a step ahead of us 😄

@cart cart merged commit 9871e7e into bevyengine:master Nov 3, 2020
@CleanCut
Copy link
Member Author

CleanCut commented Nov 3, 2020

Haha yeah every alternative we've come up with has too many downsides. Lets just stick with MinimalPlugins for now. I guess @CleanCut was a step ahead of us 😄

😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Feature A new feature, making something new possible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants