Rust for Gaming: Rust Game Development Engines 2024
Tags: rust, gamedev
Published: 2024-01-24 07:04:10

---
title: "Rust for Gaming: Rust Game Development Engines 2024"
published: "true"
description: "Rust for Gaming 🎮 Rust Game Development Engines as of 2024, using Rust in mainstream engines like Godot and 🦀 Rust alternatives like Bevy."
tags: "rust, gamedev"
canonical_url: "https://rodneylab.com/rust-for-gaming/"
cover_image: "https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g3c6mmwtk1t4ymlyu73a.png"

---

## 🦀 Rust for Game Development

C++ memory management, performance, and portability have made it a favourite of the gaming industry.  With Rust comparing favourably on these metrics and  repeatedly being voted <a href="https://survey.stackoverflow.co/2023/#technology-admired-and-desired">most admired language by developers</a>, you might be considering using Rust for gaming.  You would be adding to a long list of games written in Rust, which includes <a href="https://github.com/fishfolk/jumpy">Jumpy</a>, <a href="https://store.steampowered.com/app/1177840/Makiomino/">Makiomino</a>, <a href="https://github.com/veloren/veloren">Veloren</a> and <a href="https://github.com/ozkriff/zemeroth">Zemeroth</a>.  Targeting readers who have already decided they want to use Rust for game development, let&rsquo;s survey the current offerings for building your next game in Rust.

In this post we focus on game engines, though in the future we might also look at Entity Component Systems (**ECS**) and other Rust game development tooling.  I am new to Rust game development myself, so happy to hear feedback on anything I might have missed.  I will update the article as tools develop.

## Rust Gaming Resources

Here are some resources I used to put this article together, all fantastic fountains of knowledge:

- <a href="https://arewegameyet.rs">Are we Game Yet</a> — probably the best Rust for gaming resource, complete with lists of projects you can consider for all aspects of your game; not just the game engine.
- <a href="https://gamedev.rs/">Rust GameDev WG</a> — the Rust Game Working Group site includes links to the meetups and newsletter (each edition is filled with details of learning resources and latest game engine developments) and meetup write-ups.
- <a href="https://rustacean-station.org/">Rustacean Station Podcast</a> — although this not a gaming podcast, as such, there are several interviews with Rust gaming developers and community members (episodes linked below).

Also consider recordings from the <a href="https://www.rustgamedev.com/episodes">Rust Game Dev Podcast</a>.  Although there are no recent episodes, the archive episodes are useful for background, and some of the content will still be current. 

## 😕 Do I Need a Game Engine?

The advice I keep hearing is either to build a game engine or a game, and not  to try both!  You can see below there are many free and open-source Rust game engines, catering to various uses, so if you do opt for building a game (and not an engine), hopefully you are covered!  All the game engines, listed later, provide at least some of these features:

- animations;
- collision detection;
- ECS;
- geometry;
- graphics rendering;
- input handling;
- physics; and
- playing sound.

For now, personally, I am sticking with using existing game engines (rather than building my own), though I am researching building the features above. That is to be able better to understand the engines and their features.  My preference, initially, is for a lightweight engine, which I can build prototypes with quickly (though I have kept an open mind on engines to include below). What is your take?  Drop a comment below, or reach out some other way. I want to know if any indie developers have successfully built a game and engine on the same project!

## 🎮 Using Rust in Leading Game Engines

As of 2024, the three game engines that top  the most-used tables are Unity, Unreal Engine and Godot.  None of these has official support for Rust, though Godot, a modern, free and open-source engine, does offer some hope for Rustaceans.  Godot officially offers GDExtension, which allows you to integrate third-party libraries, using Godot for rendering. godot-rust, a community project, provides GDExtension Rust bindings.

You can find Rust bindings for Unity and Unreal, engine, though Godot looks to be the best supported offering.  Much like Unity and Unreal, Godot has a GUI.  Godot is easy to install and has a huge community creating learning resources, making it a popular choice for beginners.

### Rust for Gaming using Godot's GDExtension 

Opting for Godot, you can take advantage of this project&rsquo;s maturity, compared to some pure Rust approaches. In fact, the Bevy docs (more on Bevy below) recommend using Godot with Rust if you are looking for a stable platform for your game.

The Godot bindings were re-written for Godot 4, so be sure to look for **gdext** (based on GDExtension), rather than gdnative.  At the time of writing, there is no gdext support for WebAssembly (**WASM**), Android or iOS.  GDExtension is still experimental and minor versions are not guaranteed to be backwards compatible.

Get started with Rust in Godot by opening up the online <a href="https://godot-rust.github.io/book/index.html">godot-rust book</a>.

**Learn more about godot-rust here**:
- GitHub repo: <a href="https://github.com/godot-rust/gdext">godot-rust/gdext</a>
- Tutorial: <a href="https://docs.godotengine.org/en/stable/about/introduction.html">Official Godot Tutorial</a> — covers Godot GUI, rather than gdext
- Example Code: <a href="https://github.com/godot-rust/gdext/tree/master/examples/dodge-the-creeps">Godot Rust  Example</a>


## Rust Game Engines

Here we look at game engines written in Rust.

### Rust for Gaming: Bevy

**Popular, free and open-source 2D and 3D game engine with its own ECS.**

Bevy is the most popular Rust engine, with the most vibrant community. It is data-driven and has an Entity Component System (**ECS**), an alternative data model to a pure Object-oriented approach.  Bevy&rsquo;s ECS is a separate Rust crate, and you can use it independently of Bevy with other game engines.  

Bevy is cross-platform, with support for Windows, macOS, Linux, Web, iOS, and Android.  With a large community, it could be considered a safer choice if you will need to find developers for your project.

Official docs currently include a stability warning: as Bevy is under rapid development, there is no guarantee of API stability.  That aside you can open up the free, online <a href="https://bevyengine.org/learn/book/introduction/">Bevy book</a> to get started.

**Learn more about Bevy here**:
- GitHub repo: <a href="https://github.com/bevyengine/bevy">bevyengine/bevy</a>
- Code Examples: <a href="https://github.com/bevyengine/bevy/tree/latest/examples">Bevy Examples</a>
- Getting Started: <a href="https://bevyengine.org/learn/book/introduction/">Bevy the Book</a>
- Rust Game Dev Podcast: <a href="https://www.rustgamedev.com/episodes/interview-with-carter-anderson-bevy">Interview with Carter Anderson (Bevy) </a>.
- Discord: <a href="https://discord.gg/bevy">Join the Bevy Discord Server</a>

### Rust for Gaming: Bracket-Lib

**Game Engine targeting Rust and game development beginners.**

Bracket-Lib is a game engine with a difference.  It was written for learning — learning Rust, and alternatively, learning games development in general.  Herbert Wolverson the lead maintainer, is the author of <a href="https://hands-on-rust.com/">Hands-on Rust</a>; a book available as a paperback and e-book, covering both of those learning goals.  Hands-on Rust uses Bracket-Lib.  The advantage of learning Bracket-Lib, is that book content is locked to Bracket-Lib versions, so the book should always be current.

Bracket-Lib takes care of some complexities, for example, it has a wrapper for random number generation.  This lets you focus on the principal task at hand, letting you figure out Rust&rsquo;s rand crate later.  Herbert&rsquo;s idea is to teach you the foundations, empowering you to go on to create games with Bevy and other engines.

**Learn more about Bracket-Lib here**:
- GitHub repo: <a href="https://github.com/amethyst/bracket-lib">amethyst/bracket-lib</a>
- Tutorial: <a href="https://bfnightly.bracketproductions.com/rustbook/">Roguelike Tutorial — in Rust</a>
- Rustacean Station Podcast: <a href="https://rustacean-station.org/episode/048-herbert-wolverson/">Game Development with Herbert Wolverson</a>
- Rust Game Dev Podcast: <a href="https://www.rustgamedev.com/episodes/interview-with-herbert-wolverson-bracket-lib">Interview with Herbert Wolverson (Bracket-Lib)</a>

### Rust for Gaming: Fyrox

**2D & 3D full-featured engine with GUI scene editor.**

Fyrox (previously rg3d) is a feature-rich 2D and 3D game engine.  Although Bevy seems to be more popular, Fyrox does have a graphical user interface scene editor, like you would find in Godot, Unity or Unreal Engine. This sets it apart from other Rust engines.

The Fyrox Book (link below) is probably the best place to get going. It includes a 2D Platformer tutorial and First-Person Shooter and RPG 3D game tutorials.  The book recommends some linear algebra knowledge and basic game development experience as prerequisites.  As an alternative, there is a library of examples, with code, covering  sound, User Interface, animation and more.

**Learn more about Fyrox here**:
- GitHub repo: <a href="https://github.com/FyroxEngine/Fyrox">FyroxEngine/Fyrox</a>
- Official Docs: <a href="https://fyrox-book.github.io/">Fyrox Book</a>
- Rustacean Station Podcast: <a href="https://rustacean-station.org/episode/dmitry-stepanov/">Fyrox with Dmitry Stepanov</a>
- Code Examples: <a href="https://github.com/FyroxEngine/Fyrox-demo-projects">Fyrox Demo Projects</a>
- Discord: <a href="https://discord.gg/xENF5Uh">Join the Fyrox Discord Server</a>

### Rust for Gaming: ggez

**Batteries included, lightweight, cross-platform game framework.**

ggez (Good Game Easily) is inspired by the Lua LÖVE framework.  It focusses on 2D games, and features a modern rendering engine built on **WebGPU**.  ggez supports Windows, Linux, and macOS.  The authors made the decision not to include features like a GUI, ECS, or networking; allowing you to pick your own libraries, based on your own opinions.  It does include developer experience-focussed features like TTF font rendering and config files for defining game and engine settings.

**Learn more about ggez here**:
- GitHub repo: <a href="https://github.com/ggez/ggez">ggez/ggez</a>;
- Code Examples: <a href="https://github.com/ggez/ggez/tree/master/examples">ggez examples</a>;
- Discord: <a href="https://discord.gg/48VycPe2ZX">Join the ggez Discord Server</a>

### Rust for Gaming: Macroquad 

**Minimal and ergonomic engine with cross-platform support and a mini footprint.**

Macroquad cuts dependencies to the bare minimum, making it quick to set up initially and compile.  It has wide cross-platform support and claims that everything needed to make a 2D game is included!  You can compile for WASM, so your game runs in browser.  Beyond WASM, Windows, macOS and Linus, Macroquad supports Android and iOS.

This is the engine I have used most, so far, and I like the feel of it.  It is inspired by Raylib (suited to prototyping), which I haven&rsquo;t personally used.  It does remind me of the C++ SFML library in terms of getting out of the blocks quickly, though.  Macroquad is probably quicker to spin up (than SFML) because of Rust&rsquo;s tooling and crate handling infrastructure.  You can see an example of spinning up a Macroquad game further down. 

**Learn more about Macroquad here**:
- GitHub repo:  <a href="https://github.com/not-fl3/macroquad">not-fl3/macroquad</a>
- Code Examples: 🖥️ <a href="https://github.com/not-fl3/macroquad/tree/master/examples">Macroquad Examples</a>
- Macroquad Games & More: <a href="https://github.com/ozkriff/awesome-quads">🌟 Awesome Quads</a>
- Rust Game Dev Podcast: <a href="https://www.rustgamedev.com/episodes/interview-with-fedor-logachev">Interview with Fedor Logachev</a>.
- Matrix: <a href="https://matrix.to/#/#quad-general:matrix.org">#quad-general</a>
- Discord:  <a href="https://discord.gg/WfEp6ut">Join the Quads Discord Server</a>

### Rust for Gaming: Piston

**Mature, customizable engine with composable architecture and a rich component ecosystem.**

Piston is a 2D and 3D Rust gaming engine, I think it might be the oldest listed here, with the first version released back in December 2014.  So you can expect stability and a large community of users.  Piston has a modular design (letting you opt in to the features that you need), and there is a complete ecosystem of libraries offering features such as GPU shaders, quaternion, and an FPS counter.  The highly customizable architecture is a key Piston feature; allowing flexibility if the needs for your project change as it matures.

Here is an (unofficial) <a href="https://www.youtube.com/watch?v=HCwMb0KslX8">YouTube tutorial on building a snake clone</a> (link opens in YouTube):

**Learn more about Piston here**:
- GitHub repo:  <a href="https://github.com/PistonDevelopers/piston">PistonDevelopers/piston</a>
- Code Examples: 🖥️ <a href="https://github.com/PistonDevelopers/piston-examples">Piston Examples</a>
- Tutorials: <a href="https://github.com/pistondevelopers/piston-tutorials">Piston Tutorials</a>
- Discord:  <a href="https://discord.gg/TkDnS9x">Join the Piston Discord Server</a>

### Rust for Gaming — Amethyst
Amethyst was a popular Rust game engine before Bevy, though at one point (as I understand it) development slowed and Bevy leap-frogged.  <a href="https://github.com/amethyst/amethyst">Amethyst is not actively maintained</a> at the time of writing.

## Rust Bindings for C++ Game Engines

If you want to try Rust bindings for C++ libraries that you are already familiar with, here is a short list:

- <a href="https://github.com/deltaphc/raylib-rs">Raylib</a>
- <a href="https://github.com/Rust-SDL2/rust-sdl2">sdl2</a>
- <a href="https://github.com/jeremyletang/rust-sfml">SFML</a>

## 🔥 Quickly Spinning up a Rust Game

Here you see how quick it can be to spin up a Rust game (in just 100 seconds).  We use Macroquad, known for its small dependency footprint, and set up a snake clone. You will need <a href="https://rodneylab.com/trying-egui/#crab-setting-up-your-system-for-rust">Rust already set up on your system</a>.

### How to Spin up a Snake Clone using Rust&rsquo;s Macroquad Game Engine

Run these commands from the Terminal:

1. `cargo new --bin snake`
2. `cd snake`
3. `cargo add macroquad`
4. Replace the content in `src/main.rs` with <a href="https://github.com/not-fl3/macroquad/raw/master/examples/snake.rs">code from the Macroquad snake demo</a>.
5. `cargo run`

## 🙌🏽 Rust for Gaming: Wrapping Up

In this Rust for gaming post, we saw some options in the Rust game engine ecosystem.  More specifically, we saw:

- how you can use **Rust with Godot** and GDExtension;
- **six actively developed Rust games engines**, with and without batteries included, for 2D and 3D games; and
- some **Rust bindings for C++ engines like SFML**.

I would love to hear from you, if you are also new to Rust gaming.  Do you have alternative resources you found useful? Is there something missing here that you would have added.  Equally, if you are a veteran of the ecosystem and have some pointers, I would also like to hear from you.  Let me know what you plan to build using Rust for gaming.

## 🙏🏽 Rust for Gaming: Feedback

If you have found this post useful, see links below for further related content on this site.  Let me know if there are any ways I can improve on it. I hope you will use the code or starter in your own projects. Be sure to share your work on X, giving me a mention, so I can see what you did. Finally, be sure to let me know ideas for other short videos you would like to see. Read on to find ways to get in touch, further below. If you have found this post useful, even though you can only afford even a tiny contribution, please <a aria-label="Support Rodney Lab via Buy me a Coffee" href="https://rodneylab.com/giving/">consider supporting me through Buy me a Coffee</a>.

Finally, feel free to share the post on your social media accounts for all your followers who will find it useful. As well as leaving a comment below, you can get in touch via <a href="https://twitter.com/messages/compose?recipient_id=1323579817258831875">@askRodney</a> on X (previously Twitter) and also <a aria-label="Contact Rodney Lab via Telegram" href="https://t.me/askRodney">askRodney on Telegram</a>. Also, see <a aria-label="Get in touch with Rodney Lab" href="https://rodneylab.com/contact/">further ways to get in touch with Rodney Lab</a>. I post regularly on <a href="https://rodneylab.com/tags/deno/">Deno</a> as well as <a href="https://rodneylab.com/tags/seo/" aria-label="See posts on search engine optimisation">Search Engine Optimization</a> among other topics. Also, <a aria-label="Subscribe to the   Rodney Lab newsletter" href="https://newsletter.rodneylab.com/issue/latest-issue>subscribe to the newsletter to keep up-to-date</a> with our latest projects.