News for hackers. Stuff that matters.
Re:Why Rust Is the Future of Game Development by nine_k on Monday November 09, 2020 @02:29PM (#25038752)
Unfortunately, Rust has limitation on what it can prove to be safe using the ownership and lifetimes approach. One of the simplest things which can't safely be done in Rust is a doubly-linked list.

I'm certain that Rust will help some parts of game development a lot, but I'm also certain that game developers sometimes use tricks safety of which cannot be proven by Rust's type system.

Re:Why Rust Is the Future of Game Development by steveklabnik on Monday November 09, 2020 @02:41PM (#25038922)
You can do these things safely, you just can't do them safely and efficiently at the same time. You could do a doubly linked list with reference counting, and it would be in safe code, it just wouldn't be classic implementation you'd be imagining, and not as efficient.
Re:Why Rust Is the Future of Game Development by worik on Monday November 09, 2020 @03:01PM (#25039194)
You can do circular structures like doubly linked lists in Rust. You can do them efficiently. But you do need to use "unsafe". Of course you do, a moments thought shows you why.

It is not as "safe" as Rust without "unsafe" blocks, but it is still reasonably safe.

But circular structures are usually a bad choice.

Re:Why Rust Is the Future of Game Development by rrobukef on Monday November 09, 2020 @03:32PM (#25039527)
I haven't found any problem where a linked list could not be replaced with a vector of index-element pairs (or triples) with a reductions in allocationd.

I'm open for discussion as I haven't been able to convince myself of the use of any linked list.

Re:Why Rust Is the Future of Game Development by scythe on Monday November 09, 2020 @02:53PM (#25039105)
>Unfortunately, Rust has limitation on what it can prove to be safe using the ownership and lifetimes approach. One of the simplest things which can't safely be done in Rust is a doubly-linked list.

It can be done "safely" in Rust, as in without actual bugs; it can't be done in "safe Rust", that is, Rust without `unsafe{}` blocks. But it's reasonable to assume that any Rust game would make liberal use of `unsafe{}` blocks, because as we have all agreed, game developers don't actually care that much about memory safety anyway.

As such it seems wrong to suggest that the primary barrier to Rust in games development is its memory safety. Perhaps the culture of today's Rust community that shuns `unsafe{}` is unsuitable for games development, but Rust offers plenty of advantages beyond memory safety, and in contrast with C++ the particular advantages I would see as most relevant are:

- no legacy types/structures, important when you have a large team on a shoestring budget working late nights with sporadic communication; there will be fewer discrepancies in code styles

- potentially faster compile times than C++ when Rust is more mature

- distant future item, but there's the possibility for better FFI with game scripting languages when Rust is more mature

None of the above really depends on memory safety except kinda the FFI, but it's all relevant for a game dev.

While the adoption of "safe Rust" has left the tarmac, the best practices and widespread use of "unsafe Rust", a perfectly reasonable language in itself, have barely begun to develop. It's likely that any Rust games will generally be written with lots of `unsafe{}` and while nobody would learn Rust to use `unsafe{}` specifically, game developers might learn mostly safe Rust in CS courses that cover systems programming and then take those skills to the game industry and already know most of what they need to ramp up on an unsafe Rust codebase.

That last sentence is also why I think the Rust games era is at least a decade away; game shops don't usually want to retrain their employees on new languages; they'll just use what's in the field. That's also why Rust will probably beat out Zig (or Nim/Jai), since even though the latter is a little more suited for games, the former is much more likely to be taught in schools.

Re:Why Rust Is the Future of Game Development by pjmlp on Monday November 09, 2020 @04:22PM (#25040086)
> potentially faster compile times than C++ when Rust is more mature

First cargo needs to also handle binary dependencies, and C++20 has modules now.

Re:Why Rust Is the Future of Game Development by scythe on Monday November 09, 2020 @05:52PM (#25040950)
The technical progress will be unpredictable as usual, but at the level of the problem definition, I think it's safe to say compiling Rust is easier than compiling C++.
Re:Why Rust Is the Future of Game Development by pjmlp on Tuesday November 10, 2020 @02:35AM (#25043590)
Depends, if the option is between doing it in 5 minutes (thanks binary libraries and pkg-config) or wait 16 minutes (cargo compiling the world).