Comfy 2D Rust engine first release: a first look at v0.1

A new 2D game engine for Rust appeared on 24 September 2023, and it arrived with an unusually honest pitch. Comfy, an open-source engine built on wgpu and released under the MIT and Apache 2.0 licences, does not claim to be the fastest, the most flexible or the most correct. Its maintainers say, more or less, that it exists so you can type cargo new game and start writing gameplay code the same afternoon. Version 0.1 is a first public release of something that had already been used privately for real game projects, which shapes almost every design choice in it.
I spent a weekend with it. This is a first look at what it is, what it refuses to be, and the trade-offs underneath, because those trade-offs are the interesting part.
What Comfy is
Comfy is an opinionated 2D engine. The rendering sits on wgpu, so it reaches Vulkan, Metal, DirectX 12 and the rest through one API. On top of that you get an immediate-mode style interface for drawing and audio. If that phrase sounds familiar, it should: macroquad works in a similar way, and the release notes make the comparison themselves.
Immediate mode means you describe what you want this frame, and the engine forgets it afterwards. You do not create a sprite object, attach it to a scene and remember to remove it later. You call draw_sprite in your update function, every frame, for as long as you want it on screen. Sound works the same way with play_sound.
The feature list for v0.1, as far as the release describes it, includes:
- immediate-mode drawing and audio calls;
- a small optional ECS layer built on hecs;
- a z-index on draws, so you can submit things in any order and still get correct layering;
- HDR rendering with bloom;
- egui built in for debug windows and tools;
- an integration with the Tracy profiler.
The features page lists the pieces in more detail, and the examples are the best way to see how they fit.
What it deliberately is not
The release is blunt about scope. Comfy is not trying to compete with Unity, Unreal, Godot or Bevy. There is no physically based renderer. There is not even a perspective camera. It is not an ECS-first engine, and it does not lean on macros. If you want clever use of the type system or the most extensible architecture, the maintainers tell you to look elsewhere.
I find that refreshing. A lot of Rust engine projects aim at the general case and end up asking you to learn their architecture before you can put a square on screen. Comfy aims at one case: a small team making a 2D game they can finish and ship in a few months. If your project is a voxel world or an MMO, the engine says no up front, which saves you a month of finding out.
One context, passed everywhere
In v0.1, nearly everything goes through a single mutable reference, c: &mut EngineContext. Want the ECS command buffer? c.commands(). Want an egui window? c.egui gives you the egui context. There is no dependency injection and no system parameter magic.
Here is roughly what game code looks like in that style. This is an illustration of the pattern, not Comfy's exact API:
// Illustration of the single-context pattern.
struct EngineContext {
delta: f32,
// world, commands, egui, config and so on
}
struct Player { x: f32, y: f32, speed: f32 }
fn update(c: &mut EngineContext, player: &mut Player) {
player.x += player.speed * c.delta;
draw_square(player.x, player.y, 1.0);
}
fn draw_square(x: f32, y: f32, size: f32) {
// pushes a quad into this frame's draw queue
let _ = (x, y, size);
}
The appeal is that every function has the same shape. You never wonder where to get the delta time or the input state from. The cost is that every function also takes the context, whether it needs all of it or not, and you start threading c through helper after helper.
Globals on purpose
The part that will start arguments is that Comfy uses global state internally, and says so. The reasoning in the release is practical: in earlier experiments with other engines, the maintainers did not find real performance wins from implicitly parallel ECS scheduling. So the core engine stays single-threaded, and when something is genuinely heavy, you reach for explicit data parallelism with rayon.
That is a reasonable bet for small 2D games. Think about where the frame time goes in a typical action game with a few thousand entities. Here is a rough budget at 60 FPS, which gives you 16.7 milliseconds:
| Work | Typical share |
|---|---|
| Gameplay logic, a few thousand entities | 1 to 3 ms |
| Collision and queries | 1 to 2 ms |
| Building draw calls | 2 to 4 ms |
| GPU submission and present | the rest |
None of the gameplay rows is large enough that splitting it across eight cores changes whether you hit 60. The one place that might, a big particle update or a pathfinding batch, is exactly the place where a par_iter_mut() from rayon does the job without reorganising the whole engine around a scheduler.
use rayon::prelude::*;
struct Particle { pos: [f32; 2], vel: [f32; 2], life: f32 }
fn update_particles(particles: &mut [Particle], dt: f32) {
particles.par_iter_mut().for_each(|p| {
p.pos[0] += p.vel[0] * dt;
p.pos[1] += p.vel[1] * dt;
p.life -= dt;
});
}
That block is plain rayon, nothing Comfy-specific. The point is that parallelism becomes a local decision you make in the one hot loop, rather than a global property of the engine that shapes every system you write.
RefCell and partial borrows
Comfy also uses RefCell in places, which some Rust developers treat as a smell. The release defends it for a specific reason: partial borrows.
Rust's borrow checker works at the level of whole values when you go through methods. If your game state has a world and a particles field, and a method borrows &mut self to get the world, you cannot also borrow the particles through another method at the same time, even though they are separate fields. Game code hits this constantly, because almost every interesting function wants two or three bits of state at once.
use std::cell::RefCell;
struct State {
enemies: RefCell<Vec<f32>>,
score: RefCell<u32>,
}
fn kill_enemy(s: &State, i: usize) {
s.enemies.borrow_mut().remove(i);
*s.score.borrow_mut() += 10;
}
With interior mutability, both fields can be mutated through a shared reference. You trade a compile-time guarantee for a runtime check: borrow the same cell twice mutably and you get a panic instead of an error. In a single-threaded game loop that panic is usually easy to find, and the code reads more naturally. Whether that trade is right depends on how you like to fail.
Performance, honestly
The release does not pretend Comfy wins benchmarks. It says you could easily build a test that makes it look bad, and that game development is not a contest to draw the most sprites. What it does provide is Tracy integration, so you can see where your own frame is going. For a hobby or indie project, that is the more useful tool. A profiler tells you about your game; a benchmark tells you about someone else's.
Who it suits
Comfy v0.1 makes sense if you:
- want to make a 2D game, not an engine;
- like the macroquad style of drawing things directly every frame;
- are happy with globals and runtime borrow checks in exchange for less ceremony;
- do not need 3D, PBR or a heavily parallel simulation.
It makes less sense if you want a large ecosystem of plugins or a scene editor, or you prefer the type system to carry as much of your design as possible. The comparison with other engines in Comfy's own book frames this fairly.
The code is young. Most of it is undocumented at this point, and the maintainers say so. The examples are simple enough to read without docs, and the book covers the core ideas. My suggestion for a first evening: take one example, strip it down to a single moving square with a sound on keypress, then add a second entity type and see how soon you start wanting the ECS. That moment tells you more about whether the engine fits you than any feature list.
Filed in Rust Gamedev · Engines & Architecture

Written by Kasimir Lund
Kasimir writes about Rust for games: engine internals, ownership patterns that survive a real game loop, and getting builds onto other people's machines. He has been writing small engines for himself since the SDL days and lives in Gothenburg.


