Skip to content

The Impatient Programmer's Guide to Bevy and Rust : Build a 2D Game from Scratch

License

Notifications You must be signed in to change notification settings

jamesfebin/ImpatientProgrammerBevyRust

Repository files navigation

The Impatient Programmer's Guide to Bevy and Rust

Enjoy the first 7 chapters free! The paid ebook includes chapters 8-9, and I'm actively working on more content. As an early access release, it's currently available at a discounted price.

This repository contains the source code for "The Impatient Programmer's Guide to Bevy and Rust: Build a Video Game from Scratch" tutorial series.

License

The tutorial code in this repository is licensed under the MIT License. See the LICENSE file for details.

Chapters

Learn to build a video game from scratch using Rust and Bevy. This first chapter covers setting up your game world, creating a player character, and implementing movement and animations.

Chapter 1 Demo

Learn procedural generation techniques to create dynamic game worlds.

Chapter 2 Demo

Learn to build a data-driven character system in Bevy. We'll use a RON file to configure character attributes and animations, create a generic animation engine that handles walk, run, and jump animations, and implement character switching.

Chapter 3 Demo

Let's make the player interact with the world properly, no more walking through trees, water, or rocks. We'll implement z-ordering so they can walk behind objects, giving your 2D game true depth. Also, you'll build a collision visualizer for debugging.

Chapter 4 Demo

Build an inventory system to collect items from the world, then zoom in and add smooth camera follow.

Chapter 5 Demo

Learn to build a particle system with magical powers and create stunning particle effects. Learn custom shaders, additive blending, and how to make your game feel alive.

Chapter 6 Demo

Build intelligent enemies that hunt and attack the player.

Chapter 7 Demo

Getting Started

Each chapter has its own directory with a complete, runnable project. Navigate to the chapter directory you want to explore and run:

cd chapter1  # or chapter2, chapter3, chapter4, chapter5, chapter6
cargo run

Note for Linux users on Wayland: if you see rendering artifacts, run the app with the X11 backend:

WINIT_UNIX_BACKEND=x11 WAYLAND_DISPLAY= cargo run

Community Tip: This optimization was pointed out by one of our community members, thank you for helping make this tutorial better!

Bevy's default debug configuration can lead to performance issues: scenes that should run smoothly might drop to unplayable framerates, or large assets might take minutes to load.

The Bevy team documents this issue and provides a solution.

Add these optimizations to your Cargo.toml:

# At the bottom of your Cargo.toml

# Enable a small amount of optimization in the dev profile
[profile.dev]
opt-level = 1

# Enable a large amount of optimization in the dev profile for dependencies
[profile.dev.package."*"]
opt-level = 3

Community

Assets

  • assets/tile_layers: “16x16 Game Assets” by George Bailey, CC-BY 4.0.

About

The Impatient Programmer's Guide to Bevy and Rust : Build a 2D Game from Scratch

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published