Programming a VR Game Using Rust

Since Resolution Games started in 2015, VR technology has rapidly changed. Our first titles, Solitaire Jester, Bait! and Wonderglade were developed for smartphone  VR headsets (Samsung Gear VR and Google Daydream). Now, we’re primarily developing games for standalone and tethered headsets such as the Oculus Quest and Rift, HTC Vive, Valve Index, Pico, etc. These rapid developments in VR tech have allowed our teams to remain nimble and adaptable to whatever is thrown our way. But, this doesn’t just apply to the devices our games are played on, it also applies to the tech we use to program our games. In today’s post, our CTO Martin Vilcans shares how we are using Rust to program an upcoming title.

You are one of the founders of Resolution Games, tell us a little bit about the journey so far.

It's been quite a ride! Resolution Games started six and a half years ago with a handful of people in a small room and now we have almost 100 employees from all over the world, and a large office in central Stockholm that we haven't used much during the pandemic, of course. We’ve also published over 10 great games including Demeo, Blaston and Acron: Attack of the Squirrels! and many of them have large active communities.

You are currently working on an unannounced VR game where you have chosen to program it in Rust. Can you tell us a bit more about the reasoning behind the decision?

We still write C# code in Unity for the parts of the game that the player will see. All the graphics, audio and effects are in Unity. But we implement the core logic of the game, including physics and networking, in Rust. While C# is a good language for those things, Rust has some strengths in those areas that we wanted to explore. Rust is maybe most known for being a safe language. While it may be more difficult to write code that the compiler accepts, when the compiler accepts it, the code is more likely to do what you wanted. It won't give runtime errors or other surprises, even if you involve multithreading. I'm more confident having junior programmers working in a Rust codebase than, say, C++. Also, the code is compiled into efficient machine code if you write idiomatic Rust. This is in contrast to many other languages where, in order to make the code efficient, you may have to write "ugly" or hard to understand code.

For this game, the reason we started experimenting with Rust is to implement multiplayer capabilities in a physics-based game. We can compile a very tight and efficient binary that can run on a server, while the same code can be used to do the same calculations in parallel on the game clients. In the Rust ecosystem there are easily accessible libraries, so called crates, for almost anything you can imagine, so it's not too much work to implement things like serialization, networking, efficient data structures, and physics. As a special mention, we use the physics engine Rapier that gives us the control we want over the physics, while the developer has been very helpful with any problems we have had.

What is exciting about using Rust in game development for this game?

Apart from the language itself, the surrounding tools are very good, and it has great momentum right now. Anytime I have missed some feature in Rust, I soon find that it's in the works and will come in a later update. C and C++ have been the primary languages for many game studios over the years, and Rust can be seen as a modern replacement of those. There's a lot of interest from the games industry, but many companies are heavily invested in their old codebases, tools, and knowledge and may not be able to switch. At Resolution Games, our organization is flexible, allowing for innovation in game projects, which enables us to try out Rust in this project.

Any tips for someone reading this wanting to apply for a programmer position with us?

If you're good at programming, you should apply. If you don't have experience from the games industry, consider it anyway as you may have other skills that we're looking for. And even if you don't consider yourself the world's best programmer, but you're the kind of person who gets things done, and can prove it by having published a game (even a simple one you published yourself), you're also very welcome.

To learn more about our opportunities for skilled programmers in Rust and other languages, visit the Resolution Games career page. Some of our current openings below:

Previous
Previous

Celebrating Pride Month

Next
Next

How the Demeo team created a masterpiece