DEV Community

Ari V for Embark Studios

Posted on • Originally published at Medium on

Inside Rust at Embark 🦀

A peek inside our day-to-day work with Rust and open source game development

Originally published on our Medium blog on December 6th, 2019.

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.

Our first open-source Rust projects, available on embark.dev

A possibly even more important reason we love Rust is 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.

Rust, Open Source, Game Dev

Jake Shadle gave an overview of how Rust, Open Source, and Game Dev fit together, and why they’re a powerful combination.

An unholy fusion of Rust and C++ in physx-rs

Tomasz Stachowiak dove into the technical challenges he encountered when combining Rust and C++ code to make the physx-rs open source project.

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.

How long have you been writing Rust, and what got you into the language?

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.

How has using Rust changed your development workflow?

J: It just made me enjoy programming again, which is a great quality of life improvement when you do that for your 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 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.

What tools do you use on a daily basis?

J: I use the typical tools of cargo/rustfmt/clippy on a daily basis, all on Fedora, which is another way that Rust improves my daily workflows and enables me to be more productive.

T: Visual Studio Code with Rust Analyzer (editor note: Embark sponsors Rust Analyzer because we think it’s awesome!) for my key mashing. Clippy and rustfmt to keep it sane.

Tell me about an open source crate you really like.

J: I really love clap + structopt. The ability to write nice declarative CLIs is still pretty magical to me, it’s always the first crate I add a dependency on when making a new command-line tool.

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.

Where do you want to see the Rust project go in 2020 and beyond?

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 that 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!

If you are interested in collaborating or working together, check out our projects on embark.dev or reach out to us at opensource@embark-studios.com.

Connect with us:

→ Embark open source work at embark.dev

→ Rust ecosystem issue tracking at embark.rs

→ Follow our developer newsletter

→ EmbarkStudios on Twitter


Top comments (1)

Collapse
 
ben profile image
Ben Halpern

This is really super cool!