Game development in Rust with Macroquad

Ferris the rustacean holding a game controller

This guide is written by Olle Wreede at Agical.

This guide is available online at the following address: https://mq.agical.se/

The source code for all chapters of this book is available here:
https://mq.agical.se/github.html

Game development guide

In this guide we will be developing a game from scratch. In each chapter we will add a small feature to the game that explains a part of the Macroquad library. In the beginning the game will be very simple, but at the end of the guide you will have built a complete game with graphics and sound. You will be able to build the game for desktop computers, the web, as well as mobile devices.

The game we are making is a classic shoot ’em up where the player controls a spaceship that has to shoot down enemies flying down from the top of the screen.

At the end of every chapter there is a short quiz that shows you how much you’ve learned. The answers are anonymous and are not stored anywhere.

Challenge

This is Ferris, the teacher who will show up at the end of every chapter to give you an extra challenge. Doing the challenge is optional; you can continue to the next chapter without it.

The Macroquad game library

Macroquad is a game library for the programming language Rust. It includes everything you need to develop a 2D game. The main advantage of Macroquad compared with other game libraries is that it works with many different platforms. Since it has very few dependencies it also compiles very fast.

With Macroquad it’s possible to develop games for desktop operating systems like Windows, Mac, and Linux. It also has support to compile for mobile devices like iOS and Android. Thanks to the WebAssembly support it can also be compiled to run in a web browser. All this can be done without having to write any platform specific code.

The library has efficient 2D rendering support, and some rudimentary 3D features. It also includes a simple immediate UI library to make graphical game interfaces.

This guide assumes some prior knowledge of Rust programming. More information about Rust is available in the Rust book that is available online. I can also recommend the book Hands-on Rust by Herbert Wolverson where you learn Rust by writing a roguelike game.

Info

On the Macroquad homepage there are examples of how different features of Macroquad work, Macroquad-related articles, and documentation of the API.

Note

This guide is written for version 0.4 of Macroquad. It may not work for future versions because Macroquad is under active development.

PDF book

This guide is also available as a downloadable PDF book.

In the top right hand corner of the site there is a link to a printable version of the guide as well.

Game development in Rust with Macroquad by Olle Wreede is licensed under CC BY-SA 4.0

Agical