News for hackers. Stuff that matters.
Re:The Next Mainstream Programming Language: A Game Develope... by agluszak on Friday August 26, 2022 @07:42AM (#32606057)
I'm looking forward to Rust's adoption in popular game development engines. There's https://bevyengine.org/ in the meanwhile
Re:The Next Mainstream Programming Language: A Game Develope... by Thaxll on Friday August 26, 2022 @09:59AM (#32607631)
Rust will be nowhere in the next 10years for gamedev, not even sure it will be used at any point. The only one I know using it to some extend is Embark but they have a very good engineering culture ( ex DICE / SEED ).

For people not working there, it's kind of a blackbox in term of tooling / pipeline etc ... when you work in webservices you have a ton of opensource knowledge / tools available, videogame are kind of different they re-invent a lot of the stuff in-house.

Re:The Next Mainstream Programming Language: A Game Develope... by steveklabnik on Friday August 26, 2022 @01:25PM (#32610363)
One interesting development in this space: "Treyarch has been gradually integrating Rust into our tools and pipeline since 2018."

https://research.activision.com/publications/2021/09/the-rus...

Not in the actual games themselves yet that we know of, but still very cool!

Re:The Next Mainstream Programming Language: A Game Develope... by mustache_kimono on Friday August 26, 2022 @10:36AM (#32608083)
I think this is sadly true. If you follow Game Devs with Large, Fragile Egos Twitter (I'm not naming names!), you'll hear a lot of "I hate (but secretly also love) C++ (because I know it intimately)" and "Rust isn't the answer" because they can't iterate fast enough.

My guess is that's probably a function of them thinking they can learn Rust in a weekend, because they are 10x-ers, instead of any inherent problem with the language. There is also a machismo aspect to C/C++, especially in game dev ("I eff with raw pointers all the time!").

But, if you read the article, Tim Sweeney seems to be saying "I want a fast functional language" which Rust is. One thing I am less clear on is whether Rust is better re: modularity and extensibility.

Re:The Next Mainstream Programming Language: A Game Develope... by generichuman on Friday August 26, 2022 @12:21PM (#32609411)
> Tim Sweeney seems to be saying "I want a fast functional language" which Rust is.

He also wants a garbage collector (pg. 57) and Pascal / ML family syntax (pg. 58). He clearly wants https://nim-lang.org/.

Re:The Next Mainstream Programming Language: A Game Develope... by mustache_kimono on Friday August 26, 2022 @12:44PM (#32609760)
> He also wants a garbage collector (pg. 57) and Pascal / ML family syntax (pg. 58). He clearly wants https://nim-lang.org/.

Since this was written in 2005, Rust/the Rust model didn't exist, so maybe Rust is memory managed/ML enough? But I am interested in looking at Nim. Had no idea it was ML influenced.

And I think I read in another comment Sweeney hired an engineer to write a new language called Verse.

Re:The Next Mainstream Programming Language: A Game Develope... by generichuman on Friday August 26, 2022 @02:33PM (#32611089)
> Rust/the Rust model didn't exist

FYI Nim also follows the Rust model with sink/lent annotations[0] + optimizes the (not yet default) automatic reference counting with static analysis so that RC overhead is minimized. Nim is like something between Pascal / Rust / Python, not sure why it is not more widely used.

> Sweeney hired an engineer to write a new language called Verse.

Not just an engineer, Simon Peyton Jones: https://en.wikipedia.org/wiki/Simon_Peyton_Jones

[0] https://nim-lang.org/docs/destructors.html

Re:The Next Mainstream Programming Language: A Game Develope... by fprotthetarball on Friday August 26, 2022 @05:35PM (#32613019)
> He clearly wants https://nim-lang.org/

I think a lot of people want Nim, but either don't know about it, or some language feature turned them off. There are a few polarizing language design choices, but every language has something. Perhaps it just needs a killer app using it in some visible fashion (e.g., Lua in Neovim and Hammerspoon).

Re:The Next Mainstream Programming Language: A Game Develope... by debugnik on Friday August 26, 2022 @07:21PM (#32613885)
I was turned off by the Windows Defender issue. I can't release consumer software written in Nim if every executable compiled with their toolchain is flagged as malware and the downloads silently halted.
Re:The Next Mainstream Programming Language: A Game Develope... by elcritch on Saturday August 27, 2022 @12:06AM (#32615536)
The Nim team has been working on the false anti-virus flagging issues: https://forum.nim-lang.org/t/9358

For context apparently Nim had a few articles written on how to write “red team” software with it and it also got popular with malware writers. Ultimately there’s an issue with AVs being lazy and flagging all Nim binaries as malware. Some of them even ignore binaries properly signed with good keys. Just another reason AVs are terrible.

Re:The Next Mainstream Programming Language: A Game Develope... by debugnik on Saturday August 27, 2022 @05:19AM (#32617242)
Glad to see progress on this, because I really liked Nim when I learnt it and this is my only blocker to consider it for a few personal projects.

I understand the necessity to detect known malware, but AVs are definitely terrible if they're unable to fingerprint the actual malicious code rather than the general traits of the toolchain used.

Also, signed binaries have proven close to useless since newly released binaries/installers raise a warning on Windows until several people run them anyway.

Re:The Next Mainstream Programming Language: A Game Develope... by munk-a on Friday August 26, 2022 @04:40PM (#32612506)
A lot of game development happens under the pressure of constant crunch and low budgets. I'm not just talking about EA and their constant penny pinching but small studio releases are a huge gamble with a steep upfront cost (Sean Murray, the face of Hello Games that released No Man's Sky, famously took out a large personal mortgage against his house to keep the studio afloat) and no guarantees of success after release - games can fail for the most absurd reasons.

I think a lot of game programmers will keep an iron grip on using C/C++ for a while simply because they don't have the luxury of exploring other options. That said, I think Rust is exceedingly well designed to supplant C/C++ - game development really wants to minimize runtime failure cases and push more errors onto the compiler and static analysis due to the size and complexity of the project and Rust manages to deliver that without compromising on the performance needs - Go was a similar hopeful for a while but the lack of exception throws even under controlled situations is very difficult to deal with (I know you can panic and catch panics but it is a very rudimentary system).

Re:The Next Mainstream Programming Language: A Game Develope... by mustache_kimono on Friday August 26, 2022 @04:45PM (#32612542)
> I think Rust is exceedingly well designed to supplant C/C++ - game development really wants to minimize runtime failure cases and push more errors onto the compiler and static analysis due to the size and complexity of the project and Rust manages to deliver that without compromising on the performance needs

I hope so!

Re:The Next Mainstream Programming Language: A Game Develope... by adamrezich on Friday August 26, 2022 @11:00AM (#32608391)
why would a preference for the use of raw pointers indicate "machismo"?

do you think there's any possible other reason why game developers would choose to not use rust aside from some hypothetical jerkbag strawman that exists in your mind? is it possible that there's any practical reasons you haven't considered?

Re:The Next Mainstream Programming Language: A Game Develope... by mustache_kimono on Friday August 26, 2022 @11:37AM (#32608866)
> why would a preference for the use of raw pointers indicate "machismo"?

Ugh. That's not what I meant/said. What I meant was that there can exist a certain belief that there is only one way of doing things, when in fact there may be several. And there can be a belief that, because one has experience dealing with the most unsafe and bug ridden things, that experience is somehow necessary everywhere and all the time.

Perhaps you might try to address the question at hand, is there a certain amount of machismo re: C/C++ in game dev? Heck, everywhere?

> do you think there's any possible other reason why game developers would choose to not use rust aside from some hypothetical jerkbag strawman that exists in your mind?

Oh, totally. I'm reading the comments and looking for exactly these sorts of serious, interesting criticisms.

However, from what I've seen, some game dev criticisms have been pretty shallow from certain segments of that community. In another comment, I explain there are some game devs that have gone really deep on Rust and have really interesting things to say about it. My fear is simply that the more shallow sentiments of these high profile enfants terrible will take hold, because they often do.

Re:The Next Mainstream Programming Language: A Game Develope... by psyc on Friday August 26, 2022 @12:21PM (#32609403)
I thought about this for a bit, because at first I thought you were making up a rather insulting caricature that could only detract from your case, or at least from anyone wanting to engage with you. I've been in C++ game dev for something like 25 years, and I'm sure I have never encountered a programmer who acted like using pointers was any more impressive than using the alphabet. That goes for any daily-use language feature not including all the optional C++ esoterica. We don't even talk about using pointers, we just use them. We no kidding talk more about how to use curly braces than how to use pointers. But then it occurred to me that perhaps that's only true amongst ourselves, where we don't have as much to feel defensive about. It's just silently understood that pointers are basic. But maybe if a C++ programmer were talking to a Rust programmer or any other language with a higher level memory paradigm, and if it was a conversation about whose language was best for what, then maybe they would feel defensive and need to act a bit superior.

Or, perhaps when you say they act big about using pointers, do you mean that they act big about using pointers safely? Because that is different. That's a conversation I began declining to have because I no longer believe it's possible for a person who is trying to use C++ for a task, and has already decided it is the best available tool for that task, to have that conversation with pretty much anybody without it devolving into a pissing match.

Re:The Next Mainstream Programming Language: A Game Develope... by mustache_kimono on Friday August 26, 2022 @02:22PM (#32610973)
> But maybe if a C++ programmer were talking to a Rust programmer or any other language with a higher level memory paradigm, and if it was a conversation about whose language was best for what, then maybe they would feel defensive and need to act a bit superior.

There is a reason "I will never be able to get the control I need (but I don't know)" or "I'll have to use unsafe everywhere (but I haven't tried)" are anti-Rust tropes. It's possible for certain game dev patterns to be awkward in Rust (really interested in hearing more about these!), but these other criticisms smell less like highly relevant informed criticism, and more like one hasn't tried Rust, as much as surface-level, mole hill criticism of hypothetical or pathological instances of bad syntax do.

It isn't that one uses raw pointers. It's much more an attitude I've witnessed in younger programmers that if they're not doing it in C/C++, they're not doing the thing. It's about vibes as much as anything else, and I think, when their heros use their own vibe-level criticisms, they only reinforce that perspective.

> Or, perhaps when you say they act big about using pointers, do you mean that they act big about using pointers safely?

No, I wasn't thinking of that, but that's another part of it. And now that you mention it, "My code doesn't have any of these issues" can be yet another defensive tact.

Re:The Next Mainstream Programming Language: A Game Develope... by adamrezich on Friday August 26, 2022 @03:27PM (#32611701)
really? "anti-Rust tropes"?
Re:The Next Mainstream Programming Language: A Game Develope... by mustache_kimono on Friday August 26, 2022 @03:42PM (#32611870)
If you don't actually know, and haven't actually tried Rust? Yeah, maybe.

Do you have something you'd like to offer the discussion?

Re:The Next Mainstream Programming Language: A Game Develope... by adamrezich on Friday August 26, 2022 @04:07PM (#32612138)
it's just that the specific phrasing of "anti-_______ tropes" is usually reserved for something much more severe than criticizing a programming language…
Re:The Next Mainstream Programming Language: A Game Develope... by mustache_kimono on Friday August 26, 2022 @04:49PM (#32612584)
Gosh, if I knew I'd be dealing with the your-specific-phrasing-makes-me-uncomfortable police today, I would have worn pants.
Re:The Next Mainstream Programming Language: A Game Develope... by adamrezich on Friday August 26, 2022 @11:59AM (#32609124)
if you're actually interested in learning different perspectives from people who have done significant work in the field and you're willing to stomach someone who I have to presume is one of these "large fragile egos" or whatever other vague terms you want to use about vague people vaguely (this passive-aggression is rather unbecoming), I personally found this comment, and the rest of the thread, to be very enlightening with regards to how I think about memory management in video game development and why rust's lifetimes maybe aren't the best solution for the problem domain https://news.ycombinator.com/item?id=26443768#26451692 (specifically the numbered list of memory usage patterns and the ensuing discussion about them)
Re:The Next Mainstream Programming Language: A Game Develope... by mustache_kimono on Friday August 26, 2022 @12:20PM (#32609391)
I hadn't seen this, and I will read it.

FTR, I'm not talking about jblow. I acknowledge his criticisms are superficially similar to what I wrote. At the very least jblow is seriously engaging with the arguments re: Rust, like in this thread. As to whether he's actually seriously tried to learn Rust, I'm unsure. I hope he does.

And I'm not naming names not to be passive aggressive, but for self preservation. I don't know if you noticed, but games can have a really toxic fandom.

Re:The Next Mainstream Programming Language: A Game Develope... by eska on Friday August 26, 2022 @10:38AM (#32608111)
Your first paragraph sounds so unprofessionally dismissive that I doubt anyone reads the second.
Re:The Next Mainstream Programming Language: A Game Develope... by mustache_kimono on Friday August 26, 2022 @10:44AM (#32608183)
Are you saying you've never encountered an engineer with a large, fragile ego? Because lucky you.

I guess I'd also say there is another, more mature side that takes Rust much more seriously, even on Twitter, such as John Carmack. I didn't know this needed to be said but not all game devs have fragile egos, but, wow, some certainly do.

Re:The Next Mainstream Programming Language: A Game Develope... by ben0x539 on Friday August 26, 2022 @04:37PM (#32612478)
As a data point, I read the second paragraph.
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.
Re:The Next Mainstream Programming Language: A Game Develope... by kriro on Friday August 26, 2022 @02:35PM (#32611106)
I find it interesting that one of the go to "let's learn Rust" books (Hand on Rust) is cantered around building a rogue like game. I feel like this will have a subtle but noticable (long tail) impact because many people who start learning Rust will do so on gamedev examples. The next logical step for a couple of them will be "all right now I'll build my own cool game". Maybe it'll be a tiny fraction but I feel there will be more good people moving into the Rust-Gamedev area than if that book was about building a web server.
Re:The Next Mainstream Programming Language: A Game Develope... by maxbond on Friday August 26, 2022 @02:39PM (#32611149)
Also worth noting that you can write Godot native plugins (I don't think that's the correct terminology - forgive me, I'm not a Godot developer) with Rust, and wire them up with GDScript. This seems super promising to me as far as Rust in game dev.

https://godot-rust.github.io/

Re:The Next Mainstream Programming Language: A Game Develope... by summerlight on Friday August 26, 2022 @02:24PM (#32611000)
Not so sure about this, it may take quite a time. It's not because of language's strength or weakness but simply because the upfront cost of building a modern game engine from scratch is getting more expensive and expensive. It's going to take a decade to build a competitive ecosystem against Unity or Unreal, assuming the best scenario.
Re:The Next Mainstream Programming Language: A Game Develope... by dxuh on Friday August 26, 2022 @10:05AM (#32607726)
I am sure it will happen, but (in my opinion) there is no way that it will gain significant popularity. It's just too high friction and in game development being low friction is imho one of the most important attributes of a programming language.
Re:The Next Mainstream Programming Language: A Game Develope... by cardanome on Friday August 26, 2022 @10:23AM (#32607923)
Rust itself is high friction but the Bevy Engine is offering a ECS System with delightful ergonomics.

So while I share the general sentiment, who knows, it might actually work out. Maybe Rust can be tamed.