4 ms·
Hi, I'm the founder of the project. We chose Rust because it's performant, memory-safe, and comes with a host of modern features that make writing code with th
by zesterer 6y ago
Hi, I'm the founder of the project.
We chose Rust because it's performant, memory-safe, and comes with a host of modern features that make writing code with the language very enjoyable.
We could have chosen C++, but I'm very glad that we didn't. Memory safety is great: I've not needed to break out gdb even once throughout the history of this project, despite the size of the project. This safety means that code is easier to review because it 'does what it says on the tin' and is much less prone to UB and non-local behaviours. It also reduces the prevalence of bugs. I've been shocked by just how much easier it is to write reliable and bug-free code with Rust than it is with languages that I've used in the past (C, C++, Python, Vala, amongst others).
The type system is also very powerful and it lets us encode a lot of useful invariants that can be checked by the compiler. Knowing that what you're doing is correct-by-nature is a great help and it frees your mind up to focus on the logic of what you're writing rather than getting distracted by irrelevant details like representation.
Rust plays very well with data-oriented design. This works great for us. At its heart, Veloren uses a high-performance ECS that is extremely cache-coherent. There's still lots of optimisation work to do, but we're already seeing that servers that can handle hundreds of players and millions of entities without issue, despite the fact that terrain generation is done server-side (and, as such, we have similar performance constraints to games like Minecraft).
The client, server and client/server frontends (frontends are logically independent and alternative frontends can be written for the game) are all written in Rust. In addition, the in-development plugin API will allow for plugins written in Rust and compiled to WASM.
In addition, Rust is also very portable. Compiling the game on (and for) many platforms is incredibly easy. The game runs well on Windows, Mac OS, Linux, BSD, and community members have even gotten it running on the Raspberry Pi and a hacked Nintendo Switch!
I hope this doesn't come across as being overly evangelical, but I think I speak for all of the developers when I say that we have no regrets in the slightest about choosing Rust! That doesn't mean it's the right choice for all projects, of course. The Rust gamedev ecosystem is still relatively immature. Although this is changing fast, don't expect to find any nuts-and-bolts game engines ready to go. However, if you're not afraid of diving down into low-level APIs here and there, Rust might be a great choice.
Edit: At a second glance, I see you're asking more about why mentioning the language is important. As a community-driven project, we rely on encouraging new contributors to work on the game and the choice of language is something that developers usually care about a lot. Extensibility and open development is really important for us and so 'showing the innards' is a big part of what we do when interacting with the community. Unless it's security-sensitive, we'll always discuss development issues and ideas in a public forum where anybody can add their input.
- ksm1717 6y agoI think they were more asking why Rust matters to us as readers or users. Not that it isn’t great insight, but your answer is more like why rust matters to you.
- lubesGordi 6y agoThe answer matters to people who write games in C++, or anything in C++. They want to know that Rust can handle/be productive in various domains.
- ksm1717 6y agoAgreed
- aimor 6y agoI heard about Veloren from the Rust Game Dev Podcast (Aug 2020). I really enjoyed listening to the team talk about details of the game's development, thank you for talking about it so openly. https://rustgamedev.com/episodes/interview-with-team-veloren https://rustgamedev.com/episodes/interview-with-team-veloren
- Geminidog 6y agoThe fact that you haven’t used gdb is a huge deal. This is very rare in large C++ projects.
- moritonal 6y ago"I hope this doesn't come across as being overly evangelical" Not at all, I'm worried now my post seemed mean! This was exactly what I was looking for. I wanted to know if this was chosen just as a PoC for Rust, or whether it actively made development better (which it sounds like it does :D). There's a big difference between "Here is X written in Rust" and "X is so much easier because we wrote it in Rust!". The fact you then go on to use ECS within Rust must have amazing returns on metrics. Good luck on your progress!
- Narishma 6y ago> At its heart, Veloren uses a high-performance ECS that is extremely cache-coherent. I think you meant cache-efficient, ie: it uses the cache efficiently. Cache coherence is something completely different.