One of Bevy's core principles is modularity. All Bevy engine features are implemented as plugins. This includes internal features like the renderer, but games themselves are also implemented as plugins! This empowers developers to pick and choose which features they want. Don't need a UI? Don't register the
. Want to build a headless server? Don't register the
This also means you are free to replace any components you don't like. If you feel the need, you are welcome to build your own
, but consider contributing it back to Bevy if you think it would be useful!
However, most developers don't need a custom experience and just want the "full engine" experience with no hassle. For this, Bevy provides a set of "default plugins".
Let's make our app more interesting by adding the "default Bevy plugins".
add_plugins(DefaultPlugins) adds the features most people expect from an engine, such as a 2D / 3D renderer, asset loading, a UI system, windows, and input.
Once again run
You should hopefully notice two things:
WindowPlugin, which defines the window interface (but doesn't actually know how to make windows), and
WinitPluginwhich uses the winit library to create a window using your OS's native window api.
DefaultPluginsadds an "event loop" to our application. Our App's ECS Schedule now runs in a loop once per "frame". We will resolve the console spam in a moment.
add_plugins(DefaultPlugins) is equivalent to the following:
You are free to use whatever approach suits you!
For better organization, let's move all of our "hello" logic to a plugin. To create a plugin we just need to implement the
interface. Add the following code to your
Then register the plugin in your App like this:
Now all thats left is to move our systems into
HelloPlugin, which is just a matter of cut and paste. The
app variable in our plugin's
build() function is the same builder type we use in our
Try running the app again. It should do exactly what it did before. In the next section, we'll fix the "hello" spam using Resources.