Crate bevy

Crate bevy 

Source
Expand description

Bevy Logo

Bevy is an open-source, modular game engine built in Rust, with a focus on developer productivity and performance.

Check out the Bevy website for more information, read the Quick Start Guide for a step-by-step introduction, and engage with our community if you have any questions or ideas!

§Example

Here is a simple “Hello, World!” Bevy app:

use bevy::prelude::*;

fn main() {
   App::new()
       .add_systems(Update, hello_world_system)
       .run();
}

fn hello_world_system() {
   println!("hello world");
}

Don’t let the simplicity of the example above fool you. Bevy is a fully featured game engine, and it gets more powerful every day!

§This Crate

The bevy crate is a container crate that makes it easier to consume Bevy subcrates. The defaults provide a “full engine” experience, but you can easily enable or disable features in your project’s Cargo.toml to meet your specific needs. See Bevy’s Cargo.toml for a full list of available features.

If you prefer, you can also use the individual Bevy crates directly. Each module in the root of this crate, except for the prelude, can be found on crates.io with bevy_ appended to the front, e.g., app -> bevy_app.

§Cargo Features

Bevy exposes many Cargo features to customize the engine. Enabling them adds functionality but may come at the cost of longer compilation times and extra dependencies.

§Profiles

“Profiles” are high-level groups of cargo features that provide the full Bevy experience, but scoped to a specific domain. These exist to be paired with default-features = false, enabling compiling only the subset of Bevy that you need. This can cut down compile times and shrink your final binary size.

For example, you can compile only the “2D” Bevy features (without the 3D features) like this:

bevy = { version = "0.17", default-features = false, features = ["2d"] }
ProfileDescription
defaultThe full default Bevy experience. This is a combination of the following profiles: 2d, 3d, ui
2dThe default 2D Bevy experience. This includes the core Bevy framework, 2D functionality, Bevy UI, scenes, audio, and picking.
3dThe default 3D Bevy experience. This includes the core Bevy framework, 3D functionality, Bevy UI, scenes, audio, and picking.
uiThe default Bevy UI experience. This includes the core Bevy framework, Bevy UI, scenes, audio, and picking.

By default, the bevy crate enables the features.

§Collections

“Collections” are mid-level groups of cargo features. These are used to compose the high-level “profiles”. If the default profiles don’t suit your use case (ex: you want to use a custom renderer, you want to build a “headless” app, you want to target no_std, etc), then you can use these collections to build your own “profile” equivalent, without needing to manually manage every single feature.

CollectionDescription
devEnable this feature during development to improve the development experience. This adds features like asset hot-reloading and debugging tools. This should not be enabled for published apps!
audioFeatures used to build audio Bevy apps.
sceneFeatures used to compose Bevy scenes.
pickingEnables picking functionality
default_appThe core pieces that most apps need. This serves as a baseline feature set for other higher level feature collections (such as “2d” and “3d”). It is also useful as a baseline feature set for scenarios like headless apps that require no rendering (ex: command line tools, servers, etc).
default_platformThese are platform support features, such as OS support/features, windowing and input backends, etc.
common_apiDefault scene definition features. Note that this does not include an actual renderer, such as bevy_render (Bevy’s default render backend).
2d_apiFeatures used to build 2D Bevy apps (does not include a render backend). You generally don’t need to worry about this unless you are using a custom renderer.
2d_bevy_renderBevy’s built-in 2D renderer, built on top of bevy_render.
3d_apiFeatures used to build 3D Bevy apps (does not include a render backend). You generally don’t need to worry about this unless you are using a custom renderer.
3d_bevy_renderBevy’s built-in 3D renderer, built on top of bevy_render.
ui_apiFeatures used to build UI Bevy apps (does not include a render backend). You generally don’t need to worry about this unless you are using a custom renderer.
ui_bevy_renderBevy’s built-in UI renderer, built on top of bevy_render.
default_no_stdRecommended defaults for no_std applications

§Feature List

This is the complete bevy cargo feature list, without “profiles” or “collections” (sorted by name):

FeatureDescription
accesskit_unixEnable AccessKit on Unix backends (currently only works with experimental screen readers and forks.)
android-game-activityAndroid GameActivity support. Default, choose between this and android-native-activity.
android-native-activityAndroid NativeActivity support. Legacy, should be avoided for most new Android games.
android_shared_stdcxxEnable using a shared stdlib for cxx on Android
asset_processorEnables the built-in asset processor for processed assets.
async-ioUse async-io’s implementation of block_on instead of futures-lite’s implementation. This is preferred if your application uses async-io.
async_executorUses async-executor as a task execution backend.
basis-universalBasis Universal compressed texture support
bevy_animationProvides animation functionality
bevy_anti_aliasProvides various anti aliasing solutions
bevy_assetProvides asset functionality
bevy_audioProvides audio functionality
bevy_cameraProvides camera and visibility types, as well as culling primitives.
bevy_camera_controllerProvides a collection of prebuilt camera controllers
bevy_ci_testingEnable systems that allow for automated testing on CI
bevy_colorProvides shared color types and operations
bevy_core_pipelineProvides cameras and other basic render pipeline features
bevy_debug_steppingEnable stepping-based debugging of Bevy systems
bevy_dev_toolsProvides a collection of developer tools
bevy_gilrsAdds gamepad support
bevy_gizmosAdds support for gizmos
bevy_gizmos_renderAdds support for rendering gizmos
bevy_gltfglTF support
bevy_imageLoad and access image data. Usually added by an image format
bevy_input_focusEnable input focus subsystem
bevy_lightProvides light types such as point lights, directional lights, spotlights.
bevy_logEnable integration with tracing and log
bevy_meshProvides a mesh format and some primitive meshing routines.
bevy_mikktspaceProvides vertex tangent generation for use with bevy_mesh.
bevy_pbrAdds PBR rendering
bevy_pickingProvides picking functionality
bevy_post_processProvides post process effects such as depth of field, bloom, chromatic aberration.
bevy_remoteEnable the Bevy Remote Protocol
bevy_renderProvides rendering functionality
bevy_sceneProvides scene functionality
bevy_shaderProvides shaders usable through asset handles.
bevy_solariProvides raytraced lighting (experimental)
bevy_spriteProvides sprite functionality
bevy_sprite_renderProvides sprite rendering functionality
bevy_stateEnable built in global state machines
bevy_textProvides text functionality
bevy_uiA custom ECS-driven UI framework
bevy_ui_debugProvides a debug overlay for bevy UI
bevy_ui_renderProvides rendering functionality for bevy_ui
bevy_windowWindowing layer
bevy_winitwinit window and input backend
bluenoise_textureInclude spatio-temporal blue noise KTX2 file used by generated environment maps, Solari and atmosphere
bmpBMP image format support
compressed_image_saverEnables compressed KTX2 UASTC texture output on the asset processor
critical-sectioncritical-section provides the building blocks for synchronization primitives on all platforms, including no_std.
custom_cursorEnable winit custom cursor support
ddsDDS compressed texture support
debugEnable collecting debug information about systems and components to help with diagnostics
debug_glam_assertEnable assertions in debug builds to check the validity of parameters passed to glam
default_fontInclude a default font, containing only ASCII characters, at the cost of a 20kB binary size increase
detailed_traceEnable detailed trace event logging. These trace events are expensive even when off, thus they require compile time opt-in
dlssNVIDIA Deep Learning Super Sampling
dynamic_linkingForce dynamic linking, which improves iterative compile times
embedded_watcherEnables watching in memory asset providers for Bevy Asset hot-reloading
experimental_bevy_feathersFeathers widget collection.
experimental_bevy_ui_widgetsExperimental headless widget collection for Bevy UI.
experimental_pbr_pcssEnable support for PCSS, at the risk of blowing past the global, per-shader sampler limit on older/lower-end GPUs
exrEXR image format support
ffFarbfeld image format support
file_watcherEnables watching the filesystem for Bevy Asset hot-reloading
flacFLAC audio format support
force_disable_dlssForcibly disable DLSS so that cargo build –all-features works without the DLSS SDK being installed. Not meant for users.
free_cameraEnables the free cam from bevy_camera_controller
gamepadGamepad support. Automatically enabled by bevy_gilrs.
gesturesGestures support. Automatically enabled by bevy_window.
ghost_nodesExperimental support for nodes that are ignored for UI layouting
gifGIF image format support
glam_assertEnable assertions to check the validity of parameters passed to glam
gltf_animationEnable glTF animation loading
hdrHDR image format support
hotpatchingEnable hotpatching of Bevy systems
httpEnables downloading assets from HTTP sources. Warning: there are security implications. Read the docs on WebAssetPlugin.
httpsEnables downloading assets from HTTPS sources. Warning: there are security implications. Read the docs on WebAssetPlugin.
icoICO image format support
jpegJPEG image format support
keyboardKeyboard support. Automatically enabled by bevy_window.
ktx2KTX2 compressed texture support
libmUses the libm maths library instead of the one provided in std and core.
mesh_pickingProvides an implementation for picking meshes
meshletEnables the meshlet renderer for dense high-poly scenes (experimental)
meshlet_processorEnables processing meshes into meshlet meshes for bevy_pbr
morphEnables support for morph target weights in bevy_mesh
morph_animationEnables bevy_mesh and bevy_animation morph weight support
mouseMouse support. Automatically enabled by bevy_window.
mp3MP3 audio format support
multi_threadedEnables multithreaded parallelism in the engine. Disabling it forces all engine tasks to run on a single thread.
pan_cameraEnables the pan camera from bevy_camera_controller
pbr_anisotropy_textureEnable support for anisotropy texture in the StandardMaterial, at the risk of blowing past the global, per-shader texture limit on older/lower-end GPUs
pbr_clustered_decalsEnable support for Clustered Decals
pbr_light_texturesEnable support for Light Textures
pbr_multi_layer_material_texturesEnable support for multi-layer material textures in the StandardMaterial, at the risk of blowing past the global, per-shader texture limit on older/lower-end GPUs
pbr_specular_texturesEnable support for specular textures in the StandardMaterial, at the risk of blowing past the global, per-shader texture limit on older/lower-end GPUs
pbr_transmission_texturesEnable support for transmission-related textures in the StandardMaterial, at the risk of blowing past the global, per-shader texture limit on older/lower-end GPUs
pngPNG image format support
pnmPNM image format support, includes pam, pbm, pgm and ppm
qoiQOI image format support
raw_vulkan_initForces the wgpu instance to be initialized using the raw Vulkan HAL, enabling additional configuration
reflect_auto_registerEnable automatic reflect registration
reflect_auto_register_staticEnable automatic reflect registration without inventory. See reflect::load_type_registrations for more info.
reflect_documentationEnables bevy_reflect to access documentation comments of rust code at runtime
reflect_functionsEnable function reflection
serializeEnable serialization support through serde
shader_format_glslEnable support for shaders in GLSL
shader_format_spirvEnable support for shaders in SPIR-V
shader_format_weslEnable support for shaders in WESL
smaa_lutsInclude SMAA Look Up Tables KTX2 Files
spirv_shader_passthroughEnable passthrough loading for SPIR-V shaders (Only supported on Vulkan, shader capabilities and extensions must agree with the platform implementation)
sprite_pickingProvides an implementation for picking sprites
statically-linked-dxcStatically linked DXC shader compiler for DirectX 12
stdAllows access to the std crate.
symphonia-aacAAC audio format support (through symphonia)
symphonia-allAAC, FLAC, MP3, MP4, OGG/VORBIS, and WAV audio formats support (through symphonia)
symphonia-flacFLAC audio format support (through symphonia)
symphonia-isomp4MP4 audio format support (through symphonia)
symphonia-vorbisOGG/VORBIS audio format support (through symphonia)
symphonia-wavWAV audio format support (through symphonia)
sysinfo_pluginEnables system information diagnostic plugin
tgaTGA image format support
tiffTIFF image format support
tonemapping_lutsInclude tonemapping Look Up Tables KTX2 files. If everything is pink, you need to enable this feature or change the Tonemapping method for your Camera2d or Camera3d.
touchTouch support. Automatically enabled by bevy_window.
traceTracing support
trace_chromeTracing support, saving a file in Chrome Tracing format
trace_tracyTracing support, exposing a port for Tracy
trace_tracy_memoryTracing support, with memory profiling, exposing a port for Tracy
track_locationEnables source location tracking for change detection and spawning/despawning, which can assist with debugging
ui_pickingProvides an implementation for picking UI
vorbisOGG/VORBIS audio format support
wavWAV audio format support
waylandWayland display server support
webEnables use of browser APIs. Note this is currently only applicable on wasm32 architectures.
web_asset_cacheEnable caching downloaded assets on the filesystem. NOTE: this cache currently never invalidates entries!
webgl2Enable some limitations to be able to use WebGL2. Please refer to the WebGL2 and WebGPU section of the examples README for more information on how to run Wasm builds with WebGPU.
webgpuEnable support for WebGPU in Wasm. When enabled, this feature will override the webgl2 feature and you won’t be able to run Wasm builds with WebGL2, only with WebGPU.
webpWebP image format support
x11X11 display server support
zlibFor KTX2 supercompression
zstd_cFor KTX2 Zstandard decompression using zstd. This is a faster backend, but uses unsafe C bindings. For the safe option, stick to the default backend with “zstd_rust”.
zstd_rustFor KTX2 Zstandard decompression using pure rust ruzstd. This is the safe default. For maximum performance, use “zstd_c”.

Modules§

a11y
Reusable accessibility primitives
animation
Animation for the game engine Bevy
anti_alias
app
This crate is about everything concerning the highest-level, application layer of a Bevy app.
asset
In the context of game development, an “asset” is a piece of content that is loaded from disk and displayed in the game. Typically, these are authored by artists and designers (in contrast to code), are relatively large in size, and include everything from textures and models to sounds and music to levels and scripts.
audio
Audio support for the game engine Bevy
camera
camera_controller
A home for first-party camera controllers for Bevy, used for moving the camera around your scene.
color
Representations of colors in various color spaces.
core_pipeline
dev_tools
This crate provides additional utilities for the Bevy game engine, focused on improving developer experience.
diagnostic
This crate provides a straightforward solution for integrating diagnostics in the Bevy game engine. It allows users to easily add diagnostic functionality to their Bevy applications, enhancing their ability to monitor and optimize their game’s.
ecs
Bevy ECS
feathers
bevy_feathers is a collection of styled and themed widgets for building editors and inspectors.
gilrs
Systems and type definitions for gamepad handling in Bevy.
gizmos
This crate adds an immediate mode drawing api to Bevy for visual debugging.
gizmos_render
This crate renders bevy_gizmos with bevy_render.
gltf
Plugin providing an AssetLoader and type definitions for loading glTF 2.0 (a standard 3D scene definition format) files in Bevy.
image
input
Input functionality for the Bevy game engine.
input_focus
A UI-centric focus system for Bevy.
light
log
This crate provides logging functions and configuration for Bevy apps, and automatically configures platform specific log handlers (i.e. Wasm or Android).
math
Provides math types and functionality for the Bevy game engine.
mesh
pbr
picking
This crate provides ‘picking’ capabilities for the Bevy game engine, allowing pointers to interact with entities using hover, click, and drag events.
platform
Platform compatibility support for first-party Bevy engine crates.
post_process
prelude
use bevy::prelude::*; to import common components, bundles, and plugins.
reflect
Reflection in Rust.
remote
An implementation of the Bevy Remote Protocol, to allow for remote control of a Bevy app.
render
Useful Environment Variables
scene
Provides scene definition, instantiation and serialization/deserialization.
shader
solari
Provides raytraced lighting.
sprite
Provides 2D sprite functionality.
sprite_render
Provides 2D sprite rendering functionality.
state
In Bevy, states are app-wide interdependent, finite state machines that are generally used to model the large scale structure of your program: whether a game is paused, if the player is in combat, if assets are loaded and so on.
tasks
Bevy Tasks
text
This crate provides the tools for positioning and rendering text in Bevy.
time
Bevy Time
transform
Bevy Transform
ui
This crate contains Bevy’s UI system, which can be used to create UI for both 2D and 3D games
ui_render
Provides rendering functionality for bevy_ui.
ui_widgets
This crate provides a set of standard widgets for Bevy UI, such as buttons, checkboxes, and sliders. These widgets have no inherent styling, it’s the responsibility of the user to add styling appropriate for their game or application.
utils
General utilities for first-party Bevy engine crates.
window
bevy_window provides a platform-agnostic interface for windowing in Bevy.
winit
bevy_winit provides utilities to handle window creation and the eventloop through winit

Structs§

DefaultPlugins
This plugin group will add all the default plugins for a Bevy application:
MinimalPlugins
This plugin group will add the minimal plugins for a Bevy application: