Series · 15 tutorials

Build an Asteroid Dodger in Rust

A 15-tutorial series that takes you from an empty window to a full arcade game with physics, sound, weapons, and a shop — while teaching Rust's ownership model, traits, testing, and concurrency along the way.

beginner → advanced Rustmacroquadgame dev2D graphics

Build a complete top-down asteroid dodger in Rust using macroquad — a small game library, not an engine. The series alternates between game tutorials that add features and concept tutorials that explain the Rust patterns behind them.

No prior Rust experience required. If you’ve written C, Go, Python, or C++ before, the concepts will map cleanly.

What you’ll build

A spaceship that steers with rotation and momentum-based thrust. Irregularly shaped asteroids spawn and drift toward you, bouncing off each other with elastic physics. You can shoot them — large ones split into fragments. Four weapon types, deployable bombs, collectible power-ups, a between-rounds shop, rebindable controls, and a large scrollable world with a minimap radar.

Prerequisites

What you need to know:

C, Go, Python, or C++Variables & control flowFunctions & structsBasic terminal / CLIPrior Rust experienceGame dev experienceLinear algebra

What you need installed:

Rust & Cargorustup updateInstall Rust — or run rustup update if you already have it
No system librariesmacroquad is pure Rust and brings everything it needs

Tutorials

1
Build an Asteroid Dodger in Rust with macroquad Build a top-down spaceship with momentum-based movement and randomly shaped asteroids — your first Rust game, no engine required.
game
2
Collision Detection Add AABB and polygon collision detection, an HP bar with invincibility frames, and a complete game over loop to your Rust asteroid dodger.
game
3
Unit Testing Learn Rust's built-in testing framework by writing tests for the collision detection module.
concept
4
Shooting and Destruction Add bullets, hit detection, and asteroid splitting to your Rust asteroid dodger — shoot asteroids apart and watch fragments scatter.
game
5
Borrowing and Ownership Understand why the borrow checker made you write code a certain way — ownership, borrowing rules, and common patterns explained.
concept
6
Physics Add elastic collision physics with mass-based impulses for asteroid-asteroid and ship-asteroid bouncing, plus broad-phase AABB optimization.
game
7
Lifetimes and References Understand Rust lifetimes through the lens of your game's physics code — why split_at_mut works, when you need lifetime annotations, and when you don't.
concept
8
Sound and Particle Effects Add procedural audio and a particle system to your Rust asteroid dodger — explosions, damage flashes, and thrust sounds with no external assets.
game
9
Weapons and Bombs Add a weapon system with four fire modes and deployable bombs to your Rust asteroid dodger.
game
10
Traits and Generics Extract shared behavior into traits and write generic functions — refactoring your asteroid dodger to use Rust's polymorphism.
concept
11
Project Structure Organize a growing Rust project — group modules into directories, control visibility with pub(crate), and learn when a workspace makes sense.
concept
12
Menu, Power-ups, and Shop Add a title screen, rebindable controls, collectible power-ups, and a between-rounds shop to your Rust asteroid dodger.
game
13
Integration Testing Test game logic without opening a window — shop purchases, power-up effects, state transitions, and weapon behavior.
concept
14
Large Map and Minimap Expand the game world beyond the screen with a camera system and add a corner minimap radar to your Rust asteroid dodger.
game
15
Concurrency Parallelize asteroid updates and collision detection with rayon — an introduction to Rust's fearless concurrency.
concept