Bevy Version: | 0.10 | (current) |
---|
Getting Started
This page covers the basic setup needed for Bevy development.
For the most part, Bevy is just like any other Rust library. You need to install Rust and setup your dev environment just like for any other Rust project. You can install Rust using Rustup. See Rust's official setup page.
On Linux, you need the development files for some system libraries. See the official Bevy Linux dependencies page.
Also see the Setup page in the official Bevy Book and the official Bevy Readme.
Creating a New Project
You can simply create a new Rust project, either from your IDE/editor, or the commandline:
cargo new --bin my_game
(creates a project called my_game
)
The Cargo.toml
file contains all the configuration of your project.
Add the latest version of bevy
as a dependency. Your file should now
look something like this:
[package]
name = "my_game"
version = "0.1.0"
edition = "2021"
[dependencies]
bevy = "0.10"
The src/main.rs
file is your main source code file. This is where you
start writing your Rust code. For a minimal Bevy app, you need
at least the following:
use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.run();
}
You can now compile and run your project. The first time, this will take a while, as it needs to build the whole Bevy engine and dependencies. Subsequent runs should be fast. You can do this from your IDE/editor, or the commandline:
cargo run
Optional Extra Setup
You will likely quickly run into unusably slow performance with the default Rust unoptimized dev builds. See here how to fix.
Iterative recompilation speed is important to keep you productive, so you don't have to wait long for the Rust compiler to rebuild your project every time you want to test your game. Bevy's getting started page has advice about how to speed up compile times.
Also have a look in the Dev Tools and Editors page for suggestions about additional external dev tools that may be helpful.
What's Next?
Have a look at the guided tutorial page of this book, and Bevy's official examples.
Check out the Bevy Assets Website to find other tutorials and learning resources from the community, and plugins to use in your project.
Join the community on Discord to chat with us!
Running into Issues?
If something is not working, be sure to check the Common Pitfalls chapter, to see if this book has something to help you. Solutions to some of the most common issues that Bevy community members have encountered are documented there.
If you need help, use GitHub Discussions, or feel welcome to come chat and ask for help in Discord.
GPU Drivers
On Linux, Bevy currently requires Vulkan for graphics.
On Windows, either Vulkan or DirectX 12 can be used.
Make sure you have compatible hardware and drivers installed on your system. Your users will also need to satisfy this requirement.
If Bevy is not working, install the latest drivers, or check with your Linux distribution whether Vulkan needs additional packages to be installed.
OpenGL should work as a fallback, for systems that do not support other APIs, but might not be in such a good state as other APIs. DirectX 11 support for legacy systems is planned, but not available yet.
macOS/iOS should work without any special driver setup, using Metal.
Web games are supported and should work in any modern browser, using WebGL2.