9 ms·
I'd love to see someone write a game engine in Rust to compete with the "big boys" like Cry or Unreal. C++ game code can be such a nightmare.
by CodeMage 10y ago
I'd love to see someone write a game engine in Rust to compete with the "big boys" like Cry or Unreal. C++ game code can be such a nightmare.
- jcoffland 10y agoIt would be in Rust too.
- CodeMage 10y agoTrue enough. However, I'm willing to bet that a non-trivial amount of nightmarish code in C++ comes from the language itself. Also, I'm willing to be that a Rust build would be an improvement over a C++ build. As an example, I'm really sick of header files.
- madmax96 10y agoMaybe, maybe not. I think that you can write horrible code in any language (albeit horrible rust is safer than horrible C++ obviously). Especially considering the case when you're working on extremely compressed deadlines like many game shops, you're always in for a nightmare.
- nercht12 10y agoYes and no. Rust adds its own set of hassles. You think building becomes a synch? With Rust, you're fighting the compiler probably more than with C++. I'm sure some game developers would rather have an occasional crash they can fix down the road after their game is published than be forced to make a perfect system the first time. Remember, with game production, it's about time-to-market, not about perfect code.
- alkonaut 10y agoBeing able to cut corners with code hygiene works both ways though for productivity: you don't want to realize a week before a deadline that you have a hard-to-find memory leak or crash. A lot of the time it feels like rust development is slow because you are fighting the compiler. On the other hand once you run the program you often get that Haskell-y "it worked because it compiled" feeling. With a normal OO language I often build/run just to spot the next place I have made some bad assumption that the compiler didn't catch.
- jstimpfle 10y agoI haven't experienced that feeling for anything but toy programs. But concerning productivity: fighting the compiler sometimes means abandoning perfectly reasonable (and efficient!) designs just because the compiler doesn't like them. I'm not aware of any type corsets that I think force good designs. In a really clean design mistakes are not terribly hard to fix, even in a language like C. Granted in C they are in some cases harder to find in the first place, but there might not be any commercial interest in going beyond "it seems to work".
- alkonaut 10y agoHaving to fight the compiler over reasonable code that the compiler doesn't like will happen with any type system, you don't need one with lifetimes to have that. The question is of course where to draw the line (where the drawbacks outweigh). I really like how you opting out of the guarantees, e.g. to initialize a doubly linked pointer you might just drop to unsafe because you can overview the memory safety implications of those two lines, but not the whole program. How effective (and thus popular) Rust will be for creating large systems on tight deadlines remains to be seen I suppose - if it isn't competitive with C++ in that respect, then I'd consider that a failure. And a surprise.
- tome 10y ago> fighting the compiler sometimes means abandoning perfectly reasonable (and efficient!) designs just because the compiler doesn't like them. Citation needed!
- jstimpfle 10y agoNo.
- oconnor663 10y agoOne thing that's hard to do in safe code is getting two &mut references out of a HashMap at the same time. (If you know the keys are disjoint.) That might matter to some design somewhere?
- 10y ago
- coolsunglasses 10y agoCinch, like cinching up a belt. Synch is short for synchronization.
- nercht12 10y agoOops. Thanks.
- niketn 10y agoThis might be a large investment for the engine itself, but minimal investment for the game. In my experience, the largest, buggiest and most complicated parts of a game are all contained within the engine.
- solidsnack9000 10y ago> I'm sure some game developers would rather have an occasional crash they can fix down the road after their game is published than be forced to make a perfect system the first time. > Remember, with game production, it's about time-to-market, not about perfect code. In a way you are over-selling Rust, because it doesn't offer perfect code! I'm not sure why Mozilla would pay to build it if that's what it was about. What it offers is a lower defect rate, which is something you can definitely leverage to improve productivity. Lower defect rate at any cost is clearly too expensive; but developers seem to have been able to absorb the complexity of C++ alright and it Rust can't be called more complex than C++.
- nercht12 10y agoTo be clear, I didn't say Rust offered perfect code. But supposedly better code comes from Rust, as you're arguing. While Rust as a language isn't more complex, the paradigms are different. Games often have trees and lists, which are a real pain in Rust. To do things right in Rust requires learning new ways of doing things - not something game devs want to spend time on. They've been working with the same horse for years, so they keep riding it.
- mordocai 10y agoGame code in general is usually a nightmare. I do think Rust would be better than C++ though, in a lot of ways.
- Thaxll 10y agoNot going to happen in the next 10 years, everything is built around C++. And tbh I don't see what would games benefit from using Rust instead of C++.
- cderwin 10y agoI've never worked on anything gaming related, but the bigger cross-platform games certainly have crashes. I can't even tell you how many times Fallout 4 has crashed for me (likely hundreds). I obviously don't know if rust could help, but it's not unreasonable to think it might.
- zanny 10y agoGames are large codebases often not replacing the OS standard calls (which is where replacing C with Rust becomes problematic as you start breaking the standard library) that would benefit insanely from the safeties and default saneness Rust gives developers. Any time you work in a large team in a corporate environment you want a language that lets you stab yourself in the foot as little as possible.
- wyldfire 10y agoConsider Piston. Not able to compete with Unreal and Cry yet but it's a WIP. [1] http://www.piston.rs/ http://www.piston.rs/ [2] https://github.com/PistonDevelopers/piston https://github.com/PistonDevelopers/piston
- Retra 10y agoPiston is a mess, documentation wise. It's got like 50 different things called `Texture` and they're spread across 20 modules and every function you'll want to call is hidden under 5 layers of trait indirection. I'm exaggerating, of course, but my experience trying to use Piston was absolutely miserable. Next to zero documentation, with endless layers of confusing abstraction. It's designed to have swappable back-ends, and that's a big hassle when you don't care about that.
- htaunay 10y agoCry/Unreal? Unlikely. But something in the lines of LOVE(https://love2d.org/ https://love2d.org/) would be awesome!
- kazagistar 10y agoI don't see why not, other then time and a healthy skepticism of the untested by the AAA game devs who might build one.