DEV Community

Cover image for Rust for Gaming: Rust Game Development Engines 2024
Rodney Lab
Rodney Lab

Posted on • Originally published at rodneylab.com

Rust for Gaming: Rust Game Development Engines 2024

🦀 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 most admired language by developers, you might be considering using Rust for gaming. You would be adding to a long list of games written in Rust, which includes Jumpy, Makiomino, Veloren and Zemeroth. Targeting readers who have already decided they want to use Rust for game development, let’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:

  • Are we Game Yet — 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.
  • Rust GameDev WG — 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.
  • Rustacean Station Podcast — 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 Rust Game Dev Podcast. 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’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 godot-rust book.

Learn more about godot-rust here:

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’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 Bevy book to get started.

Learn more about Bevy here:

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 Hands-on Rust; 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’s rand crate later. Herbert’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:

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:

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:

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’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’s tooling and crate handling infrastructure. You can see an example of spinning up a Macroquad game further down.

Learn more about Macroquad here:

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) YouTube tutorial on building a snake clone (link opens in YouTube):

Learn more about Piston here:

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. Amethyst is not actively maintained 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:

🔥 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 Rust already set up on your system.

How to Spin up a Snake Clone using Rust’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 code from the Macroquad snake demo.
  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 consider supporting me through Buy me a Coffee.

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 @askRodney on X (previously Twitter) and also askRodney on Telegram. Also, see further ways to get in touch with Rodney Lab. I post regularly on Deno as well as Search Engine Optimization among other topics. Also,

Top comments (0)