News for hackers. Stuff that matters.
Re:The Next Mainstream Programming Language: A Game Develope... by speed_spread on Friday August 26, 2022 @08:46AM (#32606695)
I love Rust, but it's "righteous" nature might go against the grain in many game shops where quick and dirty is not only accepted practice but where anything more rigid than C is deemed necessarily inferior. Something like Zig might have a better chance in that space.
Re:The Next Mainstream Programming Language: A Game Develope... by littlestymaar on Friday August 26, 2022 @10:38AM (#32608116)
Are there game studios out there still using C? From what I've heard the majority is using C++, so switching Rust just makes your life easier without changing too much (C++ devs already uses templates, smart pointers, RAII, etc. which Rust has too, but with a better design (a stronger type system, and also hindsight from 30 years of C++)).

From what I've seen on HN, Zig seams to appeal people who like the “simplicity” of C and find Rust too complex, but I don't think anyone coming from C++ could find Rust “too complex” (a bit different, with a learning curve indeed, but not “too complex”).

Re:The Next Mainstream Programming Language: A Game Develope... by z3phyr on Friday August 26, 2022 @12:50PM (#32609870)
> C++ devs already uses templates, smart pointers, RAII, etc.

These are frowned upon in the game industry circles. Most of the game code is C style C++ with occasional function overloading and classes.

Re:The Next Mainstream Programming Language: A Game Develope... by ska on Friday August 26, 2022 @05:38PM (#32613044)
I don't know much at all about game development circles, but have a fair appreciation of others areas using c or c++ for combinations of high performance, low level, bare metal, etc. I've found some shops that very specifically use c, but other that use "c++" but that means "pretty c-like, with a few c++ features but don't you dare do x,y,z". Some of these variants are pretty simple, but it's enforced by code/design review (and sometimes tooling) not the language.
Re:The Next Mainstream Programming Language: A Game Develope... by generichuman on Friday August 26, 2022 @09:10AM (#32606999)
Zig also tries to block quick-and-dirty stuff, unused variables are errors for example. There are formatting related things too.

This is obviously not as "righteous" as Rust as you put it, but when you look at the source of some shipped games, you'll see that some programming best practices are ignored.

None of this will block Zig from being used in games, of course, but I wish they had a "let me work in peace until I get this working and then we can worry about that small stuff" mode in the compiler.

Re:The Next Mainstream Programming Language: A Game Develope... by zaphar on Friday August 26, 2022 @09:22AM (#32607151)
I think the reasons languages like Zig choose not to make this configurable is because other than the odd exception occasionally very few shops bother to turn on the stricter mode or are actively hostile to the stricter mode.

And when you rely on other libraries that sort of less strict mode tends to start leaking out everywhere since that one critical library you really don't want to rewrite won't compile when you use strict and you don't want to carry a bunch of patches for it either.

The net result is if you don't start out enforcing cleanliness your community of users will unintentionally devolve into unclean over time.

Re:The Next Mainstream Programming Language: A Game Develope... by adamdusty on Friday August 26, 2022 @10:06AM (#32607740)
Why not just enforce it in release configuration?
Re:The Next Mainstream Programming Language: A Game Develope... by generichuman on Friday August 26, 2022 @10:35AM (#32608077)
> The net result is if you don't start out enforcing cleanliness your community of users will unintentionally devolve into unclean over time.

Well since the package manager will be integrated to the compiler, I think they could enforce the cleanliness for people who want to publish their libraries.

Re:The Next Mainstream Programming Language: A Game Develope... by naikrovek on Friday August 26, 2022 @08:14PM (#32614251)
> when you look at the source of some shipped games, you'll see that some programming best practices are ignored.

yeah. players demand performance because it relates directly to a better playing experience. they demand it with their purchases and their critiques. game developers understand this inherently or they will not be a game developer for long.

honestly, i think a lot of “best practices” are nothing more than an influential person demanding compliance to their preferences, because a LOT of those “best practices” actively reduce developer productivity and runtime performance both; there’s no tradeoff, its just pure loss.

non-game developers could learn a lot from seasoned and experienced game developers, i think, but we imagine ourselves wholly superior when we absolutely aren’t.

Re:The Next Mainstream Programming Language: A Game Develope... by runevault on Friday August 26, 2022 @09:57AM (#32607599)
There are at least some studios using Rust. Chucklefish did for a while though they ended up stopping. Ready at Dawn was using Rust at one point but not sure if they still are. Embark still is so far as I can tell.

It certainly isn't a language for every gamedev shop but some seem to be taking it seriously.

Re:The Next Mainstream Programming Language: A Game Develope... by msmenardi on Friday August 26, 2022 @11:29AM (#32608786)
You can always use "unsafe" code in Rust. At that point you're basically writing a block of code in C++ with the guarantee that it'll interface correctly with all your other "safe" code.
Re:The Next Mainstream Programming Language: A Game Develope... by Jensson on Friday August 26, 2022 @01:53PM (#32610653)
Have you ever tried writing significant amounts of unsafe rust? It isn't like C++ at all, you get the worst of both worlds.
Re:The Next Mainstream Programming Language: A Game Develope... by ksec on Saturday August 27, 2022 @06:50AM (#32617667)
>I love Rust, but it's "righteous" nature

Finally. Someone gets it. It has nothing to do with the language itself. But the culture and philosophy of the tools / language / framework or library.

Re:The Next Mainstream Programming Language: A Game Develope... by junon on Friday August 26, 2022 @03:33PM (#32611772)
I'm writing a kernel in Rust, having a great time. I'm not sure what all the arguments here about it not being suitable for game dev are but I would imagine it works perfectly for game dev.
Re:The Next Mainstream Programming Language: A Game Develope... by throwawaymaths on Friday August 26, 2022 @05:35PM (#32613026)
Suppose you wrote a kernel in rust. Now there has been a CPU regression and you have to implement a retpoline. Obviously you don't want to implement it in places where you don't have to. Would this be easy? Or hard?
Re:The Next Mainstream Programming Language: A Game Develope... by junon on Monday August 29, 2022 @10:33PM (#32646015)
I don't see why it would be any more difficult or cumbersome than in C.
Re:The Next Mainstream Programming Language: A Game Develope... by throwawaymaths on Monday August 29, 2022 @11:30PM (#32646343)
Because macros can obscure having an accurate mental model of what is happening at the metal level, which is what matters when you're doing a retpoline. This is why ziglang, for example, has "no hidden control flow". Not only the mental model, but also you might find that where you need to add the code forces you to break open a macro, which could be a considerable refactoring task.
Re:The Next Mainstream Programming Language: A Game Develope... by junon on Tuesday August 30, 2022 @01:26PM (#32652857)
I don't see what macros have anything to do with anything.