Editor’s note: This article was last updated on 22 December 2023 to update the list of featured Rust game engines to include Macroquad and honorable mentions such as ggez, Comfy, and rend3.
More and more developers are choosing Rust over C++ as their go-to language for game development. There are many game engines you can use for projects in Rust. Let’s take a look at five popular Rust game engines and discuss how to choose the best option for your needs.
Before Rust was released, C++ was the go-to language for game development. Languages like C and Assembly provided reliable performance and speed in past years as well.
Many developers still use these languages for game development. However, the Rust community is strong, active, and growing, particularly in the game development domain.
According to Stack Overflow’s 2023 survey, Rust has been the most-loved language for the past eight years. Its growing list of production users includes tech giants such as Atlassian, Mozilla, Microsoft, and more.
There are many reasons why Rust is so popular among large companies and developers:
Typically, Rust is at least as fast as C/C++, and it may become a even faster in the future because of upcoming performance updates to the language.
Rust also has great capacity for game development due to its concurrency. Concurrency in Rust prevents data races and provides epic memory management to help make it almost impossible for your application to crash.
In my opinion, Rust is a well-designed and powerful language. Though some developers might consider Rust to have a steep learning curve, the detailed documentation and tutorials can certainly help new developers get up and running quickly.
Let us look at some Rust game engines you might want to consider for projects in the game development domain.
Bevy is a simple, data-driven game engine. While it is still in the early stages of development and likely to undergo significant changes, this does not stop its vital features from shining.
To use the Bevy engine, add the following line to your Cargo.toml
:
[dependencies] bevy = "0.21.1" # <-- ensure that this is the latest version code
Or, run the command below on your terminal while in your Rust project directory:
cargo add bevy
Bevy uses the Entity component system (ECS) design pattern, allowing for a modular architecture so components can be reused or even replaced. It is easy to use for beginners getting started in Rust game development.
You can use Bevy for 2D and 3D rendering or compose a custom rendering flow using a graph data structure. Another great feature is the Bevy UI, which helps you compose UI dynamically either in code or using the scene format.
My favorite Bevy feature is hot_asset_reloading
, which allows you to watch changes in your assets and automatically output the result of the updated asset without manually re-compiling your code. It’s the path of the default Bevy default plugin, so to use it, you might need to enable it as shown in the example below:
fn main() { App::new() .add_plugins(DefaultPlugins.set(AssetPlugin { watch_for_changes: true, ..Default::default() })) .run(); }
If you think Bevy might be the right game engine for your project, check out the documentation to gain a better understanding. Bevy is still in development as of this writing, and breaking changes are likely to be introduced every few months.
Fyrox is a production-ready game engine with extensive documentation and resources that focuses on 2D and 3D rendering.
To use the Fyrox engine, run the command below to install it in your Rust project:
cargo add fyrox
Besides being easy to use, one of Fyrox’s popular features is its scene editor, which provides a scene preview as demonstrated in this example:
The Fyrox engine was originally called rg3d, but the project founder changed this working title based on a community poll. The current release supports Windows, Linux, macOS, and WebAssembly.
Unlike some other game engines, Fyrox features reliably quick iterative compilation — in simple terms, you can quickly make and test changes in Fyrox without waiting too long for the compilation process.
The Piston project is maintained by an active group of contributors. Due to this sharing of maintenance and resources, it is described as a modular, open source game engine.
To use the Piston engine, run the command below in your project directory:
cargo add piston
Piston’s extensive library collection encompasses 2D, 3D, image processing, event programming, a GUI, sound and animation, and other features. These libraries can be used independently depending on the project you’re working on.
In addition to its modular libraries, Piston’s public API allows you to access inputs like a gamepad, mouse, or keypad. Another great Piston feature is the event loop. You can either pass your game logic into the event loop or create a separate thread for it.
Piston also uses a dynamic scripting language called Dyon, which was specifically created for game engines and designed to work with Rust. People with no programming experience will find it easy to pick up and use.
Make sure you check out this Piston repository to review some helpful tutorials.
Macroquad is a simple cross-platform Rust library for game development. It’s focused on simplicity — no language distractions — makes it easy to build games with Rust. Also, if you are familiar with the Raylib game engine, Macroquad is heavily inspired by it. Even for Rust beginners, it completely abstracts Rust-specific syntax like lifetimes and borrowing to allow you to focus on the key logic of your game.
More interestingly, Macroquad is a cross-platform game engine and supports the following platforms:
To use Macroquad, you can install it by running the following code on your terminal in your project directory:
cargo add macroquad
The fact that it uses native graphics is quite interesting. It means you can go ahead and run a simple example right now by running the code below:
use macroquad::prelude::*; #[macroquad::main("BasicShapes")] async fn main() { let mut x_position = 0.0; loop { clear_background(ORANGE); draw_rectangle(x_position, 100.0, 120.0, 60.0, BLACK); x_position += 2.0; if x_position > screen_width() { x_position = 0.0; } next_frame().await } }
The example above will display a moving rectangle as shown below:
nannou is an open source game framework that is still in its early days. It is also more hands-on for developers, but it is still a popular game engine that is greatly in use at the moment. As of this writing, the nannou crate has over 97,944 downloads.
To use the engine, run the command below:
cargo add nannou
nannou consists of a full palette of creative tools for graphics, audio, lasers, lighting, and more. In many ways, it is like a toolkit for artists — its many tools allow creative individuals to work productively.
This project is also a good toolkit to learn the Rust language. It aims to use only Rust libraries and will require you to use cargo build
for compilation.
However, remember Rust has interoperability with other languages, especially with C and C++. If there are no Rust libraries available for the functionality you’re looking for, you can use something like bindgen
to access another library.
ggez is a Rust game development library that provides a framework for building 2D games that are fast with minimum friction. It aims to implement APIs similar to the Lua Love2D game library. ggez provides APIs for you to add 2D drawing, sound, resources, and event handling to your 2D games.
Comfy is a simple but powerful and opinionated Rust game engine. It was inspired by game engines like Macroquad, raylib, and Love2D, etc. Comfy uses the Rust wgpu and winit graphics library, which means it’s cross-platform. It currently supports building games for Wasm, Windows, Linux, and MacOS from one codebase.
rend3 is a 3D rendering library built with Rust and wgpu. It is comprised of many libraries that allow you to render 3D graphics on screen using Rust. Though technically not a game engine or library, Rust game engine developers can leverage rend3 to build 3D graphics into their game engine. Check out an example of the 3D graphics you can render with this library on the official rend3 website.
After learning about the above five engines, you may be wondering which one you should use. The answer is not so straightforward. However, you can look at common patterns in what they offer to help determine which options best match your needs.
For example, most of them offer a GUI and an editor. A few focus on performance, especially Piston and Fyrox, while some are powerful game development libraries. Bevy, for example, offers hot_asset_reloading
for more productivity.
In my opinion, the best approach to choosing a Rust game engine is to review various game engine features and pick the engine that supports what you are trying to build. Ask yourself questions like:
Game development is still a growing area in the Rust ecosystem, and many of the existing game engines and libraries are still in active development. Depending on your project requirements, you should expect to deal with breaking changes while using any of these game engines.
I hope this guide helps you choose the most favorable Rust game engine for your needs. If you enjoyed this article and want to fully begin your experience in game development, check out some tutorials using various engines.
Debugging Rust applications can be difficult, especially when users experience issues that are hard to reproduce. If you’re interested in monitoring and tracking the performance of your Rust apps, automatically surfacing errors, and tracking slow network requests and load time, try LogRocket.
LogRocket is like a DVR for web and mobile apps, recording literally everything that happens on your Rust application. Instead of guessing why problems happen, you can aggregate and report on what state your application was in when an issue occurred. LogRocket also monitors your app’s performance, reporting metrics like client CPU load, client memory usage, and more.
Modernize how you debug your Rust apps — start monitoring for free.
Hey there, want to help make our blog better?
Join LogRocket’s Content Advisory Board. You’ll help inform the type of content we create and get access to exclusive meetups, social accreditation, and swag.
Sign up nowExplore use cases for using npm vs. npx such as long-term dependency management or temporary tasks and running packages on the fly.
Validating and auditing AI-generated code reduces code errors and ensures that code is compliant.
Build a real-time image background remover in Vue using Transformers.js and WebGPU for client-side processing with privacy and efficiency.
Optimize search parameter handling in React and Next.js with nuqs for SEO-friendly, shareable URLs and a better user experience.