So I have had experience in developing in a couple different environments now at this point. Most of my Computer Science classes use C++, my internship/job uses C# for all their work, and I’ve used a couple different languages for other personal projects and the such.
Personally I have not been a fan of C++, for me its not so much the language (though the language does have many flaws). I’ve found that the general feeling of hostility within the community has driven me away.
Then I encountered Rust: A systems-programming language with type-safety in mind.
Reading through the Rust Book, then exploring Rustlings, and now reading through the docs. I find that Rust is an exciting language to be learning. The design of Rust uses a lot of patterns used in functional programming (things such as pattern matching) as well as some object oriented designs (Structs). Rust also adds in its own flair with some interesting features, such as traits, object lifetimes, and ownership.
Not only do I really like the language and how Rust works, I am already incredibly fond of the Rust community. Everyone that I’ve interacted with thus far has been genuinely excited about the language and want to share it with others. Something I found when programming in Ruby in my early days, but lost track of when I got into C++.
A shortlist of why Rust is a great programming language for games.
- Games are some of the most stateful pieces of software you’ll ever know. However, using functional programming in games can help with the underlying codebase and may improve performance.
- Immutability is default unless specified with the
- The concept of null doesn’t exist in Rust. Which is a great thing as null can lead to undefined behavior. Rust requires us to handle the possibility that something our code expects, isn’t there.
- Rust is type safe, no unexpected implicit typecasting is being made.
Theres just one thing…
As with most things with Rust, its quite young. So things are still evolving and changing.
That being said…
A lot of work in the Rust-Gamedev community has been taking place, and a lot of it is pretty impressive. Many Rustaceans are really passionate about the language and are constantly working on little projects. Just talk to anyone in the official Rust-Lang Discord channel.
Great, so where can I start?
So I’ve only gotten started into game development in the Rust realm. I’m also doing some work with a indie game dev/startup that uses C#, but there are some great resources available. I started my own journey into games in Rust at the aptly named Are We Game Yet? site. Lately, I’ve been following along with Tomas Sedovic’s “A Rougelike in Rust” tutorial, which adapts the Python+libtcod tutorial for Rust (with some Rusty changes)
Amethyst is a full 2D/3D game engine built using Rust. It uses the Entity-Component-System (Or ECS) to build data driven games and has a great book that comes along with in-depth documentation. It also uses Vulkan GL primarily (or Metal for Mac), which has been really exciting to play with as well.
Overall, while things are still relatively new in developing games in Rust I believe that Rust can serve as a great alternative to languages such as C++ in the field of game devleopment.