Hacker News new | ask | show | jobs
by binary132 570 days ago
Totally subjective and superficial outsider view, but it has been my perception both that Bevy does not make great use of Rust features (i.e. I’ve heard it relies a lot on dynamic dispatch / there are things that can be done wrong which aren’t caught by the typesystem?) and that it lacks feature parity on certain important points (which I couldn’t be asked to enumerate) — which could be forgivable if its use of Rust’s typesystem was more advantageous given the first point but could be an issue if it wasn’t well differentiated by it.
1 comments

I mean, kind of. It's a bit of a vague comment. Dynamic dispatch is not bad by itself, and as not-an-ECS-developer, I couldn't actually answer how much it is or is not used in the ECS internals. Probably more than I expect, but not enough to be an issue. Performance is plenty fast, we profile that pretty often.

As for things that can't be caught by the type system, it's not like we can enforce that the logic in system_b that expects a given entity to be alive won't accidentally break if you introduce some system_a later on that despawns the entity at some point. We can't compile-time validate that kind of safety for game logic - it's just not possible.

On the other hand there are things we can do that C++ based engines can't thanks to Rust. Compile-time variable mutability means we can know exactly what set of systems modify which pieces of data, which means we can automatically schedule different systems in parallel without any safety issues, or detect what when and who touched a piece of data last.

In terms of features, Bevy is still early in development. Feature parity with existing, 10-20 year engines with many paid developers is going to take a while. But I think we have some pretty compelling features on our own even today, foremost our focus on ECS and modularity.

In terms of what Rust brings, it has the performance of C++, but with better memory safety (mostly in terms of engine internals - not like user code touches lifetimes that often), thread safety, a way better and standard build system, some modern features like pattern matching and enums, etc. The usual ways in which Rust is better than C++.

The answer isn't so much "why would I want to use an engine in Rust" (although I personally love Rust and would absolutely choose it over a C++) but more "we want to make a new engine". You want C++ levels of performance, but without having to use C++, so Rust is an obviously compelling choice for a game engine.

Like I said: superficial, subjective, outsider perspective. :)
Heyo, another contributor here. I work in rust now professionally, and Bevy is part of what opened my eyes to the power of the language. The project makes deep complex use of rust’s memory safety and type system, but also takes great pains to wrap this complexity in simple and approachable APIs. We’re also almost always one of the first consumers of newly stabilized compiler features, usually bumping MSRV and incorporating the new features (for instance const float arithmetic) within days. I don’t see how it could have been written in any other language.