What’s New in Rust Game Development?

Game Engines, Godot, and More

Herbert Wolverson
The Pragmatic Programmers

--

https://pragprog.com/newsletter/
https://pragprog.com/newsletter/

Last year, I outlined a few options for Game Development in Rust. Rust is a fast-moving ecosystem; new and exciting options become available all the time. In this article, we’ll take a look at some of what’s new in Rust game development since the last article.

Why Use Rust for Game Development?

Rust is making inroads into the game development world, and some of its strengths are becoming clear. Rust addresses a number of pain points from other languages:

  • Rust is a systems language — it runs close to the metal, compiling to fast, native code.
  • Rust has no garbage collector — so your game won’t pause unexpectedly while the system cleans up your memory.
  • Rust makes memory management easy — many common bugs (use after free, dangling pointers, many overflows) are caught by the compiler.
  • Rust offers a consistent build interface and a consistent package user interface.
  • Rust interoperates seamlessly with other languages via FFI.
  • Rust offers fearless concurrency — data races trigger a compiler error, and thread control is built into the language. It’s easy to take advantage of every core in your CPU. With Bevy and similar engines, your program automatically threads your game logic.

Rust offers a solid foundation for game development — seen in the rapid evolution of new game engines that make use of these advantages.

Rust Game Engines

There’s some exciting news in the Rust game engine world. Let’s start with Fyrox, a powerful 3D engine.

Fyrox

Fyrox 0.22 highlights.

Formerly known as RG3D, Fyrox is a rapidly developing 3D engine. It includes most of the features you expect from a modern 3D engine: an editor, scripting, lightmaps, scene-graphs, serialization, audio and more. It started as the engine for the author’s first-person shooter game — but now includes examples for making roleplaying games and more.

Another popular engine in Rust is Macroquad, focused on simple 2D game development.

Macroquad

Macroquad’s big selling point is that it is simple, efficient and minimal. Macroquad isn’t opinionated: you can store your game data however you like. The engine includes everything you need to make 2D games. It includes optional platformer physics and blazing fast sprite rendering.

Fish Fight is an open source platformer game, written with Rust and Macroquad.

Fish Fight, a game made with macroquad
Fish Fight, an open source platformer written with Macroquad.

Kajiya

Kajiya isn’t a complete game engine yet, but it’s pushing the bounds of what you can render in Rust. Using RTX, Kajiya offers global illumination and beautiful rendering. If you’re interested in the nuts and bolts of cutting-edge game development, Kajiya is a great place to look.

Kajiya Ruins
Kajiya’s global illumination system renders beautiful scenes.

Bevy 0.6

The Bevy engine has released a new version! Bevy is a data-driven game framework. Everything is stored in a fast, easy-to-use entity component system. It features great 2D rendering, increasingly powerful 3D rendering, audio and a powerful plugin system for extending the base engine.

A simple helicopter game I created with Bevy. It’s only 350 lines of code.

Bevy 0.6 includes a lot of changes. In particular, you no longer need to add .system to the end of every system when you are building your scheduler. The 3D engine now supports better, faster lighting with full shadows. Many bugs have been fixed. Bevy is moving towards a more regular release schedule. The full list of improvements is huge.

Rust in Godot

Rust’s interoperability with other languages (via FFI) is proving to be a killer feature. In the business world, Rust is seamlessly sliding into existing workflows — replacing the dangerous parts with safe, high-performance code. In the game world, Rust’s FFI support makes it easy to work with existing game engines.

Some Godot games that use Rust.

The Godot-Rust plugin makes Rust a first-class citizen of the Godot infrastructure. Easily write heavy-duty scripting in Rust and attach it to your project in the Godot editor. Ideal for projects that require heavy computation behind the scenes, while still using Godot’s excellent framework.

More About Rust Game Development in 2022

I recently gave a talk about Rust Game Development to the Rust Wurzburg Meetup, which you can watch here:

--

--