A bespoke game engine in Rust
April 25, 2025I wanted to talk about something I've been working on for the past few months. I've been building a bespoke game engine in Rust. I'm hopelessly in love with Rust and want to have its babies. In all seriousness, I really, really love Rust. Let me tell you why.
My early claim to fame was building NinJump in the early days of iOS and Android — a game that hit #1 on iOS and was downloaded hundreds of millions of times. It’s still being cloned today. Back in those days, there weren't many game engines on mobile platforms so we had to build our own in C and C++.
Over the years, I've worked with all the major engines, including Unity and Unreal. They allow you to prototype quickly but tend to be heavy and opinionated. A lot of your CPU time goes to things that you don't actually use. I've also experimented with Bevy, a promising Rust game engine that has a lot of momentum, but I wanted absolute control over the CPU and GPU, so I set off into the unknown.
About 5 years ago, I finally took a good look at Rust. I was initially hesitant but I eventually caved and read The Rust Programming Language book. What followed was an incredibly rewarding technical journey into modern systems programming, and a love affair with a programing language. A language as fast as C, but with the memory safety a committed relationship deserves.
For the last few months I've been prototyping. So far I've created a high-performance, multithreaded Vulkan renderer. Vulkan is an absolute beast, but once you get over the hump, it's a fantastic curriculum into modern GPU architectures.
One cool thing about my approach is that the game and render threads run independently. The game thread runs on a fixed timestep, while the render thread attempts to match your monitor's refresh rate. Data is sent between threads in a non-blocking way, and the render thread interpolates between fixed timesteps. A neat consequence of this is that the game thread can run at, say, 30hz, which means you can do a lot of CPU work, but the game renders as if it were running at at much higher framerate.
I'm currently targeting the simulation genre. Simulation games are very CPU heavy, so much of my work has been about optimizing memory layout to faciliate things like cache coherency and vectorization. It turns out that it's all about memory layout at the end of the day.
I've always been inspired by teams that go their own way - Factorio comes to mind. It takes a lot of courage but it's immensely rewarding. I plan to post now and then as I encounter technical challenges for those who are interested.
I'm poking around for my next gig, be it backend distributed systems, game engines, or other areas that require high-performance, native code (yes, even crypto). If you're hiring, or just want to chat about Rust or homegrown game engines, I'd love to connect!