A peek inside our day-to-day work with Rust and open source game development
As you may know, Embark has used Rust as our primary programming language since the day we started the studio. We love the safety and robustness of Rust, and the ability to write high performance, safe, and (mostly) bug free code. It enables us to fearlessly refactor and change the code, without common lifetime/ownership, memory safety, or race condition problems.
A possibly even more important reason we love Rust is the the openness and collaborative nature of the ecosystem, and the growing community around the language.
With tens of thousands of open source crates on crates.io and the best-in-class package system cargo , we truly believe Rust is a language for the future.
Last month, we hosted a Rust meetup in Stockholm , where Embark software engineers spoke about our work in Rust.
Jake Shadle gave an overview of how Rust, Open Source, and Game Dev fit together, and why they’re a powerful combination.
You can watch both talks in full on our YouTube channel !
I sat down with both speakers to get an inside peek of what it’s like to work with Rust at Embark, and their vision for Rust in 2020.
Jake: I looked at Rust one time before 1.0, but I was on Windows so the install experience was…not nice. Actually the install experience shortly after 1.0 for Windows was also not nice, my first and only PR to Rust itself was a change to the README to add a line to run when installing some dependencies via pacman.
Anyways, what got me into the language in the first place was just its promise as a legitimate replacement for C++, keeping the good stuff like manual memory management, but putting it in a nice modern package.
Tomasz: I started playing around with Rust in 2013, before crates.io was a thing, back when Box was ~, and @ was a garbage-collected pointer. I got into Rust following a breakup of a long term relationship with D. At the time I wrote a toy Rusty rendering engine in which I prototyped a few novel algorithms, like stochastic screen-space reflections, and probe-based global illumination. I made a few attempts at converting coworkers too, but did not succeed. The language was a bit rough around the corners back then, and I also needed some stability, so I ended up using C++ for a bit instead. I came back around 2017, and have been happily coding in Rust since.
J:It just made me enjoy programming again, which is a great quality of life improvement when you do that for you job every day. Sure, there are new problems that Rust gives that aren't present in typical C++ scenarios, particularly around dependency management, but the difference is that the community and ecosystem around Rust is much, much more open compared to C++, and solving problems, especially in the core language and tooling, tends to help everyone who uses Rust. So just being able to participate in a wider community is easily the biggest difference to my workflow.
T: It just makes me happier. The borrow checker has greatly improved the quality of my sleep, and made collaboration a breeze. Teamwork is much better when you can trust the other people not to introduce subtle threading and ownership issues. In my personal development, I don’t need need to reinvent the wheel nearly as much as when using C++ or D.
The tooling is amazing, and mostly just works. Back in C++ I found myself always struggling with its limited expressive power, and lack of every-day features like modules and reflection. When using D, I felt alone despite actively engaging with the community, and ended up reinventing the wheel all the time. Rust fixes all of that, and even takes over many cases where I previously would have used Python.
T: I love lalrpop ! It’s a parser generator framework that’s a pleasure to use. I wrote a few dozen parsers in my life, and quite often ended up on the fence between rolling one from scratch and using a generator. The latter would typically be quicker to start with, but frustrating whenever trying to do something not covered by examples. lalrpop makes for very succinct grammars, trivial translation to abstract syntax trees. It’s fast enough, and it’s extremely helpful if you have a mistake somewhere in your grammar definition.
J:Technically speaking, I would love to see more crates hit 1.0, and maybe a few things in cargo like dependency profiles and such. Non-technically, I would just love to see the Rust ecosystem have a more clear direction to sustainability so that this great language and community can keep growing for years to come.
T:There are a few technical features I wish for, such as stable specialization, generic associated types, and faster compile times. Build speed can be improved by using artisanal hand-crafted RUSTFLAGS in conjunction with LLD, but after having used D, I always want more. The other stuff is mostly quality-of-life improvements for reducing boilerplate.
I'd love to see the community grow, and expand into more professional use, especially around game development. Rust's cross-platform open source ecosystem could be a game-changer for smaller studios which don't have the resources to invent bespoke tech all the time.
We love the Rust community, and are always looking for new ways to contribute and help build a thriving open-source ecosystem for game development in Rust.
You can get more details about our plans for Rust and game dev at embark.rs!